:root {
  --bg: #050714;
  --bg-alt: #0b0f24;
  --accent: #ff4b81;
  --accent-soft: rgba(255, 75, 129, 0.14);
  --accent-strong: #ff8fa8;
  --text: #f5f6ff;
  --muted: #a3a7c4;
  --border: rgba(255, 255, 255, 0.08);
  --radius-lg: 18px;
  --radius-xl: 26px;
  --shadow-soft: 0 22px 60px rgba(0, 0, 0, 0.65);
  --blur: 24px;
  --transition-fast: 180ms ease-out;
  --transition-med: 230ms ease;
}

/* Light Mode Variables */
.light-mode {
  --bg: #f5f7fa;
  --bg-alt: #ffffff;
  --accent: #ff4b81;
  --accent-soft: rgba(255, 75, 129, 0.12);
  --accent-strong: #e63a6d;
  --text: #1a1d2e;
  --muted: #5a5f7d;
  --border: rgba(0, 0, 0, 0.12);
  --shadow-soft: 0 22px 60px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #171b3a 0, #050714 48%, #02020a 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 18px;
  display: flex;
  justify-content: center;
  transition: background 0.3s ease, color 0.3s ease;
}

.light-mode body {
  background: radial-gradient(circle at top, #e8ecf4 0, #f5f7fa 48%, #ffffff 100%);
}

.app-shell {
  width: 100%;
  max-width: 1240px;
  min-height: calc(100vh - 36px);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(12, 18, 48, 0.96));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  contain: layout style;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.light-mode .app-shell {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.98));
  border: 1px solid rgba(0, 0, 0, 0.15);
}

header {
  padding: 18px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 16px;
  background: radial-gradient(circle at top left, rgba(255, 75, 129, 0.12), transparent 56%);
  contain: layout style;
  position: relative; /* allow overlay controls to anchor to header edge */
  z-index: 100; /* ensure header and its overlay controls sit above hero layers */
  transition: background 0.3s ease, border-color 0.3s ease;
}

.light-mode header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: radial-gradient(circle at top left, rgba(255, 75, 129, 0.08), transparent 56%);
}

/* Overlay controls that sit just below the header, upper-right over the hero */
.header-overlay-controls {
  position: absolute;
  right: 18px;
  top: calc(100% + 8px); /* place just below header into hero area */
  z-index: 1002; /* force above hero overlay/video and iframe */
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.5));
}

.header-overlay-controls .nav-pills { order: 1; }
.header-overlay-controls .profile-pill { order: 2; }

@media (max-width: 880px) {
  .header-overlay-controls {
    right: 12px;
    top: calc(100% + 6px);
    justify-content: flex-end;
    gap: 8px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background-image: url('../images/Logo.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand-mark:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text span:first-child {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.96rem;
  text-transform: uppercase;
}

.brand-text span:last-child {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(5, 7, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
  font-size: 18px;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 8px 16px rgba(255, 75, 129, 0.3);
}

.theme-toggle-btn:active {
  transform: translateY(0) scale(0.95);
}

.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.theme-toggle-btn:hover .theme-icon {
  transform: rotate(20deg) scale(1.1);
}

.light-mode .theme-toggle-btn {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.light-mode .theme-toggle-btn:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
}

/* Main Navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(5, 7, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
  z-index: 1001;
  font-size: 16px;
}

.search-toggle-btn:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  transform: translateY(-1px);
}

.search-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  background: rgba(5, 7, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  gap: 4px;
  transition: all var(--transition-fast);
  z-index: 1001;
}

.hamburger-btn:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  transform: translateY(-1px);
}

.hamburger-line {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition-med);
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: rgba(11, 10, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1000px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--text);
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  box-shadow: 0 12px 30px rgba(255, 75, 129, 0.45);
  transform: translateY(-0.5px);
}

.nav-link.active:hover {
  transform: translateY(-1px);
}

.header-center {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow: hidden; /* prevent overlap with profile pill on tighter widths */
}

.search-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  border-radius: 1000px;
  border: 1px solid var(--border);
  padding: 9px 36px 9px 34px;
  background: rgba(5, 7, 20, 0.96);
  color: var(--text);
  font-size: 0.86rem;
  outline: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.68);
  transition: box-shadow var(--transition-med), border-color var(--transition-med), transform var(--transition-fast), background 0.3s ease, color 0.3s ease;
  will-change: transform;
}

.light-mode .search-input {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.search-input::placeholder {
  color: rgba(178, 182, 214, 0.7);
}

.search-input:focus {
  border-color: rgba(255, 75, 129, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 75, 129, 0.6), 0 18px 40px rgba(0, 0, 0, 0.7);
  transform: translateY(-0.5px) translateZ(0);
  background: rgba(5, 7, 24, 0.98);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.7;
}

.search-kb {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
  background: rgba(1, 3, 12, 0.75);
  display: none;
}

@media (min-width: 768px) {
  .search-kb {
    display: inline-flex;
  }
}

.nav-pills {
  display: flex;
  gap: 8px;
  padding: 2px;
  border-radius: 1000px;
  background: rgba(11, 10, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  will-change: transform;
}

.nav-pill span.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  display: inline-flex;
  margin-right: 6px;
  transform: translateY(1px);
}

.nav-pill.active {
  color: var(--text);
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  box-shadow: 0 12px 30px rgba(255, 75, 129, 0.45);
  transform: translateY(-0.5px) translateZ(0);
}

.nav-pill.active span.dot {
  background: rgba(0, 0, 0, 0.9);
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(2, 2, 20, 0.95);
  font-size: 0.76rem;
  color: var(--muted);
  cursor: default;
  flex-shrink: 0; /* keep guest pill from shrinking/overlapping */
}

.profile-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #020314;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(2, 2, 30, 0.95);
}

