/* =========================================
   1. CORE VARIABLES & RESET
   ========================================= */
:root {
  /* --- Color Palette --- */
  --bg-color: #0f0f0f;            /* Deep black background */
  --card-bg: #181818;             /* Slightly lighter for cards */
  --text-color: #f5f5f5;          /* Off-white text for readability */

  /* --- Accents & Highlights --- */
  --accent-color: #e50914;        /* Netflix-style Red */
  --accent-glow: rgba(229, 9, 20, 0.4);
  --secondary-text: #a0a0a0;      /* Grey for meta-data */

  /* --- Layout & Shapes --- */
  --header-height: 80px;
  --radius-md: 12px;
  --radius-pill: 50px;

  /* --- Visual Effects --- */
  --glass: rgba(18, 18, 18, 0.9); /* High opacity glass for header */
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 10px 30px -10px rgba(0,0,0,0.5);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent; /* Removes blue tap box on mobile */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden; /* Prevents horizontal scrollbar */
  -webkit-font-smoothing: antialiased; /* Smoother fonts on Mac/iOS */
  line-height: 1.6;
}

/* =========================================
   2. HEADER & NAVIGATION
   ========================================= */
#main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--glass);
  backdrop-filter: blur(12px);         /* Glassmorphism effect */
  -webkit-backdrop-filter: blur(12px); /* Safari support */
  border-bottom: var(--glass-border);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform; /* Hint to browser to optimize rendering */
}

/* Utility class to hide header via JS */
.header-hidden {
  display: none !important;
}

/* --- Mobile Layout (Flexbox) --- */
.header-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 15px 20px;
  gap: 15px;
}

/* 1. LOGO STYLING */
#logo {
  display: flex;
  align-items: center;
  height: 40px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 38px;
  font-weight: 400;
  letter-spacing: 0.5px;
  line-height: 1;
  padding-top: 4px;

  /* Text Gradient & Shine Effect */
  background: linear-gradient(110deg, #e50914 30%, #ff6b72 50%, #e50914 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #e50914; /* Fallback */

  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  animation: textShine 4s linear infinite;

  /* Flex Positioning */
  order: 1;
  margin-right: auto;
  flex-shrink: 0;
  cursor: pointer;
}

/* 2. JOIN BUTTON */
#join-btn {
  order: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  width: 50px;
  margin-right: 10px;
  background: transparent;
  border: none;
  padding: 0;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#join-btn svg {
  width: 28px;
  height: 28px;
  stroke-width: 2px;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
  transition: filter 0.2s ease;
}

/* 3. MENU BUTTON (Hamburger) */
#menu-btn {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: white;
  font-size: 33px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
  transition: background 0.2s ease;
  padding-left: 11px; /* Visual optical adjustment */
}

/* 4. SEARCH BAR */
#search-bar {
  order: 4;
  width: 100%;
  padding: 12px 20px;
  margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.3);
  color: white;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
#search-bar:focus {
  background: rgba(0,0,0,0.6);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.15);
}

/* --- Genre Scrollable Navigation --- */
#genre-nav {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding: 0 20px 15px;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox hide scrollbar */
  /* Fade out edges */
  mask-image: linear-gradient(to right, transparent, black 20px, black 95%, transparent);
  will-change: scroll-position;
}
#genre-nav::-webkit-scrollbar { display: none; /* Chrome/Safari hide scrollbar */ }
#genre-nav {
  /* ... your existing styles ... */
  scroll-behavior: auto; /* Ensure this is auto, NOT smooth */
}
.genre-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.05);
  color: var(--secondary-text);
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.genre-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 4px 15px var(--accent-glow);
}

/* =========================================
   3. SIDE MENU
   ========================================= */
#side-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 199;
}

#side-menu {
  position: fixed;
  top: 0;
  right: -280px; /* Hidden off-screen */
  width: 280px;
  height: 100%;
  background: #121212;
  z-index: 200;
  transition: right 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  padding: 30px;
  display: flex;
  flex-direction: column;
  border-left: var(--glass-border);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  will-change: right;
}

