/* ============================================
   Cinema Premium — Web Player (responsive)
   Mobile-first, scales up to 4K
   ============================================ */

:root {
  --bg: #0a0a0f;
  --bg-2: #141420;
  --surface: #1a1a26;
  --border: #2a2a38;
  --text: #fff;
  --text-muted: #9a9aa8;
  --accent: #e50914;
  --accent-hover: #ff1220;
  --shadow: 0 10px 40px rgba(0,0,0,0.6);

  --header-h: 60px;
  --side-pad: clamp(16px, 4vw, 60px);

  --row-gap: clamp(32px, 4vw, 56px);
  --card-w: clamp(130px, 22vw, 220px);
  --card-gap: clamp(6px, 0.8vw, 12px);

  --title-xl: clamp(28px, 5vw, 64px);
  --title-l: clamp(20px, 2.5vw, 32px);
  --title-m: clamp(16px, 1.6vw, 22px);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

body.modal-open, body.player-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ============================================
   Header
   ============================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: linear-gradient(to bottom, rgba(10,10,15,0.95), rgba(10,10,15,0.7) 70%, rgba(10,10,15,0));
  padding: 12px 0;
  transition: background 0.3s;
}
.site-header.scrolled {
  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--side-pad);
  height: calc(var(--header-h) - 24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(16px, 2vw, 22px);
  letter-spacing: 3px;
  font-weight: 300;
}
.brand-icon { font-size: 1.4em; }
.brand-text b { color: var(--accent); font-weight: 900; }
@media (max-width: 520px) {
  .brand-text { font-size: 14px; letter-spacing: 2px; }
}

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background 0.15s, transform 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }
.icon-btn:active { transform: scale(0.92); }

.search-bar {
  display: none;
  padding: 10px var(--side-pad);
  gap: 10px;
  background: rgba(10,10,15,0.98);
  border-top: 1px solid var(--border);
}
.search-bar.open { display: flex; align-items: center; }
.search-bar input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 16px;
  outline: none;
}
.search-bar input:focus { border-color: var(--accent); }

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  width: 100%;
  height: clamp(420px, 75vh, 820px);
  overflow: hidden;
  margin-top: 0;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 25%;
  transition: background-image 0.8s ease;
}
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.15);
}
.hero-gradient {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right,
      rgba(10,10,15,0.92) 0%,
      rgba(10,10,15,0.6) 35%,
      rgba(10,10,15,0.2) 70%,
      rgba(10,10,15,0) 100%),
    linear-gradient(to top,
      var(--bg) 0%,
      rgba(10,10,15,0) 30%);
}
@media (max-width: 768px) {
  .hero-gradient {
    background:
      linear-gradient(to top,
        var(--bg) 0%,
        rgba(10,10,15,0.7) 40%,
        rgba(10,10,15,0.1) 100%);
  }
}

.hero-content {
  position: absolute;
  bottom: clamp(40px, 10vh, 120px);
  left: var(--side-pad);
  right: var(--side-pad);
  max-width: 640px;
  z-index: 2;
}
.hero-eyebrow {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 3px;
  font-size: clamp(11px, 1vw, 13px);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.hero-title {
  font-size: var(--title-xl);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 12px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.6);
  letter-spacing: -0.02em;
}
.hero-meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 14px;
}
.hero-meta .badge {
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}
.hero-synopsis {
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.55;
  color: #e0e0e8;
  margin-bottom: 18px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 520px) {
  .hero-synopsis { -webkit-line-clamp: 2; font-size: 13px; }
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 26px;
  border-radius: 4px;
  font-size: clamp(14px, 1.1vw, 16px);
  font-weight: 700;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: #fff;
  color: #000;
}
.btn-primary:hover { background: rgba(255,255,255,0.85); }
.btn-secondary {
  background: rgba(120,120,130,0.5);
  color: #fff;
  backdrop-filter: blur(6px);
}
.btn-secondary:hover { background: rgba(120,120,130,0.7); }
.btn-icon { font-size: 1.2em; display: inline-block; }

.hero-dots {
  position: absolute;
  bottom: 16px; right: var(--side-pad);
  display: flex; gap: 6px;
  z-index: 3;
}
.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.2s;
}
.hero-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

/* ============================================
   Categories / Rows
   ============================================ */
.categories {
  position: relative;
  padding: 10px 0 60px;
  margin-top: -80px;
  z-index: 2;
}
@media (max-width: 768px) {
  .categories { margin-top: -40px; }
}

