/**
 * Movie quotes page — title cards on red velvet.
 *
 * Each .movie-quote-card is a marquee-black panel with cinema typography
 * and a small filmstrip motif at the top edge. The card is structured
 * so that when screencaps land later, an <img> can drop in above the
 * filmstrip strip without rebuilding the layout.
 *
 * Velvet backdrop comes from .media-shelf in movies.css (loaded
 * alongside this file). Marquee palette also from movies.css:
 *   --marquee-bg, --marquee-text, --marquee-text-soft, --marquee-accent
 */

.movie-quotes-page {
  padding: var(--space-4) 0;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.movie-quotes-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.movie-quotes-header-text {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: var(--space-4);
}

.movie-quotes-header h1 {
  font-family: var(--display-serif);
  font-weight: 500;
  font-size: var(--font-3xl);
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
  letter-spacing: -0.01em;
}

.movie-quotes-header-text p {
  font-family: var(--display-serif);
  font-style: italic;
  font-size: var(--font-base);
  color: var(--text-secondary);
  margin: 0;
}

.movie-quotes-disclaimer {
  flex: 0 1 300px;
  margin: 0;
  padding-left: var(--space-4);
  border-left: 2px solid rgba(212, 176, 176, 0.3);
  font-family: var(--display-serif);
  font-style: italic;
  font-size: var(--font-xs);
  line-height: 1.55;
  color: var(--text-tertiary);
  text-align: left;
}

/* ---------------------------------------------------------------------------
   Velvet container — reuses .media-shelf's red-velvet gradient.
   --------------------------------------------------------------------------- */
.passages-marquee {
  /* Inherits .media-shelf for the velvet backdrop; this class only adds
     extra padding so the cards have generous breathing room. */
  padding: var(--space-6) var(--space-5) var(--space-5);
  background:
    repeating-linear-gradient(
      175deg,
      transparent 0px, transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 3px,
      transparent 3px, transparent 6px
    ),
    repeating-linear-gradient(
      -5deg,
      transparent 0px, transparent 40px,
      rgba(0, 0, 0, 0.15) 40px,
      rgba(0, 0, 0, 0.15) 42px,
      transparent 42px, transparent 120px
    ),
    radial-gradient(ellipse at 30% 20%, rgba(180, 40, 40, 0.15), transparent 60%),
    linear-gradient(180deg, #2a0e0e 0%, #1e0808 100%);
  border: 1px solid #3a1515;
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.4);
}

/* ---------------------------------------------------------------------------
   Filter strip — dark bar on the velvet, cream/marquee controls.
   --------------------------------------------------------------------------- */
.movie-quotes-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 176, 176, 0.18);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.filter-group label {
  font-size: var(--font-sm);
  color: #f0d8d8;
  white-space: nowrap;
}

/* Sort control (custom button + popover, same UX as books quotes) */
.sort-control {
  position: relative;
}
.sort-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 200px;
  padding: var(--space-2) var(--space-3);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 176, 176, 0.25);
  border-radius: 2px;
  color: #f0d8d8;
  font-size: var(--font-sm);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.sort-trigger:hover, .sort-trigger:focus {
  outline: none;
  border-color: var(--marquee-accent);
}
.sort-trigger-label { text-align: left; }
.sort-trigger-chevron {
  font-size: var(--font-xs);
  color: rgba(240, 216, 216, 0.6);
  transition: transform var(--transition-fast);
}
.sort-trigger[aria-expanded="true"] .sort-trigger-chevron {
  transform: rotate(180deg);
}

.sort-options {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 240px;
  background: var(--marquee-bg);
  border: 1px solid rgba(212, 176, 176, 0.3);
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  z-index: 50;
  overflow: hidden;
}
.sort-options.is-open { display: block; }
.sort-option {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(212, 176, 176, 0.08);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: var(--font-sm);
  color: var(--marquee-text);
  transition: background var(--transition-fast);
}
.sort-option:last-child { border-bottom: none; }
.sort-option:hover { background: rgba(199, 90, 58, 0.18); }
.sort-option.is-selected {
  background: rgba(212, 176, 176, 0.06);
  font-style: italic;
  color: #f0d8d8;
}

