/* Exclu Vision — base : tokens de thème, reset, composants partagés.
   Fichier figé (voir SPEC.md). Thème actif : <html data-theme="halloween|noel|classique">. */

/* ---------------------------------------------------------------- */
/* Tokens                                                            */
/* ---------------------------------------------------------------- */

:root,
[data-theme="halloween"] {
  color-scheme: dark;
  --bg: #060406;
  --bg-elev: #0d080b;
  --surface: #150d11;
  --surface-2: #1e1318;
  --surface-3: #2a1a21;
  --border: rgba(255, 70, 70, 0.10);
  --border-strong: rgba(255, 70, 70, 0.26);
  --text: #f6eded;
  --text-dim: #c9b5b7;
  --text-mute: #8d7376;
  --accent: #e10600;
  --accent-hot: #ff2b1c;
  --accent-deep: #6e0000;
  --accent-soft: rgba(225, 6, 0, 0.14);
  --accent-glow: rgba(225, 6, 0, 0.55);
  --on-accent: #ffffff;
  --ember: #ff7a1a;
  --ember-soft: rgba(255, 122, 26, 0.16);
  --success: #3ddc84;
  --warning: #ffb020;
  --danger: #ff4d4f;
  --font-brand: 'Creepster', 'Bebas Neue', Impact, system-ui, sans-serif;
  --font-display: 'Bebas Neue', 'Oswald', Impact, 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hero-tint: radial-gradient(120% 80% at 15% 100%, rgba(120, 0, 0, 0.55), transparent 60%);
  --glow-text: 0 0 8px rgba(255, 30, 20, 0.8), 0 0 24px rgba(225, 6, 0, 0.55), 0 0 48px rgba(140, 0, 0, 0.5);
}

[data-theme="noel"] {
  --bg: #04080a;
  --bg-elev: #081014;
  --surface: #0d171b;
  --surface-2: #132126;
  --surface-3: #1b2d33;
  --border: rgba(220, 240, 255, 0.10);
  --border-strong: rgba(220, 240, 255, 0.24);
  --text: #f1f6f8;
  --text-dim: #b6c6cc;
  --text-mute: #7c9097;
  --accent: #d6232f;
  --accent-hot: #ff3b47;
  --accent-deep: #5e0a10;
  --accent-soft: rgba(214, 35, 47, 0.16);
  --accent-glow: rgba(214, 35, 47, 0.5);
  --ember: #f2c14e;
  --ember-soft: rgba(242, 193, 78, 0.16);
  --font-brand: 'Mountains of Christmas', 'Bebas Neue', Georgia, serif;
  --hero-tint: radial-gradient(120% 80% at 15% 100%, rgba(10, 70, 50, 0.5), transparent 60%);
  --glow-text: 0 0 8px rgba(255, 255, 255, 0.6), 0 0 24px rgba(214, 35, 47, 0.5);
}

[data-theme="classique"] {
  --bg: #08080a;
  --bg-elev: #0e0e11;
  --surface: #141418;
  --surface-2: #1c1c21;
  --surface-3: #26262d;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #f4f4f6;
  --text-dim: #b9b9c2;
  --text-mute: #7f7f8a;
  --accent: #e50914;
  --accent-hot: #ff2a35;
  --accent-deep: #5a0006;
  --accent-soft: rgba(229, 9, 20, 0.14);
  --accent-glow: rgba(229, 9, 20, 0.45);
  --ember: #f5c518;
  --ember-soft: rgba(245, 197, 24, 0.14);
  --font-brand: 'Bebas Neue', Impact, sans-serif;
  --hero-tint: radial-gradient(120% 80% at 15% 100%, rgba(60, 0, 0, 0.45), transparent 60%);
  --glow-text: 0 0 18px rgba(229, 9, 20, 0.45);
}

:root {
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 0 1px var(--border-strong), 0 10px 40px -8px var(--accent-glow);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms;
  --t: 240ms;
  --gutter: clamp(16px, 4vw, 56px);
  --header-h: 64px;
  --mobile-nav-h: 64px;
  --maxw: 1600px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------------------------------------------------------------- */
/* Reset                                                             */
/* ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
img, svg, video, iframe { display: block; max-width: 100%; }
img { object-fit: cover; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.icon { flex-shrink: 0; }
.img-broken {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  color: transparent;
}

/* ---------------------------------------------------------------- */
/* Typographie                                                       */
/* ---------------------------------------------------------------- */

.display { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; line-height: 0.95; }
.brand { font-family: var(--font-brand); font-weight: 400; letter-spacing: 0.04em; color: var(--accent-hot); text-shadow: var(--glow-text); }
.muted { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.accent { color: var(--accent-hot); }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- */
/* Boutons                                                           */
/* ---------------------------------------------------------------- */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  user-select: none;
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease), opacity var(--t);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.btn-primary {
  --btn-bg: linear-gradient(180deg, var(--accent-hot), var(--accent));
  --btn-fg: var(--on-accent);
  --btn-bd: transparent;
  box-shadow: 0 6px 24px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--accent-hot), var(--accent-hot)); border-color: transparent; box-shadow: 0 10px 32px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25); }

