/* ============================================================
   catalog.css — Universidade Lumikit
   Estilos da página de catálogo (index.php)
   ============================================================
   Requer tokens.css carregado ANTES deste arquivo.
   ============================================================ */

/* ======================================================
   Variables
====================================================== */


/* ======================================================
   Reset
====================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-b); color: inherit; }
[x-cloak] { display: none !important; }


/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,.35); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.55); }

/* ── View toggle button ── */
.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  color: var(--text);
}
.view-btn:hover {
  background: rgba(255,255,255,.13);
  border-color: var(--green);
}
.view-btn svg { width: 16px; height: 16px; stroke: var(--text); transition: stroke .2s; }
.view-btn:hover svg { stroke: var(--green); }
[data-theme="light"] .view-btn { background: rgba(0,0,0,.07); }
[data-theme="light"] .view-btn:hover { background: rgba(0,0,0,.13); }

/* Icon visibility — default: grid mode active → show list icon */
.icon-grid { display: none; }
.icon-list  { display: block; }
/* In list mode → show grid icon (to switch back) */
body.view-list .icon-grid { display: block; }
body.view-list .icon-list  { display: none; }

/* ════════════════════════════════════════════════════
   LIST VIEW MODE
   body.view-list overrides the card grid to a flat list
════════════════════════════════════════════════════ */

/* Hide the horizontal scroll infrastructure */
body.view-list .row-outer::before,
body.view-list .row-outer::after  { display: none; }
body.view-list .row-nav           { display: none; }

/* Row becomes a vertical stack */
body.view-list .row-wrap {
  overflow-x: visible;
  overflow-y: visible;
}
body.view-list .row {
  flex-direction: column;
  width: 100%;
  gap: 2px;
  padding: 0 44px 8px;
  overflow: visible;
}

/* Card becomes a horizontal list row */
body.view-list .card {
  flex: none;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
  transform: none !important;
  box-shadow: none !important;
}
body.view-list .card:hover {
  background: var(--card-hover);
  border-left-color: var(--green);
  box-shadow: none !important;
  transform: none !important;
}

/* Thumbnail: fixed small size */
body.view-list .card-thumb {
  width: 120px;
  min-width: 120px;
  aspect-ratio: 16/9;
  flex-shrink: 0;
}
body.view-list .card-thumb img { transform: none !important; }
body.view-list .card:hover .card-thumb img { transform: none !important; }

/* Badges still visible */
body.view-list .badge-serie  { font-size: 8px; padding: 2px 5px; }
body.view-list .badge-duration { font-size: 10px; }

/* Body takes remaining width */
body.view-list .card-body {
  flex: 1;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* Title row: "Título — duração" on one line */
body.view-list .card-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}
body.view-list .card-title {
  font-size: 14px;
  font-weight: 500;
  -webkit-line-clamp: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  flex-shrink: 1;
  min-width: 0;
}
body.view-list .card-list-dur {
  font-size: 12px;
  color: var(--muted-hi);
  flex-shrink: 0;
  white-space: nowrap;
}
body.view-list .card-list-dur::before { content: '— '; }

/* Short description below title */
body.view-list .card-list-desc {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* In list mode: hide the grid-only first title + sub */
body.view-list .card-body > .card-title  { display: none; }
body.view-list .card-body > .card-sub    { display: none; }

/* In grid mode: hide the list-only rows */
.card-title-row   { display: none; }
.card-list-desc   { display: none; }
body.view-list .card-title-row  { display: flex; }
body.view-list .card-list-desc  { display: block; }

/* Play overlay smaller in list mode */
body.view-list .play-overlay { background: rgba(0,0,0,.35); }
body.view-list .play-btn-circle { width: 32px; height: 32px; }
body.view-list .play-btn-circle svg { width: 13px; height: 13px; }

/* Section header stays the same */

@media (max-width: 768px) {
  body.view-list .row { padding: 0 18px 8px; }
  body.view-list .card-thumb { width: 90px; min-width: 90px; }
}

/* ── Theme toggle button ── */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  color: var(--text);
}
.theme-btn:hover {
  background: rgba(255,255,255,.13);
  border-color: var(--green);
}
.theme-btn svg { width: 17px; height: 17px; stroke: var(--text); transition: stroke .2s; }
.theme-btn:hover svg { stroke: var(--green); }

