/* ============================================================
   EMFLIX — Fluent Design · 5 thèmes
   Tokens, acrylique (blur), profondeur, reveal hover
   ============================================================ */

:root,
[data-theme="violet-vert"] {
  /* Palette — Violet & Vert (Aurora, thème par défaut) */
  --violet-900: #16092e;
  --violet-800: #1f0f42;
  --violet-600: #6d28d9;
  --violet-500: #8b5cf6;
  --violet-300: #c4b5fd;
  --green-500:  #10b981;
  --green-400:  #34d399;
  --green-300:  #6ee7b7;
  --ink:        #f4f1fb;
  --ink-dim:    #b6aed0;
  --accent-rgb:  109, 40, 217;
  --accent2-rgb: 16, 185, 129;

  /* Surfaces acryliques (Fluent) */
  --acrylic-bg:     rgba(139, 92, 246, 0.08);
  --acrylic-border: rgba(196, 181, 253, 0.16);
  --acrylic-blur:   blur(18px) saturate(140%);

  /* Profondeur */
  --shadow-2: 0 2px 8px rgba(0,0,0,.35);
  --shadow-8: 0 8px 24px rgba(0,0,0,.45);
  --shadow-16: 0 16px 48px rgba(22, 9, 46, .6);

  --radius: 10px;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* Bleu Nuit & Or — Nocturne */
[data-theme="bleu-or"] {
  --violet-900: #0a1128;
  --violet-800: #132043;
  --violet-600: #d4a017;
  --violet-500: #e6bb3d;
  --violet-300: #f3d98a;
  --green-500:  #38bdf8;
  --green-400:  #7dd3fc;
  --green-300:  #bae6fd;
  --ink:        #f1f5f9;
  --ink-dim:    #96a6c2;
  --accent-rgb:  212, 160, 23;
  --accent2-rgb: 56, 189, 248;
  --acrylic-bg:     rgba(56, 189, 248, 0.07);
  --acrylic-border: rgba(212, 160, 23, 0.2);
  --shadow-16: 0 16px 48px rgba(10, 17, 40, .6);
}

/* Rose & Cyan — Synthwave */
[data-theme="rose-cyan"] {
  --violet-900: #170826;
  --violet-800: #24103c;
  --violet-600: #ec4899;
  --violet-500: #f472b6;
  --violet-300: #fbcfe8;
  --green-500:  #22d3ee;
  --green-400:  #67e8f9;
  --green-300:  #a5f3fc;
  --ink:        #fdf4ff;
  --ink-dim:    #cf9fd4;
  --accent-rgb:  236, 72, 153;
  --accent2-rgb: 34, 211, 238;
  --acrylic-bg:     rgba(236, 72, 153, 0.08);
  --acrylic-border: rgba(244, 114, 182, 0.2);
  --shadow-16: 0 16px 48px rgba(23, 8, 38, .6);
}

/* Corail & Émeraude — Tropical */
[data-theme="corail-emeraude"] {
  --violet-900: #1a1410;
  --violet-800: #2b2019;
  --violet-600: #f4623a;
  --violet-500: #fb8360;
  --violet-300: #ffc4ac;
  --green-500:  #059669;
  --green-400:  #34d399;
  --green-300:  #86efac;
  --ink:        #fdf6f0;
  --ink-dim:    #c9b2a2;
  --accent-rgb:  244, 98, 58;
  --accent2-rgb: 5, 150, 105;
  --acrylic-bg:     rgba(244, 98, 58, 0.08);
  --acrylic-border: rgba(251, 131, 96, 0.2);
  --shadow-16: 0 16px 48px rgba(26, 20, 16, .6);
}

/* Graphite & Ambre — Minuit */
[data-theme="graphite-ambre"] {
  --violet-900: #121214;
  --violet-800: #1e1e21;
  --violet-600: #f59e0b;
  --violet-500: #fbbf24;
  --violet-300: #fde68a;
  --green-500:  #64748b;
  --green-400:  #94a3b8;
  --green-300:  #cbd5e1;
  --ink:        #f8fafc;
  --ink-dim:    #9ca3af;
  --accent-rgb:  245, 158, 11;
  --accent2-rgb: 100, 116, 139;
  --acrylic-bg:     rgba(245, 158, 11, 0.06);
  --acrylic-border: rgba(245, 158, 11, 0.18);
  --shadow-16: 0 16px 48px rgba(10, 10, 11, .65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--violet-900);
  min-height: 100vh;
  line-height: 1.6;
}

/* Fond aurore violet/vert — signature du site (thème photo IA superposé si actif via ces variables) */
:root {
  --theme-photo-url: none; --theme-photo-overlay: none;
  --theme-banner-top-url: none; --theme-banner-top-overlay: none;
  --theme-banner-bottom-url: none; --theme-banner-bottom-overlay: none;
}
.aurora {
  position: fixed; inset: 0; z-index: -2;
  background:
    var(--theme-photo-overlay),
    var(--theme-photo-url) center/cover no-repeat,
    radial-gradient(60vw 60vh at 15% 0%,  rgba(var(--accent-rgb), .45), transparent 60%),
    radial-gradient(50vw 50vh at 85% 20%, rgba(var(--accent2-rgb), .18), transparent 60%),
    radial-gradient(70vw 70vh at 50% 100%, rgba(var(--accent-rgb), .22), transparent 65%),
    var(--violet-900);
}

/* Thème bannière : remplace directement le fond de la barre du haut et du pied de page par une
   image (chacune sa propre image, cohérente avec le fond plein écran) — invisible tant qu'aucun
   thème bannière n'est actif (les calques restent "none" par défaut, .acrylic reprend la main) */
.acrylic.topbar { background: var(--theme-banner-top-overlay),    var(--theme-banner-top-url) center/cover no-repeat,    var(--acrylic-bg); }
.acrylic.footer { background: var(--theme-banner-bottom-overlay), var(--theme-banner-bottom-url) center/cover no-repeat, var(--acrylic-bg); }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-400); text-decoration: none; }
a:hover { color: var(--green-300); }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }

