/* ==========================================
   1. LAYOUT & HEADER
   ========================================== */

.header-left-group {
  display: flex;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  gap: 30px;
}

.content-head {
  width: 100%;
  max-width: var(--content-width);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 1025px) {
  .main-content {
    padding-top: 0;
  }
  .content-head {
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: 24px;
    padding-bottom: 8px;
    margin-bottom: 16px;
    background-image: url("../assets/images/movie-knight-gradient-bg.svg");
    background-size: cover;
    background-attachment: fixed;
    background-position: top left;
  }
  .content-head .top-header {
    margin-top: 0;
  }
}

/* ==========================================
   2. SEARCH BAR & AI MODE
   ========================================== */
.search-container {
  display: flex;
  align-items: center;
  background-color: rgba(var(--pink), 0.13);
  border-radius: 10px;
  padding: 5px 15px;
  height: 66.59px;
  flex-grow: 1;
  max-width: 100%;
  transition:
    background-color var(--t-base) ease,
    border-color var(--t-base) ease,
    box-shadow var(--t-base) ease;
  border: 5px solid transparent;
}

.search-container input {
  background: transparent;
  font-size: 20px;
  border: none;
  color: white;
  width: 100%;
  padding: 10px;
  outline: none;
}

.search-container > .nav-search-icon {
  width: 22px;
  height: auto;
}

.search-container:focus-within {
  box-shadow:
    0 0 0 2px rgba(var(--pink), 0.5),
    0 0 24px rgba(var(--pink), 0.18);
}

.search-container.ai-glow {
  background-color: rgba(var(--pink-alt), 0.25);
  border-color: rgba(var(--pink), 0.6);
  box-shadow: 0 0 50px rgba(var(--pink), 0.4);
}

.ai-mode-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  appearance: none;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  background-color: rgba(var(--pink-alt), 0.12);
  min-width: 10%;
  height: 42.69px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-soft);
  transition:
    background-color var(--t-base) ease,
    border-color var(--t-slow) ease,
    box-shadow var(--t-slow) ease,
    transform var(--t-fast) var(--ease-snap);
}

.ai-mode-btn img {
  width: 18px;
  height: auto;
}

.ai-mode-btn:hover {
  background-color: rgba(var(--pink-alt), 0.3);
  cursor: pointer;
}

.ai-mode-btn:active {
  transform: scale(0.96);
}

.ai-mode-btn.pressed {
  border: 1px solid rgba(var(--pink), 1);
  box-shadow: 0 0 12px rgba(var(--pink), 0.8);
  background: rgba(var(--pink-alt), 0.3);
}

/* ==========================================
   3. SURPRISE ME BUTTON
   ========================================== */
.surprise-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: auto;
  min-width: 92px;
  gap: 8px;
  cursor: pointer;
}

.surprise-btn {
  appearance: none;
  border: 0px;
  border-radius: 12px;
  min-width: 92px;
  min-height: 66.59px;
  justify-content: center;
  background-color: rgba(var(--pink-alt), 0.13);
  transition:
    background-color var(--t-slow),
    transform var(--t-fast) var(--ease-snap);
}

.dice-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.dice-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

#diceTwo {
  margin-top: -10px;
  scale: 1.2;
}
#diceOne {
  margin-top: 20px;
}

.surprise-btn:hover .dice-icon {
  opacity: 1;
}

.surprise-btn:hover {
  background-color: rgba(var(--pink-alt), 0.3);
  cursor: pointer;
}

.surprise-btn:active {
  background: rgba(var(--pink-alt), 0.7);
  transform: scale(0.94);
}

.surprise-container p {
  padding-top: 3px;
  color: var(--text-soft);
  white-space: nowrap;
}

@keyframes tossLeft {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  30% {
    transform: translate(-8px, -12px) rotate(-180deg);
  }
  70% {
    transform: translate(-4px, 4px) rotate(-360deg);
  }
  100% {
    transform: translate(0, 0) rotate(-360deg);
  }
}

@keyframes tossRight {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  30% {
    transform: translate(8px, -10px) rotate(180deg);
  }
  70% {
    transform: translate(4px, 4px) rotate(360deg);
  }
  100% {
    transform: translate(0, 0) rotate(360deg);
  }
}

.roll-left {
  animation: tossLeft 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: center center;
}

.roll-right {
  animation: tossRight 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: center center;
}

#diceIcon {
  display: inline-block;
}
/* ==========================================
   4. CONTROLS BAR (FILTERS & SORT)
   ========================================== */
.controls-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--content-width);
}

.filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 97.78px;
  height: 45.3px;
  background-color: rgba(var(--pink), 0.13);
  border-radius: 12px;
  border: none;
  text-align: center;
  color: var(--text-soft);
  font-size: 15px;
  transition:
    background-color var(--t-base) ease,
    transform var(--t-fast) var(--ease-snap);
}

.filter-btn img {
  width: 19.67px;
  height: 18.69px;
}

.filter-btn:hover {
  cursor: pointer;
  background: rgba(var(--pink), 0.3);
}

.filter-btn:active {
  transform: scale(0.96);
}

.filter-wrapper {
  position: relative;
}

.filter-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s var(--ease-snap),
    visibility 0.3s;

  position: absolute;
  top: 50px;
  left: 0;
  z-index: 200;
  background-color: rgba(var(--maroon-light), 0.85);
  border-radius: 12px;
  padding: 25px;
  width: 500px;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
}

.filter-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Apply button - statically anchored to the bottom-right of the filter panel at
   all times; closes the panel (selections persist). "Clear Filters" (shown only
   when a filter is active) is pushed to the far left via margin-right:auto, so
   Apply never shifts position whether or not Clear is present. */
.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
}

/* Clear + Apply share the same button styling; Clear is just pushed to the far
   left (margin-right:auto) so Apply stays anchored bottom-right. */
.filter-clear-btn,
.filter-apply-btn {
  margin-top: 0;
  padding: 9px 28px;
  background: rgba(var(--maroon), 0.6);
  color: var(--text);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--t-base) ease,
    transform var(--t-fast) var(--ease-snap);
}
.filter-clear-btn {
  margin-right: auto; /* keeps Apply pinned right regardless of Clear's presence */
}
.filter-clear-btn:hover,
.filter-apply-btn:hover {
  background: rgba(var(--maroon), 0.9);
}
.filter-clear-btn:active,
.filter-apply-btn:active {
  transform: scale(0.96);
}

/* ==========================================
   5. YEAR DROPDOWNS
   ========================================== */
.year-filter {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.year-custom-btn {
  text-align: center;
  height: 25px;
  width: 65px;
  background-color: rgba(var(--maroon), 0.7);
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  padding-left: 8px;
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: background-color var(--t-fast) ease;
}

.year-custom-btn:hover {
  background-color: rgba(var(--maroon), 0.95);
}

.year-custom-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--pink), 0.8);
}

.year-dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.year-label {
  font-size: 14px;
  opacity: 1;
}

.year-dropdown-menu {
  max-height: 180px;
  width: 85px;
}

.till-label {
  margin-left: 30px;
}

.year-dropdown-menu::-webkit-scrollbar,
.pill-dropdown::-webkit-scrollbar,
.sort-custom-menu::-webkit-scrollbar {
  width: 6px;
}
.year-dropdown-menu::-webkit-scrollbar-track,
.pill-dropdown::-webkit-scrollbar-track,
.sort-custom-menu::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}
.year-dropdown-menu::-webkit-scrollbar-thumb,
.pill-dropdown::-webkit-scrollbar-thumb,
.sort-custom-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}
.year-dropdown-menu::-webkit-scrollbar-thumb:hover,
.pill-dropdown::-webkit-scrollbar-thumb:hover,
.sort-custom-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ==========================================
   6. PILL UI (GENRES, ACTORS, ETC)
   ========================================== */
.pill-selector-row {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 15px;
  min-height: 35px;
}

.filter-label {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  font-size: 18px;
  color: var(--text);
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.pill-option {
  cursor: pointer;
  padding: 12px 18px;
  text-align: left;
  color: white;
  transition: background-color 0.2s ease;
}

.pill-option:hover {
  background-color: rgba(150, 50, 65, 0.9);
}

.pill-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap; /* pills stay side-by-side on one row */
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0; /* allow the list to shrink so the +/Clear stay in the box */
}

.pill-list:empty {
  display: none;
}

.pill-item {
  background-color: rgba(var(--maroon), 0.7);
  color: white;
  padding: 0 5px 0 12px;
  gap: 5px;
  height: 25px;
  font-size: 14px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  position: relative;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0; /* let pills shrink (and names truncate) to stay on one row */
  animation: pillPop 0.25s var(--ease-pop) both;
}

@keyframes pillPop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Long names (e.g. actors) truncate with an ellipsis; the full name shows in a
   hover tooltip (see .pill-tooltip). Keeps both pills on one row. */
.pill-name {
  display: inline-block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  cursor: default; /* no text/I-beam cursor over the name */
}

.pill-item .pill-remove {
  font-size: 15px;
  line-height: 1;
  width: 17px;
  height: 17px;
  cursor: pointer;
  opacity: 0.75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto; /* fixed size — never shrinks or shifts */
  transition: opacity var(--t-fast) ease;
}

