/* ═══════════════════════════════════════════════════════════════════════════
   YT Cinema — Custom Styles
   Complements Tailwind CSS with animations, cinema mode, skeleton loaders,
   custom scrollbars, and card effects.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  --yt-red:        #E50914;
  --yt-red-dark:   #B20710;
  --yt-gold:       #F5C518;
  --bg-base:       #141414;
  --bg-surface:    #1a1a1a;
  --bg-card:       #222222;
  --bg-modal:      rgba(10,10,10,0.97);
  --text-primary:  #FFFFFF;
  --text-muted:    #999999;
  --text-dim:      #666666;
  --border-subtle: rgba(255,255,255,0.08);
  --glow-red:      0 0 30px rgba(229,9,20,0.4);
  --radius-card:   0.5rem;
  --transition:    all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Netflix Sans', 'Helvetica Neue', Arial, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Custom Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar            { width: 6px; height: 6px; }
::-webkit-scrollbar-track      { background: var(--bg-base); }
::-webkit-scrollbar-thumb      { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: #666; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 4%;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.4s ease;
}

#navbar.scrolled {
  background-color: var(--bg-base);
  box-shadow: 0 2px 20px rgba(0,0,0,0.8);
}

#navbar.top {
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 100%);
}

.nav-logo {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--yt-red);
  letter-spacing: -0.03em;
  text-shadow: var(--glow-red);
  text-decoration: none;
  user-select: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links > li > a {
  text-transform: uppercase;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.dropdown-menu a {
  text-transform: none;
}

.nav-links a:hover { opacity: 1; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Search Bar ───────────────────────────────────────────────────────────── */
#search-container {
  position: relative;
  display: flex;
  align-items: center;
}

#search-input {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.4rem 0.75rem 0.4rem 2.25rem;
  border-radius: 4px;
  font-size: 0.875rem;
  width: 0;
  opacity: 0;
  transition: width 0.35s ease, opacity 0.3s ease;
  outline: none;
}

#search-input.open {
  width: 200px;
  opacity: 1;
}

#search-input::placeholder { color: var(--text-dim); }

.search-icon-btn {
  position: absolute;
  left: 0.5rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

/* ── Billboard / Hero ─────────────────────────────────────────────────────── */
#billboard {
  position: relative;
  height: 90vh;
  min-height: 500px;
  overflow: hidden;
}

#billboard-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  transition: background-image 0.6s ease;
}

#billboard-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(20,20,20,0.95) 0%,
    rgba(20,20,20,0.6)  40%,
    rgba(20,20,20,0.1)  70%,
    transparent         100%
  ),
  linear-gradient(
    to top,
    rgba(20,20,20,1)    0%,
    rgba(20,20,20,0.5)  25%,
    transparent         60%
  );
}

#billboard-content {
  position: relative;
  z-index: 2;
  padding: 0 4%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding-bottom: 8rem;
  max-width: 42rem;
}

#billboard-title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.6);
}

#billboard-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

#billboard-rating {
  color: var(--yt-gold);
  font-weight: 700;
}

#billboard-overview {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  color: black;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.65rem 1.75rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-play:hover {
  background: rgba(255,255,255,0.75);
  transform: scale(1.04);
}

.btn-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(109,109,110,0.7);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.65rem 1.75rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.btn-info:hover {
  background: rgba(109,109,110,0.4);
  transform: scale(1.04);
}

.billboard-dots {
  position: absolute;
  bottom: 4rem;
  left: 4%;
  display: flex;
  gap: 1.5rem;
  z-index: 10;
}

.b-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.b-dot:hover {
  background: rgba(255,255,255,0.6);
}

.b-dot.active {
  background: white;
  transform: scale(1.2);
}

/* ── Genre Rows ───────────────────────────────────────────────────────────── */
#rows-container {
  position: relative;
  z-index: 5;
  padding: 0 4%;
}

.genre-row {
  margin-bottom: 2.5rem;
}