:focus-visible { outline: 2px solid var(--green-400); outline-offset: 2px; border-radius: 4px; }

/* ---------- Acrylique ---------- */
.acrylic {
  background: var(--acrylic-bg);
  backdrop-filter: var(--acrylic-blur);
  -webkit-backdrop-filter: var(--acrylic-blur);
  border: 1px solid var(--acrylic-border);
}

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 28px;
  border-left: none; border-right: none; border-top: none;
  box-shadow: var(--shadow-8);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.5rem;
  color: var(--violet-300); letter-spacing: .04em;
}
.brand span { color: var(--green-400); }
.brand.small { font-size: 1.1rem; }

.mainnav { display: flex; align-items: center; gap: 4px; }
.mainnav > a, .dropbtn {
  color: var(--ink-dim); font-weight: 500; font-size: .95rem;
  padding: 8px 14px; border-radius: var(--radius);
  background: none; border: none; cursor: pointer; font-family: var(--font-body);
  transition: background .15s, color .15s;
}
.mainnav > a:hover, .dropbtn:hover, .mainnav > a.active { color: var(--ink); background: rgba(139,92,246,.18); }
.mainnav > a.active { color: var(--green-300); }

.dropdown { position: relative; }
.dropmenu {
  position: absolute; top: calc(100% + 8px); left: 0;
  display: none; grid-template-columns: repeat(2, minmax(150px, 1fr));
  padding: 10px; border-radius: var(--radius);
  background: rgba(31, 15, 66, .92);
  box-shadow: var(--shadow-16);
  max-height: 70vh; overflow: auto;
}
.dropdown:hover .dropmenu, .dropdown:focus-within .dropmenu { display: grid; }
.dropmenu a { color: var(--ink-dim); padding: 8px 12px; border-radius: 6px; font-size: .9rem; }
.dropmenu a:hover { background: rgba(16,185,129,.15); color: var(--green-300); }

.searchbox { display: flex; margin-left: auto; position: relative; }
.searchbox input {
  width: 220px; padding: 9px 14px;
  border: 1px solid var(--acrylic-border); border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  background: rgba(22, 9, 46, .5); color: var(--ink);
  font-family: var(--font-body);
}
.searchbox input::placeholder { color: var(--ink-dim); }
.searchbox button {
  padding: 0 14px; border: 1px solid var(--acrylic-border);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(139,92,246,.25); color: var(--ink); cursor: pointer;
}
.searchbox button:hover { background: var(--violet-600); }

/* ---------- Résultats de recherche instantanée ---------- */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 200;
  border-radius: var(--radius); overflow: hidden;
  background: rgba(31, 15, 66, .96);
  box-shadow: var(--shadow-16);
  max-height: 70vh; overflow-y: auto;
}
.sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; color: var(--ink); border-bottom: 1px solid rgba(196,181,253,.08);
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.active { background: rgba(139,92,246,.22); color: var(--ink); }
.sr-item img { border-radius: 5px; flex-shrink: 0; object-fit: cover; background: var(--violet-800); }
.sr-info { display: flex; flex-direction: column; min-width: 0; }
.sr-title { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-year { font-size: .78rem; color: var(--ink-dim); }
.sr-empty { padding: 14px 16px; color: var(--ink-dim); font-size: .9rem; text-align: center; }
.sr-seeall {
  display: block; padding: 10px 12px; text-align: center;
  font-size: .85rem; font-weight: 700; color: var(--green-300);
  border-top: 1px solid rgba(196,181,253,.12); background: rgba(139,92,246,.08);
}
.sr-seeall:hover { background: rgba(139,92,246,.18); color: var(--green-300); }

.userzone { display: flex; gap: 8px; align-items: center; }

/* ---------- Sélecteur de thème ---------- */
.theme-btn { font-size: 1.1rem; padding: 8px 12px; }
.theme-menu { grid-template-columns: 1fr; min-width: 200px; }
.theme-option {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; color: var(--ink-dim);
  padding: 9px 12px; border-radius: 6px; font-size: .88rem; font-family: var(--font-body);
  cursor: pointer; text-align: left; width: 100%;
}
.theme-option:hover, .theme-option.active { background: rgba(139,92,246,.15); color: var(--ink); }
.theme-swatch { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255,255,255,.2); }
.theme-more-link {
  display: block; margin-top: 6px; padding: 9px 12px; border-radius: 6px;
  font-size: .85rem; font-weight: 600; text-align: center;
  border-top: 1px solid var(--acrylic-border); color: var(--green-400) !important;
}
.theme-more-link:hover { background: rgba(16,185,129,.15); color: var(--green-300) !important; }

