/* ChrisFlix Theme CSS - Multi-Page Architecture */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@400;600;700;800;900&display=swap');

:root {
  --bg: #030305;
  --surface: #0c0c12;
  --surface2: #131320;
  --surface3: #1a1a2e;
  --border: #1e1e30;
  --border-light: #2a2a42;
  --amber: #e8a525;
  --amber-bright: #ffc542;
  --amber-dim: #b8841c;
  --amber-glow: rgba(232, 165, 37, 0.15);
  --magenta: #d14b9e;
  --magenta-bright: #e85ebb;
  --magenta-dim: #a33a7d;
  --magenta-glow: rgba(209, 75, 158, 0.15);
  --purple: #9b59b6;
  --purple-deep: #6c3483;
  --gradient-brand: linear-gradient(135deg, var(--amber) 0%, var(--magenta) 50%, var(--purple) 100%);
  --gradient-brand-h: linear-gradient(90deg, var(--amber), var(--magenta), var(--purple), var(--amber));
  --text: #f2f2fa;
  --text-secondary: #b0b0c8;
  --text-muted: #5a5a78;
  --green: #4ade80;
  --blue: #60a5fa;
  --orange: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
  --radius-lg: 20px;
}

/* ============ BASE STYLES ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html { overflow-x: hidden; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ============ FILM GRAIN & BACKGROUND ============ */
.bg-canvas {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

.grain {
  position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
  z-index: 1; pointer-events: none; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.5s steps(1) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0,0); }
  25% { transform: translate(-5%,-5%); }
  50% { transform: translate(5%,3%); }
  75% { transform: translate(-3%,5%); }
  100% { transform: translate(3%,-3%); }
}

