/* ============================================================
   CINEPLUS — style.css
   Premium cinematic web app. Dark. Intentional. High-contrast.

   FIXES & ADDITIONS:
   - Carousel left-drift fixed: scroll-snap + left padding on track
   - Carousels are fully independent (each track scrolls separately)
   - Mobile: 2-column poster grid instead of broken stacked carousel
   - touch-action: pan-x on carousel tracks for mobile swipe
   - will-change: opacity on hero images (prevents repaint on crossfade)
   - All new sidebar styles (panel, overlay, profile, tabs, lists)
   - Skeleton loading animation for poster cards
   - poster-tap-hint overlay on hover/focus
   - All new classes from script.js: rating-chip, recommend-error-card,
     sr-only, no-scroll, nav-btn, google-btn, sidebar-*, carousel-error
   - Poster images: high-def quality via w500 TMDB (already set in JS)
   - Info layer: full-screen on mobile, scrollable content
   - Footer: updated styles with subtitle
   ============================================================ */

/* ============================================================
   SECTION 1 — CSS CUSTOM PROPERTIES
   ============================================================ */

:root {
  /* ── Backgrounds ────────────────────────────────────────── */
  --bg-primary:       #0a0a0a;
  --bg-surface:       #181818;
  --bg-elevated:      #222222;
  --bg-card:          #1a1a1a;

  /* ── Accent (cinematic red) ─────────────────────────────── */
  --accent:           #c0392b;
  --accent-hover:     #e74c3c;
  --accent-dim:       rgba(192, 57, 43, 0.18);

  /* ── Text ───────────────────────────────────────────────── */
  --text-primary:     #f2f2f2;
  --text-secondary:   #a0a0a0;
  --text-muted:       #505050;

  /* ── Borders ────────────────────────────────────────────── */
  --border-subtle:    rgba(255, 255, 255, 0.06);
  --border-medium:    rgba(255, 255, 255, 0.12);
  --border-strong:    rgba(255, 255, 255, 0.20);

  /* ── Rating colours ─────────────────────────────────────── */
  --rating-imdb:      #f5c518;

  /* ── Sidebar ────────────────────────────────────────────── */
  --sidebar-width:    320px;

  /* ── Transitions ────────────────────────────────────────── */
  --t-fast:           0.18s ease;
  --t-mid:            0.28s ease;
  --t-slow:           0.4s ease;
}

/* ============================================================
   SECTION 2 — RESET & BASE
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;   /* prevent iOS font scaling */
}

body {
  background-color: #0a0a0a;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Prevent background scroll when modal/sidebar is open */
body.no-scroll {
  overflow: hidden;
  /* keeps page at current scroll position on iOS */
  position: fixed;
  width: 100%;
}

ul, ol { list-style: none; }

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ── Screen-reader only utility ─────────────────────────── */
.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;
}

/* ── Universal hidden class ─────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Default button + input resets ─────────────────────── */
button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: none;
}

/* ── Focus ring (keyboard navigation) ───────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Custom scrollbar (desktop) ─────────────────────────── */
::-webkit-scrollbar       { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }

/* ============================================================
   SECTION 3 — LAYOUT WRAPPERS
   ============================================================ */

section {
  padding: 56px 0;
}

.section-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
}

.section-header {
  margin-bottom: 28px;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.section-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================================
   SECTION 4 — HEADER & HERO
   ============================================================ */

#site-header {
  position: relative;
  height: 190px;          /* compact — logo + nav only, no tagline */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;      /* allow hero-backdrop to extend below header */
}

/* ── Hero backdrop cross-fade ───────────────────────────── */
.hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 480px;          /* extend well below header to cover recommend section */
  z-index: 0;
  overflow: hidden;
}

.hero-backdrop img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0;
  /* will-change tells the GPU to composite this layer separately.
     Eliminates the repaint stutter on every crossfade cycle. */
  will-change: opacity;
  transition: opacity 1.6s ease-in-out;
}

