/* Inventio Hub UI custom - animazioni, scrollbar, componenti riusabili.
 * Riferimento mockup: AutomationLanding/Assets/Codice/estrazione.html
 */

/* ─── Scrollbar ─── */
* { scrollbar-width: thin; scrollbar-color: #d4d4d8 transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }
*::-webkit-scrollbar-corner { background: transparent; }
*:hover::-webkit-scrollbar { width: 8px; }
*:hover::-webkit-scrollbar-thumb { background: #a1a1aa; }

/* ─── Animations ─── */
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 8px rgba(4, 148, 245, 0.15); }
  50%      { box-shadow: 0 0 24px rgba(4, 148, 245, 0.3); }
}
.pulse-glow { animation: pulse-border 1.5s ease-in-out infinite; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-row { animation: fade-in 0.3s ease-out forwards; opacity: 0; }

/* ─── Components ─── */
.source-card { transition: all 0.2s ease; }
.source-card:hover {
  border-color: #0494f5;
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(4, 148, 245, 0.08);
}

.drop-zone { transition: all 0.2s ease; }
.drop-zone.is-dragover {
  border-color: #0494f5 !important;
  background: #f4f4f5;
}

.connector-row { transition: background 0.15s ease; }
.connector-row:hover { background: #f4f4f5; }

.edit-input { transition: border-color 0.2s ease; }
.edit-input:focus {
  border-color: #0494f5 !important;
  box-shadow: 0 0 0 1px rgba(4, 148, 245, 0.15);
}

/* ─── Sparkline tooltip ─── */
.chart-bar-group { position: relative; }
.chart-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  z-index: 20;
  white-space: nowrap;
  pointer-events: none;
}
.chart-bar-group:hover .chart-tooltip { display: block; }

/* Hide elements until Alpine processes them (avoid flash). */
[x-cloak] { display: none !important; }

/* Responsive data tables.
 * Desktop keeps the standard table layout. On narrow screens each row
 * becomes a compact record card with labels from td[data-label].
 */
.responsive-table td {
  vertical-align: top;
}

.responsive-table td:first-child {
  min-width: 12rem;
}

.responsive-table td,
.responsive-table th {
  overflow-wrap: anywhere;
}

@media (max-width: 639px) {
  .responsive-table {
    display: block;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: block;
    padding: 0.5rem;
  }

  .responsive-table tbody tr {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #ffffff;
    overflow: hidden;
  }

  .responsive-table tbody tr + tr {
    margin-top: 0.5rem;
  }

  .responsive-table tbody td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.625rem 0.75rem !important;
    border: 0;
    text-align: left !important;
  }

  .responsive-table tbody td + td {
    border-top: 1px solid #e5e7eb;
  }

  .responsive-table tbody td::before {
    content: attr(data-label);
    color: #8f8f8f;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-transform: uppercase;
  }

  .responsive-table tbody td[data-label=""] {
    display: flex;
    justify-content: flex-end;
  }

  .responsive-table tbody td[data-label=""]::before {
    display: none;
  }

  .responsive-table .responsive-table-empty {
    display: block;
    text-align: center !important;
  }

  .responsive-table .responsive-table-empty::before {
    display: none;
  }
}
