/* ============================================================
   AudaceHR — base di design condivisa (Fase "restyling", tutor)
   ============================================================
   Contiene SOLO le regole che erano gia' identiche, byte per byte,
   tra index.html, truth-machine/index.html e truth-machine/validation.html
   (o presenti in una sola pagina, quindi senza rischio di collisione).

   Regole quasi-identiche-ma-non-uguali (.card, .topbar, .btn, .criterion,
   .chart-wrap, .stats) sono state lasciate volutamente locali a ciascuna
   pagina: un nome di classe uguale con valori leggermente diversi (es.
   .card ha padding/margini diversi in validation.html) avrebbe rischiato
   di alterare visivamente una pagina "silenziosamente" tramite cascata
   CSS. Verranno unificate deliberatamente nella fase di navigazione
   condivisa, non qui.
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --sidebar-bg: #0f1729;
  --sidebar-bg-2: #131c33;
  --sidebar-fg: #c9d1e6;
  --sidebar-fg-muted: #6b7693;
  --primary: #3b5bdb;
  --primary-hover: #324dc4;
  --primary-soft: #e8edff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- LAYOUT: sidebar + main (navigazione unificata) ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 18px 14px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 14px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.brand-text { line-height: 1.1; }
.brand-title { font-weight: 600; color: #fff; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--sidebar-fg-muted); }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--sidebar-fg-muted); padding: 8px 10px 6px 10px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-fg); cursor: pointer; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-item.active {
  background: rgba(59, 91, 219, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-item:not(.active):hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav-item svg { flex-shrink: 0; }

.sidebar-foot {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px; color: var(--sidebar-fg-muted);
  line-height: 1.5; padding-left: 8px;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
.topbar .crumbs { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.content { padding: 24px 28px 60px 28px; width: 100%; }

@media (max-width: 720px) {
  .sidebar { width: 200px; }
  .content { padding: 18px 16px 40px 16px; }
  .topbar { padding: 14px 16px; }
}
@media (max-width: 560px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; padding: 12px; }
  .sidebar-foot { display: none; }
}

/* ---------- CARD ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 14px 0; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card .hint { font-size: 12px; color: var(--text-muted); margin-top: -6px; margin-bottom: 14px; }

/* ---------- INFO TIP (tooltip a comparsa su termini tecnici) ---------- */
.info-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  font-size: 10px; font-weight: 700; border: none; cursor: pointer;
  position: relative; flex-shrink: 0; padding: 0; line-height: 1;
  font-family: inherit;
}
.info-tip:hover { background: var(--primary-soft); color: var(--primary); }
.info-tip-popover {
  position: absolute; top: 22px; left: 0; z-index: 20;
  width: 220px; background: #1f2937; color: #fff;
  font-size: 11.5px; font-weight: 400; line-height: 1.4;
  padding: 8px 10px; border-radius: 6px; box-shadow: var(--shadow-md);
  text-align: left; cursor: default;
}

/* ---------- BADGE ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--primary-soft); color: var(--primary); }

/* ---------- ALERT ---------- */
.alert {
  border-radius: 8px; padding: 12px 14px; font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.alert-info  { background: var(--primary-soft); color: var(--primary); border: 1px solid #c8d2ff; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #fde68a; }

/* ---------- DISCLAIMER ---------- */
.disclaimer {
  font-size: 11.5px; color: var(--text-muted);
  background: #fff8e1; border-left: 3px solid var(--warning);
  padding: 10px 12px; border-radius: 6px;
  line-height: 1.5;
}

/* ---------- STAT TILE ---------- */
.stat {
  background: #fafbfd; border: 1px solid var(--border);
  border-radius: 9px; padding: 14px;
}
.stat .stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600;
}
.stat .stat-value {
  font-size: 22px; font-weight: 700; margin-top: 4px;
  color: var(--text);
}
.stat .stat-sub {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* ---------- EMPTY STATE (base) ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ---------- LOADING VEIL ---------- */
.loading-veil {
  position: fixed; inset: 0;
  background: rgba(246, 247, 251, 0.96);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  z-index: 100;
}
.loading-veil .spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-veil .lv-text { font-size: 13px; color: var(--text-muted); }
.loading-veil[hidden] { display: none; }