.btn-light { --btn-bg: #f4f1f1; --btn-fg: #0b0708; --btn-bd: transparent; }
.btn-light:hover { background: #ffffff; border-color: transparent; }

.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: transparent; }

.btn-outline { --btn-bg: rgba(255, 255, 255, 0.04); --btn-bd: var(--border-strong); backdrop-filter: blur(8px); }

.btn-danger { --btn-bg: rgba(255, 77, 79, 0.12); --btn-fg: #ff8a8b; --btn-bd: rgba(255, 77, 79, 0.35); }
.btn-danger:hover { background: rgba(255, 77, 79, 0.22); border-color: rgba(255, 77, 79, 0.6); }

.btn-discord { --btn-bg: #5865f2; --btn-fg: #fff; --btn-bd: transparent; }
.btn-discord:hover { background: #4752c4; border-color: transparent; }
.btn-google { --btn-bg: #ffffff; --btn-fg: #1f1f1f; --btn-bd: transparent; }
.btn-google:hover { background: #f1f1f1; border-color: transparent; }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-xs); gap: 6px; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 16px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; min-width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 34px; min-width: 34px; }
.btn-round { border-radius: var(--radius-pill); }

/* ---------------------------------------------------------------- */
/* Formulaires                                                       */
/* ---------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.01em; }
.label .req { color: var(--accent-hot); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-mute); }
.field-error { font-size: 12px; color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 16px; /* évite le zoom iOS */
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
.input.invalid, .textarea.invalid { border-color: var(--danger); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b0a0a2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 14px; color: var(--text-mute); pointer-events: none; }
.input-group > .input { padding-left: 42px; }

/* Toggle */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 32px; }
.toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative; width: 44px; height: 26px; border-radius: var(--radius-pill);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background var(--t) var(--ease), border-color var(--t);
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t) var(--ease-out);
}
.toggle-input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 16px -2px var(--accent-glow); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-input:focus-visible + .toggle-track { outline: 2px solid var(--accent-hot); outline-offset: 2px; }
.toggle-label { font-size: 14px; }

/* ---------------------------------------------------------------- */
/* Chips & badges                                                    */
/* ---------------------------------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  transition: all var(--t) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active, .chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 18px -4px var(--accent-glow);
}
.chip-sm { min-height: 26px; padding: 0 10px; font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.badge-accent { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.badge-quality { background: rgba(0, 0, 0, 0.6); border-color: rgba(255, 255, 255, 0.25); color: #fff; backdrop-filter: blur(6px); }
.badge-ember { background: var(--ember-soft); border-color: transparent; color: var(--ember); }
.badge-success { background: rgba(61, 220, 132, 0.14); border-color: transparent; color: var(--success); }
.badge-muted { background: transparent; color: var(--text-mute); }

/* ---------------------------------------------------------------- */
/* Surfaces                                                          */
/* ---------------------------------------------------------------- */

.panel {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.divider { height: 1px; background: var(--border); border: 0; margin: 16px 0; }

/* ---------------------------------------------------------------- */
/* Modale                                                            */
/* ---------------------------------------------------------------- */

#modal-root { position: relative; z-index: 1000; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 200ms var(--ease);
}
.modal-backdrop.show { opacity: 1; }
.modal {
  position: relative;
  width: 100%; max-height: min(88dvh, 900px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 80px -20px var(--accent-glow);
  transform: translateY(16px) scale(0.98);
  transition: transform 260ms var(--ease-out);
  outline: none;
}
.modal-backdrop.show .modal { transform: none; }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-title { font-family: var(--font-display); font-weight: 400; font-size: 28px; letter-spacing: 0.04em; text-transform: uppercase; }
.modal-close { margin-left: auto; }
.modal-body { padding: 12px 20px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.confirm-text { color: var(--text-dim); }

@media (max-width: 600px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92dvh; padding-bottom: var(--safe-bottom); transform: translateY(40px); }
}

/* ---------------------------------------------------------------- */
/* Toasts                                                            */
/* ---------------------------------------------------------------- */

#toasts {
  position: fixed; z-index: 1100;
  left: 50%; bottom: calc(var(--mobile-nav-h) + var(--safe-bottom) + 12px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(92vw, 420px);
  pointer-events: none;
}
@media (min-width: 1024px) { #toasts { bottom: 24px; } }
.toast {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(22, 14, 18, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(12px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease-out);
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast-success .icon { color: var(--success); }
.toast-error { border-color: rgba(255, 77, 79, 0.5); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon, .toast-warning .icon { color: var(--ember); }

/* ---------------------------------------------------------------- */
/* Chargement / vide                                                 */
/* ---------------------------------------------------------------- */

.spinner {
  width: 36px; height: 36px; margin: 48px auto;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  box-shadow: 0 0 24px -4px var(--accent-glow);
  animation: ev-spin 0.8s linear infinite;
}
@keyframes ev-spin { to { transform: rotate(360deg); } }

.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: ev-shimmer 1.4s infinite;
}
@keyframes ev-shimmer { to { transform: translateX(100%); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 20px; color: var(--text-dim); }
.empty-icon {
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  color: var(--accent-hot);
  filter: drop-shadow(0 0 12px var(--accent-glow));
  animation: ev-float 4s ease-in-out infinite;
}
.empty-title { font-family: var(--font-display); font-weight: 400; font-size: 28px; letter-spacing: 0.04em; color: var(--text); text-transform: uppercase; }
.empty-text { max-width: 420px; }
.empty .btn { margin-top: 8px; }
@keyframes ev-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------------------------------------------------------------- */
/* Utilitaires                                                       */
/* ---------------------------------------------------------------- */

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }

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