/* ============ REVEAL ANIMATIONS ============ */
.reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-left { opacity: 0; transform: translateX(-40px); transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1); }
.reveal-right { opacity: 0; transform: translateX(40px); transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1); }
.reveal-left.visible, .reveal-right.visible { opacity: 1; transform: translateX(0); }
.reveal-scale { opacity: 0; transform: scale(0.85); transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1); }
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* ============ AVATAR STYLES ============ */
.user-avatar { width:40px;height:40px;border-radius:50%;object-fit:cover;border:2px solid var(--border); }
.user-avatar-lg { width:80px;height:80px; }
.user-avatar-fallback { display:flex;align-items:center;justify-content:center;background:var(--amber);color:#000;font-weight:700;font-size:1.1rem; }

/* ============ NAVIGATION ============ */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px; height: 76px;
  background: rgba(3, 3, 5, 0.6);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  overflow: visible;
  transition: background 0.3s, box-shadow 0.3s;
}
nav.scrolled {
  background: rgba(3, 3, 5, 0.92);
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
.nav-logo { flex-shrink: 0; }
.nav-logo img { height: 44px; transition: all 0.3s; cursor: pointer; }
.nav-logo img:hover { filter: brightness(1.1); transform: scale(1.03); }
.nav-links { display: flex; gap: 32px; align-items: center; overflow-x: auto; overflow-y: hidden; white-space: nowrap; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--text-secondary); text-decoration: none; font-size: 0.88rem;
  font-weight: 500; letter-spacing: 0.3px; transition: color 0.3s; position: relative;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--gradient-brand); border-radius: 1px;
}
.nav-user { display: none; }
.nav-user .user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; color: #000;
  box-shadow: 0 0 16px rgba(232,165,37,0.2);
}
.user-name-text { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.nav-logout { color: var(--text-muted) !important; font-size: 0.8rem !important; margin-left: 8px; }
.nav-login-btn {
  padding: 10px 28px; border-radius: 50px; border: none;
  background: var(--gradient-brand); color: #000; font-family: 'Inter', sans-serif;
  font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all 0.3s;
  text-decoration: none; box-shadow: 0 4px 20px rgba(232,165,37,0.2);
}
.nav-login-btn:hover {
  transform: translateY(-1px); box-shadow: 0 6px 30px rgba(232,165,37,0.35);
}

/* ============ TOAST NOTIFICATIONS ============ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  padding: 12px 24px; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); backdrop-filter: blur(10px);
  transform: translateX(100%); transition: transform 0.3s;
}
.toast.show { transform: translateX(0); }
.toast.success { background: rgba(74,222,128,0.9); color: #000; border: 1px solid var(--green); }
.toast.error { background: rgba(239,68,68,0.9); color: #fff; border: 1px solid var(--red); }
.toast.warning { background: rgba(245,158,11,0.9); color: #000; border: 1px solid var(--orange); }
.toast.info { background: rgba(96,165,250,0.9); color: #000; border: 1px solid var(--blue); }

/* ============ MODAL/OVERLAY STYLES ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
  position: relative; width: 95%; max-width: 700px; max-height: 90vh;
  overflow-y: auto; background: #0a0a12;
  border: 1px solid rgba(255,255,255,0.06); border-radius: 16px;
  scrollbar-width: none;
}
.modal-card::-webkit-scrollbar { display: none; }
.modal-backdrop-img { width: 100%; height: 300px; object-fit: cover; border-radius: 16px 16px 0 0; display: block; }
.modal-backdrop-gradient {
  position: absolute; top: 0; left: 0; right: 0; height: 300px;
  background: linear-gradient(180deg,transparent 30%,#0a0a12 100%);
  border-radius: 16px 16px 0 0;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1); color: #fff;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.modal-body { padding: 0 28px 28px; margin-top: -80px; position: relative; z-index: 2; }
.modal-title { font-size: 1.8rem; font-weight: 800; color: #fff; margin-bottom: 4px; line-height: 1.1; }
.modal-tagline { font-size: 0.85rem; color: var(--amber); font-style: italic; margin-bottom: 12px; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.modal-meta-tag {
  font-size: 0.72rem; padding: 3px 10px; border-radius: 20px;
  background: rgba(255,255,255,0.06); color: var(--text-muted);
}
.modal-meta-tag.rating { background: rgba(232,165,37,0.15); color: var(--amber); font-weight: 700; }
.modal-overview { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.modal-trailer { width: 100%; aspect-ratio: 16/9; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); margin-bottom: 20px; }
.modal-cast {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px;
  margin-bottom: 20px; scrollbar-width: none;
}
.modal-cast::-webkit-scrollbar { display: none; }
.modal-cast-item { text-align: center; min-width: 70px; flex-shrink: 0; }
.modal-cast-photo {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  margin-bottom: 4px; border: 2px solid rgba(255,255,255,0.06);
}
.modal-cast-name { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.2; }
.modal-cast-char { font-size: 0.6rem; color: var(--text-muted); }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============ BUTTON STYLES ============ */
.modal-btn {
  padding: 12px 28px; border-radius: 10px; border: none;
  font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
}
.modal-btn-request { background: var(--gradient-brand); color: #000; }
.modal-btn-request:hover { transform: scale(1.03); box-shadow: 0 4px 20px rgba(232,165,37,0.3); }
.modal-btn-status { background: rgba(255,255,255,0.06); color: var(--text-muted); cursor: default; }
.modal-btn-status.live { background: rgba(74,222,128,0.15); color: var(--green); }
.modal-btn-live { background: linear-gradient(135deg,#00c853,#00e676); color: #000; font-weight: 800; }
.modal-btn-live:hover { transform: scale(1.03); box-shadow: 0 4px 20px rgba(0,200,83,0.3); }
.modal-btn-cancel { background: rgba(232,165,37,0.15); color: var(--amber); border: 1px solid rgba(232,165,37,0.3); }
.modal-btn-cancel:hover { background: rgba(255,80,80,0.15); color: #ff5050; border-color: rgba(255,80,80,0.3); }
.modal-btn-already { background: rgba(255,255,255,0.06); color: var(--text-muted); cursor: default; }
.modal-btn-status.requested { background: rgba(232,165,37,0.15); color: var(--amber); }

/* ============ CARD STYLES ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s;
}
.card:hover { border-color: var(--border-light); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

/* ============ HERO BANNER ============ */
.hero-banner {
  cursor: pointer; position: relative; width: 100vw;
  margin-left: calc(-50vw + 50%); height: 360px;
  overflow: hidden; margin-bottom: -40px;
}
.hero-backdrop {
  position: absolute; inset: 0; background-size: cover;
  background-position: center 20%; transition: opacity 1.5s ease;
}
.hero-backdrop.fade-out { opacity: 0; }
.hero-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1); color: #fff;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; opacity: 0.6;
}
.hero-nav:hover { opacity: 1; background: rgba(232,165,37,0.3); border-color: var(--amber); }
.hero-nav.prev { left: 16px; }
.hero-nav.next { right: 16px; }
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,rgba(3,3,5,0.8) 0%,rgba(3,3,5,0.3) 25%,rgba(3,3,5,0.5) 65%,rgba(3,3,5,1) 100%);
  pointer-events: none;
}
.hero-content {
  position: absolute; bottom: 50px; left: 0; right: 0;
  padding: 0 24px; max-width: 900px; margin: 0 auto;
  z-index: 2; pointer-events: none;
}
.hero-greeting {
  font-size: 1.6rem; font-weight: 700; color: #fff;
  margin-bottom: 4px; text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.hero-subtitle {
  font-size: 0.85rem; color: rgba(255,255,255,0.6);
  text-shadow: 0 1px 10px rgba(0,0,0,0.5);
}
.hero-featured {
  font-size: 0.7rem; color: var(--amber);
  text-transform: uppercase; letter-spacing: 2px; font-weight: 600;
  margin-bottom: 8px;
}

/* ============ CAROUSEL & SECTION STYLES ============ */
.section { margin: 48px 0; }
.section h3 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 16px;
  color: #fff;
}
.section h3.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.carousel {
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: 8px; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }

.carousel-item {
  min-width: 120px; max-width: 140px;
  scroll-snap-align: start; flex-shrink: 0;
  transition: all 0.3s; position: relative;
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer;
}
.carousel-item:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.carousel-item img {
  width: 100%; pointer-events: none;
  aspect-ratio: 2/3; object-fit: cover;
  display: block; border-radius: var(--radius);
}

.carousel-item-wide {
  min-width: 140px; max-width: 160px;
}
.carousel-item-wide:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(232,165,37,0.08);
}