.hero-backdrop img.active {
  opacity: 1;
}

/* ── Gradient overlay over backdrop — feathers into bg ──── */
.header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 480px;          /* matches hero-backdrop extended height */
  z-index: 1;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0.10) 0%,
    rgba(10, 10, 10, 0.30) 25%,
    rgba(10, 10, 10, 0.55) 45%,
    rgba(10, 10, 10, 0.80) 65%,
    var(--bg-primary) 90%
  );
  pointer-events: none;
}

/* ── Header content (logo + nav) ────────────────────────── */
.header-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* avatar-btn removed — replaced by Profile nav link */

.site-logo {
  font-size: 3.2rem;
  font-weight: 900;           /* maximum weight — heavy cinematic feel */
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--accent);       /* same red as the branding — matches Streamlit original */
  text-shadow: 0 2px 24px rgba(192, 57, 43, 0.45);
}

/* ── Navigation — bright and tappable ───────────────────── */
nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* All nav items share this base — bright white, easy to read on backdrop */
.nav-link {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.28);
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  /* Large tap target on mobile */
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.55);
  color: #ffffff;
}

/* Profile pill — slightly accented so it stands out */
.nav-link--profile {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.nav-link--profile:hover,
.nav-link--profile:focus-visible {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* nav-btn classes removed — replaced by .nav-link system above */

/* ============================================================
   SECTION 5 — AUTH MODAL
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 301;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 18px;
  padding: 36px 32px;
  width: 420px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  transition: color var(--t-fast);
}
.modal-close-btn:hover { color: var(--text-primary); }

/* ── Auth tabs ───────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
}
.auth-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ── Auth panels ─────────────────────────────────────────── */
#auth-signin-panel,
#auth-signup-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Google button ───────────────────────────────────────── */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 9px;
  border: 1px solid var(--border-medium);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--t-fast);
}
.google-btn:hover { background: #2a2a2a; }

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Divider ─────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Auth inputs ─────────────────────────────────────────── */
#auth-signin-panel input,
#auth-signup-panel input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: 9px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--t-fast);
}
#auth-signin-panel input:focus,
#auth-signup-panel input:focus { border-color: var(--accent); }
#auth-signin-panel input::placeholder,
#auth-signup-panel input::placeholder { color: var(--text-muted); }

/* ── Submit buttons ─────────────────────────────────────── */
.primary-btn {
  background: var(--accent);
  color: var(--text-primary);
  padding: 12px 28px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background var(--t-fast), opacity var(--t-fast);
  cursor: pointer;
}
.primary-btn:hover    { background: var(--accent-hover); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; }

#email-signin-btn,
#email-signup-btn {
  width: 100%;
  background: var(--accent);
  color: var(--text-primary);
  padding: 12px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--t-fast);
}
#email-signin-btn:hover,
#email-signup-btn:hover { background: var(--accent-hover); }

/* ── Auth error messages ─────────────────────────────────── */
.auth-error {
  color: #e05555;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.4;
}

/* ── Show password toggle ────────────────────────────────── */
.show-password-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -4px;
  align-self: flex-start;
}
.show-password-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.show-password-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

/* ============================================================
   SECTION 6 — RECOMMENDATION ENGINE
   ============================================================ */

#recommend-section {
  position: relative;
  z-index: 3;             /* sit above hero-backdrop (z:0) and overlay (z:1) */
  padding-top: 16px;
  padding-bottom: 24px;
}

.mood-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto 12px;
}

#mood-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  padding: 14px 18px;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  min-height: 48px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
#mood-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  min-height: 80px;           /* expand when user is actively typing */
}
#mood-input::placeholder { color: rgba(255, 255, 255, 0.55); }

.find-btn {
  align-self: stretch;        /* full-width — big, conspicuous CTA */
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

/* ── Customize panel ─────────────────────────────────────── */
#customize-panel {
  max-width: 680px;
  margin: 0 auto 16px;    /* reduced from 36px for tighter layout */
}

