/* BestMovies - Retro VHS Rental Shop Aesthetic */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --neon-blue: #00d4ff;
  --neon-pink: #ff2d7b;
  --warm-amber: #ffb347;
  --bg-dark: #0a0a0a;
  --bg-card: #1a1a2e;
  --text-primary: #e0e0e0;
  --text-muted: #888;
  --card-width: 180px;
  --card-height: 270px;
}

body {
  font-family: "VT323", monospace;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* CRT Scanline overlay */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Header */
.site-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  border-bottom: 2px solid var(--neon-blue);
  background: linear-gradient(180deg, #0d0d1a 0%, var(--bg-dark) 100%);
}

.logo {
  font-size: 3.5rem;
  color: var(--neon-blue);
  text-shadow:
    0 0 10px var(--neon-blue),
    0 0 20px var(--neon-blue),
    0 0 40px rgba(0, 212, 255, 0.4);
  letter-spacing: 4px;
  text-transform: uppercase;
}

.tagline {
  color: var(--neon-pink);
  font-size: 1.3rem;
  margin-top: 0.3rem;
  text-shadow: 0 0 8px rgba(255, 45, 123, 0.5);
}

/* Genre Navigation (now at bottom) */
.genre-nav {
  padding: 0.8rem;
  border-top: 1px solid #222;
  background: rgba(10, 10, 10, 0.95);
}

.genre-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.genre-tab {
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #333;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.genre-tab:hover {
  color: var(--neon-blue);
  border-color: var(--neon-blue);
}

.genre-tab.active {
  color: var(--bg-dark);
  background: var(--neon-blue);
  border-color: var(--neon-blue);
  text-shadow: none;
}

.tab-count {
  font-size: 0.7em;
  opacity: 0.5;
  margin-left: 0.2em;
}

.genre-tab.active .tab-count {
  opacity: 0.7;
}

/* Search Bar */
.search-bar {
  display: flex;
  justify-content: center;
  padding: 1.2rem 1rem;
  gap: 0.5rem;
}

#search-input {
  font-family: "VT323", monospace;
  font-size: 1.3rem;
  background: #111;
  border: 1px solid #333;
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  width: 100%;
  max-width: 500px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

#search-btn {
  font-size: 1.3rem;
  background: var(--neon-blue);
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

#search-btn:hover {
  opacity: 0.8;
}

/* Movie Shelf */
.movie-shelf {
  padding: 1.5rem 0;
}

.shelf-header {
  padding: 0 1.5rem 1rem;
}

.shelf-title {
  font-size: 1.8rem;
  color: var(--warm-amber);
  text-shadow: 0 0 6px rgba(255, 179, 71, 0.4);
}

/* Carousel */
.carousel-wrapper {
  position: relative;
  padding: 0 1rem;
}

.carousel {
  display: flex;
  gap: 1.2rem;
  overflow-x: scroll;
  scroll-behavior: auto;
  padding: 2rem 0.5rem 1.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-items: center;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--neon-blue);
  color: var(--neon-blue);
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.carousel-arrow:hover {
  background: var(--neon-blue);
  color: var(--bg-dark);
}

.carousel-arrow-left {
  left: 0;
}

.carousel-arrow-right {
  right: 0;
}

/* Movie Card */
.movie-card {
  flex: 0 0 var(--card-width);
  width: var(--card-width);
  height: var(--card-height);
  min-width: var(--card-width);
  cursor: pointer;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    3px 3px 0 #000,
    inset 1px 1px 0 rgba(255, 255, 255, 0.1);
  transition: opacity 0.5s ease;
  background: var(--bg-card);
  opacity: 0.65;
  z-index: 1;
}

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

.movie-card.center-highlight {
  opacity: 1;
  transform: translateY(-8px) scale(1.08);
  box-shadow:
    0 10px 30px rgba(0, 212, 255, 0.25),
    3px 3px 0 #000;
}

