/* ================================================================
   ClinicFlow2 — Design Tokens
   Unica fonte di verità per colori, spaziature, tipografia, motion.
   Modifica SOLO questo file per cambiare l'aspetto globale.
   ================================================================ */

:root {
  /* ---------- BRAND ---------- */
  --brand-50:  #e6f3fb;
  --brand-100: #bfe0f5;
  --brand-200: #94cbee;
  --brand-300: #5fb2e4;
  --brand-400: #2f9adb;
  --brand-500: #007acc;   /* primary */
  --brand-600: #0069b3;
  --brand-700: #005696;
  --brand-800: #004477;
  --brand-900: #002f55;
  --brand-accent: #00d4ff;
  --brand-gradient: linear-gradient(135deg, #007acc 0%, #00d4ff 100%);

  /* ---------- SEMANTIC ---------- */
  --success-50:  #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --warning-50:  #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --danger-50:   #fef2f2;
  --danger-100:  #fee2e2;
  --danger-500:  #ef4444;
  --danger-600:  #dc2626;
  --danger-700:  #b91c1c;

  --info-50:   #eff6ff;
  --info-100:  #dbeafe;
  --info-500:  #3b82f6;
  --info-600:  #2563eb;

  /* ---------- NEUTRAL SCALE ---------- */
  --neutral-0:    #ffffff;
  --neutral-50:   #f8fafc;
  --neutral-100:  #f1f5f9;
  --neutral-200:  #e2e8f0;
  --neutral-300:  #cbd5e1;
  --neutral-400:  #94a3b8;
  --neutral-500:  #64748b;
  --neutral-600:  #475569;
  --neutral-700:  #334155;
  --neutral-800:  #1e293b;
  --neutral-900:  #0f172a;
  --neutral-950:  #020617;

  /* ---------- SEMANTIC ALIASES (LIGHT THEME DEFAULT) ---------- */
  --color-bg:            var(--neutral-50);
  --color-bg-subtle:     var(--neutral-100);
  --color-surface:       var(--neutral-0);
  --color-surface-hover: var(--neutral-50);
  --color-surface-muted: var(--neutral-100);
  --color-border:        var(--neutral-200);
  --color-border-strong: var(--neutral-300);
  --color-text:          var(--neutral-800);
  --color-text-muted:    var(--neutral-500);
  --color-text-subtle:   var(--neutral-400);
  --color-text-inverted: var(--neutral-0);
  --color-overlay:       rgba(15, 23, 42, 0.45);

  --color-primary:       var(--brand-500);
  --color-primary-hover: var(--brand-600);
  --color-primary-soft:  var(--brand-50);

  --color-focus-ring:    rgba(0, 122, 204, 0.35);

  /* Sidebar (dark by design, indipendente dal theme) */
  --sidebar-bg:          #0d0d14;
  --sidebar-bg-hover:    rgba(0, 122, 204, 0.2);
  --sidebar-border:      rgba(255, 255, 255, 0.06);
  --sidebar-text:        rgba(255, 255, 255, 0.72);
  --sidebar-text-strong: #ffffff;
  --sidebar-text-muted:  rgba(255, 255, 255, 0.38);
  --sidebar-active-bg:   linear-gradient(135deg, rgba(0,122,204,0.35), rgba(0,212,255,0.22));

  /* ---------- SPACING (4px base) ---------- */
  --space-0:   0;
  --space-1:   0.25rem;  /* 4px */
  --space-2:   0.5rem;   /* 8px */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-16:  4rem;     /* 64px */
  --space-20:  5rem;

  /* ---------- RADIUS ---------- */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* ---------- SHADOWS (elevation scale) ---------- */
  --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:  0 10px 25px rgba(15, 23, 42, 0.10), 0 4px 10px rgba(15, 23, 42, 0.05);
  --shadow-xl:  0 25px 50px rgba(15, 23, 42, 0.15);
  --shadow-focus: 0 0 0 3px var(--color-focus-ring);
  --shadow-brand: 0 4px 15px rgba(0, 122, 204, 0.25);

  /* ---------- TYPOGRAPHY ---------- */
  --font-sans: "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */

  --leading-tight:   1.25;
  --leading-snug:    1.375;
  --leading-normal:  1.5;
  --leading-relaxed: 1.625;

  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* ---------- MOTION ---------- */
  --motion-fast:      120ms;
  --motion-base:      180ms;
  --motion-slow:      280ms;
  --ease-standard:    cubic-bezier(0.2, 0.0, 0.0, 1.0);
  --ease-accelerate:  cubic-bezier(0.3, 0.0, 1.0, 1.0);
  --ease-decelerate:  cubic-bezier(0.0, 0.0, 0.2, 1.0);

  /* ---------- Z-INDEX STACK ---------- */
  --z-base:      1;
  --z-sticky:    10;
  --z-dropdown:  30;
  --z-sidebar:   40;
  --z-topbar:    45;
  --z-overlay:   80;
  --z-modal:     90;
  --z-toast:     100;
  --z-tooltip:   110;

  /* ---------- LAYOUT ---------- */
  --sidebar-width:      16rem;     /* 256px */
  --sidebar-collapsed:  4.5rem;    /* 72px */
  --topbar-height:      3.5rem;    /* 56px */
  --content-max:        88rem;     /* 1408px */
}

/* ================================================================
   DARK THEME
   Attiva con <html data-theme="dark"> oppure prefers-color-scheme.
   ================================================================ */

[data-theme="dark"] {
  --color-bg:            #0a0a0f;
  --color-bg-subtle:     #0d0d14;
  --color-surface:       #12121a;
  --color-surface-hover: #1a1a24;
  --color-surface-muted: #161621;
  --color-border:        rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.14);
  --color-text:          #e2e8f0;
  --color-text-muted:    #94a3b8;
  --color-text-subtle:   #64748b;
  --color-text-inverted: #0f172a;
  --color-overlay:       rgba(0, 0, 0, 0.6);
  --color-primary-soft:  rgba(0, 122, 204, 0.15);
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 10px 25px rgba(0, 0, 0, 0.55);
  --shadow-xl:  0 25px 50px rgba(0, 0, 0, 0.6);
}

/* Rispetto reduced-motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 1ms;
    --motion-base: 1ms;
    --motion-slow: 1ms;
  }
}