/* Movie filter — admin-modal-style search */
.movie-filter-search-wrap { position: relative; }

#movie-filter-search {
  width: 240px;
  padding: var(--space-2) var(--space-3);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 176, 176, 0.25);
  border-radius: 2px;
  color: #f0d8d8;
  font-size: var(--font-sm);
  font-family: var(--font-primary);
}
#movie-filter-search::placeholder {
  color: rgba(240, 216, 216, 0.45);
  font-style: italic;
}
#movie-filter-search:focus {
  outline: none;
  border-color: var(--marquee-accent);
}

.movie-filter-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 320px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--marquee-bg);
  border: 1px solid rgba(212, 176, 176, 0.3);
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  z-index: 50;
}
.movie-filter-results:empty { display: none; }

.movie-filter-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(212, 176, 176, 0.08);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.movie-filter-result:last-child { border-bottom: none; }
.movie-filter-result:hover { background: rgba(199, 90, 58, 0.2); }

.movie-filter-result-cover {
  width: 30px;
  height: 45px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.movie-filter-result-info { flex: 1; min-width: 0; }
.movie-filter-result-title {
  font-family: var(--display-serif);
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--marquee-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movie-filter-result-credits {
  font-size: var(--font-xs);
  color: var(--marquee-text-soft);
  font-style: italic;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movie-filter-no-results {
  padding: var(--space-3);
  text-align: center;
  color: var(--marquee-text-soft);
  font-size: var(--font-sm);
  font-style: italic;
}

/* Selected-movie chip is now a button — entire chip is the click target
   to clear the filter. Hover lights up to make the affordance obvious. */
.movie-filter-selected {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 176, 176, 0.25);
  border-radius: 2px;
  color: #f0d8d8;
  font-family: var(--display-serif);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.movie-filter-selected:hover {
  background: rgba(199, 90, 58, 0.18);
  border-color: var(--marquee-accent);
  color: #fff;
}
.movie-filter-selected:hover .movie-filter-clear-icon {
  color: var(--marquee-accent);
}
.movie-filter-selected:focus-visible {
  outline: 2px solid var(--marquee-accent);
  outline-offset: 2px;
}

.movie-filter-cover {
  width: 24px;
  height: 36px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.movie-filter-title {
  font-size: var(--font-sm);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movie-filter-clear-icon {
  color: rgba(240, 216, 216, 0.65);
  font-size: var(--font-lg);
  line-height: 1;
  padding: 0 var(--space-1);
  transition: color var(--transition-fast);
}

/* Liked-only toggle */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  white-space: nowrap;
  font-size: var(--font-sm);
  color: #f0d8d8;
}
.filter-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 176, 176, 0.35);
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}
.filter-toggle input[type="checkbox"]:checked {
  background: var(--marquee-accent);
  border-color: var(--marquee-accent);
}
.filter-toggle input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}
.filter-toggle input[type="checkbox"]:hover { border-color: var(--marquee-accent); }

/* ---------------------------------------------------------------------------
   Quotes grid — JS distributes items into .movie-quotes-column children.
   --------------------------------------------------------------------------- */
.movie-quotes-grid {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
}

.movie-quotes-column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ---------------------------------------------------------------------------
   Movie quote card — marquee-black title card with a filmstrip top edge.
   Structured so a screencap <img> can land above .movie-quote-strip later.
   --------------------------------------------------------------------------- */
.movie-quote-item {
  margin-bottom: 0;
}

.movie-quote-card {
  position: relative;
  background: var(--marquee-bg);
  color: var(--marquee-text);
  border: 1px solid rgba(212, 176, 176, 0.18);
  border-radius: 2px;
  overflow: hidden;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 10px 22px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 220, 180, 0.04);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.movie-quote-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.45),
    0 14px 32px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 220, 180, 0.06);
}