#side-menu.open { right: 0; }

#close-menu {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--secondary-text);
  font-size: 28px;
  cursor: pointer;
  margin-bottom: 30px;
}

#side-menu ul { list-style: none; }
#side-menu li {
  padding: 15px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  font-size: 18px;
  color: var(--secondary-text);
}

.hidden { display: none !important; }

/* =========================================
   4. MAIN FEED & CARDS (HIGH PERFORMANCE)
   ========================================= */
#feed-container {
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  max-width: 1400px;
  margin: 0 auto;
  /* Perf: Promotes container to its own layer */
  transform: translateZ(0);
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,0.03);

  /* --- EXTREME PERFORMANCE OPTIMIZATIONS --- */
  /* 1. Containment: Browser ignores internal layout changes affecting outside */
  contain: layout paint style;
  /* 2. Content Visibility: Skips rendering off-screen content (Modern Browsers) */
  content-visibility: auto;
  contain-intrinsic-size: 200px 300px; /* Placeholder size prevents scrollbar jumping */
  /* 3. GPU Hardware Acceleration */
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  will-change: transform, opacity;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
}

/* Poster Image */
.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.4s ease-out, filter 0.4s ease;
  opacity: 0; /* Starts hidden for fade-in effect */
}

/* Fade in when JS adds 'loaded' class */
.card.loaded .card-poster { opacity: 1; }

/* Blur background when card is clicked/expanded */
.card.expanded .card-poster {
  filter: blur(15px) brightness(0.4) saturate(1.2);
}

/* Rating Badge (Top Left Overlay) */
.rating-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 20;
}

/* Card Details (Hidden until Expanded) */
.card-details {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 15px;
  padding-bottom: 45px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 15%, rgba(0,0,0,0.5) 60%, transparent 100%);
  transition: opacity 0.3s ease;
  z-index: 6;
}

.card.expanded .card-details { opacity: 1; pointer-events: auto; }

