* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: all 0.5s;
  user-select: none;
}

/* ===== Scrollbar CSS ===== */
/* Hide scrollbars on all elements by default */
/* Firefox */
* {
  scrollbar-width: none;
}

/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
  display: none;
}

/* Custom styled scrollbars for specific elements */
.movie-grid,
.popup-details,
.sidebar-content {
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Chrome, Edge, and Safari */
.movie-grid::-webkit-scrollbar,
.popup-details::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar {
  display: block; /* Re-enable scrollbar */
  width: 8px;
  height: 8px;
}

.movie-grid::-webkit-scrollbar-track,
.popup-details::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.movie-grid::-webkit-scrollbar-thumb,
.popup-details::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.18);
  border-radius: 8px;
}

/* Background Canvas */
#canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  margin: 0 auto 20px;
  display: block;
  filter: url('#shadowed-goo');
}

svg {
  display: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: hsl(195, 100%, 7%);
  min-height: 100vh;
  overflow-x: hidden;
  color: #333;
}

/* Theme Variables */
:root {
  --primary-gradient: linear-gradient(135deg, hsl(195, 100%, 20%), hsl(220, 100%, 10%));
  --card-shadow: rgba(15, 39, 77, 0.5);
  --accent-color: #FC217B;
  --accent-alt: #FFC300;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --bg-hue: 195;
  --bg-sat: 100;
}

