/* ============================================================
   Rick y Morty LATAM — Production Stylesheet
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --bg-card: #16161f;
  --panel: rgba(18, 18, 28, 0.85);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --text: #eef0f6;
  --text-secondary: #b0b8c8;
  --muted: #7a8494;
  --accent: #00ff41;
  --accent-dim: rgba(0, 255, 65, 0.15);
  --accent-glow: rgba(0, 255, 65, 0.25);
  --accent-2: #00d4ff;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; border: none; cursor: pointer; background: none; color: inherit; }

/* ---- Layout ---- */

.app-shell {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-shell > main { flex: 1; }

/* ---- Topbar ---- */

.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 8px 16px; border-radius: var(--radius-pill);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.topbar nav a:hover { background: var(--surface-hover); color: var(--text); }

/* ---- Brand ---- */

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.brand span { color: var(--muted); font-size: 12px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover;
}

/* ---- Hero ---- */

.hero {
  display: grid; grid-template-columns: 1.1fr 1fr;
  gap: 40px; padding: 64px 0 40px; align-items: center;
}
.hero-copy h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -0.03em; margin-bottom: 16px;
}
.hero-copy h1 .accent-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.eyebrow {
  display: inline-block; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 11px; font-weight: 700; margin-bottom: 12px;
  padding: 4px 10px; background: var(--accent-dim);
  border-radius: var(--radius-pill);
}
.lede, .section-head p {
  color: var(--text-secondary); max-width: 52ch; line-height: 1.7;
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px;
}
.hero-meta span {
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* Hero showcase */
.hero-visual { display: flex; align-items: center; justify-content: center; }
.hero-showcase {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 24px;
  backdrop-filter: blur(12px); width: 100%;
}
.showcase-label {
  color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em; font-weight: 600; margin-bottom: 14px;
}
.showcase-seasons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.showcase-item {
  display: grid; place-items: center;
  padding: 16px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); font-weight: 700; font-size: 14px;
  transition: all var(--transition-fast);
}
.showcase-item:hover {
  background: var(--accent-dim); border-color: rgba(0,255,65,0.25);
  color: var(--accent); transform: translateY(-2px);
}

/* ---- Buttons ---- */

.button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-size: 14px; font-weight: 600;
  transition: all var(--transition); white-space: nowrap; cursor: pointer;
}
.button.primary {
  background: var(--accent); color: var(--bg); border-color: transparent;
  box-shadow: 0 0 16px var(--accent-glow);
}
.button.primary:hover {
  background: #33ff66;
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}
.button.ghost { background: var(--surface); color: var(--text-secondary); }
.button.ghost:hover {
  background: var(--surface-hover); color: var(--text);
  border-color: var(--border-hover);
}

/* ---- Sections ---- */

.section { padding-top: 48px; }
.section-top { padding-top: 32px; }
.section-head { margin-bottom: 24px; }
.section-head h1, .section-head h2 {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px;
}

/* ---- Season Switcher (pills) ---- */

.season-switcher {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 24px; padding: 5px;
  background: var(--surface); border-radius: var(--radius-pill);
  border: 1px solid var(--border); width: fit-content; max-width: 100%;
}
.season-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; padding: 8px 18px;
  border-radius: var(--radius-pill); border: none;
  background: transparent; color: var(--muted);
  cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all var(--transition-fast);
  text-decoration: none;
}
.season-pill:hover { background: var(--surface-hover); color: var(--text); }
.season-pill.active {
  background: var(--accent); color: var(--bg);
  box-shadow: 0 0 12px var(--accent-glow);
}
.season-switcher-compact { margin-bottom: 20px; }

/* ---- Grids ---- */

.season-grid, .episode-grid { display: grid; gap: 16px; }
.season-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.episode-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---- Cards ---- */

.season-card-link, .episode-link {
  display: block; border-radius: var(--radius-lg); overflow: hidden;
}
.season-card, .episode-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* Poster (season card) */
.poster {
  min-height: 120px; padding: 20px;
  display: flex; align-items: flex-end;
  background: linear-gradient(135deg, rgba(0,255,65,0.1), rgba(0,212,255,0.1));
  position: relative;
}
.poster h3 { font-size: 1rem; font-weight: 700; position: relative; z-index: 1; }

/* Episode thumb */
.episode-thumb {
  min-height: 120px; padding: 16px;
  display: flex; align-items: flex-end;
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(168,85,247,0.08));
  position: relative;
}
.ep-number {
  position: relative; z-index: 1;
  font-size: 12px; font-weight: 700; color: var(--text);
  background: rgba(0,0,0,0.5); padding: 4px 8px;
  border-radius: var(--radius-sm); backdrop-filter: blur(4px);
}