/* ---------- Galerie de thèmes (/mes-themes.php) ---------- */
.theme-search-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.theme-search-bar input { flex: 1; max-width: 420px; }
.theme-search-count { font-size: .85rem; color: var(--ink-dim); }
.theme-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px; margin-bottom: 40px;
}
.theme-card {
  display: flex; flex-direction: column; gap: 8px; padding: 8px;
  background: var(--acrylic-bg); border: 1px solid var(--acrylic-border); border-radius: var(--radius);
  cursor: pointer; font-family: var(--font-body); transition: transform .15s, border-color .15s;
}
.theme-card:hover { transform: translateY(-3px); border-color: var(--violet-500); }
.theme-card.active { border-color: var(--green-400); box-shadow: 0 0 0 2px rgba(16,185,129,.35); }
.theme-preview { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background-size: cover; background-position: center; }
.theme-gallery-banners { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.theme-preview-banner { aspect-ratio: 3 / 1; }
.theme-genre-title { font-size: 1rem; font-weight: 700; color: var(--ink-dim); margin: 22px 0 10px; }
.theme-card-name { font-size: .82rem; color: var(--ink); text-align: center; line-height: 1.3; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: .92rem; cursor: pointer; border: none;
  font-family: var(--font-body); transition: transform .12s, box-shadow .12s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--violet-600), var(--violet-500));
  color: #fff; box-shadow: var(--shadow-2);
}
.btn.primary:hover { box-shadow: 0 4px 16px rgba(139,92,246,.5); }
.btn.green {
  background: linear-gradient(135deg, var(--green-500), var(--green-400));
  color: #06281c; box-shadow: var(--shadow-2);
}
.btn.green:hover { box-shadow: 0 4px 16px rgba(16,185,129,.45); }
.btn.ghost {
  background: transparent; color: var(--ink-dim);
  border: 1px solid var(--acrylic-border);
}
.btn.ghost:hover { color: var(--ink); border-color: var(--violet-500); }

/* ---------- Conteneur ---------- */
.container { max-width: 1400px; margin: 0 auto; padding: 28px 28px 64px; }