.profile-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #37ff9b;
  box-shadow: 0 0 0 2px rgba(7, 15, 32, 0.95);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px 18px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* For index.html with hero section */
main:has(.hero-section) {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.hero-section {
  position: relative;
  border-radius: var(--radius-xl);
  min-height: 214px;
  overflow: hidden;
  background: radial-gradient(circle at top left, rgba(255, 75, 129, 0.3), rgba(5, 7, 24, 1));
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: stretch;
  isolation: isolate;
  contain: layout style paint;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.light-mode .hero-section {
  background: radial-gradient(circle at top left, rgba(255, 75, 129, 0.15), rgba(248, 250, 252, 1));
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.hero-video-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
}

@media (max-width: 880px) {
  .hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.38;
  transform: scale(1.04) translateZ(0);
  filter: saturate(1.1) contrast(1.02);
  transform-origin: center;
  will-change: background-image;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(3, 4, 18, 0.92) 14%, rgba(4, 6, 22, 0.92) 38%, rgba(3, 4, 20, 0.6) 60%, rgba(0, 0, 0, 0.9) 100%);
  mix-blend-mode: multiply;
}

/* Controls container in the hero (upper-right) */
.hero-controls {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* keep pills first, profile to the right */
.hero-controls .nav-pills {
  order: 1;
}

.hero-controls .profile-pill {
  order: 2;
}

@media (max-width: 880px) {
  .hero-controls {
    top: 10px;
    right: 10px;
    justify-content: flex-end;
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 18px 18px 18px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1.35fr);
  gap: 24px;
  align-items: center;
  width: 100%;
}

@media (max-width: 880px) {
  .hero-content {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
}

.hero-badge-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill-soft, .pill-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill-soft {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.pill-outline {
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: var(--accent-strong);
  background: rgba(1, 3, 14, 0.7);
}

.pill-soft span.dot,
.pill-outline span.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.hero-title {
  font-size: clamp(1.45rem, 2.3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.85);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(8, 39, 25, 0.98);
  color: #52ffb3;
  border: 1px solid rgba(82, 255, 179, 0.4);
  box-shadow: 0 0 0 1px rgba(5, 24, 16, 0.9);
}

.hero-rating span.star {
  font-size: 0.9rem;
}

.hero-overview {
  margin-top: 6px;
  font-size: 0.82rem;
  color: rgba(209, 213, 245, 0.9);
  line-height: 1.6;
  max-height: 3.6em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-primary,
.btn-ghost {
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast);
  will-change: transform;
}

.btn-primary {
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
  box-shadow: 0 16px 35px rgba(255, 75, 129, 0.7);
}

.btn-primary:hover {
  transform: translateY(-1px) translateZ(0);
  box-shadow: 0 22px 50px rgba(255, 75, 129, 0.7);
}

.btn-ghost {
  background: rgba(4, 8, 26, 0.94);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.8);
}

.btn-ghost:hover {
  transform: translateY(-1px) translateZ(0);
  background: rgba(6, 11, 35, 1);
}

.btn-primary span.icon,
.btn-ghost span.icon {
  font-size: 0.98rem;
  transform: translateY(1px);
}

.hero-right {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}

.hero-poster-frame {
  position: relative;
  width: min(220px, 56%);
  margin-left: auto;
  margin-right: 6px;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(11, 14, 34, 0.98);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  contain: layout style paint;
}

@media (max-width: 880px) {
  .hero-right {
    justify-content: flex-start;
  }
  .hero-poster-frame {
    width: 190px;
    margin: 4px 0 0;
  }
}

.hero-poster-frame img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 260px;
}

.hero-tagline {
  padding: 8px 10px 10px;
  font-size: 0.72rem;
  color: rgba(225, 227, 246, 0.9);
  background: linear-gradient(180deg, rgba(2, 5, 20, 0.92), rgba(3, 6, 22, 1));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.hero-tagline span.label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(162, 170, 214, 0.9);
}

.hero-tagline span.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ffcf71;
  box-shadow: 0 0 0 0 rgba(255, 207, 113, 0.8);
  transform: translateY(1px);
  animation: ping 1.6s infinite;
}

@keyframes ping {
  0% {
    transform: scale(1) translateY(1px);
    opacity: 1;
  }
  60% {
    transform: scale(1.9) translateY(1px);
    opacity: 0;
  }
  100% {
    transform: scale(1.9) translateY(1px);
    opacity: 0;
  }
}

/* Controls row placed below the hero (aligned upper-right of the page flow) */
.below-hero-controls {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 8px;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .below-hero-controls {
    justify-content: space-between;
    padding-inline: 10px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
}

.content-section {
  position: relative;
  margin-top: 2px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(2, 4, 16, 0.96);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  contain: layout style;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.light-mode .content-section {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
  padding-inline: 2px;
}

.content-title {
  font-size: 0.86rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(220, 224, 252, 0.98);
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-title span.badge-count {
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(8, 10, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(177, 183, 221, 0.9);
}

.media-toggle-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 75, 129, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
  will-change: transform;
}

.media-toggle-btn:hover {
  background: rgba(255, 75, 129, 0.25);
  border-color: rgba(255, 75, 129, 0.5);
  transform: translateY(-1px) translateZ(0);
  box-shadow: 0 8px 16px rgba(255, 75, 129, 0.3);
}

.media-toggle-btn:active {
  transform: scale(0.95) translateZ(0);
}

.media-toggle-btn .toggle-icon {
  display: inline-flex;
  transition: transform var(--transition-fast);
}

.media-toggle-btn:hover .toggle-icon {
  transform: scale(1.1);
}

.content-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(3, 6, 20, 0.96);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.chip span.dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #4facfe;
}

.movies-grid {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding-top: 6px;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(112, 119, 178, 0.8) transparent;
  contain: layout style;
}

.movies-grid::-webkit-scrollbar {
  width: 7px;
}

.movies-grid::-webkit-scrollbar-track {
  background: transparent;
}

.movies-grid::-webkit-scrollbar-thumb {
  background: rgba(112, 119, 178, 0.8);
  border-radius: 999px;
}

@media (max-width: 1120px) {
  .movies-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .movies-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .movies-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .movies-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.movie-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(5, 7, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.8);
  transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med), background 0.3s ease;
  will-change: transform;
  contain: layout style paint;
}

.light-mode .movie-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.16);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.15);
}