/* Brighten on hover only — no scaling, so the × stays put. */
.pill-item .pill-remove:hover {
  opacity: 1;
}

.pill-overflow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  padding: 0 5px;
  cursor: default;
  height: 25px;
  line-height: 1;
}

.pill-tooltip {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(20, 20, 20, 0.95); /* black, matching the wheel tooltip */
  color: white;
  text-shadow: none;
  line-height: 1;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 13px;
  z-index: 1000;
  pointer-events: none;
}

.pill-overflow:hover .pill-tooltip,
.pill-item:hover .pill-tooltip {
  visibility: visible;
  opacity: 1;
}

.pill-add-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0; /* the +/Clear buttons are never squeezed out of the row */
}

.pill-add-btn {
  background-color: rgba(var(--maroon), 0.7);
  color: white;
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background-color var(--t-fast) ease,
    transform var(--t-fast) var(--ease-pop);
}

.pill-add-btn:hover {
  background-color: rgba(var(--maroon), 0.95);
  transform: scale(1.1);
}

.pill-add-btn:active {
  transform: scale(0.9);
}

.pill-add-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--pink), 0.8);
}

/* Disabled "+" (Actor / Director — no backend people-search yet): greyed out,
   not-allowed, and inert to hover/active so it clearly reads as unavailable. */
.pill-add-btn--soon {
  background-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}
.pill-add-btn--soon:hover,
.pill-add-btn--soon:active {
  background-color: rgba(255, 255, 255, 0.12);
  transform: none;
}

/* Small "Coming Soon" badge sitting next to a not-yet-wired filter label. */
.coming-soon-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
  color: rgb(var(--pink));
  background: rgba(var(--pink), 0.14);
  border: 1px solid rgba(var(--pink), 0.4);
  cursor: default;
}

/* 6. The Dropdown Menu */
.pill-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s var(--ease-snap),
    visibility 0.3s;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: rgba(var(--maroon), 0.95);
  border-radius: 8px;
  z-index: 999;
  width: max-content;
  min-width: 40px;
  text-align: center;
  white-space: nowrap;
  margin-top: 5px;
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
}

.pill-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.pill-clear-btn {
  background: transparent;
  color: white;
  text-decoration: underline;
  border: none;
  font-size: 14px;
  cursor: pointer;
  margin: 0;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
  display: none;
}

.pill-clear-btn:hover {
  color: white;
  text-decoration: underline;
}

#ageRatingBtn {
  width: 90px;
}

/* Pinned to the top of the (scrolling) dropdown so it stays visible while the
   list scrolls underneath. The solid background hides names passing behind it. */
.dropdown-search {
  position: sticky;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  background-color: rgb(var(--maroon-light));
  border: none;
  border-bottom: 1px solid rgba(var(--pink), 0.3);
  border-radius: 8px 8px 0 0;
  color: white;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.dropdown-search::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.dropdown-search:focus {
  border-bottom-color: rgba(var(--pink), 0.8);
}

/* Non-interactive "No people found" row in the actor/director dropdowns */
.pill-option--empty,
.pill-option--empty:hover {
  color: rgba(255, 255, 255, 0.6);
  background-color: transparent;
  cursor: default;
}

/* ==========================================
   7. STAR RATING SYSTEM
   ========================================== */
.star-rating {
  display: flex;
  gap: 8px;
  align-items: center;
}

.star {
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.star:hover {
  transform: scale(1.25) rotate(-6deg);
}

/* ==========================================
   8. SORT BY MENU
   ========================================== */
/* Container Layout */
.sort-dropdown {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.sort-label {
  font-size: 16px;
  margin: 0;
  color: var(--text-soft);
}

/* Wrapper for the custom dropdown */
.sort-custom-wrapper {
  position: relative;
}

.sort-custom-btn {
  width: 97.83px;
  height: 45.3px;
  background-color: rgba(var(--pink), 0.13);
  color: var(--text-soft);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding-left: 10px;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition:
    background-color var(--t-base) ease,
    transform var(--t-fast) var(--ease-snap);
}

.sort-custom-btn:hover {
  background-color: rgba(var(--pink), 0.22);
}

.sort-custom-btn:active {
  transform: scale(0.97);
}

.sort-custom-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--pink), 0.8);
}

.sort-custom-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s var(--ease-snap),
    visibility 0.3s;
  position: absolute;
  top: 105%;
  right: 0;
  width: max-content;
  min-width: 250px;
  background-color: rgba(var(--maroon-light), 0.95);
  border-radius: 12px;
  z-index: 1000;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.5);
  padding: 10px 0;
}