/* Card body */
.card-copy { padding: 14px 16px 16px; }
.card-copy h3 { margin: 0 0 6px; font-size: 0.95rem; font-weight: 600; }
.card-tag {
  display: inline-flex; padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(0,255,65,0.15);
}
.card-tag--upcoming {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
}
.meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Card hover */
.season-card:hover, .episode-card.available:hover {
  transform: translateY(-3px);
  border-color: rgba(0,255,65,0.2);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 16px rgba(0,255,65,0.05);
}
.episode-card.available { cursor: pointer; }
.episode-card.unavailable { opacity: 0.5; filter: saturate(0.5); }
.episode-card.unavailable:hover { opacity: 0.65; }

/* ---- Catalog page ---- */

.catalog-banner {
  padding: 48px 0 24px;
  background:
    linear-gradient(135deg, rgba(0,255,65,0.06) 0%, transparent 40%),
    linear-gradient(225deg, rgba(0,212,255,0.05) 0%, transparent 40%);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.catalog-banner-content { max-width: 600px; }
.catalog-banner h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.1; margin-bottom: 8px;
}
.catalog-banner-sub {
  color: var(--text-secondary); font-size: 15px;
}
.catalog-nav {
  padding: 20px 0 0;
  position: sticky; top: 56px; z-index: 50;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.catalog-episodes {
  padding: 24px 0 0;
}

/* ---- Featured episode (hero) ---- */

.hero-featured { display: flex; align-items: center; justify-content: center; }
.featured-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden; width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.featured-card:hover {
  border-color: rgba(0,255,65,0.2);
  box-shadow: 0 16px 48px rgba(0,0,0,0.4), 0 0 20px rgba(0,255,65,0.05);
}
.featured-thumb {
  position: relative; width: 100%; aspect-ratio: 3/1;
  background: linear-gradient(135deg, rgba(0,255,65,0.08), rgba(0,212,255,0.08));
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.featured-play {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(0,255,65,0.9); color: #000;
  display: grid; place-items: center;
  font-size: 24px; padding-left: 4px;
  box-shadow: 0 0 30px rgba(0,255,65,0.4);
  transition: transform var(--transition), box-shadow var(--transition);
}
.featured-card:hover .featured-play {
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(0,255,65,0.6);
}
.featured-info { padding: 12px 16px; }
.featured-badge {
  display: inline-block; padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim); color: var(--accent);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.featured-info h3 {
  font-size: 0.95rem; font-weight: 700; margin-bottom: 2px;
}
.featured-info p {
  color: var(--muted); font-size: 12px; margin-bottom: 12px;
}
.featured-btn { width: 100%; text-align: center; }

/* ---- Mini chart (hero) ---- */

.hero-chart { display: flex; align-items: center; justify-content: center; }
.mini-chart-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; width: 100%;
  backdrop-filter: blur(12px);
}
.mini-chart-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.mini-chart-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.mini-chart-link {
  font-size: 12px; color: var(--accent); font-weight: 500;
}
.mini-chart-link:hover { opacity: 0.8; }
.mini-chart-footer {
  display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted);
}
.mini-chart-footer span { display: flex; align-items: center; gap: 4px; }

/* ---- Stats widget ---- */

.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.stat-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; text-align: center;
}
.stat-number {
  display: block; font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800; color: var(--accent); letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.stat-label {
  display: block; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ---- Empty state ---- */

.empty-state {
  grid-column: 1 / -1; text-align: center;
  padding: 48px 24px; color: var(--text-secondary);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.empty-state p { margin-bottom: 16px; }

/* ---- Player page ---- */

.player-page { padding-top: 24px; }
.player-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.player-page-title {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 700; letter-spacing: -0.02em;
}
.player-page-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.player-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px;
}
.player-shell {
  position: relative;
  background: #000; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
#episode-player {
  display: block; width: 100%;
  aspect-ratio: 16/9; background: #000;
}

/* Sidebar */
.player-sidebar {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  max-height: calc(100vh - 140px); overflow-y: auto;
}
.player-sidebar::-webkit-scrollbar { width: 4px; }
.player-sidebar::-webkit-scrollbar-track { background: transparent; }
.player-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.player-sidebar h4 {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
  margin-bottom: 12px;
}
#episode-sidebar-list { display: grid; gap: 6px; }

.episode-side-item {
  display: block; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary);
  transition: all var(--transition-fast); font-size: 13px;
  text-decoration: none;
}
.episode-side-item strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }
.episode-side-item span { display: block; font-size: 12px; color: var(--muted); }
.episode-side-item.active {
  border-color: rgba(0,255,65,0.3); background: var(--accent-dim);
}
.episode-side-item.active strong { color: var(--accent); }
.episode-side-item.disabled { opacity: 0.4; }
.episode-side-item:not(.disabled):hover {
  transform: translateX(3px); border-color: var(--border-hover);
  background: var(--surface-hover);
}
.player-backlink {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.player-backlink a {
  color: var(--accent); font-size: 14px; font-weight: 500;
}
.player-backlink a:hover { opacity: 0.8; }

/* ---- Ad gate (play-to-unlock) ---- */

.ad-gate {
  position: absolute; top: 0; left: 0;
  width: 100%; aspect-ratio: 16/9;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(0,255,65,0.04) 0%, transparent 60%),
    rgba(10, 10, 15, 0.92);
  border-radius: var(--radius-lg);
  transition: opacity 0.4s ease;
}
.ad-gate.cleared { opacity: 0; pointer-events: none; }

