/* ============================================================
   DESIGN TOKENS — BIM-Pilot Design System
   Version 1.1.0
   
   Thème unique : Dark Grey Chocolat / Canard-tête-noir / Orange
   
   Accent:    Amber/Orange (#d97706)
   Primary:   Chocolat (#1c1410)
   Duck:      Canard vert (#1a3320)
   Type:      Inter + JetBrains Mono
   Spacing:   4px base scale
   ============================================================
   Usage: <link rel="stylesheet" href="/static/css/design-tokens.css">
   Single dark theme — pas de light/pro variants.
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   1. DARK THEME — Chocolat / Orange / Canard-tête-noir
   ════════════════════════════════════════════════════════════ */
:root {
  /* ─── Background Colors ──────────────────────────────── */
  --color-bg-primary: #1c1410;
  --color-bg-secondary: #241c16;
  --color-bg-tertiary: #2d221a;
  --color-bg-elevated: #35281e;
  --color-bg-glass: rgba(36, 28, 22, 0.72);
  --color-bg-glass-solid: rgba(36, 28, 22, 0.95);
  --color-bg-glass-hover: rgba(36, 28, 22, 0.82);
  --color-viewer-bg: #0d0a08;
  --color-header-gradient: linear-gradient(135deg, #2d221a, #1c1410);

  /* ─── Accent (Amber/Orange — bec de canard-tête-noir) ── */
  --color-accent: #d97706;
  --color-accent-hover: #b45309;
  --color-accent-subtle: rgba(217, 119, 6, 0.1);
  --color-accent-glow: rgba(217, 119, 6, 0.2);

  /* ─── Surface / Overlay ──────────────────────────────── */
  --color-surface: #2d221a;
  --color-surface-hover: #3a2c20;
  --color-overlay: rgba(0, 0, 0, 0.6);

  /* ─── Semantic Colors ────────────────────────────────── */
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-subtle: rgba(239, 68, 68, 0.1);
  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-subtle: rgba(245, 158, 11, 0.1);
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-subtle: rgba(16, 185, 129, 0.1);
  --color-info: #3b82f6;
  --color-info-subtle: rgba(59, 130, 246, 0.1);
  --color-purple: #a78bfa;

  /* ─── Clash Severity (BIM-specific) ──────────────────── */
  --color-clash-critical: #ef4444;
  --color-clash-major: #f59e0b;
  --color-clash-minor: #3b82f6;
  --color-clash-none: #10b981;

  /* ─── Text Colors ────────────────────────────────────── */
  --color-text-primary: #f5f0e8;
  --color-text-secondary: #b8a694;
  --color-text-muted: #8a7a6a;
  --color-text-inverse: #1c1410;
  --color-text-on-accent: #1c1410;

  /* ─── Border Colors ──────────────────────────────────── */
  --color-border: #3a2c1e;
  --color-border-hover: #4d3c2a;
  --color-border-light: rgba(58, 44, 30, 0.5);
  --color-border-glass: rgba(255, 255, 255, 0.04);

  /* ─── Typography ─────────────────────────────────────── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Cascadia Code', Consolas, monospace;
  --font-heading: var(--font-sans);

  /* ─── Font Sizes / Type Scale ────────────────────────── */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.9375rem; /* 15px */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */

  /* Heading-specific sizes */
  --font-size-h1: var(--text-4xl);
  --font-size-h2: var(--text-2xl);
  --font-size-h3: var(--text-xl);
  --font-size-h4: var(--text-lg);
  --font-size-body: var(--text-base);
  --font-size-small: var(--text-sm);
  --font-size-caption: var(--text-xs);
  --font-size-code: 0.8125rem;

  /* ─── Font Weights ───────────────────────────────────── */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ─── Line Heights ───────────────────────────────────── */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* ─── Letter Spacing ─────────────────────────────────── */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* ─── Spacing Scale (4px base) ───────────────────────── */
  --space-0: 0;
  --space-0\.5: 0.125rem;  /* 2px */
  --space-1: 0.25rem;      /* 4px */
  --space-1\.5: 0.375rem;  /* 6px */
  --space-2: 0.5rem;       /* 8px */
  --space-2\.5: 0.625rem;  /* 10px */
  --space-3: 0.75rem;      /* 12px */
  --space-3\.5: 0.875rem;  /* 14px */
  --space-4: 1rem;         /* 16px */
  --space-5: 1.25rem;      /* 20px */
  --space-6: 1.5rem;       /* 24px */
  --space-7: 1.75rem;      /* 28px */
  --space-8: 2rem;         /* 32px */
  --space-9: 2.25rem;      /* 36px */
  --space-10: 2.5rem;      /* 40px */
  --space-11: 2.75rem;     /* 44px */
  --space-12: 3rem;        /* 48px */
  --space-14: 3.5rem;      /* 56px */
  --space-16: 4rem;        /* 64px */
  --space-20: 5rem;        /* 80px */
  --space-24: 6rem;        /* 96px */

  /* ─── Border Radius ──────────────────────────────────── */
  --radius-none: 0;
  --radius-xs: 0.1875rem;   /* 3px */
  --radius-sm: 0.375rem;    /* 6px */
  --radius-md: 0.5rem;      /* 8px */
  --radius-lg: 0.75rem;     /* 12px */
  --radius-xl: 1rem;        /* 16px */
  --radius-2xl: 1.25rem;    /* 20px */
  --radius-3xl: 1.5rem;     /* 24px */
  --radius-full: 9999px;

  /* ─── Shadows ─────────────────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.5);
  --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--color-accent-glow);
  --shadow-window: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.6);

  /* ─── Gradients ──────────────────────────────────────── */
  --gradient-accent: linear-gradient(135deg, #d97706, #b45309);
  --gradient-hero: linear-gradient(135deg, var(--color-accent), #1a3320);
  --gradient-surface: linear-gradient(135deg, #2d221a, #35281e);

  /* ─── Transitions / Animations ───────────────────────── */
  --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Animation durations */
  --duration-instant: 0ms;
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;

  /* Easing functions */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ─── Layout ─────────────────────────────────────────── */
  --grid-max-width: 1200px;
  --grid-gap: var(--space-6);
  --nav-height: 3.5rem;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --content-max-width: 960px;

  /* ─── Z-Index Scale ──────────────────────────────────── */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-toast: 600;
  --z-tooltip: 700;
}


/* ════════════════════════════════════════════════════════════
   3. CSS RESET (Minimal)
   ════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  transition: background var(--transition-normal), color var(--transition-normal);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  text-decoration: none;
  color: var(--color-accent);
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

ul,
ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--color-accent-subtle);
  color: var(--color-text-primary);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ════════════════════════════════════════════════════════════
   4. LAYOUT
   ════════════════════════════════════════════════════════════ */
.container {
  max-width: var(--grid-max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
  width: 100%;
}

.main-content {
  flex: 1;
  padding: var(--space-8) var(--space-4);
  max-width: var(--grid-max-width);
  margin: 0 auto;
  width: 100%;
}


/* ════════════════════════════════════════════════════════════
   5. UTILITY CLASSES
   ════════════════════════════════════════════════════════════ */

/* ─── Icon sizing ──────────────────────────────────────── */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* ─── Text utilities ───────────────────────────────────── */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-accent { color: var(--color-accent); }

.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* ─── Spacing utilities ────────────────────────────────── */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.m-0 { margin: 0; }

/* ─── Flex / Grid utilities ────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.grid { display: grid; }

/* ─── Display ──────────────────────────────────────────── */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ─── Border radius ────────────────────────────────────── */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ─── Cursor ───────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

/* ─── Truncate text ────────────────────────────────────── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Screen reader only ───────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ─── Scrollbar styling ────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}


/* ════════════════════════════════════════════════════════════
   6. MEETING MODE
   ════════════════════════════════════════════════════════════ */
body.meeting-mode {
  font-size: 1.2em;
  line-height: var(--leading-relaxed);
}

body.meeting-mode .container,
body.meeting-mode .main-content {
  max-width: 1600px;
}

body.meeting-mode h1 { font-size: calc(var(--font-size-h1) * 1.2); }
body.meeting-mode h2 { font-size: calc(var(--font-size-h2) * 1.2); }
body.meeting-mode h3 { font-size: calc(var(--font-size-h3) * 1.2); }
body.meeting-mode p,
body.meeting-mode li,
body.meeting-mode label { font-size: 1.1em; }