/* ---------- Héros ---------- */
.hero-carousel {
  position: relative; border-radius: 16px; overflow: hidden;
  min-height: 420px; margin-bottom: 40px; box-shadow: var(--shadow-16);
}
.hero-slide {
  position: absolute; inset: 0; display: flex; align-items: flex-end;
  opacity: 0; visibility: hidden; transition: opacity .8s ease;
  pointer-events: none;
}
.hero-slide.active { opacity: 1; visibility: visible; pointer-events: auto; position: relative; }
.hero-bg { position: absolute; inset: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(22,9,46,.15) 0%, rgba(22,9,46,.92) 90%),
              linear-gradient(90deg, rgba(var(--accent-rgb),.35), transparent 55%);
}
.hero-content { position: relative; padding: 36px; padding-bottom: 64px; max-width: 640px; }
.hero-badge {
  display: inline-block; padding: 4px 12px; border-radius: 100px;
  background: rgba(16,185,129,.2); border: 1px solid rgba(52,211,153,.4);
  color: var(--green-300); font-size: .8rem; font-weight: 600;
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: .08em;
}
.hero-slide h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 800; margin-bottom: 12px; }
.hero-slide p { color: var(--ink-dim); margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.hero-dots {
  position: absolute; bottom: 20px; right: 28px; z-index: 5;
  display: flex; gap: 8px;
}
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%; padding: 0;
  background: rgba(255,255,255,.3); border: none; cursor: pointer;
  transition: background .2s, transform .2s;
}
.hero-dot:hover { background: rgba(255,255,255,.55); }
.hero-dot.active { background: var(--green-400); transform: scale(1.3); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Rangées & cartes ---------- */
.row { margin-bottom: 44px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.row-head h2 { font-size: 1.35rem; font-weight: 700; }
.row-head h2::before { content: ''; display: inline-block; width: 4px; height: 1em; margin-right: 10px; vertical-align: -0.15em; border-radius: 2px; background: linear-gradient(180deg, var(--violet-500), var(--green-400)); }
.row-more { font-size: .9rem; font-weight: 600; }
.row-head-actions { display: flex; align-items: baseline; gap: 14px; flex-shrink: 0; }
.row-refresh {
  border: 1px solid var(--acrylic-border); background: var(--acrylic-bg); color: var(--ink-dim);
  border-radius: 100px; width: 30px; height: 30px; font-size: 1rem; line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s, transform .4s;
}
.row-refresh:hover { color: var(--ink); border-color: var(--green-400); }
.row-refresh.spinning { transform: rotate(360deg); color: var(--green-400); }

.row-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: 168px;
  gap: 16px; overflow-x: auto; padding: 6px 2px 14px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
  scrollbar-color: var(--violet-600) transparent;
  /* Empêche Chrome de transférer le scroll à un élément parent une fois à la limite du
     défilement horizontal (bug connu, aggravé par les arrondis de mise en page au zoom) */
  overscroll-behavior: contain;
}
.row-scroll > .card { scroll-snap-align: start; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 22px 16px; padding: 6px 2px;
}

.card { position: relative; }
.card-link { display: block; color: inherit; }
.card-poster {
  position: relative; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 2 / 3; background: var(--violet-800);
  box-shadow: var(--shadow-2);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card-link:hover .card-poster {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 32px rgba(139,92,246,.35), 0 0 0 1px rgba(52,211,153,.35);
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; }
.card-score {
  position: absolute; bottom: 8px; left: 8px;
  min-width: 40px; padding: 3px 8px; border-radius: 100px;
  font-family: var(--font-display); font-weight: 700; font-size: .85rem;
  background: rgba(22,9,46,.85); backdrop-filter: blur(6px);
  border: 1px solid var(--green-500); color: var(--green-300); text-align: center;
}
.card-score[data-score^="4"], .card-score[data-score^="3"], .card-score[data-score^="2"], .card-score[data-score^="1"], .card-score[data-score="0"] { border-color: var(--violet-500); color: var(--violet-300); }
.card-score small { font-size: .65em; opacity: .8; }
.card-title { font-size: .92rem; font-weight: 600; margin-top: 10px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-year { font-size: .8rem; color: var(--ink-dim); }

.card-fav {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--acrylic-border);
  background: rgba(22,9,46,.75); backdrop-filter: blur(6px);
  color: var(--ink-dim); font-size: 1rem; cursor: pointer;
  transition: color .15s, transform .15s, border-color .15s;
}
.card-fav:hover { transform: scale(1.12); color: var(--green-300); }
.card-fav.active { color: var(--green-400); border-color: var(--green-500); }

/* ---------- Statut "déjà vu" ---------- */
.card-watch {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--acrylic-border);
  background: rgba(22,9,46,.75); backdrop-filter: blur(6px);
  color: var(--ink-dim); font-size: 1rem; cursor: pointer;
  transition: color .15s, transform .15s, border-color .15s;
}
.card-watch:hover { transform: scale(1.12); color: var(--green-300); }
.card-watch.active { color: var(--green-400); border-color: var(--green-500); }
.card[data-watched="1"] .card-poster { opacity: .5; }
.card[data-watched="1"] .card-poster::after {
  content: '✓ Déjà vu'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: .85rem;
  color: var(--green-300); background: rgba(22,9,46,.35);
}

.watched-filter { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.watched-filter-btn {
  padding: 8px 16px; border-radius: 100px; border: 1px solid var(--acrylic-border);
  background: var(--acrylic-bg); color: var(--ink-dim); font-family: var(--font-body);
  font-size: .88rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.watched-filter-btn:hover { color: var(--ink); border-color: var(--violet-500); }
.watched-filter-btn.active {
  background: linear-gradient(135deg, var(--violet-600), var(--violet-500));
  color: #fff; border-color: transparent;
}

/* ---------- Badges de navigation ---------- */
.nav-badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px;
  border-radius: 100px; color: #fff;
  font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.3;
}
.nav-badge-request { background: #dc2626; } /* rouge : demandes d'ami en attente */
.nav-badge-chat    { background: var(--green-500); } /* vert : nouveaux messages non lus */

/* ---------- Page Amis ---------- */
.friend-results { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.friend-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  background: rgba(22, 9, 46, .35); border: 1px solid var(--acrylic-border);
  margin-bottom: 10px;
}
.friend-name { font-weight: 600; }

/* ---------- Fenêtre de chat ---------- */
.chat-window {
  border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  max-width: 720px; margin: 0 auto;
}
.chat-messages {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 55vh; min-height: 240px; overflow-y: auto; padding: 6px;
}
.chat-empty { text-align: center; color: var(--ink-dim); padding: 40px 0; }
.chat-msg {
  max-width: 72%; padding: 10px 14px; border-radius: 14px; position: relative;
  font-size: .92rem; line-height: 1.45;
}
.chat-msg.them {
  align-self: flex-start; background: rgba(139,92,246,.16);
  border: 1px solid var(--acrylic-border); border-bottom-left-radius: 4px;
}
.chat-msg.me {
  align-self: flex-end; background: linear-gradient(135deg, var(--violet-600), var(--violet-500));
  color: #fff; border-bottom-right-radius: 4px;
}
.chat-bubble-text { white-space: pre-wrap; word-break: break-word; margin: 0; }
.chat-time { display: block; font-size: .68rem; opacity: .7; margin-top: 4px; text-align: right; }
.chat-attach-img { max-width: 220px; border-radius: 10px; margin-top: 6px; display: block; }
.chat-attach-file {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  color: inherit; text-decoration: underline; font-size: .88rem;
}

.chat-file-preview {
  font-size: .82rem; color: var(--ink-dim); padding: 6px 12px;
  background: rgba(139,92,246,.1); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chat-file-preview[hidden] { display: none; }
.chat-pending-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 100px;
  background: rgba(139,92,246,.18); border: 1px solid var(--acrylic-border);
}
.chat-pending-remove {
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  font-size: .85rem; line-height: 1; padding: 0 2px;
}
.chat-pending-remove:hover { color: #fca5a5; }

.chat-delete-btn {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(22,9,46,.85); border: 1px solid var(--acrylic-border);
  color: var(--ink-dim); font-size: .72rem; cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s;
  display: flex; align-items: center; justify-content: center;
}
.chat-msg { position: relative; }
.chat-msg:hover .chat-delete-btn { opacity: 1; }
.chat-delete-btn:hover { color: #fca5a5; border-color: #fca5a5; }
.chat-msg.deleted { opacity: .6; }
.chat-deleted-text { font-style: italic; color: var(--ink-dim) !important; }
.chat-form { display: flex; align-items: center; gap: 10px; }
.chat-attach {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(139,92,246,.15); border: 1px solid var(--acrylic-border);
  cursor: pointer; font-size: 1.1rem;
}
.chat-attach:hover { background: rgba(139,92,246,.28); }
.chat-form input[type="text"] {
  flex: 1; padding: 11px 14px; border-radius: 100px;
  border: 1px solid var(--acrylic-border); background: rgba(22, 9, 46, .5);
  color: var(--ink); font-family: var(--font-body);
}
.chat-hint { font-size: .78rem; color: var(--ink-dim); text-align: center; }

/* ---------- Appels audio/vidéo ---------- */
.call-buttons { display: flex; gap: 12px; margin-bottom: 20px; }

.incoming-call-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; border-radius: 100px;
  background: rgba(31, 15, 66, .97); border: 1px solid var(--green-500);
  box-shadow: var(--shadow-16);
  animation: call-pulse 1.4s ease-in-out infinite;
}
/* Corrige un bug d'affichage : sans cette règle, la bannière restait visible en permanence
   pour tout le monde car "display: flex" ci-dessus l'emportait sur l'attribut [hidden]. */
.incoming-call-banner[hidden] { display: none; }
.incoming-call-banner span { font-weight: 600; font-size: .92rem; }
.incoming-call-actions { display: flex; gap: 8px; }
@keyframes call-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.4), var(--shadow-16); }
  50%      { box-shadow: 0 0 0 10px rgba(16,185,129,0), var(--shadow-16); }
}

.call-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(10, 5, 20, .92); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.call-overlay[hidden] { display: none; }
.call-panel {
  width: 100%; max-width: 720px; padding: 24px; text-align: center;
}
.call-status { font-size: 1rem; color: var(--ink-dim); margin-bottom: 18px; }
.call-videos {
  position: relative; border-radius: 16px; overflow: hidden;
  background: var(--violet-800); aspect-ratio: 16/9; margin-bottom: 20px;
}
.call-overlay.audio-only .call-videos { aspect-ratio: auto; height: 160px; display: flex; align-items: center; justify-content: center; }
.call-overlay.audio-only .call-videos::before { content: '🎙️'; font-size: 3rem; }
#call-remote-video { width: 100%; height: 100%; object-fit: cover; }
#call-local-video {
  position: absolute; bottom: 12px; right: 12px; width: 25%; max-width: 180px;
  border-radius: 10px; border: 2px solid var(--acrylic-border); box-shadow: var(--shadow-8);
}
.call-overlay.audio-only #call-local-video, .call-overlay.audio-only #call-remote-video { display: none; }
.call-controls { display: flex; gap: 16px; justify-content: center; }
.call-controls button { font-size: 1rem; padding: 12px 22px; }
#call-mute-btn.active { background: rgba(220,38,38,.25); border-color: #dc2626; }

