/* ══════════════════════════════════════════════════════════════════
   CinéAstre — Design System
   Sobre, monochrome, "liquid glass" (verre dépoli translucide façon
   Apple). Un seul jeu de règles pour toutes les pages, du site public
   au panel admin — voir README.md #design-system.
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --surface:      #0a0a0a;
  --elevated:     #111111;
  --base:         #000000;

  /* Text */
  --text:         #f2f2f0;
  --text-dim:     #a3a29c;
  --text-faint:   #6b6a65;

  /* Glass */
  --glass-bg:          rgba(255, 255, 255, 0.055);
  --glass-bg-hover:    rgba(255, 255, 255, 0.10);
  --glass-border:      rgba(255, 255, 255, 0.10);
  --glass-border-hover:rgba(255, 255, 255, 0.20);
  --glass-highlight:   rgba(255, 255, 255, 0.09);
  --glass-blur:        20px;

  /* Radius scale */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
}

html, body {
  background-color: var(--base);
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

::-webkit-scrollbar { width: 0; background: transparent; }
* { scrollbar-width: none; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Posters, backdrops, TMDB title logos: no browser drag-ghost, no accidental text selection. */
img { -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; user-select: none; }

/* ── Liquid glass surfaces ─────────────────────────────────────────
   Real translucency + blur, a soft inner highlight along the top edge
   (the "light catching the glass" cue), and a hairline border. Every
   page — home, watch, admin — pulls from these three classes only. */

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}
/* Zero-specificity default radius: any explicit Tailwind rounded-* class on
   the same element (rounded-full pills, circular badges, !rounded-none
   sidebars) wins over this without fighting cascade order. */
:where(.glass-panel) { border-radius: var(--r-lg); }

.glass-button {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  color: var(--text);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.glass-button:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
}
.glass-button:active { transform: scale(0.97); }

.glass-input {
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.glass-input::placeholder { color: var(--text-faint); }
.glass-input:focus {
  border-color: var(--glass-border-hover);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.glass-card-overlay {
  background: linear-gradient(to top, #000 0%, rgba(0,0,0,0.45) 50%, transparent 100%);
}

/* ── Buttons ───────────────────────────────────────────────────────
   One shared shape language: pill radius, three sizes, three
   intents. Used identically on the homepage and inside the admin. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 9999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.75rem; gap: 0.375rem; }
.btn-md { padding: 0.75rem 1.5rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.95rem 2rem; font-size: 0.9375rem; }

.btn-icon { padding: 0.625rem; border-radius: 9999px; }
.btn-icon.btn-sm { padding: 0.45rem; }

.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: rgba(255,255,255,0.88); }

.btn-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  color: var(--text);
  border-color: var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.btn-glass:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-hover); }

.btn-active {
  background: rgba(255,255,255,0.14);
  color: var(--text);
  border-color: var(--glass-border-hover);
}

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ── Solid dropdown panels (profile menu, source picker) ─────────────
   Genuinely opaque — NOT a translucent glass surface. A dropdown sitting
   over a bright/colorful hero image needs a fully solid backing or it reads
   as "still see-through" no matter how high the alpha value; backdrop-blur
   alone doesn't fix that once alpha < 1. Plain solid color, zero ambiguity. */
.solid-dropdown {
  background: #0c0c0c;
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7);
}

/* ── Navbar liquid bubble ──────────────────────────────────────────
   Slides behind the active/hovered nav link (JS sets left/top/width/height). */
.nav-bubble {
  position: absolute;
  border-radius: 9999px;
  background: var(--glass-bg-hover);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--glass-border-hover);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  opacity: 0;
  pointer-events: none;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              top 0.25s ease, height 0.25s ease, opacity 0.2s ease;
}

/* ── Text ──────────────────────────────────────────────────────── */
.text-balance { text-wrap: balance; }

/* ── Layout ────────────────────────────────────────────────────── */
.loader-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: var(--base);
}

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Fades the right edge of a horizontally-scrolling row (tabs, filter pills) so a
   cut-off button reads as "more to scroll" instead of looking clipped/broken —
   image carousels already get this for free from the poster itself being cut off. */
.scroll-fade-x { mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%); -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%); }

/* ── Misc app-wide helpers (no build step, so no @apply available) ─── */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.animate-fade-in { animation: fadeIn 0.3s ease-out; }

/* ── Home hero carousel ────────────────────────────────────────────
   Slow "Ken Burns" drift on the active backdrop + a fade/rise for the
   title block on every slide change — the crossfade opacity itself is
   set inline (duration needs to match the JS autoplay interval). */
@keyframes heroKenBurns { from { transform: scale(1.0); } to { transform: scale(1.08); } }
.hero-kenburns { transition: transform 1.2s ease-out; }
.hero-kenburns-active { animation: heroKenBurns 8s ease-out forwards; }

@keyframes heroTextIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.hero-text-in { animation: heroTextIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Segmented progress-bar slide indicator: the active segment fills left-to-right
   over the autoplay duration (JS sets animation-duration to match) instead of a
   static dot, so the indicator itself shows "time until next slide". */
@keyframes heroSegFill { from { width: 0%; } to { width: 100%; } }
.hero-seg-fill { animation-name: heroSegFill; animation-timing-function: linear; animation-fill-mode: forwards; }

/* ── Watch Party "théâtre" mode ──────────────────────────────────────
   #theater-wrap is the element that actually goes fullscreen (see
   watch-party.js) — fullscreening the player iframe itself would hide our
   own chat UI entirely, since a fullscreen element only renders its own DOM
   subtree. JS re-parents #party-drawer into #theater-wrap and toggles this
   class; everything else here just re-lays-out that already-existing DOM
   from "fixed overlay" to "docked column next to the player". */
.theater-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #000;
  height: 100vh;
  padding: 1rem;
  box-sizing: border-box;
}
.theater-mode #player-container { flex: 1 1 auto; min-width: 0; max-height: 100%; }
.theater-mode #party-drawer {
  position: static !important;
  inset: auto !important;
  width: 380px !important;
  max-width: 380px;
  height: 100% !important;
  flex-shrink: 0;
}

/* ── Dropdown open transition ──────────────────────────────────────
   Shared by every popover-style menu (profile menu, source picker, ...).
   Relies on display:none resetting animation state: toggling the paired
   `hidden` class off replays this each time the menu opens, no JS needed. */
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.dropdown-in { animation: dropdownIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) both; }