[data-theme="sunset"] {
  --primary-gradient: linear-gradient(135deg, #ff6b35, #f7931e, #ff006e);
  --card-shadow: rgba(255, 107, 53, 0.3);
  --accent-color: #ff006e;
  --accent-alt: #f7931e;
  --bg-hue: 20;
  --bg-sat: 95;
}

[data-theme="cyberpunk"] {
  --primary-gradient: linear-gradient(135deg, #0f3460, #16213e, #e94560);
  --card-shadow: rgba(233, 69, 96, 0.4);
  --accent-color: #e94560;
  --accent-alt: #0f3460;
  --bg-hue: 310;
  --bg-sat: 85;
}

[data-theme="forest"] {
  --primary-gradient: linear-gradient(135deg, #2d5016, #3e7b27, #88d498);
  --card-shadow: rgba(45, 80, 22, 0.4);
  --accent-color: #88d498;
  --accent-alt: #3e7b27;
  --bg-hue: 140;
  --bg-sat: 70;
}

[data-theme="purple"] {
  --primary-gradient: linear-gradient(135deg, #4c1130, #804674, #b388eb);
  --card-shadow: rgba(76, 17, 48, 0.4);
  --accent-color: #b388eb;
  --accent-alt: #804674;
  --bg-hue: 280;
  --bg-sat: 60;
}

[data-theme="dark"] {
  --primary-gradient: linear-gradient(135deg, #000000, #1a1a1a, #333333);
  --card-shadow: rgba(0, 0, 0, 0.8);
  --accent-color: #ffffff;
  --accent-alt: #666666;
  --bg-hue: 0;
  --bg-sat: 0;
}

/* Settings Button */
.settings-btn {
  display: none; /* Replaced by sidebar */
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 70px;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1500;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    padding: 15px 0;
}

.sidebar:hover {
    width: 220px;
}

.sidebar-logo {
    font-size: 28px;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 30px;
    padding: 10px 0;
}

.sidebar-logo i {
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.sidebar:hover .sidebar-logo i {
    transform: rotate(-10deg);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-nav.bottom-nav {
    flex-grow: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    height: 50px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active a {
    color: #fff;
    background: var(--accent-color);
}

.nav-item a i {
    font-size: 18px;
    min-width: 70px;
    text-align: center;
    transition: all 0.2s;
}

.nav-item.active a i {
    color: #fff;
}

.nav-text {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.2s, transform 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar:hover .nav-text {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
}

/* Settings Modal */
.settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.settings-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 15px;
  padding: 30px;
  min-width: 400px;
  max-width: 90vw;
  color: var(--text-primary);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.settings-header h2 {
  font-size: 24px;
  font-weight: 300;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.3s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.settings-section {
  margin-bottom: 25px;
}

.settings-section h3 {
  font-size: 18px;
  font-weight: 300;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 15px;
  padding: 12px;
}

.input-group i {
  color: var(--text-secondary);
  margin-right: 10px;
  width: 20px;
}

.input-group input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
}

.input-group input::placeholder {
  color: var(--text-secondary);
}

#theme-selector,
#player-selector {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

#theme-selector option,
#player-selector option {
  background: #1a1a1a;
  color: var(--text-primary);
}

.save-btn {
  width: 100%;
  padding: 15px;
  background: var(--accent-color);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s;
}

.save-btn:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

/* Sections */
.section {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto 40px;
}

/* Spotlight Section */
#spotlight-section {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #111;
}

#spotlight-container {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.spotlight-slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    background-size: cover;
    background-position: center 20%;
    display: flex;
    align-items: flex-end;
    padding: 40px;
}

.spotlight-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0) 100%);
    z-index: 1;
}

.spotlight-content {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 60%;
}

.spotlight-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.spotlight-content p {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #e0e0e0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spotlight-content .btn-primary {
    background: rgba(255,255,255,0.9);
    color: #111;
}
.spotlight-content .btn-primary:hover {
    background: #fff;
    box-shadow: 0 8px 25px rgba(252, 33, 123, 0.3);
}

.spotlight-slide-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
}

.spotlight-nav {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spotlight-nav button {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(5px);
    color: white;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: grid;
    place-items: center;
    padding: 0;
}

.spotlight-nav button:hover {
    background: rgba(0,0,0,0.7);
    border-color: white;
}

.section h2 {
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: 0.5px;
  margin: 10px 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Content Wrapper */
.content-wrapper {
  position: relative;
  z-index: 1;
  padding: 80px 20px 20px;
  margin-left: 70px;
  transition: margin-left 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.sidebar:hover ~ .content-wrapper {
    margin-left: 220px;
}

.top-controls {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 0 auto 20px;
}
#search-input {
  width: min(700px, 70vw);
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  outline: none;
  font-size: 16px;
}
#search-input::placeholder {
    color: #ffffff;
    opacity: 0.8;
}
.filter-btn {
  padding: 14px 16px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
  cursor: pointer;
}

.movie-grid {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 6px 10px 14px;
  scroll-snap-type: x proximity;
}
.my-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 60vh;
    padding: 10px;
}
.my-list-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.my-list-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.my-list-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    padding: 20px 10px 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.my-list-item:hover .my-list-item-info {
    opacity: 1;
}
.my-list-item-info p {
    color: white;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    flex-grow: 1;
}
.play-btn-small {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #111;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.my-list-item .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 14px;
}

.movie-card { scroll-snap-align: start; flex: 0 0 auto; }

/* Transparent scrollbar - This is now handled by the global (*) rule above */
/*
.movie-grid::-webkit-scrollbar { height: 8px; }
.movie-grid::-webkit-scrollbar-track { background: transparent; }
.movie-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 8px;
}
*/

/* Movie Card Styles */
.movie-card {
  width: 300px;
  height: 500px;
  border-radius: 35px;
  position: relative;
  box-shadow: 0 0 50px #0f274d;
}

.movie-card:nth-child(even) {
  margin-top: 0;
}

.movie-card .content-card,
.movie-card .watch-card {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 35px;
  overflow: hidden;
  cursor: pointer;
}

.movie-card .watch-card {
  background: var(--accent-color);
  z-index: -1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 20px;
}

.movie-card:nth-child(even) .watch-card {
  background: var(--accent-alt);
}

.movie-card .watch-card button {
  border: none;
  outline: none;
  background: none;
  color: #eee;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.movie-card:hover .watch-card button {
  opacity: 1;
}

.movie-card .content-card {
  padding: 20px 25px;
  top: 0;
}

.movie-card:hover .content-card {
  top: -50px;
}

.movie-card .content-card img {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  object-fit: cover;
  transition: transform .5s;
}

.movie-card:hover .content-card img {
  transform: scale(1.2);
}

.movie-card .content-card .shadow {
  width: 100%;
  height: 170px;
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  background: #0F274D;
  box-shadow: 0 0 10px 20px #0F274D;
  filter: blur(10px);
}

.movie-card:nth-child(even) .content-card .shadow {
  background: #111;
  box-shadow: 0 0 10px 20px #111;
}

.movie-card .content-card .content {
  position: absolute;
  color: var(--text-primary);
  bottom: 20px;
  left: 25px;
  right: 25px;
}

.movie-card .content-card .content h1 {
  text-transform: capitalize;
  font-weight: 700;
  font-size: 2.2em;
}

.movie-card .content-card .content .date {
  color: var(--text-secondary);
  text-transform: capitalize;
  font-weight: 700;
  font-size: 0.75em;
}

.movie-card .content-card .content b {
  margin: 5px 0;
  display: inline-block;
}

.movie-card .content-card .content .stars {
  margin: 8px 0;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.movie-card .content-card .content .stars .checked {
  color: orange;
}

.movie-card .content-card .content .hex-tag {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  margin-bottom: 20px;
}

.movie-card .content-card .content .hex-tag .tag {
  background: rgba(200,200,200,.2);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.85em;
}

.movie-card .content-card .content .fa-angle-up,
.movie-card .content-card .content .fa-angle-down {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8em;
  color: var(--text-secondary);
}

/* ========================= */
/* ULTRA CLEAN POPUP DESIGN */
/* ========================= */
.popup-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(15px);
  z-index: 2500;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.popup-overlay.active {
  display: flex;
  opacity: 1;
}
.popup {
  background: #1d1d1d;
  color: #fff;
  width: min(1100px, 95vw);
  max-height: 85vh;
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 350px 1fr;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  transform: scale(0.8) translateY(40px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background-size: cover;
  background-position: center center;
}
.popup::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(20, 20, 20, 1) 25%, rgba(20, 20, 20, 0.95) 50%, rgba(20, 20, 20, 0.8) 100%);
    z-index: 1;
}

#popup-content-container {
    display: contents;
    z-index: 2;
}

.popup-overlay.active .popup {
  transform: scale(1) translateY(0);
}

.popup .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.popup .close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Poster Section */
.popup-poster {
  position: relative;
  background: transparent;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.popup-poster img {
  width: 100%;
  height: auto;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.poster-overlay {
  position: absolute;
  inset: 40px; /* Match padding */
  background: rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.popup-poster:hover .poster-overlay {
  opacity: 1;
}
.poster-overlay .play-btn {
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.poster-overlay .play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

/* Details Section */
.popup-details {
  position: relative;
  z-index: 2;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  color: #e5e5e5;
}
.movie-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.movie-header h2 {
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.rating {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.rating .imdb {
  background: var(--accent-color);
  color: #111;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
}
.rating .stars {
  color: var(--accent-color);
  font-size: 14px;
}
.movie-meta {
  display: flex;
  gap: 20px;
  align-items: center;
  margin: -8px 0;
}
.movie-meta span {
  color: #a0a0a0;
  font-weight: 400;
  font-size: 16px;
}
.genres {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.genre {
  background: rgba(255, 255, 255, 0.08);
  color: #d1d1d1;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.synopsis {
  font-size: 15px;
  line-height: 1.6;
  color: #b3b3b3;
  margin: 8px 0;
}
.movie-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.info-item {
  display: flex;
  gap: 16px;
}
.info-item .label {
  min-width: 80px;
  font-weight: 600;
  color: #888;
  font-size: 14px;
}
.info-item .value {
  color: #ddd;
  font-size: 14px;
}
.action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.btn-primary {
  border: none;
  background: var(--accent-color);
  color: #111;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
}
.btn-primary:hover {
  background: var(--accent-color);
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(252, 33, 123, 0.3);
}
.btn-secondary {
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
}
.btn-secondary:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}
.btn-icon {
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: all 0.3s ease;
}
.btn-icon:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
  color: #fff;
  transform: translateY(-2px);
}

/* Video Modal */
.video-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}

.video-content {
  position: relative;
  width: 90%;
  height: 85%;
  max-width: 1600px;
  display: flex;
}

.close-video-btn {
  position: absolute;
  top: -45px;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  z-index: 10;
  display: grid;
  place-items: center;
}

.video-player-container {
  flex-grow: 1;
  height: 100%;
  transition: margin-right 0.4s ease-in-out;
}

#video-player {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
}

#tv-sidebar {
    position: absolute;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100%;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(15px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: right 0.4s ease-in-out;
    z-index: 5;
    border-radius: 0 10px 10px 0;
    display: flex;
}

#tv-sidebar.open {
    right: 0;
}
#tv-sidebar.open + .video-player-container {
    margin-right: 320px;
}
#tv-sidebar.open .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar-toggle-btn {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 100px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn i {
    transition: transform 0.4s ease-in-out;
}
.sidebar-toggle-btn span {
    position: absolute;
    white-space: nowrap;
    transform: rotate(-90deg);
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: none;
}
#tv-sidebar:not(.open) .sidebar-toggle-btn span {
    display: block;
}