.customize-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.82rem;
  transition: all var(--t-fast);
}
.customize-toggle-btn:hover { border-color: var(--accent); color: #ffffff; }

.gear-icon {
  width: 14px;
  height: 14px;
}

#customize-options {
  margin-top: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.decade-buttons,
.type-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.era-btn, .type-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  transition: all var(--t-fast);
}
.era-btn:hover,
.type-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.era-btn.era-active,
.type-btn.type-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ── Recommendation results ──────────────────────────────── */
#recommendation-results { margin-top: 36px; }

.more-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 32px 0 16px;
}

#more-picks-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Ensure more-picks posters match trending portrait ratio, not square */
#more-picks-grid .poster-card img {
  width: 160px;
  height: 240px;
  object-fit: cover;
}

/* ── Recommendation error card ───────────────────────────── */
.recommend-error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  text-align: center;
  max-width: 500px;
}

.recommend-error-icon {
  font-size: 2.4rem;
}

.recommend-error-msg {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================================
   SECTION 7 — POSTER CARDS
   ============================================================ */

.poster-card {
  width: 160px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 10px;
  position: relative;
  transition: transform var(--t-fast);
  /* Prevent text selection on tap (mobile UX fix) */
  user-select: none;
  -webkit-user-select: none;
}

.poster-card:hover,
.poster-card:focus-visible {
  transform: translateY(-4px);
  outline: none;
}

/* Poster image */
.poster-card img {
  width: 160px;
  height: 240px;
  object-fit: cover;
  border-radius: 10px;
  /* High-definition display: never upscale, always crisp */
  image-rendering: auto;
  transition: box-shadow var(--t-fast);
}
.poster-card:hover img {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Fallback when image fails to load */
.poster-card--no-image {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-medium);
}
.poster-card--no-image::before {
  content: "🎬";
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  width: 160px;
}



.card-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 160px;
  padding: 0 4px;
}

.card-rating {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: center;
}



/* ── Skeleton loading cards ──────────────────────────────── */
.poster-card.skeleton {
  width: 160px;
  cursor: default;
  pointer-events: none;
}

.poster-card.skeleton::before {
  content: "";
  display: block;
  width: 160px;
  height: 240px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    #2a2a2a 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Carousel error message ──────────────────────────────── */
.carousel-error {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 8px 0;
}

/* ============================================================
   SECTION 8 — PRIORITY CARD (hero recommendation pick)
   ============================================================ */

.priority-card {
  display: flex;
  gap: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 18px;
  padding: 28px;
  max-width: 720px;
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.priority-card:hover { border-color: var(--accent); }

.priority-poster-wrap {
  flex-shrink: 0;
}

.priority-poster {
  width: 180px;
  height: 270px;
  object-fit: cover;
  border-radius: 12px;
  /* Sharp, high-def poster rendering */
  image-rendering: auto;
}

.priority-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.priority-label {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.priority-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.priority-meta {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.average-rating-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--text-primary);
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  align-self: flex-start;
}

/* Rating chips row on priority card */
.priority-ratings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rating-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid;
}
.imdb-chip  { color: var(--rating-imdb); border-color: var(--rating-imdb); }

.priority-synopsis {
  font-size: 0.86rem;
  line-height: 1.68;
  color: #b8b8b8;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "Tap for more info" hint at bottom of priority card */
.tap-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 4px;
  letter-spacing: 0.04em;
}
.priority-card:hover .tap-hint { color: var(--accent); }

/* ============================================================
   SECTION 9 — TRENDING CAROUSELS
   Two carousels that scroll completely independently.
   Fix: each .carousel-track is its own scroll container.
   The data-target attribute on each button determines which
   track it controls — no CSS needed for this, it's pure JS.
   ============================================================ */

#trending-section {
  position: relative;
  z-index: 3;
  padding-top: 48px;          /* breathing room above “🔥 Trending Movies” */
}