/* Filmstrip motif: a thin horizontal band of sprocket holes at the top
   of each card. Pure CSS — repeating radial gradient on a dark band. */
.movie-quote-strip {
  height: 14px;
  background:
    radial-gradient(circle at 8px 7px, rgba(240, 216, 216, 0.6) 1.5px, transparent 1.9px),
    linear-gradient(180deg, #050202 0%, #0a0404 100%);
  background-size: 18px 14px, 100% 100%;
  background-repeat: repeat-x, no-repeat;
  border-bottom: 1px solid rgba(212, 176, 176, 0.18);
}

.movie-quote-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.movie-quote-text-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.movie-quote-text {
  flex: 1;
  margin: 0;
  font-family: var(--display-serif);
  font-size: var(--font-md);
  font-style: italic;
  line-height: 1.6;
  color: var(--marquee-text);
  white-space: pre-line;
  letter-spacing: 0.005em;
}

/* Like button — warm-red accent on the marquee card */
.quote-like-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--marquee-text-soft);
  font-size: var(--font-lg);
  padding: var(--space-1);
  border-radius: var(--radius-base);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quote-like-btn:hover {
  color: var(--marquee-accent);
  background: rgba(199, 90, 58, 0.12);
}
.quote-like-btn.liked { color: var(--marquee-accent); }
.quote-like-btn.liked:hover { color: #a8472f; }
.quote-like-btn:focus-visible {
  outline: 2px solid var(--marquee-accent);
  outline-offset: 2px;
}
.quote-like-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes heartBeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
}
.quote-like-btn.animating {
  animation: heartBeat 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Character + scene timestamp — like screenplay slug */
.movie-quote-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-primary);
  font-size: var(--font-xs);
  color: var(--marquee-text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.movie-quote-character {
  font-weight: 600;
}
.movie-quote-meta-sep {
  opacity: 0.5;
}

/* Source row at bottom — small poster + title + director credits */
.movie-quote-source {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(212, 176, 176, 0.15);
}
.movie-quote-source-cover {
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.movie-quote-source-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.movie-quote-source-title {
  font-family: var(--display-serif);
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--marquee-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movie-quote-source-credits {
  font-size: var(--font-xs);
  color: var(--marquee-text-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-quotes-empty {
  text-align: center;
  padding: var(--space-8);
  color: #f0d8d8;
  font-style: italic;
  font-family: var(--display-serif);
}

/* ---------------------------------------------------------------------------
   Pagination — sits below the grid on the velvet.
   --------------------------------------------------------------------------- */
.movie-quotes-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0 0;
  padding: var(--space-3);
}

.movie-quotes-pagination button {
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 176, 176, 0.25);
  border-radius: 2px;
  color: #f0d8d8;
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.movie-quotes-pagination button:hover:not(:disabled) {
  background: var(--marquee-accent);
  border-color: var(--marquee-accent);
  color: #f9e8d4;
}
.movie-quotes-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.movie-quotes-pagination .page-info {
  font-family: var(--display-serif);
  font-style: italic;
  font-size: var(--font-sm);
  color: #f0d8d8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .movie-quotes-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }
  .movie-quotes-disclaimer {
    flex: 1 1 auto;
    border-left: none;
    border-top: 2px solid rgba(212, 176, 176, 0.3);
    padding: var(--space-3) 0 0;
  }
  .movie-quotes-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group { width: 100%; }
  .sort-trigger, #movie-filter-search { width: 100%; }
  .movie-quotes-pagination { gap: var(--space-2); }
  .movie-quotes-pagination button { padding: var(--space-2) var(--space-3); }
  .movie-quotes-pagination .page-info { font-size: var(--font-xs); }
}
