:root {
  --bg: #0f0f12;
  --bg-elev: #15161a;
  --text: #e8e8ea;
  --muted: #a0a0a8;
  --primary: #6c5ce7;
  --primary-700: #584bd0;
  --danger: #ef5350;
  --card: #1a1b21;
  --border: #2a2c35;
  --accent: #00d3a7;
}

.theme-light {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --text: #15161a;
  --muted: #5b6572;
  --primary: #5b6dff;
  --primary-700: #4656e6;
  --danger: #e53935;
  --card: #ffffff;
  --border: #e9ecf1;
  --accent: #0bb;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-display: swap;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 15, 18, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.header__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 8px 0;
}

.header__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.brand:hover {
  transform: scale(1.05);
}

.brand__icon {
  font-size: 20px;
}

.brand__text {
  font-weight: 700;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Movie Banner Slider - RoPhim Style */
.movie-banner {
  position: relative;
  width: 100vw;
  height: 70vh;
  min-height: 500px;
  max-height: 700px;
  overflow: hidden;
  margin: 0 0 2rem 0;
  margin-left: calc(-50vw + 50%);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.banner-slider {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.banner-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.banner-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.banner-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  z-index: 1;
}

.banner-content {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 1400px;
  padding: 60px 40px 40px;
  color: white;
  z-index: 2;
  background: linear-gradient(
    transparent 0%,
    rgba(0, 0, 0, 0.2) 30%,
    rgba(0, 0, 0, 0.6) 70%,
    rgba(0, 0, 0, 0.85) 100%
  );
}

.banner-title {
  font-size: 3rem;
  font-weight: 800;
  margin: 0 0 16px 0;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9);
  line-height: 1.1;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.banner-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 0 20px 0;
  font-size: 1rem;
  font-weight: 500;
}

.banner-year,
.banner-quality,
.banner-episode {
  background: rgba(255, 107, 53, 0.9);
  padding: 6px 14px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.banner-description {
  font-size: 1.1rem;
  line-height: 1.7;
  margin: 0 0 30px 0;
  max-width: 700px;
  opacity: 0.95;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.banner-btn {
  padding: 14px 28px;
  border: none;
  border-radius: 30px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.banner-btn--primary {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.banner-btn--primary:hover {
  background: linear-gradient(135deg, #f7931e 0%, #ff6b35 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

.banner-btn--secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.banner-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Thumbnail Navigation */
.banner-thumbnails {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-10%);
  display: flex;
  gap: 12px;
  z-index: 3;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.banner-thumbnail {
  width: 80px;
  height: 45px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  opacity: 0.7;
}

.banner-thumbnail:hover {
  transform: scale(1.1);
  opacity: 1;
  border-color: rgba(255, 107, 53, 0.6);
}

.banner-thumbnail.active {
  opacity: 1;
  border-color: #ff6b35;
  box-shadow: 0 0 15px rgba(255, 107, 53, 0.4);
}

.banner-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.banner-thumbnail:hover img {
  transform: scale(1.05);
}


/* Responsive Design for Banner - Optimized for Mobile */
@media (max-width: 768px) {
  .movie-banner {
    height: 45vh;
    min-height: 320px;
    max-height: 400px;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-bottom: 1rem;
  }
  
  .banner-content {
    padding: 30px 20px 25px;
    width: 100%;
    max-width: none;
    background: linear-gradient(
      transparent 0%,
      rgba(0, 0, 0, 0.1) 20%,
      rgba(0, 0, 0, 0.5) 60%,
      rgba(0, 0, 0, 0.9) 100%
    );
  }
  
  .banner-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    line-height: 1.2;
  }
  
  .banner-meta {
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
  }
  
  .banner-year,
  .banner-quality,
  .banner-episode {
    padding: 4px 10px;
    font-size: 0.8rem;
  }
  
  .banner-description {
    font-size: 0.9rem;
    margin-bottom: 18px;
    max-width: 100%;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  
  .banner-actions {
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .banner-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
    min-width: 120px;
    justify-content: center;
  }
  
  /* Enhanced Mobile Thumbnails */
  .banner-thumbnails {
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 90vw;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    /* Touch scrolling optimization */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  .banner-thumbnails::-webkit-scrollbar {
    display: none;
  }
  
  .banner-thumbnail {
    width: 70px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 6px;
    /* Touch target optimization */
    min-width: 70px;
    cursor: pointer;
    touch-action: manipulation;
  }
  
  .banner-thumbnail:hover {
    transform: scale(1.05);
  }
  
  .banner-thumbnail.active {
    border-width: 2px;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
  }
}

/* Loading State */
.banner-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--card);
  color: var(--muted);
  font-size: 1.1rem;
}

.banner-loading::before {
  content: '🎬';
  margin-right: 8px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}


@media (max-width: 480px) {
  .movie-banner {
    height: 40vh;
    min-height: 280px;
    max-height: 320px;
  }
  
  .banner-content {
    padding: 20px 16px 20px;
  }
  
  .banner-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  
  .banner-meta {
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .banner-year,
  .banner-quality,
  .banner-episode {
    padding: 3px 8px;
    font-size: 0.75rem;
  }
  
  .banner-description {
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin-bottom: 15px;
  }
  
  .banner-actions {
    gap: 8px;
  }
  
  .banner-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-width: 100px;
  }
  
  .banner-thumbnails {
    bottom: 10px;
    padding: 6px 10px;
    gap: 4px;
    max-width: 95vw;
  }
  
  .banner-thumbnail {
    width: 60px;
    height: 35px;
    min-width: 60px;
  }
  
  .banner-nav {
    display: none; /* Hide nav buttons on very small screens */
  }
}

/* Dark/Light Theme Support */
.theme-light .movie-banner {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.theme-light .banner-slide::before {
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0.3) 50%,
    rgba(0, 0, 0, 0.7) 100%
  );
}

/* Performance Optimizations */
.banner-slide {
  will-change: opacity;
}

.banner-nav,
.banner-dot {
  will-change: transform;
}

/* Accessibility */
.banner-nav:focus,
.banner-dot:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .banner-slide {
    transition: none;
  }
  
  .banner-nav,
  .banner-dot {
    transition: none;
  }
  
  @keyframes pulse {
    0%, 100% { opacity: 1; }
  }
}

.nav--quick {
  display: flex;
  gap: 8px;
}

.nav__btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.nav__btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.nav__link--primary {
  background: linear-gradient(45deg, var(--primary), #ff6b6b);
  color: white !important;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  padding: 8px 12px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.nav__link--primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.search { 
  display: flex; 
  gap: 6px;
  flex: 1;
  max-width: 400px;
  margin: 0 20px;
}

.search__input {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.search__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.1);
}

.search__btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.search__btn:hover { background: var(--primary-700); }

.filters { display: none; gap: 8px; align-items: center; }
.select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
}
.theme-toggle {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.app { padding: 24px 0 56px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  /* Optimize grid rendering performance */
  contain: layout;
  transform: translateZ(0);
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) {
  .nav { display: flex; }
  .filters { display: flex; }
  .grid { grid-template-columns: repeat(5, 1fr); }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.card__img-container {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: linear-gradient(135deg, #333 0%, #222 100%);
  /* Hardware acceleration for smooth animations */
  transform: translateZ(0);
  will-change: auto;
}

.card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
  /* Optimize image rendering */
  image-rendering: auto;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  /* Hardware acceleration */
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Image Skeleton Loading */
.image-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #f0f0f0 25%, 
    #e0e0e0 50%, 
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

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

/* Dark theme skeleton */
@media (prefers-color-scheme: dark) {
  .image-skeleton {
    background: linear-gradient(
      90deg,
      #2a2a2a 25%, 
      #3a3a3a 50%, 
      #2a2a2a 75%
    );
    background-size: 200% 100%;
  }
}

/* 🚀 Performance Notification */
.perf-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #00b894, #00a085);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 300px;
  animation: perfNotificationShow 0.3s ease-out;
}

@keyframes perfNotificationShow {
  from {
    opacity: 0;
    transform: translateY(100%) translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

.perf-notification-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: white;
}

.perf-notification-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.perf-notification-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.perf-notification-text strong {
  font-size: 15px;
}

.perf-notification-close {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.perf-notification-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Enhanced loading cards for better UX */
.loading__card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 260px;
  position: relative;
  overflow: hidden;
}

.loading__shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 25%, 
    rgba(255, 255, 255, 0.1) 50%, 
    transparent 75%
  );
  background-size: 200% 100%;
  animation: shimmer-loading 1.5s infinite;
}

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

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .perf-notification {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .perf-notification-text {
    font-size: 13px;
  }
  
  .perf-notification-text strong {
    font-size: 14px;
  }
}

/* 📡 Network Speed Indicator */
.network-indicator {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.network-indicator.fast {
  background: rgba(0, 184, 148, 0.9);
}

.network-indicator.medium {
  background: rgba(255, 179, 0, 0.9);
}

.network-indicator.slow {
  background: rgba(231, 76, 60, 0.9);
}

.network-indicator-icon {
  font-size: 14px;
}

/* Ultra-fast blur preview */
.image-blur-preview {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0.2;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 1;
}

/* Performance-optimized animations */
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
  }
  
  .card:hover {
    transform: translateY(-1px) translateZ(0);
  }
}

/* Optimize for low-end devices */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
  
  .card__img {
    transition: none; /* Disable transitions on mobile for performance */
  }
  
  .image-skeleton {
    animation-duration: 2s; /* Slower animation to reduce CPU usage */
  }
}

.card__img:not([src]),
.card__img[src=""],
.card__img[src*="data:image/svg"] {
  position: relative;
}

.card__img:not([src])::after,
.card__img[src=""]::after {
  content: "🎬";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  opacity: 0.3;
}
.card__meta { padding: 10px; }
.card__title {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.25;
  height: 2.5em;
  overflow: hidden;
}
.card__sub { color: var(--muted); font-size: 12px; }
.card__badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,.6);
  color: #fff;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 6px;
}

.section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 14px;
}
.section__title { margin: 0; font-size: 20px; }
.section__more {
  background: transparent;
  color: var(--primary);
  border: none;
  cursor: pointer;
}

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pager button {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.loading {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.loading__card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 260px;
  position: relative;
  overflow: hidden;
}
.loading__shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.detail { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .detail { grid-template-columns: 280px 1fr; } }
.detail__poster { width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.detail__meta { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.detail__title { margin-top: 0; margin-bottom: 8px; }
.detail__line { margin: 6px 0; color: var(--muted); }
.detail__actions { display: flex; gap: 8px; margin-top: 10px; }
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

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

.filters .select {
  min-width: 100px;
}

.filters .btn {
  flex-shrink: 0;
}

.select--compact {
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.btn--ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

/* Clear filters button styling */
#clearFiltersBtn {
  background: transparent !important;
  color: #dc3545 !important;
  border: 1px solid #dc3545 !important;
  transition: all 0.2s ease;
  opacity: 0.8;
}

#clearFiltersBtn:hover {
  background: #dc3545 !important;
  color: white !important;
  transform: translateY(-1px);
  opacity: 1;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

#clearFiltersBtn:active {
  transform: translateY(0);
}

#clearFiltersBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.episodes {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.server-tabs { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.server-tab {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.server-tab.active { border-color: var(--primary); color: var(--primary); }

.ep-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.player {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}
.player iframe, .player video { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 8px; }

.footer { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted); }
.footer a { color: var(--primary); text-decoration: none; } 

.nav__link--special {
  background: linear-gradient(45deg, var(--primary), #ff6b6b);
  color: white !important;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
}

.nav__link--special:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Category Grid Styles */
.category-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 16px !important;
  margin-top: 20px !important;
  padding: 0 !important;
  position: relative !important;
  z-index: 10 !important;
  background: var(--bg) !important;
  min-height: 400px !important;
}

.category-card {
  display: block !important;
  padding: 20px !important;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: all 0.2s ease !important;
  text-align: center !important;
  width: auto !important;
  height: auto !important;
  position: relative !important;
}

.category-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header__main {
    flex-wrap: wrap;
    gap: 12px;
    min-height: auto;
    padding: 12px 0;
  }
  
  .search {
    order: 3;
    flex-basis: 100%;
    margin: 0;
    max-width: none;
  }
  
  .header__nav {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .nav--quick {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .nav__btn {
    font-size: 12px;
    padding: 5px 8px;
  }
  
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 12px !important;
  }
  
  .category-card {
    padding: 16px !important;
  }
}

@media (max-width: 480px) {
  .brand__text {
    display: none;
  }
  
  .brand__icon {
    font-size: 24px;
  }
  
  .header__actions {
    gap: 8px;
  }
  
  .nav__btn {
    flex: 1;
    text-align: center;
    min-width: 70px;
  }
  
  .filters {
    gap: 6px;
  }
  
  .select--compact {
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* Simple Home Layout */
.section {
  margin-bottom: 32px;
}

.section__title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.grid--simple {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Page Navigation */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.btn--back {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn--back:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.movies-container {
  margin-bottom: 40px;
}

.btn--more {
  display: block;
  margin: 20px auto;
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--more:hover {
  background: var(--primary-dark, #5a67d8);
  transform: translateY(-1px);
}

.btn--load-more {
  display: block;
  margin: 24px auto;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--load-more:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.error-msg {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 40px 20px;
}

/* Notification System */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
  pointer-events: none;
}

.notification {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  margin-bottom: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.notification--success {
  border-left: 4px solid #4caf50;
}

.notification--show {
  transform: translateX(0);
}

.notification--fade-out {
  opacity: 0;
  transform: translateX(100%);
}

.notification__icon {
  font-size: 24px;
  flex-shrink: 0;
  animation: bounce 2s infinite;
}

.notification__content {
  flex: 1;
  min-width: 0;
}

.notification__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.notification__message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 6px;
}

.notification__time {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

.notification__close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.notification__close:hover {
  background: var(--bg-elev);
  color: var(--text);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-3px);
  }
  60% {
    transform: translateY(-1px);
  }
}

/* Responsive cho layout đơn giản */
@media (max-width: 768px) {
  .section {
    margin-bottom: 24px;
  }
  
  .section__title {
    font-size: 18px;
  }
  
  .grid--simple {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .page-title {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .grid--simple {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .btn--more, .btn--load-more {
    padding: 8px 20px;
    font-size: 13px;
  }
  
  /* Notification responsive */
  .notification-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .notification {
    padding: 12px;
    gap: 10px;
  }
  
  .notification__icon {
    font-size: 20px;
  }
  
  .notification__title {
    font-size: 13px;
  }
  
  .notification__message {
    font-size: 12px;
  }
}

/* Saved Movies & Watch Progress Features */
.card__badge--saved {
  background: linear-gradient(45deg, #e74c3c, #c0392b) !important;
  color: white !important;
  top: 8px !important;
  right: 8px !important;
  left: auto !important;
  font-size: 10px !important;
  padding: 3px 6px !important;
}

.card__badge--progress {
  background: linear-gradient(45deg, #f39c12, #e67e22) !important;
  color: white !important;
  top: 30px !important;
  left: 8px !important;
  font-size: 10px !important;
  padding: 3px 6px !important;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn--save {
  background: var(--bg-elev) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  transition: all 0.2s ease !important;
}

.btn--save:hover {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.btn--save.btn--saved {
  background: linear-gradient(45deg, #e74c3c, #c0392b) !important;
  color: white !important;
  border-color: #e74c3c !important;
}

.btn--save.btn--saved:hover {
  background: linear-gradient(45deg, #c0392b, #a93226) !important;
}

.btn--continue {
  background: linear-gradient(45deg, #f39c12, #e67e22) !important;
  color: white !important;
  border: none !important;
  font-size: 13px !important;
}

.btn--continue:hover {
  background: linear-gradient(45deg, #e67e22, #d35400) !important;
}

.btn--danger {
  background: linear-gradient(45deg, #e74c3c, #c0392b) !important;
  color: white !important;
  border: none !important;
}

.btn--danger:hover {
  background: linear-gradient(45deg, #c0392b, #a93226) !important;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 20px 0;
  font-size: 14px;
}

/* Saved Movies Stats */
.saved-stats {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.saved-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Responsive cho saved movies */
@media (max-width: 768px) {
  .card__badge--progress {
    font-size: 9px !important;
    padding: 2px 4px !important;
    max-width: calc(100% - 12px) !important;
  }
  
  .saved-actions {
    gap: 6px;
  }
  
  .btn--continue {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }
}

@media (max-width: 480px) {
  .card__badge--saved {
    font-size: 9px !important;
    padding: 2px 4px !important;
  }
  
  .detail__actions {
    flex-direction: column !important;
    gap: 6px !important;
  }
  
  .detail__actions .btn {
    width: 100% !important;
    text-align: center !important;
  }
}

/* Scroll Improvements & Page Transitions */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Account for sticky header */
}

/* Improve card hover transitions */
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card:active {
  transform: translateY(-2px) scale(0.98);
}

/* Focus styles for better accessibility */
.card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading Detail Styles */
.loading-detail {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.error-container {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Page transition animation */
.app {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Disable smooth scroll on mobile for better performance */
@media (max-width: 768px) {
  html {
    scroll-behavior: auto;
  }
}

/* Disable transitions when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  .card {
    transition: none;
  }
  
  .app {
    animation: none;
  }
}

/* Performance Optimizations */
.grid {
  /* Enable hardware acceleration */
  transform: translateZ(0);
  will-change: auto;
  
  /* Optimize rendering */
  contain: layout style;
  
  /* Improve scroll performance */
  overflow-anchor: none;
}

.card {
  /* Optimize individual cards */
  contain: layout style;
  transform: translateZ(0);
  will-change: transform, opacity;
}

.card__img {
  /* Optimize image rendering */
  contain: layout;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  
  /* Better memory management */
  content-visibility: auto;
  contain-intrinsic-size: 300px 400px;
}

/* Virtual scrolling specific styles */
.virtual-grid {
  contain: strict;
  overflow: auto;
}

.virtual-grid .viewport {
  contain: layout style;
  will-change: height;
}

.virtual-grid .card {
  position: absolute !important;
  contain: layout style paint;
}

/* Optimize animations for performance */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes shimmer-loading {
  0% {
    transform: translate3d(-100%, 0, 0);
  }
  100% {
    transform: translate3d(100%, 0, 0);
  }
}

/* Reduce paint complexity */
.loading__shimmer {
  will-change: transform;
  transform: translateZ(0);
}

/* Memory efficient gradients */
.card__img-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #333 0%, #222 100%);
  z-index: -1;
}

/* Performance-first mobile optimizations */
@media (max-width: 768px) {
  .grid {
    /* Reduce complexity on mobile */
    contain: layout;
    transform: none;
  }
  
  .card {
    will-change: auto;
    transform: none;
  }
  
  .card:hover {
    transform: none;
  }
  
  /* Disable expensive effects on mobile */
  .card__img {
    transition: none;
    image-rendering: auto;
  }
  
  .loading__shimmer {
    animation-duration: 2s;
  }
} 