@media (max-width: 600px) {
  .chat-msg { max-width: 86%; }
}

/* ---------- Page film ---------- */
.movie-hero { display: grid; grid-template-columns: 300px 1fr; gap: 36px; margin-bottom: 44px; }
.movie-poster { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-16); }
.movie-info h1 { font-size: clamp(1.6rem, 3.5vw, 2.6rem); font-weight: 800; }
.movie-tagline { color: var(--green-300); font-style: italic; margin: 6px 0 14px; }
.movie-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.chip {
  padding: 5px 14px; border-radius: 100px; font-size: .85rem; font-weight: 500;
  background: rgba(139,92,246,.15); border: 1px solid var(--acrylic-border); color: var(--violet-300);
}
a.chip:hover { border-color: var(--green-400); color: var(--green-300); }
.movie-overview { max-width: 760px; color: var(--ink); margin-bottom: 22px; }
.movie-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.movie-rating-block { margin-top: 16px; }

/* ---------- Plateformes de streaming ---------- */
.watch-block { margin: 4px 0 24px; }
.watch-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim); margin-bottom: 10px; }
.watch-providers { display: flex; flex-wrap: wrap; gap: 10px; }
.watch-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 8px; border-radius: 100px;
  font-weight: 600; font-size: .9rem; color: #fff;
  border: 1px solid var(--acrylic-border);
  background: rgba(22, 9, 46, .55); backdrop-filter: blur(6px);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.watch-badge img { border-radius: 6px; display: block; }