.light-mode .movie-card:hover {
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.25);
  border-color: rgba(0, 0, 0, 0.35);
}

.movie-card:hover {
  transform: translateY(-4px) translateZ(0);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.95);
  border-color: rgba(255, 255, 255, 0.45);
}

.movie-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  background: radial-gradient(circle at 30% 20%, #4facfe, #020617);
  overflow: hidden;
}

.movie-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-med);
  will-change: transform;
}

.movie-card:hover .movie-poster img {
  transform: scale(1.04) translateZ(0);
}

.poster-fade {
  position: absolute;
  inset: auto 0 0;
  height: 32%;
  background: linear-gradient(180deg, transparent 0, rgba(1, 4, 15, 0.3), rgba(1, 3, 14, 0.95));
  pointer-events: none;
}

.movie-rating-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(5, 24, 16, 0.98);
  color: #52ffb3;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(82, 255, 179, 0.5);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.9);
}

.movie-rating-badge span.star {
  font-size: 0.82rem;
}

.movie-year-pill {
  position: absolute;
  top: 7px;
  right: 7px;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(1, 5, 20, 0.95);
  color: rgba(204, 208, 240, 0.96);
  font-size: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.movie-card-body {
  padding: 7px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.movie-title {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

.movie-meta-row span.dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(165, 169, 205, 0.9);
  margin-inline: 4px;
}

.movie-overview {
  margin-top: 2px;
  font-size: 0.7rem;
  color: rgba(186, 191, 230, 0.84);
  line-height: 1.4;
  max-height: 2.4em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-hover-indicator {
  margin-top: 5px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0.7;
}

.movie-hover-indicator span.icon {
  font-size: 0.9rem;
  transform: translateY(1px);
}

.movie-card:hover .movie-hover-indicator {
  opacity: 1;
}

.empty-state,
.error-state {
  padding: 26px 10px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}

.error-state {
  color: #ff8fa8;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
  will-change: opacity;
}

.light-mode .modal-backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 850px;
  max-height: min(610px, 92vh);
  border-radius: 24px;
  background: rgba(3, 4, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.95);
  overflow: hidden;
  transform: translateY(10px) scale(0.97) translateZ(0);
  opacity: 0;
  transition: transform var(--transition-med), opacity var(--transition-med), background 0.3s ease, border-color 0.3s ease;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  will-change: transform, opacity;
  contain: layout style paint;
}

.light-mode .modal {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.24);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
}

.modal-backdrop.visible .modal {
  transform: translateY(0) scale(1) translateZ(0);
  opacity: 1;
}

@media (max-width: 820px) {
  .modal {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    max-width: 88vw;
    max-height: 80vh;
  }
  
  .modal-poster {
    max-height: 160px;
    min-height: 160px;
  }
  
  .modal-poster img {
    object-position: center top;
  }
}

.modal-poster {
  position: relative;
  background: radial-gradient(circle at 30% 20%, #4facfe, #020617);
  overflow: hidden;
}

.modal-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-poster-overlay {
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.6), rgba(1, 3, 12, 0.98));
}

.modal-main {
  position: relative;
  padding: 16px 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden; /* Desktop: hide overflow */
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.modal-title-block {
  max-width: 100%;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.modal-tagline {
  font-size: 0.8rem;
  color: rgba(197, 201, 236, 0.9);
  font-style: italic;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-favorite-btn,
.modal-close-btn {
  border-radius: 999px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background: rgba(4, 6, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  cursor: pointer;
  color: rgba(218, 222, 252, 0.9);
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  will-change: transform;
}

.modal-favorite-btn {
  font-size: 0.9rem;
}

.modal-favorite-btn.active {
  background: rgba(255, 75, 129, 0.2);
  border-color: rgba(255, 75, 129, 0.6);
}

.modal-favorite-btn:hover {
  background: rgba(255, 75, 129, 0.3);
  border-color: rgba(255, 75, 129, 0.7);
  transform: translateY(-1px) scale(1.1) translateZ(0);
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.5);
}

.modal-favorite-btn.active:hover {
  background: rgba(255, 75, 129, 0.4);
}

.modal-close-btn:hover {
  background: rgba(255, 75, 129, 0.9);
  color: #02020a;
  box-shadow: 0 10px 24px rgba(255, 75, 129, 0.6);
  transform: translateY(-1px) translateZ(0);
}

.modal-submeta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 3px;
}

.modal-submeta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.modal-submeta span.dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(164, 170, 214, 0.9);
}

.modal-rating-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  background: rgba(6, 24, 16, 0.96);
  border: 1px solid rgba(82, 255, 179, 0.45);
  color: #52ffb3;
}

