/* ═══════════════════════════════════════════════════════
   TEMI SCADENZIARIO STUDIO
   Ogni tema sovrascrive le CSS variables di base.html
   ═══════════════════════════════════════════════════════ */

/* ── 1. CLASSICO (default — navy/oro) ─────────────────── */
[data-theme="classico"] {
  --ink:        #1a1f2e;
  --ink-mid:    #3d4659;
  --ink-soft:   #6b7590;
  --ink-faint:  #a8b0c4;
  --surface:    #f7f8fc;
  --white:      #ffffff;
  --accent:     #c8a96e;
  --accent-dk:  #a8893e;
  --red:        #c94040;
  --orange:     #c97030;
  --green:      #2d7a5a;
  --border:     rgba(26,31,46,.09);
  --shadow-sm:  0 1px 3px rgba(26,31,46,.07), 0 1px 2px rgba(26,31,46,.04);
  --shadow-md:  0 4px 16px rgba(26,31,46,.10), 0 1px 4px rgba(26,31,46,.06);
  --sidebar-bg: #1a1f2e;
  --sidebar-link-active-bg:   rgba(200,169,110,.15);
  --sidebar-link-active-color: #c8a96e;
  --sidebar-text:  rgba(255,255,255,.55);
  --sidebar-brand-sub: rgba(255,255,255,.35);
}

/* ── 2. CHIARO MODERNO (grigio chiaro / blu) ─────────── */
[data-theme="chiaro"] {
  --ink:        #1e293b;
  --ink-mid:    #475569;
  --ink-soft:   #64748b;
  --ink-faint:  #94a3b8;
  --surface:    #f1f5f9;
  --white:      #ffffff;
  --accent:     #3b82f6;
  --accent-dk:  #2563eb;
  --red:        #ef4444;
  --orange:     #f97316;
  --green:      #22c55e;
  --border:     rgba(30,41,59,.1);
  --shadow-sm:  0 1px 3px rgba(30,41,59,.07);
  --shadow-md:  0 4px 16px rgba(30,41,59,.10);
  --sidebar-bg: #ffffff;
  --sidebar-link-active-bg:    rgba(59,130,246,.1);
  --sidebar-link-active-color: #2563eb;
  --sidebar-text:  #64748b;
  --sidebar-brand-sub: #94a3b8;
}

/* ── 3. VERDE STUDIO (sage/moss — caldo professionale) ── */
[data-theme="verde"] {
  --ink:        #1c2b22;
  --ink-mid:    #3a5244;
  --ink-soft:   #627a6e;
  --ink-faint:  #9ab4a8;
  --surface:    #f4f7f5;
  --white:      #ffffff;
  --accent:     #5a9e72;
  --accent-dk:  #3d7d56;
  --red:        #c0392b;
  --orange:     #d35400;
  --green:      #27ae60;
  --border:     rgba(28,43,34,.09);
  --shadow-sm:  0 1px 3px rgba(28,43,34,.07);
  --shadow-md:  0 4px 16px rgba(28,43,34,.10);
  --sidebar-bg: #1c2b22;
  --sidebar-link-active-bg:    rgba(90,158,114,.18);
  --sidebar-link-active-color: #7ec898;
  --sidebar-text:  rgba(255,255,255,.5);
  --sidebar-brand-sub: rgba(255,255,255,.3);
}

/* ── 4. SCURO TOTALE (dark mode elegante) ────────────── */
[data-theme="scuro"] {
  --ink:        #e2e8f0;
  --ink-mid:    #cbd5e1;
  --ink-soft:   #94a3b8;
  --ink-faint:  #64748b;
  --surface:    #0f172a;
  --white:      #1e293b;
  --accent:     #f59e0b;
  --accent-dk:  #d97706;
  --red:        #f87171;
  --orange:     #fb923c;
  --green:      #4ade80;
  --border:     rgba(226,232,240,.08);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
  --sidebar-bg: #0f172a;
  --sidebar-link-active-bg:    rgba(245,158,11,.12);
  --sidebar-link-active-color: #fbbf24;
  --sidebar-text:  rgba(255,255,255,.4);
  --sidebar-brand-sub: rgba(255,255,255,.25);
}

/* ── 5. BORDEAUX (eleganza classica notarile) ─────────── */
[data-theme="bordeaux"] {
  --ink:        #2d1b1b;
  --ink-mid:    #5a3535;
  --ink-soft:   #8a6060;
  --ink-faint:  #b89090;
  --surface:    #fdf5f5;
  --white:      #ffffff;
  --accent:     #9b2335;
  --accent-dk:  #7a1a28;
  --red:        #c0392b;
  --orange:     #d35400;
  --green:      #1e8449;
  --border:     rgba(45,27,27,.09);
  --shadow-sm:  0 1px 3px rgba(45,27,27,.07);
  --shadow-md:  0 4px 16px rgba(45,27,27,.10);
  --sidebar-bg: #2d1b1b;
  --sidebar-link-active-bg:    rgba(155,35,53,.2);
  --sidebar-link-active-color: #e07080;
  --sidebar-text:  rgba(255,255,255,.5);
  --sidebar-brand-sub: rgba(255,255,255,.3);
}