.movie-card .card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

.movie-card .card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  padding: 2rem 0.5rem 0.5rem;
  font-size: 1rem;
  color: #fff;
  text-align: center;
}

/* Remove button on collection cards */
.remove-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 5;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #555;
  color: #999;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: "VT323", monospace;
  opacity: 0;
  transition: opacity 0.2s;
}

.movie-card:hover .remove-btn {
  opacity: 1;
}

.remove-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: #888;
  color: #ddd;
}

.movie-card .card-rating {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--warm-amber);
  color: var(--warm-amber);
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Neighbors of center card get partial brightness */
.movie-card.center-highlight + .movie-card,
.movie-card:has(+ .center-highlight) {
  opacity: 0.8;
}

/* Snapshot preview below carousel */
.snapshot-preview {
  max-width: 700px;
  margin: 0.5rem auto 0;
  text-align: center;
  min-height: 60px;
  padding: 0 1rem;
  transition: opacity 0.4s ease;
  position: relative;
  z-index: 1;
  clear: both;
}

.snapshot-preview.hidden {
  opacity: 0;
}

.snapshot-preview .snapshot-img {
  width: 100%;
  max-width: 700px;
  border-radius: 8px;
  border: 2px solid rgba(0, 212, 255, 0.4);
  box-shadow:
    0 0 30px rgba(0, 212, 255, 0.3),
    0 8px 30px rgba(0, 0, 0, 0.6);
  display: block;
  margin: 0 auto;
}

.snapshot-preview .snapshot-title {
  font-size: 1.5rem;
  color: var(--neon-blue);
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
  margin-top: 0.6rem;
}

.snapshot-preview .snapshot-meta {
  font-size: 1.1rem;
  color: var(--warm-amber);
  margin-top: 0.2rem;
}