.modal-rating-chip span.star {
  font-size: 0.9rem;
}

.modal-overview {
  margin-top: 6px;
  font-size: 0.8rem;
  color: rgba(207, 211, 242, 0.94);
  line-height: 1.6;
  max-height: 8.4em;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(112, 119, 178, 0.8) transparent;
  flex-shrink: 0; /* Prevent overview from shrinking */
}

.modal-overview::-webkit-scrollbar {
  width: 6px;
}

.modal-overview::-webkit-scrollbar-thumb {
  background: rgba(112, 119, 178, 0.8);
  border-radius: 999px;
}

/* Modal Trailer Section */
.modal-trailer-section {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(2, 4, 16, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-trailer-header {
  padding: 8px 12px;
  background: rgba(255, 75, 129, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.trailer-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(220, 224, 252, 0.95);
}

.modal-trailer-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  background: rgba(0, 0, 0, 0.9);
}

.modal-trailer-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  touch-action: none; /* Prevent iframe from capturing touch events */
}

/* Hide YouTube branding and controls overlay */
.modal-trailer-container::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 60px;
  background: transparent;
  pointer-events: none;
  z-index: 10;
}

/* Mobile Modal Adjustments */
@media (max-width: 820px) {
  .modal-main {
    padding: 12px 14px 14px;
    overflow-y: scroll !important; /* Force scroll on mobile */
    overflow-x: hidden;
    max-height: calc(80vh - 160px);
    min-height: 200px; /* Ensure minimum height for scrolling */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
    -webkit-overflow-scrolling: touch; /* Enable smooth momentum scrolling on iOS */
    overscroll-behavior: contain; /* Prevent scroll chaining */
    touch-action: pan-y; /* Allow vertical touch scrolling */
    position: relative;
  }
  
  /* Hide scrollbar for Chrome, Safari and Opera */
  .modal-main::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  
  .modal-overview {
    max-height: 6em !important; /* Limit overview height on mobile */
    overflow-y: auto;
    flex-shrink: 0;
  }
  
  .modal-trailer-section {
    flex-shrink: 0; /* Prevent trailer from being hidden */
  }
  
  .modal-footer-row {
    flex-shrink: 0; /* Prevent footer from being hidden */
  }
  
  .modal-trailer-section {
    margin-top: 10px;
    border-radius: 10px;
  }
  
  .modal-trailer-header {
    padding: 6px 10px;
  }
  
  .trailer-label {
    font-size: 0.72rem;
  }
  
  .modal-trailer-container {
    padding-bottom: 56.25%; /* Maintain 16:9 aspect ratio */
  }
  
  .modal-footer-row {
    padding-top: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .modal-actions {
    width: 100%;
    justify-content: center;
  }
  
  .modal-footer-meta {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .modal {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 16px;
  }
  
  .modal-poster {
    max-height: 140px;
    min-height: 140px;
  }
  
  .modal-main {
    padding: 8px 10px 10px;
    max-height: calc(85vh - 140px);
    min-height: 200px; /* Ensure minimum height for scrolling */
    overflow-y: scroll !important; /* Force scroll on mobile */
    overflow-x: hidden;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
    -webkit-overflow-scrolling: touch; /* Enable smooth momentum scrolling on iOS */
    overscroll-behavior: contain; /* Prevent scroll chaining */
    touch-action: pan-y; /* Allow vertical touch scrolling */
    position: relative;
  }
  
  /* Hide scrollbar for Chrome, Safari and Opera */
  .modal-main::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  
  .modal-title {
    font-size: 0.95rem;
  }
  
  .modal-tagline {
    font-size: 0.72rem;
  }
  
  .modal-submeta {
    font-size: 0.68rem;
    gap: 4px 8px;
    flex-shrink: 0;
  }
  
  .modal-overview {
    font-size: 0.74rem;
    max-height: 5em !important; /* Smaller on very small screens */
    overflow-y: auto;
    flex-shrink: 0;
  }
  
  .modal-trailer-section {
    flex-shrink: 0;
  }
  
  .modal-footer-row {
    flex-shrink: 0;
  }
  
  .modal-trailer-section {
    margin-top: 6px;
    border-radius: 6px;
  }
  
  .modal-trailer-header {
    padding: 4px 6px;
  }
  
  .trailer-label {
    font-size: 0.65rem;
  }
  
  .modal-trailer-container {
    padding-bottom: 56.25%;
  }
  
  .modal-actions .btn-primary,
  .modal-actions .btn-ghost {
    font-size: 0.72rem;
    padding: 5px 9px;
  }
}

.modal-footer-row {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modal-actions .btn-primary,
.modal-actions .btn-ghost {
  padding-inline: 11px;
  font-size: 0.78rem;
}

.modal-footer-meta {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

.modal-footer-meta span.tmdb {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(144, 219, 255, 0.7);
  background: rgba(2, 7, 21, 0.94);
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

.modal-footer-meta span.tmdb-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #01b4e4;
}

/* Page Header Styles */
.page-header {
  padding: 24px 18px 18px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top, rgba(255, 75, 129, 0.08), transparent 60%);
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Category Section Styles */
.category-section {
  padding: 18px 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.category-section:last-of-type {
  border-bottom: none;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-inline: 4px;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(220, 224, 252, 0.98);
}

.category-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 75, 129, 0.6);
}

.category-count {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 10, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(177, 183, 221, 0.9);
}

.category-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.see-all-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 75, 129, 0.4);
  background: rgba(255, 75, 129, 0.12);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.see-all-btn:hover {
  background: rgba(255, 75, 129, 0.25);
  border-color: rgba(255, 75, 129, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(255, 75, 129, 0.3);
}

.see-all-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Category View Section */
.category-view-section {
  padding: 20px 18px;
}

.category-view-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.category-view-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.category-view-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.close-category-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background: rgba(4, 6, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: rgba(218, 222, 252, 0.9);
  transition: all var(--transition-fast);
}

.close-category-btn:hover {
  background: rgba(255, 75, 129, 0.9);
  color: #02020a;
  box-shadow: 0 10px 24px rgba(255, 75, 129, 0.6);
  transform: translateY(-1px) scale(1.05);
}

.close-category-btn:active {
  transform: translateY(0) scale(0.95);
}

.category-view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.category-dropdown-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.category-dropdown {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 7, 20, 0.96);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  min-width: 200px;
}

.category-dropdown:hover {
  border-color: rgba(255, 75, 129, 0.5);
  background: rgba(8, 10, 28, 1);
}

.category-dropdown:focus {
  border-color: rgba(255, 75, 129, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 75, 129, 0.15);
}

.light-mode .category-dropdown {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.light-mode .category-dropdown:hover {
  background: rgba(248, 250, 252, 1);
}

/* Full Grid Layout for Category View */
.movies-grid-full {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1120px) {
  .movies-grid-full {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .movies-grid-full {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .movies-grid-full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .movies-grid-full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  flex-wrap: wrap;
}

.pagination-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 20, 0.96);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  transform: translateY(-1px);
}

.pagination-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.4);
}

.pagination-btn.active:hover {
  transform: translateY(-1px) scale(1.02);
}

.page-info {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
}

.light-mode .pagination-btn {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.light-mode .pagination-btn:hover:not(:disabled) {
  background: rgba(255, 75, 129, 0.15);
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
  .category-view-section {
    padding: 16px 12px;
  }

  .category-view-title {
    font-size: 1.3rem;
  }

  .close-category-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .category-dropdown {
    min-width: 160px;
    font-size: 0.8rem;
    padding: 7px 12px;
  }

  .category-dropdown-label {
    font-size: 0.75rem;
  }

  .pagination-btn {
    min-width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }

  .page-info {
    font-size: 0.75rem;
    padding: 0 8px;
  }

  .see-all-btn {
    font-size: 0.7rem;
    padding: 5px 10px;
  }
}

/* ==== IPTV STYLES ==== */
.iptv-player-section {
  padding: 20px 18px;
}

.iptv-player-container {
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: rgba(2, 4, 16, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.iptv-player-header {
  padding: 14px 18px;
  background: rgba(5, 7, 24, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.iptv-player-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.current-channel-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
}

.current-channel-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.current-channel-name {
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-channel-status {
  font-size: 0.75rem;
  color: #52ffb3;
  display: flex;
  align-items: center;
  gap: 4px;
}

.close-player-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background: rgba(4, 6, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: rgba(218, 222, 252, 0.9);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.close-player-btn:hover {
  background: rgba(255, 75, 129, 0.9);
  color: #02020a;
  box-shadow: 0 10px 24px rgba(255, 75, 129, 0.6);
  transform: translateY(-1px) scale(1.05);
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
}

.video-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.iptv-filters {
  padding: 18px 18px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 20, 0.96);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-btn:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  color: var(--text);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.4);
}

.iptv-channels-grid {
  padding: 0 18px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.iptv-channel-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(5, 7, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: all var(--transition-med);
  display: flex;
  flex-direction: column;
}

.iptv-channel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.95);
  border-color: rgba(255, 75, 129, 0.5);
}

.channel-logo-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.channel-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--transition-med);
}

.iptv-channel-card:hover .channel-logo {
  transform: scale(1.1);
}

.channel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.iptv-channel-card:hover .channel-overlay {
  opacity: 1;
}

.play-icon {
  font-size: 2.5rem;
  color: var(--accent-strong);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.channel-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-category {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

@media (max-width: 920px) {
  .iptv-channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .iptv-player-section {
    padding: 14px 12px;
  }

  .iptv-player-header {
    padding: 12px 14px;
  }

  .current-channel-logo {
    width: 40px;
    height: 40px;
  }

  .current-channel-name {
    font-size: 0.95rem;
  }

  .close-player-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .iptv-filters {
    padding: 14px 12px 10px;
    gap: 6px;
  }

  .filter-btn {
    font-size: 0.72rem;
    padding: 6px 12px;
  }

  .iptv-channels-grid {
    padding: 0 12px 20px;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  .channel-name {
    font-size: 0.78rem;
  }

  .channel-category {
    font-size: 0.65rem;
  }
}

/* Horizontal Scrolling Grid */
.movies-grid-horizontal {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(112, 119, 178, 0.8) transparent;
  scroll-behavior: smooth;
}

.movies-grid-horizontal::-webkit-scrollbar {
  height: 8px;
}

.movies-grid-horizontal::-webkit-scrollbar-track {
  background: transparent;
}

.movies-grid-horizontal::-webkit-scrollbar-thumb {
  background: rgba(112, 119, 178, 0.8);
  border-radius: 999px;
}

.movies-grid-horizontal .movie-card {
  flex: 0 0 auto;
  width: 180px;
}

@media (max-width: 640px) {
  .movies-grid-horizontal .movie-card {
    width: 160px;
  }
  
  .page-header {
    padding: 18px 12px 14px;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .category-section {
    padding: 14px 12px 18px;
  }
  
  .category-title {
    font-size: 0.95rem;
  }
}

/* ==== MY LIST STYLES ==== */
.mylist-filters {
  padding: 18px 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 20, 0.96);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}

.filter-pill .filter-count {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(8, 10, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(177, 183, 221, 0.9);
  margin-left: 2px;
}

.filter-pill:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  color: var(--text);
  transform: translateY(-1px);
}

.filter-pill.active {
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.4);
}

.filter-pill.active .dot {
  background: rgba(0, 0, 0, 0.9);
}

.filter-pill.active .filter-count {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(0, 0, 0, 0.3);
  color: rgba(0, 0, 0, 0.8);
}

.clear-all-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 75, 129, 0.4);
  background: rgba(255, 75, 129, 0.12);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.clear-all-btn:hover {
  background: rgba(255, 75, 129, 0.25);
  border-color: rgba(255, 75, 129, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(255, 75, 129, 0.3);
}

.clear-all-btn:active {
  transform: translateY(0) scale(0.98);
}

.clear-all-btn .icon {
  font-size: 0.9rem;
}

.favorites-section {
  padding: 20px 18px;
  min-height: 400px;
}

.empty-favorites {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 16px;
}

.empty-icon {
  font-size: 4rem;
  opacity: 0.6;
  animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.empty-favorites h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.empty-favorites p {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 400px;
  line-height: 1.6;
  margin: 0;
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.empty-actions .btn-primary,
.empty-actions .btn-ghost {
  text-decoration: none;
}

@media (max-width: 640px) {
  .mylist-filters {
    padding: 14px 12px 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-pills {
    justify-content: center;
  }

  .filter-pill {
    font-size: 0.72rem;
    padding: 7px 12px;
  }

  .clear-all-btn {
    width: 100%;
    justify-content: center;
  }

  .favorites-section {
    padding: 16px 12px;
  }

  .empty-favorites {
    padding: 40px 16px;
  }

  .empty-icon {
    font-size: 3rem;
  }

  .empty-favorites h3 {
    font-size: 1.2rem;
  }

  .empty-favorites p {
    font-size: 0.85rem;
  }

  .empty-actions {
    flex-direction: column;
    width: 100%;
  }

  .empty-actions .btn-primary,
  .empty-actions .btn-ghost {
    width: 100%;
    justify-content: center;
  }
}

footer {
  padding: 10px 24px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  transition: border-color 0.3s ease;
}

.light-mode footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

footer a {
  color: var(--accent-strong);
  text-decoration: none;
  opacity: 0.9;
}

footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Footer component enhancements */
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background-image: url('../images/Logo.png');
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.footer-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.footer-brand-name {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.footer-brand-tagline {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-nav,
.footer-utils {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  padding: 4px 6px;
  border-radius: 999px;
  transition: color var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.footer-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.footer-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-support-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px !important;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4b81, #ffcf71) !important;
  color: #0b0412 !important;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(255, 75, 129, 0.3);
  transition: all var(--transition-fast);
}

.footer-support-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.5) !important;
  background: linear-gradient(135deg, #ff5a8f, #ffd685) !important;
}

.footer-support-btn:active {
  transform: translateY(0) scale(0.98) !important;
}

.footer-support-btn .support-icon {
  font-size: 1rem;
  animation: coffeeFloat 2s ease-in-out infinite;
}

@keyframes coffeeFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-3px);
  }
}

.light-mode .footer-support-btn {
  background: linear-gradient(135deg, #ff4b81, #ffcf71) !important;
  color: #0b0412 !important;
  box-shadow: 0 4px 12px rgba(255, 75, 129, 0.4);
}

.light-mode .footer-support-btn:hover {
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.6) !important;
}

.footer-sep {
  opacity: 0.6;
  color: var(--muted);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.light-mode .footer-bottom {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .footer-utils {
    font-size: 0.74rem;
  }
  .footer-link {
    font-size: 0.74rem;
  }
}

/* ==== LAST WATCHED POPUP ==== */
.last-watched-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  max-width: 380px;
  width: calc(100vw - 48px);
  animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

@keyframes slideInUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.last-watched-popup.hiding {
  animation: slideOutDown 0.3s cubic-bezier(0.7, 0, 0.84, 0);
  animation-fill-mode: forwards;
}

@keyframes slideOutDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100px);
    opacity: 0;
  }
}

.last-watched-content {
  background: rgba(3, 4, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.last-watched-content:hover {
  transform: translateY(-2px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.98);
}

.light-mode .last-watched-content {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.24);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
}

.last-watched-header {
  padding: 12px 16px;
  background: rgba(255, 75, 129, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.last-watched-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(220, 224, 252, 0.95);
  display: flex;
  align-items: center;
  gap: 6px;
}

.last-watched-label::before {
  content: '🎬';
  font-size: 1rem;
}

.close-popup-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background: rgba(4, 6, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  color: rgba(218, 222, 252, 0.9);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.close-popup-btn:hover {
  background: rgba(255, 75, 129, 0.9);
  color: #02020a;
  box-shadow: 0 6px 16px rgba(255, 75, 129, 0.6);
  transform: scale(1.1);
}

.last-watched-body {
  padding: 14px;
  display: flex;
  gap: 14px;
}

.last-watched-poster {
  position: relative;
  width: 100px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, #4facfe, #020617);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.last-watched-poster:hover {
  transform: scale(1.05);
}

.last-watched-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 2/3;
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.last-watched-poster:hover .play-overlay {
  opacity: 1;
}

.play-icon {
  font-size: 2rem;
  color: var(--accent-strong);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.last-watched-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.popup-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.popup-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-meta::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.btn-continue {
  margin-top: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.4);
  align-self: flex-start;
}

.btn-continue:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(255, 75, 129, 0.6);
}

.btn-continue:active {
  transform: translateY(0) scale(0.98);
}

.btn-continue .icon {
  font-size: 0.9rem;
}

.popup-timer-bar {
  height: 3px;
  background: linear-gradient(90deg, #ff4b81, #ffcf71);
  transform-origin: left;
  animation: timerProgress 15s linear forwards;
}

@keyframes timerProgress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.popup-timer-bar.paused {
  animation-play-state: paused;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .last-watched-popup {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    width: auto;
  }

  .last-watched-body {
    padding: 12px;
    gap: 12px;
  }

  .last-watched-poster {
    width: 80px;
  }

  .popup-title {
    font-size: 0.88rem;
  }

  .popup-meta {
    font-size: 0.7rem;
  }

  .btn-continue {
    font-size: 0.72rem;
    padding: 7px 12px;
  }
}

@media (max-width: 480px) {
  .last-watched-popup {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }

  .last-watched-header {
    padding: 10px 12px;
  }

  .last-watched-label {
    font-size: 0.75rem;
  }

  .last-watched-body {
    padding: 10px;
    gap: 10px;
  }

  .last-watched-poster {
    width: 70px;
  }

  .popup-title {
    font-size: 0.82rem;
  }
}

/* Mid-width responsive layout: move the three category buttons and Guest down in the navbar (second row) */
@media (max-width: 1180px) {
  header {
    flex-wrap: wrap;
    row-gap: 12px;
  }
  .header-center {
    order: 3;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 10px;
  }
  .search-wrapper {
    flex: 1 1 100%;
  }
  /* limit to header-only so hero controls are unaffected */
  header .nav-pills {
    flex: 1 1 auto;
    justify-content: flex-start;
    width: 100%;
  }
  header .profile-pill {
    order: 4;
    margin-left: auto;
    position: static; /* flow into the new row on the right */
  }
}

@media (max-width: 920px) {
  .hamburger-btn {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(280px, 75vw);
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 80px 20px 20px;
    background: rgba(3, 4, 18, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
    transform: translateX(100%);
    transition: transform var(--transition-med);
    z-index: 1002;
    backdrop-filter: blur(20px);
  }

  .nav-menu.active {
    transform: translateX(0);
  }

  .nav-link {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.88rem;
    justify-content: flex-start;
  }

  .main-nav::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-med);
    z-index: 1001;
    backdrop-filter: blur(4px);
  }

  .main-nav.menu-open::before {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-left: 18px;
    padding-right: 18px;
  }

  /* Show search toggle button on mobile */
  .search-toggle-btn {
    display: flex;
    position: absolute;
    top: 18px;
    right: 58px;
    z-index: 1003;
  }

  /* Put the hamburger in the upper-right on mobile */
  .hamburger-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    z-index: 1003;
  }

  /* Center the brand on mobile */
  .brand {
    flex: 1;
  }

  /* Hide search bar by default on mobile */
  .header-center {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    padding: 12px 18px;
    background: rgba(3, 4, 18, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1002;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-med), opacity var(--transition-med);
    backdrop-filter: blur(20px);
  }

  /* Show search bar when active */
  .header-center.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Style the search wrapper on mobile */
  .header-center .search-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .header-center .search-input {
    width: 100%;
  }

  header .nav-pills {
    width: 100%;
    justify-content: space-between;
  }

  header .profile-pill {
    position: static;
    top: auto;
    right: auto;
  }

  main {
    padding-inline: 12px;
  }

  .content-section {
    padding-inline: 10px;
  }

  footer {
    padding-inline: 16px;
  }
}

/* ==== FIREBASE STATS WIDGET (DRAGGABLE) ==== */
.stats-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 997;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.stats-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(3, 4, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  transition: all var(--transition-fast);
}

.stats-compact:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8);
}

.light-mode .stats-compact {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stats-compact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.stats-compact-item .icon {
  font-size: 1rem;
}

.stats-compact-item .value {
  color: var(--text);
}

.stats-compact-item.online .value {
  color: #52ffb3;
}

.stats-compact-item.visitors .value {
  color: #4facfe;
}

.live-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 75, 129, 0.4);
  background: rgba(255, 75, 129, 0.15);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-btn:hover {
  background: rgba(255, 75, 129, 0.3);
  border-color: rgba(255, 75, 129, 0.7);
  transform: scale(1.05);
}

.live-btn .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #52ffb3;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.3);
  }
}