.row {
  margin-bottom: var(--row-gap);
}
.row-header {
  padding: 0 var(--side-pad);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.row-title {
  font-size: var(--title-l);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.row-count { color: var(--text-muted); font-size: 13px; }

.row-scroller {
  position: relative;
}
.row-items {
  display: flex;
  gap: var(--card-gap);
  padding: 8px var(--side-pad);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: var(--side-pad);
}
.row-items::-webkit-scrollbar { display: none; }

.row-nav {
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(to right, rgba(10,10,15,0.85), rgba(10,10,15,0));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s;
}
.row-nav.right {
  right: 0;
  background: linear-gradient(to left, rgba(10,10,15,0.85), rgba(10,10,15,0));
}
.row-nav.left { left: 0; }
.row-scroller:hover .row-nav { opacity: 1; }
.row-nav:hover { color: var(--accent); }
@media (hover: none) { .row-nav { display: none; } }

/* ============================================
   Cards
   ============================================ */
.card {
  flex: 0 0 var(--card-w);
  aspect-ratio: 2 / 3;
  background: var(--surface) center/cover no-repeat;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  scroll-snap-align: start;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 15px 30px rgba(0,0,0,0.7);
  z-index: 2;
}
@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
  .card:active { transform: scale(0.98); }
}

.card.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: rgba(255,255,255,0.1);
}
.card-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--accent);
  color: #fff;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

/* Admin-only: botón interactivo para destacar/des-destacar desde la card */
.card-star {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fbbf24;
  background: rgba(0, 0, 0, 0.55);
  color: #fbbf24;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  padding: 0;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: inherit;
}
.card-star:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}
.card-star[data-featured="1"] {
  background: #fbbf24;
  color: #111;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
}
.card-star.saving {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}
.card-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 12px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.25s;
}
.card:hover .card-overlay { opacity: 1; transform: translateY(0); }
@media (hover: none) {
  .card-overlay { opacity: 1; transform: none; }
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================
   Search results
   ============================================ */
.search-results {
  padding: 90px var(--side-pad) 60px;
  min-height: 60vh;
}
.section-title {
  font-size: var(--title-l);
  font-weight: 700;
  margin-bottom: 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 18px;
}
.empty-search {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 18px;
}

/* ============================================
   Detail modal
   ============================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: 100%;
  max-width: 880px;
  max-height: 95vh;
  background: var(--bg-2);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--accent); }

.modal-bg {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}
.modal-gradient {
  position: absolute;
  top: 0; left: 0; right: 0;
  aspect-ratio: 16 / 9;
  background: linear-gradient(to bottom, transparent 40%, var(--bg-2) 100%);
  pointer-events: none;
}
.modal-content {
  padding: 0 clamp(20px, 4vw, 40px) 30px;
  margin-top: clamp(-80px, -8vw, -40px);
  position: relative;
  overflow-y: auto;
}
.modal-title {
  font-size: clamp(24px, 3.5vw, 42px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.modal-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 14px;
}
.modal-meta .badge {
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}
.modal-tagline {
  color: var(--accent);
  font-style: italic;
  margin-bottom: 12px;
  font-size: 15px;
}
.modal-tagline:empty { display: none; }
.modal-synopsis {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 10px;
  color: #dcdce6;
}
.translate-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 0;
  border: 0;
  cursor: pointer;
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.translate-btn:hover { color: var(--accent); }
.translate-btn.translated { color: #4ade80; }
.translate-btn.loading { cursor: wait; opacity: 0.7; }
.translate-btn.loading::before {
  content: '';
  width: 10px; height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.modal-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 24px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.modal-info strong { color: #fff; margin-right: 6px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================
   Player overlay
   ============================================ */
.player-overlay {
  position: fixed; inset: 0;
  background: #000;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s;
}
.player-container {
  position: relative;
  width: 100%;
  height: 100%;
}
#player-video, #player-iframe {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border: 0;
  display: block;
}
#player-iframe.hidden, #player-video.hidden { display: none; }
.player-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s;
}
.player-close:hover { background: var(--accent); }
.player-title-bar {
  position: absolute;
  top: 16px; left: 16px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  max-width: calc(100% - 80px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-title-bar h3 { font-size: 16px; font-weight: 700; }

/* ============================================
   Loading / Error
   ============================================ */
.loading-state, .error-state {
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.loading-state p { margin-top: 18px; font-size: 14px; }
.spinner {
  width: 50px; height: 50px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state h2 { color: var(--text); font-size: 22px; margin-bottom: 10px; }
.error-state p { margin-bottom: 20px; max-width: 500px; }

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  z-index: 1000;
  transition: transform 0.3s;
  max-width: calc(100vw - 40px);
  text-align: center;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  padding: 40px var(--side-pad);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.site-footer p { margin: 4px 0; }
.footer-links a { color: var(--accent); margin: 0 4px; }
.footer-links a:hover { text-decoration: underline; }

/* ============================================
   Skeleton (loading shimmer for rows)
   ============================================ */
.skeleton-row {
  padding: 0 var(--side-pad);
  margin-bottom: var(--row-gap);
}
.skeleton-title {
  width: 180px; height: 22px;
  background: var(--surface);
  border-radius: 4px;
  margin-bottom: 12px;
}
.skeleton-cards {
  display: flex; gap: var(--card-gap);
  overflow: hidden;
}
.skeleton-card {
  flex: 0 0 var(--card-w);
  aspect-ratio: 2/3;
  background: linear-gradient(90deg, var(--surface) 0%, #252535 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Accessibility / reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