.watch-badge span { line-height: 1; }
.watch-badge:hover {
  transform: translateY(-2px); color: #fff;
  border-color: rgba(var(--accent-rgb), .6);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), .35);
}
[class*="watch-netflix"]:hover { border-color: #e50914; box-shadow: 0 6px 18px rgba(229, 9, 20, .35); }
[class*="watch-amazon-prime"]:hover, [class*="watch-prime"]:hover { border-color: #00a8e1; box-shadow: 0 6px 18px rgba(0, 168, 225, .35); }
[class*="watch-disney"]:hover { border-color: #0063e5; box-shadow: 0 6px 18px rgba(0, 99, 229, .4); }

.section-title { font-size: 1.35rem; font-weight: 700; margin: 40px 0 16px; }
.section-title::before { content: ''; display: inline-block; width: 4px; height: 1em; margin-right: 10px; vertical-align: -0.15em; border-radius: 2px; background: linear-gradient(180deg, var(--violet-500), var(--green-400)); }

.trailer-wrap {
  position: relative; width: 100%; max-width: 960px;
  aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-16); background: var(--violet-800);
}
.trailer-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.cast-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 120px; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.cast-card { text-align: center; display: block; color: inherit; }
.cast-card:hover .cast-name { color: var(--green-300); }
.cast-card img { border-radius: var(--radius); aspect-ratio: 2/3; object-fit: cover; background: var(--violet-800); }

/* ---------- Cartes personnalités (acteurs) ---------- */
.person-poster { border-radius: 50%; aspect-ratio: 1/1; }
.person-poster img { object-fit: cover; }
.person-card .card-title { text-align: center; }
.person-card .card-year { text-align: center; }
.person-known-for { font-size: .78rem; color: var(--ink-dim); text-align: center; margin-top: 2px; }
.person-hero .movie-poster { border-radius: 50%; aspect-ratio: 1/1; overflow: hidden; max-width: 320px; }
.person-hero .movie-poster img { object-fit: cover; }

@media (max-width: 820px) {
  .person-hero .movie-poster { max-width: 220px; margin: 0 auto; }
}
.cast-name { font-size: .82rem; font-weight: 600; margin-top: 8px; }
.cast-role { font-size: .75rem; color: var(--ink-dim); }

/* ---------- Pages / formulaires ---------- */
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }
.page-head p { color: var(--ink-dim); margin-top: 6px; max-width: 700px; }

/* ---------- Panneau de filtres (repliable) ---------- */
.filters { margin-bottom: 26px; }
.filters-toggle {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.filters-toggle::-webkit-details-marker { display: none; }
.filters-toggle::after { content: '▾'; font-size: .75rem; transition: transform .15s; margin-left: 2px; }
.filters[open] .filters-toggle::after { transform: rotate(180deg); }
.filters-badge {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--green-500); color: #06281c; padding: 2px 8px; border-radius: 100px;
}
.filter-bar {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-top: 14px; padding: 18px; border-radius: var(--radius);
  background: var(--acrylic-bg); border: 1px solid var(--acrylic-border);
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: .8rem; font-weight: 600; color: var(--ink-dim); }
.filter-select {
  padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--acrylic-border); background: rgba(22, 9, 46, .6);
  color: var(--ink); font-family: var(--font-body); font-size: .92rem; cursor: pointer;
  min-width: 180px;
}
.filter-select:focus { border-color: var(--violet-500); outline: none; box-shadow: 0 0 0 3px rgba(139,92,246,.25); }
.filter-select option { background: var(--violet-800); color: var(--ink); }
.filter-reset { padding: 8px 14px; }