/* Stats Modal */
.stats-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(8px);
}

.stats-modal.active {
  display: flex;
}

.stats-modal-content {
  background: rgba(3, 4, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.light-mode .stats-modal-content {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.24);
}

.stats-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.stats-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  background: rgba(4, 6, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  color: rgba(218, 222, 252, 0.9);
  transition: all var(--transition-fast);
}

.stats-modal-close:hover {
  background: rgba(255, 75, 129, 0.9);
  color: #02020a;
  transform: scale(1.1);
}

.stats-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(5, 7, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: all var(--transition-fast);
}

.stat-detail:hover {
  background: rgba(8, 10, 32, 0.8);
  border-color: rgba(255, 75, 129, 0.3);
  transform: translateX(4px);
}

.light-mode .stat-detail {
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.stat-detail-label {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-detail-label .icon {
  font-size: 1.1rem;
}

.stat-detail-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.stat-detail-value.online {
  color: #52ffb3;
}

.stat-detail-value.visits {
  color: #4facfe;
}

.stat-detail-value.peak {
  color: #ffcf71;
}

.stat-location-detail {
  padding: 12px 14px;
  background: rgba(5, 7, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.light-mode .stat-location-detail {
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.stat-location-detail::before {
  content: '📍';
  font-size: 1rem;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .stats-widget {
    bottom: 16px;
    right: 16px;
  }

  .stats-compact {
    padding: 8px 12px;
    gap: 10px;
  }

  .stats-compact-item {
    font-size: 0.8rem;
  }

  .live-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .stats-modal-content {
    padding: 20px;
    max-width: 90%;
  }

  .stats-modal-title {
    font-size: 1.1rem;
  }

  .stat-detail-value {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .stats-widget {
    bottom: 12px;
    right: 12px;
  }

  .stats-compact {
    padding: 6px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .stats-compact-item {
    font-size: 0.75rem;
  }

  .stats-compact-item .icon {
    font-size: 0.9rem;
  }

  .live-btn {
    padding: 4px 8px;
    font-size: 0.65rem;
  }
}

/* ==== BREADCRUMB NAVIGATION ==== */
.breadcrumb-nav {
  padding: 12px 18px;
  background: rgba(5, 7, 24, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.light-mode .breadcrumb-nav {
  background: rgba(248, 250, 252, 0.8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-link {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.breadcrumb-link .breadcrumb-icon {
  font-size: 0.9rem;
}

.breadcrumb-separator {
  color: var(--muted);
  opacity: 0.5;
  font-size: 0.7rem;
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
  padding: 4px 8px;
  background: rgba(255, 75, 129, 0.12);
  border-radius: 6px;
  border: 1px solid rgba(255, 75, 129, 0.3);
}

@media (max-width: 640px) {
  .breadcrumb-nav {
    padding: 10px 12px;
    font-size: 0.75rem;
  }

  .breadcrumb-list {
    gap: 6px;
  }

  .breadcrumb-item {
    gap: 6px;
  }

  .breadcrumb-link {
    padding: 3px 6px;
  }

  .breadcrumb-separator {
    font-size: 0.65rem;
  }
}

/* ==== USER REVIEWS SYSTEM ==== */
.reviews-section {
  margin-top: 16px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(5, 7, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.reviews-header {
  margin-bottom: 24px;
}

.reviews-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reviews-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}

.reviews-rating-overview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: rgba(255, 75, 129, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(255, 75, 129, 0.3);
}

.reviews-avg-rating {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent-strong);
  line-height: 1;
}

.reviews-stars {
  font-size: 1.2rem;
  color: #ffcf71;
  letter-spacing: 2px;
}

.reviews-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.reviews-distribution {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 12px;
  align-items: center;
}

.distribution-label {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

.distribution-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.distribution-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4b81, #ffcf71);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.distribution-count {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.reviews-actions {
  margin-bottom: 20px;
}

.btn-write-review {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-write-review:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.5);
}

/* Review Form */
.review-form {
  padding: 20px;
  background: rgba(2, 4, 16, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  margin-bottom: 24px;
}

.review-form-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.review-form-group {
  margin-bottom: 16px;
}

.review-form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.review-rating-input {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
}

.review-rating-input input[type="radio"] {
  display: none;
}

.star-label {
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.review-rating-input input[type="radio"]:checked ~ .star-label,
.review-rating-input .star-label:hover,
.review-rating-input .star-label:hover ~ .star-label {
  color: #ffcf71;
  transform: scale(1.1);
}

.review-form-input,
.review-form-textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 20, 0.96);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.review-form-input:focus,
.review-form-textarea:focus {
  border-color: rgba(255, 75, 129, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 75, 129, 0.15);
}

.review-form-textarea {
  resize: vertical;
  min-height: 100px;
}

.review-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-submit-review,
.btn-cancel-review {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-submit-review {
  background: linear-gradient(135deg, #ff4b81, #ffcf71);
  color: #0b0412;
}

.btn-submit-review:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 75, 129, 0.5);
}

.btn-cancel-review {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-cancel-review:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Reviews List */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reviews-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.review-item {
  padding: 16px;
  background: rgba(2, 4, 16, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all var(--transition-fast);
}

.review-item:hover {
  border-color: rgba(255, 75, 129, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.review-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #020314;
}

.review-username {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.review-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.review-rating-stars {
  font-size: 1rem;
  color: #ffcf71;
  letter-spacing: 1px;
}

.review-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.review-comment {
  font-size: 0.85rem;
  color: rgba(209, 213, 245, 0.9);
  line-height: 1.6;
  margin-bottom: 12px;
}

.review-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.review-helpful-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-helpful {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 20, 0.96);
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-helpful:hover {
  background: rgba(255, 75, 129, 0.15);
  border-color: rgba(255, 75, 129, 0.5);
  color: var(--text);
  transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .reviews-summary {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .reviews-rating-overview {
    padding: 12px;
  }

  .reviews-avg-rating {
    font-size: 2.5rem;
  }

  .review-form {
    padding: 16px;
  }

  .review-form-actions {
    flex-direction: column;
  }

  .btn-submit-review,
  .btn-cancel-review {
    width: 100%;
  }

  .review-footer {
    flex-wrap: wrap;
  }
}

/* Professional Migration Banner */
.migration-banner {
    position: fixed;
    bottom: 24px;
    right: 24px; /* Positioned to the side for a less intrusive feel */
    width: 380px;
    max-width: calc(100% - 48px);
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid #6366f1; /* Accent border */
    border-radius: 12px;
    padding: 24px;
    z-index: 10000;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.migration-content h4 {
    margin: 0 0 8px 0;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.migration-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #94a3b8;
}

.migration-btn {
    background: #6366f1;
    color: #ffffff !important;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.migration-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.close-migration {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.close-migration:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}