.sort-custom-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sort-option {
  padding: 12px 20px;
  color: white;
  cursor: pointer;
  font-size: 16px;
  transition:
    background-color 0.2s,
    padding-left var(--t-fast) ease;
  text-align: left;
  opacity: 0.7;
}

.sort-option:hover {
  background-color: rgba(var(--maroon), 0.95);
  opacity: 1;
  padding-left: 26px;
}

.sort-option.selected {
  opacity: 1;
  font-weight: bold;
}

/* ==========================================
   9. MOVIE GRID & POSTERS
   ========================================== */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  row-gap: 20px;
  column-gap: 40px;
  width: 100%;
  max-width: var(--content-width);
  padding: 8px;
}

/* Friendly empty / error state shown in place of the cards */
.grid-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  font-size: 22px;
  color: var(--text-muted);
}

/* Infinite-scroll sentinel: a 1px full-row marker the IntersectionObserver
   watches. `overflow-anchor: none` keeps the browser from ever choosing it as
   the scroll-anchor element, so appending cards above it can't yank the view. */
#infinite-scroll-sentinel {
  grid-column: 1 / -1;
  width: 100%;
  height: 1px;
  pointer-events: none;
  overflow-anchor: none;
}

.movie-card {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer; /* the whole card opens the movie details page */
  aspect-ratio: 2 / 3; /* card fills its grid track; height follows from the 2:3 ratio */
  border: 3px solid rgb(var(--rose));
  transition:
    transform var(--t-base) var(--ease-snap),
    box-shadow var(--t-base) var(--ease-snap),
    border-color var(--t-base) ease;
  animation: cardEnter 0.5s var(--ease-snap) backwards;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.movie-card:nth-child(1) {
  animation-delay: 0s;
}
.movie-card:nth-child(2) {
  animation-delay: 0.05s;
}
.movie-card:nth-child(3) {
  animation-delay: 0.1s;
}
.movie-card:nth-child(4) {
  animation-delay: 0.15s;
}
.movie-card:nth-child(5) {
  animation-delay: 0.2s;
}
.movie-card:nth-child(6) {
  animation-delay: 0.25s;
}
.movie-card:nth-child(7) {
  animation-delay: 0.3s;
}
.movie-card:nth-child(8) {
  animation-delay: 0.35s;
}
.movie-card:nth-child(n + 9) {
  animation-delay: 0.4s;
}

.movie-card:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: rgb(var(--pink));
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.poster-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3; /* fixed ratio so the box is reserved before the asset loads */
  object-fit: cover;
  display: block;
  /* Skeleton fill shown until the image decodes — no flash of empty space and,
     with the fixed ratio above, no reflow when the poster paints in. */
  background-color: rgba(255, 255, 255, 0.05);
}

.movie-card--skeleton {
  cursor: default;
  /* Reserve the exact same box a real card occupies so the grid never
     collapses while a page is in flight. width fills the grid track and the
     inherited aspect-ratio: 2/3 fixes the height off that width — keeping the
     skeleton identical in size to the card that replaces it (no reflow jump). */
  width: 100%;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  border-color: rgba(var(--rose), 0.35);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.12) 37%,
    rgba(255, 255, 255, 0.04) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.card-overlay {
  opacity: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 30px;
  position: absolute;
  transition: opacity var(--t-base) ease;
}

.movie-card:hover .card-overlay {
  opacity: 1;
  cursor: pointer;
}

.card-overlay button {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgb(var(--wine));
  border-radius: 100px;
  border: none;
  width: 60px;
  height: auto;
  aspect-ratio: 1 / 1;
  flex-shrink: 1;
  transform: scale(0.6);
  opacity: 0;
  transition:
    background-color var(--t-base) ease,
    transform var(--t-base) var(--ease-pop),
    opacity var(--t-base) ease;
}

.card-overlay button img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.card-overlay button:nth-child(1) img {
  width: 27px;
  height: auto;
}

.movie-card:hover .card-overlay button {
  transform: scale(1);
  opacity: 1;
}
.movie-card:hover .card-overlay button:nth-child(1) {
  transition-delay: 0.04s;
}
.movie-card:hover .card-overlay button:nth-child(2) {
  transition-delay: 0.09s;
}
.movie-card:hover .card-overlay button:nth-child(3) {
  transition-delay: 0.14s;
}

.card-overlay button:hover {
  background-color: rgba(var(--rose), 0.8);
  cursor: pointer;
}

.card-overlay button:hover {
  transform: scale(1.05);
}
.movie-card:hover .card-overlay button:active {
  transform: scale(0.95);
}