.carousel-container {
  margin-bottom: 16px;
}

.carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.carousel-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 4px 14px 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* FIX: removed touch-action: pan-x — it was blocking vertical page
     scroll when a finger started on a poster card. The browser handles
     horizontal carousel swipe naturally via overflow-x: auto. */
  overscroll-behavior-x: contain;
}
.carousel-track::-webkit-scrollbar { display: none; }

/* Each poster card inside a carousel snaps to its left edge */
.carousel-track .poster-card {
  scroll-snap-align: start;
}

.carousel-btn {
  background: rgba(24, 24, 24, 0.88);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  font-size: 1.4rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
  /* Prevent buttons from shrinking when track is long */
  min-width: 40px;
}
.carousel-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ============================================================
   SECTION 10 — INFO LAYER (detail panel)
   ============================================================ */

.info-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Animated show/hide via opacity + visibility */
  opacity: 1;
  visibility: visible;
  transition: opacity var(--t-mid), visibility var(--t-mid);
}

.info-layer.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Override display:none !important from .hidden for transition to work */
  display: flex !important;
}

.info-layer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.info-layer-panel {
  position: relative;
  z-index: 201;
  background: rgba(22, 22, 22, 0.9);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-medium);
  border-radius: 18px;
  max-width: 880px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
}

.info-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  transition: color var(--t-fast);
  z-index: 10;
}
.info-close-btn:hover { color: var(--text-primary); }

.info-layout {
  display: flex;
  gap: 32px;
}

.info-poster img {
  width: 200px;
  height: auto;
  border-radius: 12px;
  flex-shrink: 0;
  image-rendering: auto;
}