/* Item overlays and badges */
.item-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 30px 10px 10px;
  background: linear-gradient(transparent,rgba(0,0,0,0.9));
  border-radius: 0 0 var(--radius) var(--radius);
}
.item-title {
  font-size: 0.78rem; font-weight: 600; color: #fff;
  line-height: 1.2;
}
.item-meta {
  font-size: 0.65rem; color: var(--text-muted);
  margin-top: 3px;
}
.item-rating {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  padding: 3px 7px; border-radius: 5px;
  font-size: 0.65rem; font-weight: 700; color: var(--amber);
  border: 1px solid rgba(232,165,37,0.2);
}
.item-rank {
  position: absolute; top: 8px; left: 8px;
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; color: #000;
}
.item-new {
  position: absolute; top: 6px; left: 6px;
  pointer-events: none; background: var(--gradient-brand);
  color: #000; font-size: 0.55rem; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 1px;
}
.on-chrisflix-badge {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(135deg,#00c853,#00e676);
  color: #000; font-size: 0.55rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.5px;
  text-align: center; padding: 3px 0; z-index: 2;
  pointer-events: none;
}

/* ============ RESPONSIVE DESIGN ============ */
@media (max-width: 768px) {
  nav { padding: 0 12px; }
  .nav-links { gap: 16px; flex: 1; }
  .nav-user { display: none !important; }
  .nav-logo img { height: 36px; margin-right: 8px; flex-shrink: 0; }
  
  .hero-banner { height: 260px; }
  .hero-greeting { font-size: 1.2rem; }
  .hero-nav { width: 32px; height: 32px; font-size: 0.9rem; }
  .hero-nav.prev { left: 8px; }
  .hero-nav.next { right: 8px; }
  
  .modal-body { padding: 0 18px 18px; margin-top: -50px; }
  .modal-backdrop-img { height: 200px; }
  .modal-backdrop-gradient { height: 200px; }
  .modal-title { font-size: 1.3rem; }
  
  .card { padding: 18px; }
  .card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  nav { padding: 0 16px; }
  .section { margin: 32px 0; }
  .carousel { gap: 10px; }
  .carousel-item { min-width: 110px; max-width: 130px; }
  .carousel-item-wide { min-width: 130px; max-width: 150px; }
}

/* ============ UTILITY CLASSES ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.hidden { display: none; }
.visible { display: block; }