.card-details h3 { font-size: 14px; margin-bottom: 4px; line-height: 1.2; color: white; }
.card-details p { font-size: 11px; color: #ccc; line-height: 1.3; display: none; }
.card.expanded .card-details p { display: block; }

/* "See" Corner (Bottom Right Triangle) */
.see-corner {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50px;
  height: 50px;
  border-radius: 100% 0 0 0;
  background: var(--accent-color);
  cursor: pointer;
  z-index: 10;
  box-shadow: -2px -2px 10px rgba(0,0,0,0.2);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}
.see-corner:hover { background-color: #f00b16; }
.see-text {
  margin-right: 10px;
  margin-bottom: 10px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  pointer-events: none;
  color: white;
}
.card.expanded .see-corner { background: #333; }

/* =========================================
   5. DETAIL VIEW & REVIEWS
   ========================================= */
.detail-view {
  padding: 0 20px 40px;
  max-width: 800px;
  margin: 0 auto;
}

/* Sticky Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 25px;
  position: sticky;
  top: 0;
  background-color: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(10px);
  z-index: 90;
}
.tab-btn {
  flex: 1;
  padding: 20px 10px;
  background: none;
  border: none;
  color: var(--secondary-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  transition: color 0.3s;
}
.tab-btn.active { color: white; }
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-color);
}

/* Review Accordion */
.review-section { margin-bottom: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.review-header {
  width: 100%;
  padding: 20px 10px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 18px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color 0.3s ease;
}
.review-header span { display: none; }

.review-section.open .review-header {
  color: white;
  text-shadow: 0 0 10px rgba(229, 9, 20, 0.5);
  background: linear-gradient(90deg, var(--accent-color) 0%, rgba(229, 9, 20, 0.2) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: gradientSweep 0.6s ease-out forwards;
}

.review-content {
  display: none;
  padding: 15px 10px 30px;
  font-size: 15px;
  line-height: 1.6;
  color: #ccc;
}
.review-section.open .review-content {
  display: block;
  animation: fadeUp 0.4s ease;
}

/* Shop Coupon */
.coupon-box {
  margin-top: 25px;
  padding: 20px;
  border: 2px dashed var(--accent-color);
  border-radius: 12px;
  background: rgba(229, 9, 20, 0.08);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.coupon-box strong {
  display: block;
  font-size: 20px;
  font-family: 'Courier New', monospace;
  color: var(--accent-color);
  letter-spacing: 1px;
  margin-bottom: 5px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#coupon-text { font-size: 12px; color: #bbb; text-transform: uppercase; font-weight: 600; }
.coupon-box:active { transform: scale(0.98); }

/* Shop Items Grid */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.shop-item { background: #1f1f1f; padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); transition: transform 0.2s; }
.shop-item:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.1); }
.shop-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; margin-bottom: 10px; }
.shop-name { font-size: 14px; color: #eee; font-weight: 500; }
.shop-price { color: var(--accent-color); font-weight: bold; margin-top: 4px; display: block;}

/* =========================================
   6. ANIMATIONS & LOADING STATES
   ========================================= */

/* Logo Text Shine */
@keyframes textShine { to { background-position: 200% center; } }

/* Review Header Sweep */
@keyframes gradientSweep { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Content Fade Up */
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Skeleton Loader Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Loading State for Cards */
.card.is-loading {
  /* Dark Grey background with lighter grey moving shine */
  background: #181818;
  background: linear-gradient(110deg, #181818 8%, #2a2a2a 18%, #181818 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

/* Ensure poster is hidden while shimmer plays behind it */
.card.is-loading .card-poster {
  opacity: 0;
}

/* Poster Fade-in Transition */
.card-poster {
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}
/* new addons ***************** */
/* --- NEW REVIEW STYLES --- */

/* =========================================
   CLEAN & READABLE REVIEW STYLES
   ========================================= */

/* 1. Container Spacing */
.detail-view {
    padding: 0 25px 60px; /* More side/bottom padding */
    max-width: 800px;
    margin: 0 auto;
}

/* 2. The Quick Summary (Clean Quote Style) */
.summary-box {
    margin: 30px 0;
    padding-left: 20px;
    border-left: 4px solid var(--accent-color);
    background: transparent; /* No box background */
}
.summary-text {
    font-size: 18px; /* Bigger text */
    font-weight: 500;
    color: #fff;
    line-height: 1.6;
    font-style: italic;
}

/* 3. Watch It / Skip It (Spacious Grid) */
.decision-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px; /* Space between boxes */
    margin-bottom: 40px;
}
.decision-box {
    background: rgba(255, 255, 255, 0.03); /* Very subtle bg */
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.decision-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: block;
}
.watch-title { color: #46d369; }
.skip-title { color: #ff4444; }

.decision-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.decision-list li {
    font-size: 15px; /* Readable size */
    color: #ddd;
    margin-bottom: 10px; /* Space between items */
    padding-left: 18px;
    position: relative;
    line-height: 1.5;
}
.decision-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    font-size: 18px;
    color: #666;
    line-height: 18px;
}

/* 4. Review Content (The "Article" Look) */
/* 4. Review Content (Edge-to-Edge Headers) */
.review-section {
    /* No margin between sections, so lines stack perfectly */
    margin-bottom: 0; 
}

.review-header {
    /* 1. Stretch to screen edges (overriding parent padding) */
    width: calc(100% + 50px); 
    margin-left: -25px;
    margin-right: -25px;
    
    /* 2. Push text back to align with everything else */
    padding: 25px; 
    
    /* 3. Visual Styles */
    background: transparent;
    border: none;
    
    /* Edge-to-edge divider line */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
    
    color: #fff;
    font-size: 18px; 
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    
    /* Active feedback */
    transition: background 0.2s ease;
}

/* Add a subtle highlight when you touch it */
.review-header:active {
    background: rgba(255, 255, 255, 0.05);
}

/* 4. REMOVE the Plus/Minus Signs */
.review-header::after {
    display: none; 
}

/* Content Area */
.review-content {
    display: none;
    padding: 20px 0 40px 0; /* Add space inside the reading area */
    font-size: 17px; 
    line-height: 1.8; 
    color: #ccc;
}

.review-section.open .review-content { 
    display: block; 
    /* Optional: Small fade-in animation */
    animation: fadeContent 0.3s ease;
}

@keyframes fadeContent {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 5. Cast List (Clean Rows) */
.cast-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}
.cast-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
}
.cast-name { font-size: 16px; color: #fff; font-weight: 600; }
.cast-role { font-size: 15px; color: var(--secondary-text); text-align: right; }

/* 6. Quotes & Coupon */
.review-content ul { padding-left: 20px; }
.review-content li { margin-bottom: 10px; font-style: italic; }

.coupon-box-small {
    margin-top: 40px;
    background: #111;
    border: 1px dashed var(--accent-color);
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}
.cb-label { font-size: 12px; color: #ff8a8a; font-weight: 700; display: block; margin-bottom: 4px; text-transform: uppercase;}
.cb-code { font-family: monospace; font-size: 18px; color: #fff; letter-spacing: 1px; }

/* Mobile Stack */
@media (max-width: 600px) {
    .decision-grid { grid-template-columns: 1fr; gap: 15px; } 
    .detail-view { padding: 0 20px 80px; }
}
/* =========================================
   7. MEDIA QUERIES (RESPONSIVENESS)
   ========================================= */

/* Tablets & Desktop */
@media (min-width: 768px) {
  #feed-container { grid-template-columns: repeat(3, 1fr); }

  .header-content { flex-wrap: nowrap; gap: 0; height: 80px; }
  
  #logo { order: 1; margin-right: 30px; }
  
  #search-bar { order: 2; width: auto; flex: 1; max-width: 500px; margin: 0 auto; }

  #join-btn {
      order: 3;
      margin-left: 30px;
      margin-right: 45px;
      height: 50px;
      width: 50px;
      padding: 0;
  }
  
  #menu-btn { order: 4; margin-left: 0; }
}

/* Large Screens */
@media (min-width: 1024px) {
  #feed-container { grid-template-columns: repeat(5, 1fr); }
}
/* =========================================
   CLEAN & READABLE REVIEW STYLES
   ========================================= */

/* 1. Container Spacing */
.detail-view {
  padding: 0 25px 60px; /* Padding is 25px */
  max-width: 800px;
  margin: 0 auto;
}

/* 2. The Quick Summary (Smaller & Clean) */
.summary-box {
  margin: 25px 0;
  padding-left: 15px;
  border-left: 3px solid var(--accent-color);
  background: transparent;
}
.summary-text {
  font-size: 13px;          /* UPDATED: Smaller size */
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  font-style: italic;
}

/* 3. Watch It / Skip It (Full Width Touch-End) */
.decision-grid {
  display: flex;            /* UPDATED: Flex ensures they split 50/50 */
  
  /* The Magic Trick for Full Width */
  margin-left: -25px;       /* Pull left outside parent padding */
  margin-right: -25px;      /* Pull right outside parent padding */
  width: calc(100% + 50px); /* Fill the new space */
  
  margin-bottom: 40px;
  gap: 0;                   /* UPDATED: No gap so they touch */
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.decision-box {
  flex: 1;                  /* UPDATED: Each takes 50% width */
  background: rgba(255, 255, 255, 0.02);
  padding: 20px;
  border-radius: 0;         /* UPDATED: No radius (Rectangular) */
  border: none;             /* Borders handled by grid container or separator */
  
  /* Vertical divider between the two */
  border-right: 1px solid rgba(255,255,255,0.05);
}

/* Remove border from the last box */
.decision-box:last-child {
  border-right: none;
}

.decision-title {
  font-size: 12px;          /* Slightly smaller to match layout */
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  display: block;
}
.watch-title { color: #46d369; }
.skip-title { color: #ff4444; }

.decision-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.decision-list li {
  font-size: 13px;          /* Smaller list items */
  color: #ccc;
  margin-bottom: 6px;
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}
.decision-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-size: 14px;
  color: #666;
  line-height: 14px;
}