.sidebar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar-tabs {
    display: flex;
    flex-shrink: 0;
}
.sidebar-tab {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.sidebar-tab.active {
    color: #fff;
    border-bottom-color: var(--accent-color);
}
.sidebar-content {
    display: none;
    overflow-y: auto;
    flex-grow: 1;
}
.sidebar-content.active {
    display: block;
}
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

#seasons-list .season-item {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s ease;
    color: #ddd;
    font-size: 14px;
}
#seasons-list .season-item:hover {
    background: rgba(255,255,255,0.05);
}
#seasons-list .season-item.active {
    background: var(--accent-color);
    color: #111;
    font-weight: 700;
}

#episodes-list #episode-list-title {
    padding: 15px 20px;
    font-weight: 500;
    color: #fff;
    background: rgba(0,0,0,0.2);
}
.episode-item {
    display: flex;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s ease;
}
.episode-item:hover {
    background: rgba(255,255,255,0.05);
}
.episode-number {
    color: #888;
    width: 30px;
    flex-shrink: 0;
}
.episode-details .episode-title {
    color: #ddd;
    font-size: 14px;
    margin-bottom: 4px;
}
.episode-details .episode-air-date {
    color: #888;
    font-size: 12px;
}

/* Highlight for active episode item */
.episode-item.active {
  background: var(--accent-color);
  color: #111;
  font-weight: 700;
  position: relative;
  border-radius: 8px; /* Added for a cleaner look */
  margin: 0 5px; /* Added to give space for border-radius */
}