/* Show/hide icons based on current theme */
.icon-light { display: none; }
.icon-dark  { display: block; }
[data-theme="light"] .icon-light { display: block; }
[data-theme="light"] .icon-dark  { display: none; }

/* Light mode — header and modal adjustments */
[data-theme="light"] .header {
  background: rgba(242,242,240,.97);
  border-bottom-color: rgba(0,0,0,.1);
}
[data-theme="light"] .search-input {
  background: rgba(0,0,0,.06);
  color: var(--text);
}
[data-theme="light"] .search-input:focus { background: rgba(0,0,0,.09); }
/* Light mode — component overrides */
[data-theme="light"] .header         { background: rgba(240,240,238,.97); }
[data-theme="light"] .modal          { background: #ffffff; border-color: rgba(0,0,0,.12); }
[data-theme="light"] .modal-bar      { background: #f5f5f3; border-bottom: 1px solid rgba(0,0,0,.1); }
[data-theme="light"] .modal-close-btn,
[data-theme="light"] .modal-share-btn,
[data-theme="light"] .modal-back-btn { background: rgba(0,0,0,.07); border-color: rgba(0,0,0,.13); }
[data-theme="light"] .modal-close-btn svg,
[data-theme="light"] .modal-share-btn svg,
[data-theme="light"] .modal-back-btn svg { stroke: #222; }
[data-theme="light"] .modal-close-btn:hover,
[data-theme="light"] .modal-share-btn:hover,
[data-theme="light"] .modal-back-btn:hover { background: rgba(0,0,0,.13); }
[data-theme="light"] .modal-title    { color: #0f0f0f; }
[data-theme="light"] .modal-subtitle { color: #666; }
[data-theme="light"] .modal-divider  { background: rgba(0,0,0,.1); }
[data-theme="light"] .modal-desc     { color: rgba(0,0,0,.72); }
[data-theme="light"] .modal-tag      { color: var(--green); }
[data-theme="light"] .modal-dur      { color: #555; }
[data-theme="light"] .ep-item:hover  { background: rgba(0,0,0,.04); }
[data-theme="light"] .ep-item.active { background: rgba(78,154,16,.08); }
[data-theme="light"] .ep-title       { color: #111; }
[data-theme="light"] .ep-dur         { color: #666; }
[data-theme="light"] .badge-duration { background: rgba(0,0,0,.62); }
[data-theme="light"] .row-nav        { background: rgba(240,240,238,.96); border-color: rgba(0,0,0,.15); }
[data-theme="light"] .row-nav svg    { stroke: #222; }
[data-theme="light"] .backdrop       { background: rgba(0,0,0,.55); }
[data-theme="light"] .card           { box-shadow: 0 2px 8px rgba(0,0,0,.09); }
[data-theme="light"] .section-title  { color: #0f0f0f; }
[data-theme="light"] .search-input   { background: rgba(0,0,0,.07); color: #111; }
[data-theme="light"] .search-input::placeholder { color: #888; }
[data-theme="light"] .search-input:focus { background: rgba(0,0,0,.1); }
[data-theme="light"] .card-title     { color: #111; }
[data-theme="light"] .card-sub       { color: #666; }
[data-theme="light"] .row-outer::before { background: linear-gradient(to right, var(--bg) 20%, transparent 100%); }
[data-theme="light"] .row-outer::after  { background: linear-gradient(to left,  var(--bg) 20%, transparent 100%); }

/* ======================================================
   Header
====================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 44px;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
}

/* Logo preto (lumikit_black.png)
   Dark mode  → sem inversão (preto sobre fundo escuro verde-escuro)
   Light mode → inverter para branco (sobre fundo claro) */
.logo img {
  height: 28px;
  width: auto;
  filter: invert(0);         /* dark mode: mantém preto */
  transition: filter .25s;
}
[data-theme="light"] .logo img {
  filter: invert(1);         /* light mode: preto → branco */
}

.logo-sep {
  width: 1px;
  height: 20px;
  background: var(--border-hi);
}

.logo-text {
  font-family: var(--font-d);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green);
}

/* Search */
.search-wrap {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  pointer-events: none;
  color: var(--muted);
  transition: color .2s;
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 9px 36px 9px 38px;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.search-input::placeholder { color: var(--muted); }

.search-input:focus {
  background: #0f0f0f;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.search-input:focus ~ .search-icon { color: var(--green); }

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}

.search-clear:hover { background: rgba(255,255,255,.22); }
.search-clear svg { width: 10px; height: 10px; stroke: #fff; }

/* ======================================================
   Main
====================================================== */
.main { padding: 36px 0 80px; }

/* ======================================================
   Section
====================================================== */
.section { margin-bottom: 44px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 44px;
  margin-bottom: 18px;
}

.section-line {
  width: 3px;
  height: 20px;
  background: var(--green);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.section-title {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
}

.section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(112,196,47,.2);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  margin-left: 4px;
}

/* ======================================================
   Horizontal row
====================================================== */
.row {
  display: flex;
  gap: 14px;
  padding: 10px 44px 16px;
  /* overflow must be visible so card hover glow/translate isn't clipped */
  overflow: visible;
  width: max-content;
  min-width: 100%;
  scroll-snap-type: x mandatory;
}

/* ======================================================
   Row outer + nav arrows
   ── The key: .row-outer holds the buttons (stays fixed).
      .row-wrap is the actual scroll container inside it.
====================================================== */
.row-outer {
  position: relative;   /* anchor for absolute buttons */
}

/* Fade-edge gradients — on .row-outer so they never scroll */
.row-outer::before,
.row-outer::after {
  content: '';
  position: absolute;
  top: 0; bottom: 16px;
  width: 80px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
}
.row-outer::before {
  left: 0;
  background: linear-gradient(to right, var(--bg) 20%, transparent 100%);
}
.row-outer::after {
  right: 0;
  background: linear-gradient(to left, var(--bg) 20%, transparent 100%);
}
.row-outer.can-prev::before { opacity: 1; }
.row-outer.can-next::after  { opacity: 1; }

/* Scroll container */
.row-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) rgba(255,255,255,.05);
}
.row-wrap::-webkit-scrollbar         { height: 5px; }
.row-wrap::-webkit-scrollbar-track   { background: rgba(255,255,255,.05); }
.row-wrap::-webkit-scrollbar-thumb   { background: rgba(255,255,255,.28); border-radius: var(--radius-pill); }
.row-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }

[data-theme="light"] .row-wrap {
  scrollbar-color: rgba(0,0,0,.35) rgba(0,0,0,.08);
}
[data-theme="light"] .row-wrap::-webkit-scrollbar-track { background: rgba(0,0,0,.08); }
[data-theme="light"] .row-wrap::-webkit-scrollbar-thumb { background: rgba(0,0,0,.38); }
[data-theme="light"] .row-wrap::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.6); }

/* Nav buttons — absolutely placed on .row-outer, never scroll */
.row-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);   /* visual center (offset for bottom padding) */
  z-index: 10;
  width: 40px;
  height: 40px;
  background: rgba(10,10,10,.96);
  border: 1px solid rgba(112,196,47,.45);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, background .18s, border-color .18s,
              box-shadow .18s, transform .18s;
  box-shadow: 0 4px 20px rgba(0,0,0,.55);
}
.row-nav svg {
  width: 17px; height: 17px;
  stroke: #fff; stroke-width: 2.5; fill: none;
  pointer-events: none;
}
.row-nav.nav-prev { left: 8px; }
.row-nav.nav-next { right: 8px; }

/* Show buttons via parent class set by JS */
.row-outer.can-prev .nav-prev { opacity: 1; pointer-events: auto; }
.row-outer.can-next .nav-next { opacity: 1; pointer-events: auto; }

.row-nav:hover {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 22px var(--green-glow);
  transform: translateY(-60%) scale(1.1);
}
.row-nav:hover svg { stroke: #000; }
.row-nav:active    { transform: translateY(-60%) scale(.94); }

/* ======================================================
   Card
====================================================== */
.card {
  flex: 0 0 210px;
  scroll-snap-align: start;
  background: var(--card);
  border-radius: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform .22s var(--ease),
              box-shadow .22s var(--ease),
              border-color .22s var(--ease);
}

.card:hover {
  transform: translateY(-4px) scale(1.012);
  box-shadow: 0 6px 18px rgba(0,0,0,.18),
              0 0 0 1px var(--green);
  border-color: var(--green);
  z-index: 5;
}
/* Lighter shadow in light mode */
[data-theme="light"] .card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.12),
              0 0 0 1px var(--green);
}

/* Thumbnail */
.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #0f0f0f;
  position: relative;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s var(--ease);
}

.card:hover .card-thumb img { transform: scale(1.07); }

/* Play overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}

.card:hover .play-overlay { opacity: 1; }

.play-btn-circle {
  width: 44px;
  height: 44px;
  background: var(--green);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(.85);
  transition: transform .2s var(--ease);
  box-shadow: 0 0 24px var(--green-glow);
}

.card:hover .play-btn-circle { transform: scale(1); }

.play-btn-circle svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  margin-left: 3px;
}

/* Badges */
.badge-serie {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--green);
  color: #000;
  font-family: var(--font-d);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.badge-duration {
  position: absolute;
  bottom: 7px;
  right: 8px;
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

/* Card body */
.card-body {
  padding: 11px 13px 13px;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-sub {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted-hi);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-sub .dot {
  width: 3px;
  height: 3px;
  border-radius: var(--radius-circle);
  background: var(--muted);
}

/* No-image placeholder */
.thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
}

.thumb-empty svg { width: 32px; height: 32px; color: #333; }

/* ======================================================
   POPUP / MODAL  (shared base)
====================================================== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  /* Enter animation */
  animation: backdropIn .25s var(--ease) forwards;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Closing state */
.backdrop.closing {
  animation: backdropOut .2s var(--ease) forwards;
}

@keyframes backdropOut {
  to { opacity: 0; }
}

.modal {
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  background: #0f0f0f;
  border: 1px solid rgba(112,196,47,.2);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0,0,0,.7),
              0 0 0 1px rgba(112,196,47,.08);

  /* Enter animation */
  animation: modalIn .28s cubic-bezier(.34,1.28,.64,1) forwards;
}

@keyframes modalIn {
  from { transform: scale(.9) translateY(20px); opacity: 0; }
  to   { transform: scale(1)  translateY(0);    opacity: 1; }
}

.backdrop.closing .modal {
  animation: modalOut .18s var(--ease) forwards;
}

@keyframes modalOut {
  to { transform: scale(.94) translateY(12px); opacity: 0; }
}

/* Modal sections */
.modal-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
  flex-shrink: 0;
}

.modal-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Thumbnail preview (before play) */
.modal-cover {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.7);
  transition: filter .25s;
}

.modal-cover:hover img { filter: brightness(.85); }

.modal-cover-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-play-btn {
  width: 64px;
  height: 64px;
  background: var(--green);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px var(--green-glow);
  transition: transform .2s var(--ease), box-shadow .2s;
}

.modal-cover:hover .cover-play-btn {
  transform: scale(1.08);
  box-shadow: 0 0 60px var(--green-glow);
}

.cover-play-btn svg { width: 26px; height: 26px; fill: #fff; margin-left: 4px; }

/* Modal header bar */
.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  gap: 16px;
  flex-shrink: 0;
}

.modal-titles { flex: 1; min-width: 0; }

.modal-title {
  font-family: var(--font-d);
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--muted-hi);
  margin-top: 3px;
}

.modal-close-btn,
.modal-share-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-circle);
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.modal-share-btn svg { width: 14px; height: 14px; }
.modal-share-btn:hover { background: rgba(255,255,255,.14); }
.modal-share-btn:hover svg { stroke: var(--green); }
.modal-share-btn.copied { background: var(--green-dim); border-color: rgba(112,196,47,.4); }
.modal-share-btn.copied svg { stroke: var(--green); }

.modal-close-btn:hover {
  background: rgba(255,255,255,.14);
  border-color: var(--border-hi);
}

.modal-close-btn svg { width: 14px; height: 14px; stroke: var(--text); stroke-width: 2.5; }

.modal-divider { height: 1px; background: var(--border); flex-shrink: 0; }

/* Description area (for single videos) */
.modal-desc-area {
  padding: 18px 22px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  font-size: 14px;
  color: rgba(255,255,255,.65);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.modal-desc a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(112,196,47,.4);
  transition: color .15s, text-decoration-color .15s;
}
.modal-desc a:hover {
  color: #9de05a;
  text-decoration-color: var(--green);
}
.modal-desc a.ts-link {
  /* Timestamp links: pill style */
  display: inline-block;
  background: var(--green-dim);
  border: 1px solid rgba(112,196,47,.25);
  border-radius: var(--radius-sm);
  padding: 0px 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  color: var(--green);
  font-family: 'Courier New', monospace;
  transition: background .15s, border-color .15s;
}
.modal-desc a.ts-link:hover {
  background: rgba(112,196,47,.22);
  border-color: var(--green);
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 12px;
}

.modal-tag {
  background: var(--green-dim);
  border: 1px solid rgba(112,196,47,.2);
  color: var(--green);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-d);
  letter-spacing: .05em;
}

.modal-dur { color: var(--muted-hi); }

/* ======================================================
   Serie modal — back button + episode player view
====================================================== */
.modal-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  border-radius: var(--radius-circle);
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.modal-back-btn:hover { background: rgba(255,255,255,.14); border-color: var(--border-hi); }
.modal-back-btn svg   { width: 15px; height: 15px; }

.modal-ep-view {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}

.modal-ep-desc {
  padding: 18px 22px 24px;
}

/* ======================================================
   Episode list (series modal)
====================================================== */
.ep-list { overflow-y: auto; flex: 1; }

.ep-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}

.ep-item:hover { background: rgba(255,255,255,.04); }

.ep-item.active { background: var(--green-dark); }

.ep-num {
  width: 24px;
  text-align: center;
  font-family: var(--font-d);
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.ep-item.active .ep-num { color: var(--green); }

.ep-thumb-wrap {
  width: 104px;
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
  position: relative;
}

.ep-thumb-wrap img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.ep-thumb-over {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}

.ep-item:hover .ep-thumb-over { opacity: 1; }

.ep-mini-play {
  width: 26px;
  height: 26px;
  background: var(--green);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ep-mini-play svg { width: 11px; height: 11px; fill: #fff; margin-left: 2px; }

.ep-info { flex: 1; min-width: 0; }

.ep-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-item.active .ep-title { color: var(--green); }

.ep-dur { font-size: 11px; color: var(--muted-hi); margin-top: 3px; }

.ep-play-icon {
  width: 32px;
  height: 32px;
  background: var(--green);
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, transform .15s;
}

.ep-item:hover .ep-play-icon {
  opacity: 1;
  transform: scale(1.05);
}

.ep-play-icon svg { width: 13px; height: 13px; fill: #fff; margin-left: 2px; }

.ep-playing-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: var(--radius-circle);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--green);
}

/* ======================================================
   Search results view
====================================================== */
.search-view {
  padding: 36px 44px;
  animation: fadeUp .25s var(--ease);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.search-heading {
  font-family: var(--font-d);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.search-heading span { color: var(--green); }

.search-sub { font-size: 13px; color: var(--muted-hi); margin-bottom: 28px; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 16px;
}

/* List mode: results become a vertical column */
body.view-list .results-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ======================================================
   Loading
====================================================== */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 0;
  gap: 12px;
}

.loader-ring {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(112,196,47,.2);
  border-top-color: var(--green);
  border-radius: var(--radius-circle);
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
  font-size: 13px;
  color: var(--muted-hi);
}

/* ======================================================
   Empty state
====================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon { font-size: 40px; margin-bottom: 16px; filter: grayscale(1); opacity: .4; }

.empty h3 {
  font-family: var(--font-d);
  font-size: 20px;
  color: rgba(255,255,255,.5);
  margin-bottom: 8px;
}

.empty p { font-size: 14px; }

/* ======================================================
   Responsive
====================================================== */
@media (max-width: 768px) {
  .header { padding: 0 18px; height: 58px; }
  .logo img { height: 22px; }
  .logo-text { font-size: 11px; }
  .section-header { padding: 0 18px; }
  .row { padding: 4px 18px 12px; }
  .card { flex: 0 0 160px; }
  .search-view { padding: 24px 18px; }
  .modal { max-height: 92vh; }
  .modal-bar { padding: 14px 16px 10px; }
  .modal-desc-area { padding: 14px 16px 18px; }
  .ep-item { padding: 10px 16px; }
  .ep-thumb-wrap { width: 84px; }
}