.row-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.row-wrapper {
  position: relative;
}

.row-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 0.5rem 0 1rem;
  -webkit-overflow-scrolling: touch;
}

.row-scroll::-webkit-scrollbar { display: none; }

/* ── Arrow Buttons ────────────────────────────────────────────────────────── */
.row-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);
  z-index: 10;
  background: rgba(20,20,20,0.85);
  border: 1px solid var(--border-subtle);
  color: white;
  width: 40px;
  height: 70px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: var(--transition);
  opacity: 0;
  pointer-events: none;
}

.row-wrapper:hover .row-arrow {
  opacity: 1;
  pointer-events: all;
}

.row-arrow:hover {
  background: rgba(40,40,40,0.95);
  transform: translateY(-60%) scale(1.05);
}

.arrow-left  { left: -40px; }
.arrow-right { right: -40px; }

/* ── Movie Card ───────────────────────────────────────────────────────────── */
.movie-card {
  color: inherit;
  text-decoration: none;
  display: block;
  flex-shrink: 0;
  width: 180px;
  border-radius: var(--radius-card);
  overflow: visible;
  cursor: pointer;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              z-index 0s 0.3s;
  z-index: 1;
}

.movie-card:hover {
  transform: scale(1.10);
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              z-index 0s 0s;
}

.card-poster-wrapper {
  position: relative;
  width: 100%;
  padding-top: 150%; /* 2:3 aspect */
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.card-poster-wrapper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}

.card-hover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.6rem 0.6rem;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.movie-card:hover .card-hover-info {
  opacity: 1;
  transform: translateY(0);
}

.card-title {
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.card-rating {
  color: var(--yt-gold);
  font-weight: 600;
}

.card-genre-badge {
  background: var(--bg-surface);
  border-radius: 2px;
  padding: 0.1rem 0.3rem;
  font-size: 0.55rem;
  white-space: nowrap;
}

/* ── Skeleton Loader ──────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #2a2a2a 25%,
    #383838 50%,
    #2a2a2a 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-card);
}

.skeleton-card {
  flex-shrink: 0;
  width: 180px;
  padding-top: 270px; /* 180 * 1.5 */
  border-radius: var(--radius-card);
}

.skeleton-billboard {
  background: linear-gradient(
    90deg,
    #1c1c1c 25%,
    #252525 50%,
    #1c1c1c 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* ── Movie Modal / Detail Panel ───────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

#modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#modal-box {
  background: #181818;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 860px;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0,0,0,0.9);
  transform: translateY(40px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#modal-overlay.open #modal-box {
  transform: translateY(0) scale(1);
}

#modal-player-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
}

#modal-player-wrap iframe,
#modal-player-wrap #yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

#modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#modal-close:hover { background: rgba(229,9,20,0.8); }

#modal-body {
  padding: 1.5rem 2rem 2rem;
}

#modal-title {
  font-size: 1.75rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

#modal-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#modal-rating-badge {
  color: var(--yt-gold);
  font-weight: 700;
  font-size: 1rem;
}

#modal-overview {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.82);
  margin-bottom: 1.25rem;
}

#modal-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.genre-pill {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: background 0.2s;
  cursor: pointer;
}

.genre-pill:hover {
  background: rgba(229,9,20,0.2);
  border-color: var(--yt-red);
  color: white;
}

.genre-pill.active {
  background: var(--yt-red);
  border-color: var(--yt-red);
  color: white;
}

/* ── Cinema Mode ──────────────────────────────────────────────────────────── */
#cinema-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.0);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: background 0.5s ease;
}

#cinema-overlay.active {
  background: rgba(0,0,0,0.96);
  pointer-events: all;
}

#cinema-player-wrap {
  width: 0;
  height: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,0,0,1), var(--glow-red);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#cinema-overlay.active #cinema-player-wrap {
  width: 90vw;
  height: calc(90vw * 0.5625); /* 16:9 */
  max-height: 85vh;
}