.episode-item.active .episode-number,
.episode-item.active .episode-title,
.episode-item.active .episode-air-date {
  color: #111; /* Ensure text is dark on accent background */
}

.episode-item.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent-alt); /* A subtle glow/border */
    border-radius: 8px;
    opacity: 0.8;
    animation: pulse-border 1.5s infinite alternate;
}

@keyframes pulse-border {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.02); opacity: 1; }
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Filter modal specifics */
.settings-content .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-content .two-col label { display:block; font-size:12px; color: var(--text-secondary); margin:8px 0 6px; }
.settings-content select, .settings-content input[type="date"] {
  width: 100%; padding: 10px; border: none; border-radius: 8px;
  background: rgba(255,255,255,0.1); color: var(--text-primary); outline: none;
}
.genre-pills { display:flex; flex-wrap: wrap; gap:10px; }
.genre-pills button {
  padding: 8px 12px; border: none; border-radius: 8px;
  background: rgba(255,255,255,0.12); color: var(--text-primary); cursor: pointer;
}
.genre-pills button.active { background: var(--accent-color); color: #111; }

@media (max-width: 900px) {
    .popup {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        max-height: 90vh;
    }
    .popup-poster {
        grid-row: 1;
        padding: 20px;
        padding-bottom: 0;
        max-height: 40vh;
    }
    .popup-poster img {
        max-height: calc(40vh - 20px);
        width: auto;
    }
    .poster-overlay {
        inset: 20px 20px 0 20px;
    }
    .popup-details {
        padding: 30px;
    }
    .movie-header h2 {
        font-size: 2rem;
    }
}

@media (max-width: 700px) {
  .movie-grid {
    grid-template-columns: 1fr;
    gap: 50px;
    padding: 0 20px;
  }
  
  .movie-card:nth-child(even) {
    margin-top: 0;
  }
  
  .settings-content {
    min-width: 90%;
    padding: 20px;
  }
  
  .video-content {
    width: 95%;
    height: 70%;
  }
}

@media (max-width: 600px) {
    .popup {
        width: 95vw;
        margin: 20px;
        grid-template-rows: 250px 1fr;
    }
    .popup-details {
        padding: 24px;
        gap: 20px;
    }
    .movie-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .movie-header h2 {
        font-size: 1.75rem;
    }
    .action-buttons {
        flex-wrap: wrap;
    }
    .btn-primary,
    .btn-secondary {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}