.card-overlay button:active {
  background-color: rgb(var(--rose));
}

.card-overlay button.active {
  background-color: rgb(var(--rose));
}

.movie-title-pill {
  font-size: 12px;
  line-height: 1.25;
  display: flex;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 30px;
  width: calc(100% - 20px);
  min-height: 24.21px;
  padding: 4px 12px;
  background-color: rgba(var(--pink), 0.2);
  text-transform: uppercase;
  text-align: center;
  align-items: center;
  justify-content: center;
}

.rating-badge {
  min-width: 55px;
  min-height: 29px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: absolute;
  padding-right: 7px;
  padding-left: 7px;
  padding-top: 3px;
  top: -3px;
  right: -3px;
  background-color: rgba(91, 91, 91, 0.55);
  border-radius: 10px;
}

.rating-badge img {
  min-width: 15px;
  min-height: 14px;
  padding-bottom: 2px;
}

/* ==========================================
   10. RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================== */
@media (max-width: 1024px) {
  /* Search row: hamburger + search bar (Surprise Me moves to the controls row). */
  .header-left-group {
    gap: 12px;
    align-items: center;
  }
  .search-container {
    height: 52px;
    border-width: 3px;
    padding: 4px 12px;
  }
  .search-container input {
    font-size: 16px;
    padding: 8px;
  }
  .search-container > .nav-search-icon {
    width: 20px;
  }
  .ai-mode-btn {
    font-size: 14px;
    height: 36px;
    padding: 10px;
    gap: 6px;
  }
  .ai-mode-btn img {
    width: 16px;
  }

  .controls-bar {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
  }
  .filter-btn {
    width: auto;
    height: 38px;
    padding: 0 10px;
    gap: 5px;
    font-size: 13px;
  }
  .filter-btn img {
    width: 15px;
    height: auto;
  }
  .sort-dropdown {
    gap: 5px;
  }
  .sort-label {
    font-size: 13px;
  }
  .sort-custom-btn {
    width: auto;
    min-width: 66px;
    height: 38px;
    font-size: 13px;
    padding-left: 9px;
    padding-right: 24px;
  }

  .surprise-container {
    flex-direction: row;
    align-items: center;
    width: auto;
    gap: 5px;
    height: 38px;
    padding: 0 10px;
    background: rgba(var(--pink), 0.13);
    border-radius: 12px;
    transition: background-color var(--t-base) ease;
  }
  .surprise-container:hover {
    background: rgba(var(--pink), 0.25);
  }
  .surprise-btn {
    background: transparent;
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    padding: 0;
  }
  .surprise-btn:hover,
  .surprise-btn:active {
    background: transparent;
    transform: none;
  }
  .surprise-container p {
    padding: 0;
    font-size: 13px;
    white-space: nowrap;
  }
  .dice-wrapper {
    gap: 2px;
  }
  .dice-icon {
    width: 15px;
    height: 15px;
  }
  #diceOne,
  #diceTwo {
    margin-top: 0;
    scale: 1;
  }

  .filter-dropdown {
    width: min(92vw, 500px);
    padding: 18px;
  }

  .pill-selector-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .filter-label {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .year-filter {
    flex-wrap: wrap;
  }
  .till-label {
    margin-left: 0;
  }
  .pill-dropdown {
    max-width: min(70vw, 240px);
    white-space: normal;
  }
  .pill-option {
    white-space: normal;
  }
  .star-rating {
    flex-wrap: wrap;
    gap: 6px;
  }
  .star {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 768px) {
  .movie-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 16px;
  }
  .rating-badge {
    font-size: 13px;
    min-width: 0;
    min-height: 0;
    padding: 2px 5px;
  }
  .card-overlay {
    gap: 8px;
    padding: 8px;
  }
  .card-overlay button {
    width: 34px;
    height: auto;
  }
  .card-overlay button img {
    width: 13px;
    height: 13px;
  }
  .card-overlay button:nth-child(1) img {
    width: 22px;
    height: auto;
  }
  .movie-title-pill {
    width: calc(100% - 12px);
    font-size: 10px;
    height: auto;
    padding: 3px 4px;
  }
}

/* Tiny screens: collapse Filters + Surprise to just their icons so the controls
   row always stays on a single line. */
@media (max-width: 389px) {
  .filter-btn {
    width: 40px;
    padding: 0;
    gap: 0;
    font-size: 0;
    justify-content: center;
  }
  .filter-btn img {
    width: 18px;
    height: 18px;
  }
  .surprise-container {
    padding: 0 11px;
  }
  .surprise-container p {
    display: none;
  }
}
