/* ===== VARIABLES ===== */
:root {
  /* Theme variables; data-theme and data-accent live on <html>. */
  --brand: #2d3e8f;           /* ← Bleu nuit clair (plus lumineux) */
  --brand-dark: #1e2a5f;      /* ← Bleu nuit plus foncé mais pas trop */
  --brand-light: #e8ecf7;
  --accent: #2d3e8f;
  --accent-contrast: #ffffff;
  --app-bg: #f6f8fc;
  
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  
  --surface: #ffffff;
  --surface-alt: #ffffff;
  --surface-soft: #f9f9f9;
  --surface-hover: #f4f7fc; 
  
  --border: #e0e0e0;
  --border-soft: #f0f0f0;
  
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  
  --radius: 8px;
  --spacing: 16px;
}

/* ===== RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface);
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1em;
  color: var(--text-secondary);
}

.eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  margin-bottom: 0.5rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== BUTTONS ===== */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s ease;
}

.primary-button {
  background: var(--brand);
  color: white;
  padding: 12px 24px;
  font-size: 1rem;
}

.primary-button:hover {
  background: var(--brand-dark);
  box-shadow: var(--shadow-md);
}

.primary-button:active {
  transform: scale(0.98);
}

.ghost-button {
  background: transparent;
  color: var(--brand);
  border: 2px solid var(--brand);
  padding: 10px 22px;
  font-size: 1rem;
}

.ghost-button:hover {
  background: var(--brand-light);
}

.close-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
}

.close-button:hover {
  background: var(--border-soft);
}

/* ===== FORMS ===== */
input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(46, 168, 143, 0.1);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

label > span {
  margin-left: 0.25rem;
}