/* ── Applica sidebar-bg e testi sidebar ──────────────── */
[data-theme] .sidebar            { background: var(--sidebar-bg) !important; }
[data-theme] .sidebar-link       { color: var(--sidebar-text) !important; }
[data-theme] .sidebar-link:hover { background: rgba(255,255,255,.07) !important; color: rgba(255,255,255,.85) !important; }
[data-theme] .sidebar-link.active {
  background: var(--sidebar-link-active-bg)  !important;
  color:      var(--sidebar-link-active-color) !important;
}
[data-theme] .sidebar-link.active i { color: var(--sidebar-link-active-color) !important; }
[data-theme] .sidebar-brand .studio-name { color: var(--sidebar-brand-sub) !important; }
[data-theme] .sidebar-brand .logo-text   { color: rgba(255,255,255,.9) !important; }
[data-theme] .sidebar-user .user-name    { color: rgba(255,255,255,.85) !important; }
[data-theme] .sidebar-user .user-actions a { color: var(--sidebar-text) !important; }
[data-theme] .sidebar-brand .logo-icon  { background: var(--accent) !important; color: var(--surface) !important; }

/* Tema chiaro: sidebar testo scuro */
[data-theme="chiaro"] .sidebar-link       { color: #64748b !important; }
[data-theme="chiaro"] .sidebar-link:hover { background: #f1f5f9 !important; color: #1e293b !important; }
[data-theme="chiaro"] .sidebar-brand .logo-text  { color: #1e293b !important; }
[data-theme="chiaro"] .sidebar-user .user-name   { color: #1e293b !important; }
[data-theme="chiaro"] .sidebar-user .user-actions a { color: #64748b !important; }
[data-theme="chiaro"] .sidebar { border-right: 1px solid rgba(30,41,59,.1) !important; }
[data-theme="chiaro"] .nav-section-label { color: #94a3b8 !important; }

/* Tema scuro: body e cards */
[data-theme="scuro"] body    { background: var(--surface) !important; color: var(--ink) !important; }
[data-theme="scuro"] .card   { background: var(--white) !important; }
[data-theme="scuro"] .stat-card { background: var(--white) !important; }
[data-theme="scuro"] .sc-card  { background: var(--white) !important; }
[data-theme="scuro"] .tl-card  { background: var(--white) !important; }
[data-theme="scuro"] .k-card   { background: var(--white) !important; }
[data-theme="scuro"] .kanban-col { background: rgba(255,255,255,.04) !important; }
[data-theme="scuro"] .form-control, [data-theme="scuro"] .form-select {
  background: var(--white) !important; color: var(--ink) !important;
  border-color: var(--border) !important;
}
[data-theme="scuro"] .table th { background: rgba(255,255,255,.04) !important; }
[data-theme="scuro"] .cal-cell { background: var(--white) !important; }
[data-theme="scuro"] .cal-cell.other { background: rgba(255,255,255,.02) !important; }


/* ═══════════════════════════════════════════════════════
   FONT PER TEMA
   Ogni tema ha la sua coppia tipografica
   ═══════════════════════════════════════════════════════ */

/* CLASSICO — DM Serif Display + DM Sans (già di default) */
[data-theme="classico"] {
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
}

/* CHIARO — IBM Plex Sans (moderna, tecnica, leggibile) */
[data-theme="chiaro"] {
  --font-serif: 'IBM Plex Sans', system-ui, sans-serif;
  --font-sans:  'IBM Plex Sans', system-ui, sans-serif;
}
[data-theme="chiaro"] .page-header h1,
[data-theme="chiaro"] .page-header h4,
[data-theme="chiaro"] .sidebar-brand .logo-text,
[data-theme="chiaro"] .stat-value {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  letter-spacing: -.02em;
}

/* VERDE — Libre Baskerville titoli + Source Sans 3 corpo
   Rimanda a documenti notarili classici, carta da lettere */
[data-theme="verde"] {
  --font-serif: 'Libre Baskerville', Georgia, serif;
  --font-sans:  'Source Sans 3', system-ui, sans-serif;
}

/* SCURO — Jost (geometrica, futuristica, leggibile su scuro) */
[data-theme="scuro"] {
  --font-serif: 'Jost', system-ui, sans-serif;
  --font-sans:  'Jost', system-ui, sans-serif;
}
[data-theme="scuro"] .page-header h1,
[data-theme="scuro"] .page-header h4,
[data-theme="scuro"] .sidebar-brand .logo-text,
[data-theme="scuro"] .stat-value {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  letter-spacing: .04em;
}

/* BORDEAUX — Cormorant Garamond (aristocratico, lussuoso)
   + Source Sans 3 per il corpo */
[data-theme="bordeaux"] {
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Source Sans 3', system-ui, sans-serif;
}
[data-theme="bordeaux"] .page-header h1,
[data-theme="bordeaux"] .page-header h4 {
  font-size: 1.9rem;
  letter-spacing: .01em;
  font-style: italic;
}
[data-theme="bordeaux"] .sidebar-brand .logo-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  letter-spacing: .03em;
}
[data-theme="bordeaux"] .stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
}

/* Applica font-sans al body per tutti i temi */
[data-theme] body        { font-family: var(--font-sans) !important; }
[data-theme] .form-control,
[data-theme] .form-select,
[data-theme] .btn-primary,
[data-theme] .btn-gold,
[data-theme] .sidebar-link { font-family: var(--font-sans) !important; }