.info-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.info-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.info-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.info-meta-year,
.info-meta-type {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.info-rating-badge {
  background: var(--accent);
  color: var(--text-primary);
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 700;
}

/* ── Ratings breakdown ───────────────────────────────────── */
.ratings-breakdown {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.rating-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rating-source {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rating-value {
  font-size: 1.05rem;
  font-weight: 700;
}
.rating-value.imdb { color: var(--rating-imdb); }

.info-synopsis {
  font-size: 0.88rem;
  line-height: 1.76;
  color: #c0c0c0;
}

/* ── Action buttons in info layer ───────────────────────── */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 10px 22px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--t-fast);
}

.action-btn--bookmark {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.action-btn--bookmark:hover         { border-color: var(--accent); }
.action-btn--bookmark svg            { width: 16px; height: 16px; stroke: #c71a1a; fill: none; transition: all var(--t-fast); }
.action-btn--bookmark.bookmarked svg { stroke: #46d369; fill: #46d369; }
.action-btn--bookmark.bookmarked    { border-color: #46d369; }

.action-btn--watchlist {
  background: var(--accent);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.action-btn--watchlist:hover        { background: var(--accent-hover); }
.action-btn--watchlist svg           { width: 16px; height: 16px; stroke: #fff; fill: none; transition: all var(--t-fast); }
.action-btn--watchlist.watchlisted svg { stroke: #fff; fill: #fff; }
.action-btn--watchlist.watchlisted  { background: #46d369; border-color: #46d369; }

/* Watch for Free — outlined accent CTA */
.action-btn--watch-free {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}
.action-btn--watch-free:hover {
  background: var(--accent);
  color: var(--text-primary);
}

/* ── Trailer container ───────────────────────────────────── */
.info-trailer-wrap {
  margin-top: 8px;
}
.info-trailer-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 12px;
  display: block;
}

/* ============================================================
   SECTION 11 — SIDEBAR
   Slides in from the right. Independent scroll. Profile header,
   3 tabs (Bookmarks / Watchlist / Recent), logout at bottom.
   ============================================================ */

/* Dark overlay behind sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Sidebar panel — slides in from right */
.sidebar-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 401;
  width: var(--sidebar-width);
  max-width: 88vw;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-medium);
  display: flex;
  flex-direction: column;
  /* Start off-screen */
  transform: translateX(100%);
  transition: transform var(--t-slow);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.sidebar-panel.open {
  transform: translateX(0);
}

/* ── Sidebar header ──────────────────────────────────────── */
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-close-btn {
  display: block;
  margin-left: auto;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  transition: color var(--t-fast);
}
.sidebar-close-btn:hover { color: var(--text-primary); }

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
  flex-shrink: 0;
  border: 2px solid var(--border-medium);
}

.sidebar-profile-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sidebar-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-email {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar tabs ────────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-tab-btn {
  flex: 1;
  padding: 12px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.sidebar-tab-btn:hover { color: var(--text-secondary); }
.sidebar-tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ── Sidebar list panels ─────────────────────────────────── */
.sidebar-list-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.sidebar-loading {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

.sidebar-empty {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 8px;
  line-height: 1.6;
}

/* ── Sidebar list rows (bookmarks + watchlist) ───────────── */
.sidebar-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.sidebar-list-row:hover { background: var(--bg-elevated); }

.sidebar-item-title {
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── History rows ────────────────────────────────────────── */
.sidebar-history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.sidebar-history-row:hover { background: var(--bg-elevated); }

.sidebar-history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.sidebar-history-title {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-history-mood {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar thumbnails ───────────────────────────────────── */
.sidebar-thumb {
  width: 42px;
  height: 63px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

/* ── Sidebar action icons (bookmark delete, plus, X) ─────── */
.sidebar-action-icon {
  width: 28px;
  height: 28px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
.sidebar-action-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
}
.sidebar-action-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
/* Active state for the plus-to-watchlist icon in bookmarks */
.sidebar-action-icon.active svg {
  stroke: #46d369;
  fill: #46d369;
}
.sidebar-action-icon.active {
  border-color: #46d369;
  background: rgba(70, 211, 105, 0.12);
}

/* ── Watchlist circle (to-do style) ──────────────────────── */
.watchlist-done-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.watchlist-done-circle:hover {
  border-color: #46d369;
  background: rgba(70, 211, 105, 0.12);
}
.watchlist-done-circle.checked {
  border-color: #46d369;
  background: #46d369;
}

/* ── Sidebar footer (logout) ─────────────────────────────── */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-logout-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  padding: 11px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--t-fast);
}
.sidebar-logout-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-dim);
}

/* ============================================================
   SECTION 12 — FOOTER
   ============================================================ */

.site-footer {
  text-align: center;
  padding: 40px 28px;
  border-top: 1px solid var(--border-subtle);
}

.site-footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-sub {
  margin-top: 6px;
  font-size: 0.72rem !important;
  color: #333 !important;
}

/* ============================================================
   SECTION 13 — RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ── Tablet (max 900px) ──────────────────────────────────── */
@media (max-width: 900px) {
  .site-logo { font-size: 2.4rem; letter-spacing: 0.28em; }

  .priority-card {
    flex-direction: column;
    padding: 20px;
    gap: 20px;
  }
  .priority-poster { width: 100%; height: auto; max-height: 360px; object-position: top; }

  .info-layout {
    flex-direction: column;
    gap: 20px;
  }
  .info-poster img { width: 100%; max-width: 220px; margin: 0 auto; }
}

/* ── Mobile (max 600px) ──────────────────────────────────── */
@media (max-width: 600px) {

  /* ── Header ────────────────────────────────────────────── */
  #site-header { height: 155px; }   /* compact on small screen */
  .site-logo   { font-size: 1.85rem; letter-spacing: 0.18em; }
  .nav-link    { font-size: 0.65rem; padding: 5px 11px; min-height: 32px; }

  nav {
    gap: 10px;
  }
  nav a { font-size: 0.7rem; letter-spacing: 0.08em; }

  .section-inner { padding: 0 16px; }
  section        { padding: 40px 0; }

  /* ── Mood input ─────────────────────────────────────────── */
  .find-btn { align-self: stretch; }

  /* ── Carousels on mobile:
     Keep horizontal scroll (don't go column — that was the bug).
     Carousel buttons hidden; users swipe with touch-action: pan-x.
     ────────────────────────────────────────────────────────── */
  .carousel-wrapper {
    /* Stay as flex row — do NOT switch to column on mobile */
    gap: 0;
  }

  .carousel-btn {
    /* Hide arrow buttons on mobile — users swipe instead */
    display: none;
  }

  .carousel-track {
    /* Full-width swipeable scroll on mobile */
    padding: 8px 8px 12px;
    gap: 12px;
    /* Snap more aggressively on mobile */
    scroll-snap-type: x mandatory;
  }

  /* Slightly smaller posters on very small screens */
  .poster-card,
  .poster-card img,
  .poster-card--no-image::before {
    width: 130px;
  }
  .poster-card img { height: 195px; }
  .poster-card--no-image::before { height: 195px; }
  .card-title { width: 130px; }

  /* ── More picks grid: 2 columns on mobile ─────────────── */
  #more-picks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-items: center;
  }
  #more-picks-grid .poster-card,
  #more-picks-grid .poster-card img {
    width: 100%;
    max-width: 160px;
  }

  /* ── Info layer: full screen on mobile ─────────────────── */
  .info-layer-panel {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    border-radius: 18px 18px 0 0;
    padding: 24px 20px;
    /* Stick to bottom of screen */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    margin: 0;
  }

  .info-layout {
    flex-direction: column;
    gap: 16px;
  }
  .info-poster img {
    width: 120px;
    border-radius: 8px;
    margin: 0 auto;
  }
  .info-title { font-size: 1.25rem; }

  /* ── Priority card on mobile ────────────────────────────── */
  .priority-card {
    flex-direction: column;
    padding: 18px;
    border-radius: 14px;
  }
  .priority-poster { width: 100%; height: 200px; object-fit: cover; object-position: top; }

  /* ── Auth modal: full width on mobile ───────────────────── */
  .modal-panel {
    padding: 24px 20px;
    border-radius: 14px;
  }

  /* ── Sidebar full width on small screens ─────────────────── */
  .sidebar-panel {
    max-width: 100%;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-medium);
    border-radius: 18px 18px 0 0;
    top: auto;
    bottom: 0;
    height: 80vh;
    transform: translateY(100%);
  }
  .sidebar-panel.open {
    transform: translateY(0);
  }

  /* ── Fix sidebar rows on small screens ─────────────────── */
  .sidebar-list-row {
    gap: 8px;
    padding: 8px 6px;
  }
  .sidebar-thumb {
    width: 36px;
    height: 54px;
  }
  .sidebar-action-icon {
    width: 26px;
    height: 26px;
    padding: 3px;
  }
  .sidebar-item-title {
    font-size: 0.78rem;
  }
  .sidebar-history-mood {
    font-size: 0.68rem;
  }
  .sidebar-history-info {
    min-width: 0;
    overflow: hidden;
  }

  .section-header h2 { font-size: 1.2rem; }
}

/* ── Very small phones (max 380px) ──────────────────────── */
@media (max-width: 380px) {
  .site-logo { font-size: 1.5rem; letter-spacing: 0.16em; }

  .poster-card,
  .poster-card img,
  .poster-card--no-image::before {
    width: 110px;
  }
  .poster-card img { height: 165px; }
  .poster-card--no-image::before { height: 165px; }
  .card-title { width: 110px; }

  /* Sidebar fixes for very small phones */
  .sidebar-list-row {
    gap: 6px;
    padding: 6px 4px;
  }
  .sidebar-thumb {
    width: 32px;
    height: 48px;
    border-radius: 4px;
  }
  .sidebar-action-icon {
    width: 24px;
    height: 24px;
    padding: 2px;
  }
  .sidebar-item-title {
    font-size: 0.74rem;
  }
  .sidebar-history-mood {
    font-size: 0.64rem;
  }
}