.required {
  color: var(--danger);
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .primary-button,
  .ghost-button {
    width: 100%;
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════
   ===== THEMES UTILISATEUR (localStorage uniquement) =====
   ═══════════════════════════════════════════════════════════ */

/* THÈME DARK */
html[data-theme="dark"] {
  color-scheme: dark;
  --text-primary: #f1f5f9;
  --text-secondary: #b7c0cc;
  --text-muted: #8793a3;
  --surface: #111827;
  --surface-alt: #1f2937;
  --surface-soft: #182231;
  --surface-hover: #263449;
  --border: #344256;
  --border-soft: #2a3749;
  --app-bg: #0b1220;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   ===== COULEURS D'ACCENT (15 + custom) =====
   ═══════════════════════════════════════════════════════════ */

html[data-accent="blue"] {
  --accent: #2d3e8f;
  --brand: #2d3e8f;
  --brand-dark: #1e2a5f;
  --brand-light: #e8ecf7;
}

html[data-accent="teal"] {
  --accent: #0f766e;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-light: #d9f5f1;
}

html[data-accent="purple"] {
  --accent: #7c3aed;
  --brand: #7c3aed;
  --brand-dark: #5b21b6;
  --brand-light: #eee5ff;
}

html[data-accent="orange"] {
  --accent: #ea580c;
  --brand: #ea580c;
  --brand-dark: #c2410c;
  --brand-light: #ffeadf;
}

html[data-accent="rose"] {
  --accent: #e11d48;
  --brand: #e11d48;
  --brand-dark: #be123c;
  --brand-light: #ffe4eb;
}

html[data-accent="red"] {
  --accent: #ef4444;
  --brand: #ef4444;
  --brand-dark: #7f1d1d;
  --brand-light: #fca5a5;
}

html[data-accent="green"] {
  --accent: #22c55e;
  --brand: #22c55e;
  --brand-dark: #15803d;
  --brand-light: #dcfce7;
}

html[data-accent="emerald"] {
  --accent: #10b981;
  --brand: #10b981;
  --brand-dark: #065f46;
  --brand-light: #a7f3d0;
}

html[data-accent="amber"] {
  --accent: #f59e0b;
  --brand: #f59e0b;
  --brand-dark: #78350f;
  --brand-light: #fde68a;
}

html[data-accent="lime"] {
  --accent: #84cc16;
  --brand: #84cc16;
  --brand-dark: #365314;
  --brand-light: #d4fc79;
}

html[data-accent="cyan"] {
  --accent: #06b6d4;
  --brand: #06b6d4;
  --brand-dark: #164e63;
  --brand-light: #a5f3fc;
}

html[data-accent="indigo"] {
  --accent: #6366f1;
  --brand: #6366f1;
  --brand-dark: #1e1b4b;
  --brand-light: #c7d2fe;
}

html[data-accent="fuchsia"] {
  --accent: #d946ef;
  --brand: #d946ef;
  --brand-dark: #500724;
  --brand-light: #f0abfc;
}

html[data-accent="slate"] {
  --accent: #64748b;
  --brand: #64748b;
  --brand-dark: #1e293b;
  --brand-light: #cbd5e1;
}

html[data-accent="sky"] {
  --accent: #0ea5e9;
  --brand: #0ea5e9;
  --brand-dark: #0c4a6e;
  --brand-light: #bae6fd;
}

/* COULEUR PERSONNALISÉE */
html[data-accent="custom"] {
  --accent: var(--custom-accent-hex, #2d3e8f);
  --brand: var(--custom-accent-hex, #2d3e8f);
  --brand-dark: var(--custom-accent-hex, #2d3e8f);
  --brand-light: color-mix(in srgb, var(--custom-accent-hex, #2d3e8f) 15%, transparent);
}

/* Appliquer les transitions de couleur */
body {
  background: var(--app-bg, var(--surface));
  transition: background-color 0.2s ease, color 0.2s ease;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ═══════════════════════════════════════════════════════════
   ===== SÉLECTEUR DE THÈME ET D'ACCENT =====
   ═══════════════════════════════════════════════════════════ */

.theme-choice-list,
.accent-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Boutons de sélection du thème */
.theme-choice {
  background: var(--surface-soft);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-choice:hover,
.theme-choice.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ═══════════════════════════════════════════════════════════
   ===== ACCENT SWATCHES (BOUTONS COULEUR) =====
   ═══════════════════════════════════════════════════════════ */

.accent-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.accent-swatch:hover {
  transform: scale(1.08);
}

.accent-swatch.active {
  border-color: var(--text-primary);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────── */
/* COULEURS ORIGINALES */
/* ─────────────────────────────────────────────────────── */
.accent-swatch[data-accent-choice="blue"] {
  background: #2d3e8f;
}

.accent-swatch[data-accent-choice="teal"] {
  background: #0f766e;
}

.accent-swatch[data-accent-choice="purple"] {
  background: #7c3aed;
}

.accent-swatch[data-accent-choice="orange"] {
  background: #ea580c;
}

.accent-swatch[data-accent-choice="rose"] {
  background: #e11d48;
}

/* ─────────────────────────────────────────────────────── */
/* 🆕 NOUVELLES COULEURS */
/* ─────────────────────────────────────────────────────── */
.accent-swatch[data-accent-choice="red"] {
  background: #ef4444;
}

.accent-swatch[data-accent-choice="green"] {
  background: #22c55e;
}

.accent-swatch[data-accent-choice="emerald"] {
  background: #10b981;
}

.accent-swatch[data-accent-choice="amber"] {
  background: #f59e0b;
}

.accent-swatch[data-accent-choice="lime"] {
  background: #84cc16;
}

.accent-swatch[data-accent-choice="cyan"] {
  background: #06b6d4;
}

.accent-swatch[data-accent-choice="indigo"] {
  background: #6366f1;
}

.accent-swatch[data-accent-choice="fuchsia"] {
  background: #d946ef;
}

.accent-swatch[data-accent-choice="slate"] {
  background: #64748b;
}

.accent-swatch[data-accent-choice="sky"] {
  background: #0ea5e9;
}

/* ═══════════════════════════════════════════════════════════
   ===== CUSTOM COLOR PICKER =====
   ═══════════════════════════════════════════════════════════ */

.accent-swatch-custom {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px dashed var(--border);
  outline: 1px solid var(--border);
  background: var(--surface-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.accent-swatch-custom:hover {
  transform: scale(1.08);
}

.accent-swatch-custom.has-value {
  border-style: solid;
}

.accent-swatch-custom.active {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.accent-swatch-custom input[type="color"] {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}

/* ═══════════════════════════════════════════════════════════
   ===== CONTRAST WARNING =====
   ═══════════════════════════════════════════════════════════ */

.contrast-warning {
  display: none;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--warning, #eab308) 12%, transparent);
  border: 1px solid var(--warning, #eab308);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 8px;
  width: 100%;
}

.contrast-warning.visible {
  display: flex;
}