/* ---------- Champ à suggestions (combobox) ---------- */
.combo-field { position: relative; }
.combo-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; z-index: 210;
  border-radius: var(--radius); overflow: hidden; max-height: 260px; overflow-y: auto;
  background: rgba(31, 15, 66, .97); border: 1px solid var(--acrylic-border);
  box-shadow: var(--shadow-16);
}
.combo-item {
  display: block; width: 100%; text-align: left; padding: 9px 14px;
  background: none; border: none; color: var(--ink); font-family: var(--font-body);
  font-size: .9rem; cursor: pointer; border-bottom: 1px solid rgba(196,181,253,.08);
}
.combo-item:last-child { border-bottom: none; }
.combo-item:hover, .combo-item.active { background: rgba(139,92,246,.22); }
.combo-empty { padding: 12px 14px; color: var(--ink-dim); font-size: .85rem; text-align: center; }

/* ---------- Sélection multiple (case de texte cliquable + panneau à cases à cocher) ---------- */
.multi-check-field { position: relative; }
.multi-check-input::placeholder { color: var(--ink-dim); }
.multi-check-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 210;
  min-width: 240px; max-width: 320px; max-height: 280px; overflow-y: auto;
  padding: 8px; border-radius: var(--radius);
  background: rgba(31, 15, 66, .98); border: 1px solid var(--acrylic-border);
  box-shadow: var(--shadow-16);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
/* Corrige un bug d'affichage : sans cette règle, le panneau restait visible en permanence
   car "display: grid" ci-dessus l'emportait sur l'attribut [hidden]. */
.multi-check-panel[hidden] { display: none; }
.multi-check-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  font-size: .85rem; color: var(--ink);
}
.multi-check-option:hover { background: rgba(139,92,246,.18); }
.multi-check-option input { accent-color: var(--green-500); flex-shrink: 0; }

.auth-card {
  max-width: 440px; margin: 40px auto; padding: 36px;
  border-radius: 16px; box-shadow: var(--shadow-16);
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 22px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-dim); }
.field input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--acrylic-border); background: rgba(22,9,46,.5);
  color: var(--ink); font-family: var(--font-body); font-size: .95rem;
}
.field input:focus { border-color: var(--violet-500); outline: none; box-shadow: 0 0 0 3px rgba(139,92,246,.25); }
.auth-alt { margin-top: 18px; font-size: .9rem; color: var(--ink-dim); text-align: center; }