/* Skeleton loading cards */
.skeleton-card {
  flex: 0 0 var(--card-width);
  height: var(--card-height);
  background: linear-gradient(110deg, #1a1a2e 30%, #252540 50%, #1a1a2e 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  scroll-snap-align: start;
}

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

/* Movie Detail Overlay */
.movie-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.movie-overlay[hidden] {
  display: none;
}

.movie-detail-card {
  background: #111;
  border: 2px solid var(--neon-blue);
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.8rem;
  font-size: 2rem;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}

.close-btn:hover {
  color: var(--neon-pink);
}

.detail-content {
  padding: 1.5rem;
}

.detail-poster {
  width: 100%;
  max-width: 200px;
  border-radius: 4px;
  float: left;
  margin: 0 1rem 1rem 0;
}

.detail-title {
  font-size: 2rem;
  color: var(--neon-blue);
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
  margin-bottom: 0.3rem;
}

.detail-tagline {
  color: var(--neon-pink);
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  font-style: italic;
}

.detail-meta {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
}

.detail-overview {
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  clear: both;
}

.detail-ratings {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid #333;
}

.rating-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.rating-badge .label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.rating-badge .value {
  font-size: 1.5rem;
  color: var(--warm-amber);
  text-shadow: 0 0 6px rgba(255, 179, 71, 0.4);
}

.detail-credits {
  font-size: 1.1rem;
  color: var(--text-muted);
  border-top: 1px solid #333;
  padding-top: 0.8rem;
}

.detail-credits strong {
  color: var(--text-primary);
}

.detail-loading {
  text-align: center;
  padding: 3rem;
  font-size: 1.5rem;
  color: var(--neon-blue);
}

/* Music Player */
.music-player {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 500;
  display: flex;
  gap: 0.3rem;
}

.music-btn {
  font-family: "VT323", monospace;
  font-size: 1rem;
  background: rgba(10, 10, 10, 0.9);
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(255, 45, 123, 0.5);
  transition: all 0.2s;
  line-height: 1;
}

.music-btn:hover {
  background: var(--neon-pink);
  color: #000;
  text-shadow: none;
}

.music-play.playing {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  text-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid #222;
  margin-top: 2rem;
}

.footer-link {
  color: var(--neon-blue);
  text-decoration: none;
  font-size: 1.2rem;
}

.footer-link:hover {
  text-decoration: underline;
}

.attribution {
  margin-top: 0.8rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.attribution a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Touch devices - always show remove button since no hover */
@media (hover: none) {
  .remove-btn {
    opacity: 0.7;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .site-header {
    padding: 1rem 0.75rem 0.7rem;
  }

  .logo {
    font-size: 2.5rem;
  }

  :root {
    --card-width: 120px;
    --card-height: 180px;
  }

  .genre-nav {
    padding: 0.35rem 0;
    overflow: hidden;
  }

  .genre-tabs {
    flex-wrap: nowrap;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0 0.55rem 0.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .genre-tabs::-webkit-scrollbar {
    display: none;
  }

  .genre-tab {
    flex: 0 0 auto;
    font-size: 0.98rem;
    line-height: 1;
    padding: 0.28rem 0.52rem;
  }

  .tab-count {
    font-size: 0.62em;
    margin-left: 0.12em;
  }

  .search-bar {
    padding: 0.7rem 0.65rem 0.35rem;
  }

  #search-input {
    font-size: 1.1rem;
    padding: 0.45rem 0.65rem;
  }

  #search-btn {
    font-size: 1.05rem;
    padding: 0.45rem 0.65rem;
  }

  .movie-shelf {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0 0;
  }

  .snapshot-preview {
    order: 1;
  }

  .shelf-header {
    order: 2;
    padding: 0 0.8rem 0.35rem;
  }

  .shelf-title {
    font-size: 1.35rem;
  }

  .carousel-wrapper {
    order: 3;
  }

  .carousel {
    padding: 0.9rem 0.5rem 1rem;
    gap: 0.8rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* No scale on mobile to keep the poster row stable below the snapshot */
  .movie-card.center-highlight {
    transform: none;
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
  }

  .carousel-arrow {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  .detail-poster {
    float: none;
    display: block;
    margin: 0 auto 1rem;
  }

  .snapshot-preview {
    max-width: 500px;
  }

  /* Move YouTube player off-screen on mobile but keep it rendering (iOS requires it for autoplay) */
  #yt-player-wrap {
    width: 100px !important;
    height: 56px !important;
    position: fixed !important;
    bottom: -200px !important;
    right: 0 !important;
    pointer-events: none !important;
  }

  .music-player {
    bottom: 0.5rem;
    right: 0.5rem;
  }

  /* Keep the large preview clean above the poster row on mobile */
  .snapshot-preview {
    position: relative;
    z-index: 1;
    margin-top: 0.25rem;
    min-height: 0;
  }

  .carousel {
    position: relative;
    z-index: 2;
  }
}

@media (max-width: 480px) {
  :root {
    --card-width: 100px;
    --card-height: 150px;
  }

  .logo {
    font-size: 2rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .site-header {
    padding: 1rem 0.5rem 0.8rem;
  }

  .genre-tab {
    font-size: 0.88rem;
    padding: 0.24rem 0.45rem;
    border-radius: 3px;
  }

  .carousel {
    padding: 0.75rem 0.3rem 0.7rem;
    gap: 0.6rem;
  }

  .search-bar {
    padding: 0.6rem 0.5rem 0.25rem;
  }

  .shelf-header {
    padding: 0 0.8rem 0.25rem;
  }

  .snapshot-preview {
    padding: 0 0.55rem;
  }

  .snapshot-preview .snapshot-img {
    border-width: 1px;
    border-radius: 6px;
  }

  .snapshot-preview .snapshot-title {
    font-size: 1.2rem;
  }

  .music-btn {
    font-size: 0.9rem;
    padding: 0.4rem 0.7rem;
  }

  .movie-shelf {
    padding: 0.5rem 0;
  }
}