#cinema-player-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

#cinema-close-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 310;
  background: rgba(229,9,20,0.85);
  border: none;
  color: white;
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.5s ease, background 0.2s;
  opacity: 0.15;
}

#cinema-close-btn:hover,
#cinema-close-btn.wake {
  opacity: 1;
  background: var(--yt-red-dark);
}

#cinema-overlay.active ~ #cinema-close-btn,
#cinema-close-btn.visible {
  display: flex;
}

/* ── Genre filter banner ──────────────────────────────────────────────────── */
#genre-filter-bar {
  padding: 1rem 4% 0;
  margin-top: -6rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 20;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 3rem 4% 2rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 3rem;
}

footer a { color: inherit; }

/* ── Share Buttons ────────────────────────────────────────────────────────── */
.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.1);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-share:hover { background: rgba(255,255,255,0.2); }
.mobile-only { display: none !important; }
.desktop-only { display: inline-flex !important; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #navbar { padding: 0 4%; justify-content: space-between; position: relative; }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(20,20,20,0.98);
    padding: 1.5rem 4%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    gap: 1.25rem;
    z-index: 1000;
  }
  .nav-links.open { display: flex !important; }
  .dropdown:hover .dropdown-menu { display: none; }
  .dropdown.open .dropdown-menu {
    display: block;
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(255,255,255,0.05);
    margin-top: 0.5rem;
  }
  #billboard { height: 75vh; }
  #billboard-title { font-size: 1.8rem; }
  #billboard-overview { display: none; }
  #genre-filter-bar { margin-top: -3rem; margin-bottom: 1.5rem; }
  #rows-container { padding: 0 3%; }
  .movie-card {
  color: inherit;
  text-decoration: none;
  display: block; width: 130px; }
  .skeleton-card { width: 130px; padding-top: 195px; }
  .movie-card:hover { transform: scale(1.10); }
  #modal-box { border-radius: 0; }
  #modal-body { padding: 1rem; }
  #modal-title { font-size: 1.25rem; }
  .arrow-left  { left:  -12px; }
  .arrow-right { right: -12px; }
  .row-arrow   { width: 30px; height: 55px; }
  
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
}

@media (max-width: 480px) {
  .movie-card {
  color: inherit;
  text-decoration: none;
  display: block; width: 110px; }
  .skeleton-card { width: 110px; padding-top: 165px; }
  .btn-play, .btn-info { font-size: 0.85rem; padding: 0.55rem 1.2rem; }
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ── No results ───────────────────────────────────────────────────────────── */
#no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  display: none;
}

#no-results svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.3;
}

/* ── Custom Menus ─────────────────────────────────────────────────────────── */
.dropdown {
  position: relative;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.5rem 0;
  min-width: 180px;
  z-index: 1000;
  list-style: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
.dropdown:hover .dropdown-menu {
  display: block;
}
.dropdown-menu li {
  margin: 0;
  padding: 0;
}
.dropdown-menu a {
  display: block;
  padding: 0.6rem 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.2s;
  white-space: nowrap;
}
.dropdown-menu a:hover {
  background: rgba(255,255,255,0.1);
}

/* ── Modal Lower Layout ───────────────────────────────────────────────────── */
.modal-lower-grid {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}
.modal-main-col {
  flex: 3;
}
.modal-side-col {
  flex: 1;
  min-width: 200px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 1.5rem;
}
@media (max-width: 768px) {
  .modal-lower-grid {
    flex-direction: column;
  }
  .modal-side-col {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border-subtle);
    padding-top: 1.5rem;
  }
}

.modal-movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1rem;
}
.modal-vertical {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
}
.modal-movie-grid .movie-card {
  color: inherit;
  text-decoration: none;
  display: block;
  width: 100%;
}
.modal-vertical .movie-card {
  color: inherit;
  text-decoration: none;
  display: block;
  width: 110px;
  max-width: 100%;
}