/* ═══════════════════════════════════════════════════════════
   5GInvest Design System - Design Tokens
   ═══════════════════════════════════════════════════════════
   Brand: 5GInvest
   Industry: Stratégie d'investissement financier
   Personnalité: Moderne, simplifié, architecture compréhensible
   Cible: Investisseurs particuliers non professionnels
   ═══════════════════════════════════════════════════════════ */

/* ─── 1. COLOR SYSTEM ─────────────────────────────────────
   Palette construite sur des teintes bleues (confiance/finance)
   avec des sémantiques vertes/rouges pour gains/pertes.
   ──────────────────────────────────────────────────────── */

:root {
  /* Primary - Bleu confiance */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6;   /* Primary */
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;

  /* Secondary - Indigo profondeur */
  --color-secondary-50: #eef2ff;
  --color-secondary-100: #e0e7ff;
  --color-secondary-200: #c7d2fe;
  --color-secondary-300: #a5b4fc;
  --color-secondary-400: #818cf8;
  --color-secondary-500: #6366f1;  /* Secondary */
  --color-secondary-600: #4f46e5;
  --color-secondary-700: #4338ca;

  /* Neutral - Slate (gris bleutés) */
  --color-neutral-0: #ffffff;
  --color-neutral-50: #f8fafc;
  --color-neutral-100: #f1f5f9;
  --color-neutral-200: #e2e8f0;
  --color-neutral-300: #cbd5e1;
  --color-neutral-400: #94a3b8;
  --color-neutral-500: #64748b;
  --color-neutral-600: #475569;
  --color-neutral-700: #334155;
  --color-neutral-800: #1e293b;
  --color-neutral-900: #0f172a;
  --color-neutral-950: #020617;

  /* Semantic - Success (gains) */
  --color-success-50: #f0fdf4;
  --color-success-100: #dcfce7;
  --color-success-400: #4ade80;
  --color-success-500: #22c55e;
  --color-success-600: #16a34a;
  --color-success-bg: rgba(34, 197, 94, 0.12);

  /* Semantic - Error (pertes) */
  --color-error-50: #fef2f2;
  --color-error-100: #fee2e2;
  --color-error-400: #f87171;
  --color-error-500: #ef4444;
  --color-error-600: #dc2626;
  --color-error-bg: rgba(239, 68, 68, 0.12);

  /* Semantic - Warning */
  --color-warning-50: #fffbeb;
  --color-warning-100: #fef3c7;
  --color-warning-400: #fbbf24;
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;
  --color-warning-bg: rgba(245, 158, 11, 0.12);

  /* Semantic - Info */
  --color-info-50: #eff6ff;
  --color-info-500: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.10);

  /* ─── 2. TYPOGRAPHY SYSTEM ──────────────────────────────
     Police: Inter (Google Fonts) - optimisée pour les chiffres
     Fallback: system fonts
     ────────────────────────────────────────────────────── */

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;

  /* Font weights */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Type scale (mobile-first, 1.2 ratio) */
  --text-xs: 0.6875rem;     /* 11px */
  --text-sm: 0.8125rem;     /* 13px */
  --text-base: 0.9375rem;   /* 15px */
  --text-lg: 1.125rem;      /* 18px */
  --text-xl: 1.375rem;      /* 22px */
  --text-2xl: 1.75rem;      /* 28px */
  --text-3xl: 2.25rem;      /* 36px */
  --text-4xl: 2.75rem;      /* 44px */

  /* Line heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.75;

  /* Letter spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;

  /* ─── 3. SPACING SYSTEM ─────────────────────────────────
     Base: 4px grid
     ────────────────────────────────────────────────────── */

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

  /* ─── 4. BORDERS & RADIUS ───────────────────────────── */

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --border-width: 1px;
  --border-color: var(--color-neutral-700);

  /* ─── 5. SHADOWS ────────────────────────────────────── */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.4);

  /* ─── 6. TRANSITIONS ────────────────────────────────── */

  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* ─── 7. Z-INDEX SCALE ──────────────────────────────── */

  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* ─── 8. TOUCH & ACCESSIBILITY ──────────────────────── */

  --touch-target: 44px;
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

/* ─── DARK THEME (default) ────────────────────────────── */
:root,
[data-theme="dark"] {
  --surface-bg: var(--color-neutral-900);
  --surface-card: var(--color-neutral-800);
  --surface-elevated: var(--color-neutral-700);
  --surface-hover: #2d3b50;
  --text-primary: var(--color-neutral-100);
  --text-secondary: var(--color-neutral-400);
  --text-tertiary: var(--color-neutral-500);
  --border-default: var(--color-neutral-700);
}

/* ─── LIGHT THEME ─────────────────────────────────────── */
[data-theme="light"] {
  --surface-bg: var(--color-neutral-50);
  --surface-card: var(--color-neutral-0);
  --surface-elevated: var(--color-neutral-100);
  --surface-hover: var(--color-neutral-100);
  --text-primary: var(--color-neutral-900);
  --text-secondary: var(--color-neutral-500);
  --text-tertiary: var(--color-neutral-400);
  --border-default: var(--color-neutral-200);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ─── GLOBAL TYPOGRAPHY ───────────────────────────────── */
body {
  font-family: var(--font-family);
  font-feature-settings: 'tnum' 1;  /* Tabular numbers for financial data */
}

/* Headings */
h1, .h1 { font-size: var(--text-2xl); font-weight: var(--fw-bold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h2, .h2 { font-size: var(--text-xl); font-weight: var(--fw-bold); line-height: var(--leading-tight); }
h3, .h3 { font-size: var(--text-lg); font-weight: var(--fw-semibold); line-height: var(--leading-snug); }
h4, .h4 { font-size: var(--text-base); font-weight: var(--fw-semibold); line-height: var(--leading-normal); }
h5, .h5 { font-size: var(--text-sm); font-weight: var(--fw-semibold); line-height: var(--leading-normal); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
h6, .h6 { font-size: var(--text-xs); font-weight: var(--fw-semibold); line-height: var(--leading-normal); text-transform: uppercase; letter-spacing: var(--tracking-wide); }

/* ─── ACCESSIBILITY ───────────────────────────────────── */

/* Focus visible (keyboard only) */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border-default: var(--color-neutral-400);
    --text-secondary: var(--color-neutral-300);
  }
}

/* ─── Tablet type scale ───────────────────────────────── */
@media (min-width: 768px) {
  :root {
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --text-3xl: 2.5rem;
  }
}

/* ─── Desktop type scale ──────────────────────────────── */
@media (min-width: 1024px) {
  :root {
    --text-2xl: 2.25rem;
    --text-3xl: 3rem;
    --text-4xl: 3.5rem;
  }
}