/* ---------- Mon compte ---------- */
.account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; align-items: start; }
.account-grid .auth-card { margin: 0; max-width: none; }
.account-grid h2 { font-size: 1.15rem; margin-bottom: 18px; }
.field-hint { font-size: .82rem; color: var(--ink-dim); margin: -6px 0 18px; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Choix du style de filtre ---------- */
.filter-style-choice { display: flex; flex-direction: column; gap: 10px; }
.filter-style-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid var(--acrylic-border);
  background: rgba(22, 9, 46, .35); cursor: pointer; transition: border-color .15s, background .15s;
}
.filter-style-option:hover { border-color: var(--violet-500); }
.filter-style-option:has(input:checked) { border-color: var(--green-500); background: rgba(16,185,129,.08); }
.filter-style-option input[type="radio"] { margin-top: 3px; accent-color: var(--green-500); flex-shrink: 0; }
.filter-style-option strong { display: block; font-size: .92rem; }
.filter-style-option small { display: block; color: var(--ink-dim); font-size: .8rem; margin-top: 2px; }
.btn.danger {
  background: linear-gradient(135deg, #b91c1c, #dc2626); color: #fff;
  box-shadow: var(--shadow-2);
}
.btn.danger:hover { box-shadow: 0 4px 16px rgba(220,38,38,.45); }
.danger-zone { border-color: rgba(220,38,38,.35); }
.danger-zone h2 { color: #fca5a5; }
.danger-text { font-size: .88rem; color: var(--ink-dim); margin-bottom: 18px; }

@media (max-width: 820px) {
  .account-grid { grid-template-columns: 1fr; }
}

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: .92rem; }
.alert.error   { background: rgba(220, 38, 38, .12); border: 1px solid rgba(248,113,113,.4); color: #fca5a5; }
.alert.success { background: rgba(16,185,129,.12);  border: 1px solid rgba(52,211,153,.4);  color: var(--green-300); }

.empty-state { text-align: center; padding: 64px 20px; color: var(--ink-dim); }
.empty-state .big { font-size: 3rem; margin-bottom: 12px; }

/* ---------- Sections favoris (films / séries séparés) ---------- */
.fav-section { margin-bottom: 44px; }
.fav-section .section-title { margin-top: 0; }
.fav-empty-hint { color: var(--ink-dim); font-size: .92rem; }
.fav-empty-hint a { font-weight: 600; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 36px; }
.page-info { color: var(--ink-dim); font-size: .9rem; }

/* ---------- Pied de page ---------- */
.footer { margin-top: 40px; border-left: none; border-right: none; border-bottom: none; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.footer nav { display: flex; gap: 18px; }
.footer nav a { color: var(--ink-dim); font-size: .88rem; }
.footer nav a:hover { color: var(--green-300); }
.credits { margin-left: auto; font-size: .78rem; color: var(--ink-dim); text-align: right; }

/* ---------- Burger / responsive ---------- */
.burger { display: none; background: none; border: none; color: var(--ink); font-size: 1.4rem; cursor: pointer; }

@media (max-width: 1024px) {
  .searchbox input { width: 150px; }
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .burger { display: block; order: 3; margin-left: auto; }
  .searchbox { order: 4; width: 100%; margin: 0; }
  .searchbox input { flex: 1; }
  .userzone { order: 2; }
  .mainnav {
    order: 5; display: none; width: 100%;
    flex-direction: column; align-items: stretch;
  }
  .mainnav.open { display: flex; }
  .dropmenu { position: static; grid-template-columns: 1fr 1fr; box-shadow: none; }
  .container { padding: 20px 16px 48px; }
  .movie-hero { grid-template-columns: 1fr; }
  .movie-poster { max-width: 260px; }
  .hero-carousel { min-height: 340px; }
  .credits { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Panneau d'administration ---------- */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.admin-stat-card {
  padding: 18px; border-radius: var(--radius); text-align: center;
  background: var(--acrylic-bg); border: 1px solid var(--acrylic-border);
}
.admin-stat-value { display: block; font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--green-300); }
.admin-stat-label { display: block; font-size: .8rem; color: var(--ink-dim); margin-top: 4px; }

.admin-table-wrap { overflow-x: auto; margin-top: 18px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th {
  text-align: left; padding: 10px 12px; color: var(--ink-dim);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--acrylic-border);
}
.admin-table td { padding: 10px 12px; border-bottom: 1px solid rgba(196,181,253,.08); vertical-align: middle; }
.admin-table tr:hover td { background: rgba(139,92,246,.06); }
.admin-actions { display: flex; gap: 6px; }
.admin-actions .btn { padding: 6px 10px; font-size: .85rem; }

/* ---------- Notes agrégées (OMDb : IMDb / Rotten Tomatoes / Metacritic) ---------- */
.ratings-block { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 20px; }
.rating-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 100px; font-size: .88rem;
  background: rgba(139,92,246,.12); border: 1px solid var(--acrylic-border);
  color: var(--ink-dim);
}
.rating-badge strong { color: var(--ink); font-family: var(--font-display); }

/* ---------- Notation couleur (rouge/orange/vert), en haut de fiche ---------- */
.rating-picker { display: inline-flex; align-items: center; gap: 8px; }
.rating-picker-label { font-size: .85rem; color: var(--ink-dim); }
.rating-dot {
  border: 1px solid var(--acrylic-border); background: rgba(22, 9, 46, .35);
  border-radius: 100px; width: 38px; height: 38px; font-size: 1.15rem; line-height: 1;
  cursor: pointer; transition: transform .15s, box-shadow .15s, opacity .15s; opacity: .55;
}
.rating-dot:hover { transform: scale(1.12); opacity: .85; }
.rating-dot.active { opacity: 1; box-shadow: 0 0 0 2px currentColor; }
.rating-dot.rating-red    { color: #ef4444; }
.rating-dot.rating-orange { color: #f59e0b; }
.rating-dot.rating-green  { color: #22c55e; }
.rating-chip { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Avis et notes utilisateurs (note couleur + commentaires) ---------- */
.comments-toggle { margin: 40px 0; }
.comments-toggle[open] .filters-toggle::after { transform: rotate(180deg); }
.comments-panel { margin-top: 18px; display: flex; flex-direction: column; gap: 22px; max-width: 720px; }

.review-form { display: flex; flex-direction: column; }
.review-form textarea {
  width: 100%; min-height: 90px; margin: 0 0 14px; padding: 10px 14px;
  border-radius: var(--radius); border: 1px solid var(--acrylic-border);
  background: rgba(22, 9, 46, .5); color: var(--ink); font-family: var(--font-body);
  font-size: .92rem; resize: vertical;
}
.review-form textarea:focus { border-color: var(--violet-500); outline: none; box-shadow: 0 0 0 3px rgba(139,92,246,.25); }
.review-form-actions { display: flex; gap: 10px; }

.reviews-list { display: flex; flex-direction: column; gap: 14px; }
.review-item {
  padding: 14px 16px; border-radius: var(--radius);
  background: rgba(22, 9, 46, .35); border: 1px solid var(--acrylic-border);
}
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.review-author { font-weight: 700; }
.review-color-dot { font-size: .95rem; }
.review-date { font-size: .78rem; color: var(--ink-dim); margin-left: auto; }
.review-text { color: var(--ink); font-size: .92rem; line-height: 1.5; margin: 0; }