.ad-gate-inner { text-align: center; }

.ad-gate-step {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); margin-bottom: 20px;
  background: var(--accent-dim); display: inline-block;
  padding: 4px 14px; border-radius: var(--radius-pill);
}

.ad-gate-play {
  display: grid; place-items: center;
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  text-decoration: none; margin: 0 auto;
  box-shadow: 0 0 24px var(--accent-glow), 0 0 60px rgba(0,255,65,0.1);
  transition: transform var(--transition), box-shadow var(--transition);
}
.ad-gate-play:hover {
  transform: scale(1.1);
  box-shadow: 0 0 36px var(--accent-glow), 0 0 80px rgba(0,255,65,0.15);
}
.ad-gate-play-icon { font-size: 26px; padding-left: 4px; }

.ad-gate-msg {
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  margin-top: 16px; margin-bottom: 20px;
}

.ad-gate-progress {
  width: 180px; height: 4px; margin: 0 auto;
  background: var(--surface); border-radius: var(--radius-pill);
  overflow: hidden;
}
.ad-gate-progress-bar {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.3s ease;
}

/* ---- Ad debug ---- */

.ad-debug {
  margin-top: 16px; padding: 16px 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px;
  font-family: "SF Mono", "Fira Code", monospace;
}
.ad-debug h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 10px;
}
.ad-debug-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.ad-debug-row:last-child { border-bottom: none; }
.ad-debug-label { color: var(--text-secondary); }
.ad-debug-val { font-weight: 600; }
.ad-debug-val.on { color: var(--accent); }
.ad-debug-val.off { color: var(--muted); }
.ad-debug-event {
  padding: 4px 0; color: var(--text-secondary); font-size: 12px;
}
.ad-debug-event span { color: var(--accent); }

/* ---- FAQ ---- */

.faq details {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; overflow: hidden;
}
.faq details:hover { border-color: var(--border-hover); }
.faq details[open] { border-color: rgba(0,255,65,0.15); }
.faq summary {
  cursor: pointer; font-weight: 600; padding: 16px 20px;
  font-size: 14px; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-size: 18px; color: var(--muted);
  transition: transform var(--transition);
}
.faq details[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq summary:hover { background: var(--surface); }
.faq details p { padding: 0 20px 16px; font-size: 14px; color: var(--text-secondary); }

/* ---- Footer ---- */

.site-footer {
  margin-top: 64px; padding: 24px 0;
  border-top: 1px solid var(--border); text-align: center;
}
.site-footer p { color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--accent); }
.site-footer a:hover { opacity: 0.8; }

/* ---- Skeleton ---- */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.15; }
}
.skeleton {
  background: var(--surface); border-radius: var(--radius);
  animation: skeleton-pulse 1.8s ease-in-out infinite;
}
.skeleton-card {
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  overflow: hidden; animation: skeleton-pulse 1.8s ease-in-out infinite;
}
.skeleton-card .skeleton-thumb { height: 120px; background: var(--surface); }
.skeleton-card .skeleton-body { padding: 14px 16px; }
.skeleton-card .skeleton-line {
  height: 12px; background: var(--surface);
  border-radius: 6px; margin-bottom: 10px;
}
.skeleton-card .skeleton-line:last-child { width: 60%; margin-bottom: 0; }

/* ---- Animations ---- */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { opacity: 0; animation: fade-up 0.5s ease forwards; }
.fade-in-delay-2 { animation-delay: 0.15s; }
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .player-layout { grid-template-columns: 1fr 280px; }
}

@media (max-width: 768px) {
  body { font-size: 14px; }
  .app-shell { width: calc(100% - 32px); }
  .topbar { flex-wrap: wrap; padding: 12px 0; gap: 8px; }
  .topbar nav { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .hero { grid-template-columns: 1fr; padding: 32px 0 24px; gap: 24px; }
  .hero-copy h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
  .player-layout { grid-template-columns: 1fr; }
  .player-sidebar { max-height: none; }
  .player-header { flex-direction: column; }
  .season-switcher {
    width: 100%; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap;
  }
  .season-switcher::-webkit-scrollbar { display: none; }
  .season-pill { flex-shrink: 0; }
  .season-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .episode-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 480px) {
  .hero-copy h1 { font-size: 1.4rem; }
  .season-grid { grid-template-columns: 1fr 1fr; }
  .episode-grid { grid-template-columns: 1fr; }
  .button { padding: 10px 18px; font-size: 13px; }
  .showcase-seasons { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .showcase-item { padding: 12px 8px; font-size: 13px; }
}
