/* Televisodes Theme — Main Stylesheet */

/* ── CSS Variables (Light Theme) ─────────────────────────────────────────── */
:root {
  --tv-primary:       #7c3aed;
  --tv-primary-light: #ede9fe;
  --tv-primary-dark:  #5b21b6;
  --tv-accent:        #f59e0b;

  --tv-bg:        #f0f2f7;
  --tv-surface:   #ffffff;
  --tv-surface-2: #f8f9fc;
  --tv-surface-3: #eff1f5;
  --tv-border:    #e2e8f0;

  --tv-text:   #0f172a;
  --tv-text-2: #475569;
  --tv-text-3: #94a3b8;

  --tv-radius:      10px;
  --tv-radius-sm:   6px;
  --tv-radius-lg:   16px;

  --tv-shadow:       0 2px 12px rgba(0,0,0,.07);
  --tv-shadow-hover: 0 8px 28px rgba(0,0,0,.14);
  --tv-shadow-card:  0 1px 4px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.08);

  --tv-header-h: 64px;
  --tv-container: 1360px;
  --tv-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
}

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--tv-font);
  background: var(--tv-bg);
  color: var(--tv-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.tv-container {
  max-width: var(--tv-container);
  margin: 0 auto;
  padding: 0 20px;
}

.tv-main {
  min-height: calc(100vh - var(--tv-header-h) - 140px);
  padding: 28px 0 48px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.tv-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--tv-header-h);
  background: var(--tv-surface);
  border-bottom: 1px solid var(--tv-border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.tv-header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

/* Logo */
.tv-logo {
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--tv-primary);
}

.tv-logo img { height: 36px; width: auto; }

/* Primary nav */
.tv-nav { margin-left: 8px; }

.tv-nav ul,
.tv-nav > ul { display: flex; align-items: center; gap: 4px; list-style: none; }

.tv-nav a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--tv-radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--tv-text-2);
  transition: background .15s, color .15s;
}

.tv-nav a:hover,
.tv-nav .current-menu-item > a,
.tv-nav .current_page_item > a {
  background: var(--tv-primary-light);
  color: var(--tv-primary);
}

/* Search */
.tv-header-actions { margin-left: auto; }

.tv-search-form {
  display: flex;
  align-items: center;
  background: var(--tv-surface-3);
  border: 1px solid var(--tv-border);
  border-radius: 24px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}

.tv-search-form:focus-within {
  border-color: var(--tv-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

.tv-search-form input[type="search"] {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--tv-text);
  width: 200px;
  outline: none;
}

.tv-search-form input[type="search"]::placeholder { color: var(--tv-text-3); }

.tv-search-form button {
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--tv-text-3);
  display: flex;
  align-items: center;
  transition: color .15s;
}

.tv-search-form button:hover { color: var(--tv-primary); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.tv-footer {
  background: var(--tv-text);
  color: rgba(255,255,255,.7);
  padding: 32px 0 0;
}

.tv-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.tv-footer-logo {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.4px;
}

.tv-footer-nav { display: flex; gap: 16px; flex-wrap: wrap; }

.tv-footer-nav a,
.tv-footer-nav > ul { display: flex; gap: 16px; flex-wrap: wrap; list-style: none; }

.tv-footer-nav a {
  font-size: 13px;
  color: rgba(255,255,255,.6);
  transition: color .15s;
}

.tv-footer-nav a:hover { color: #fff; }

.tv-footer-copy {
  text-align: center;
  padding: 16px 0;
  font-size: 12px;
  color: rgba(255,255,255,.35);
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.tv-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--tv-text);
  color: #fff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
}

.tv-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */
.tv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.tv-grid.portrait {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.tv-grid.square {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.tv-card {
  background: var(--tv-surface);
  border-radius: var(--tv-radius);
  overflow: hidden;
  box-shadow: var(--tv-shadow-card);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}

.tv-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tv-shadow-hover);
}

.tv-card-thumb {
  position: relative;
  overflow: hidden;
  background: #1a1a2e;
}

.tv-card-thumb::before {
  content: '';
  display: block;
  padding-top: 56.25%;  /* 16:9 default */
}

.tv-grid.portrait .tv-card-thumb::before { padding-top: 150%; }
.tv-grid.square   .tv-card-thumb::before { padding-top: 100%; }

.tv-card-thumb img,
.tv-card-thumb .tv-card-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease, opacity .3s;
}

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

.tv-card-preview {
  opacity: 0;
  pointer-events: none;
}

.tv-card:hover .tv-card-preview { opacity: 1; }

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

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

.tv-card-play svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }

/* Duration badge */
.tv-card-dur {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .2px;
  backdrop-filter: blur(4px);
}

/* HD badge */
.tv-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.tv-badge-hd {
  background: var(--tv-primary);
  color: #fff;
}

.tv-badge-new {
  background: var(--tv-accent);
  color: #fff;
}

/* EP badge (top right) */
.tv-badge-ep {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* Card body */
.tv-card-body {
  padding: 12px 13px 13px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tv-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--tv-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tv-card:hover .tv-card-title { color: var(--tv-primary); }

.tv-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--tv-text-3);
  margin-top: auto;
  padding-top: 6px;
}

.tv-card-meta svg { flex-shrink: 0; }

/* ── Section heading ──────────────────────────────────────────────────────── */
.tv-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.tv-section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--tv-text);
  position: relative;
  padding-left: 12px;
}

.tv-section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  background: var(--tv-primary);
  border-radius: 2px;
}

/* ── Archive header ───────────────────────────────────────────────────────── */
.tv-archive-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  background: var(--tv-surface);
  border-radius: var(--tv-radius-lg);
  margin-bottom: 22px;
  box-shadow: var(--tv-shadow);
}

.tv-archive-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.tv-archive-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--tv-text);
}

.tv-archive-desc {
  font-size: 13px;
  color: var(--tv-text-2);
  margin-top: 3px;
}

.tv-archive-count {
  margin-left: auto;
  background: var(--tv-primary-light);
  color: var(--tv-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* ── Search header ────────────────────────────────────────────────────────── */
.tv-search-head {
  margin-bottom: 22px;
}

.tv-search-head h1 {
  font-size: 20px;
  font-weight: 700;
}

.tv-search-head h1 span { color: var(--tv-primary); }

.tv-search-count {
  font-size: 13px;
  color: var(--tv-text-3);
  margin-top: 4px;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.tv-pagination { margin-top: 36px; display: flex; justify-content: center; }

.tv-pagination .page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  flex-wrap: wrap;
  justify-content: center;
}

.tv-pagination .page-numbers li { display: contents; }

.tv-pagination .page-numbers a,
.tv-pagination .page-numbers span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--tv-radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--tv-text-2);
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  transition: background .15s, color .15s, border-color .15s;
}

.tv-pagination .page-numbers a:hover {
  background: var(--tv-primary-light);
  border-color: var(--tv-primary);
  color: var(--tv-primary);
}

.tv-pagination .page-numbers .current {
  background: var(--tv-primary);
  border-color: var(--tv-primary);
  color: #fff;
}

.tv-pagination .page-numbers .dots {
  border: none;
  background: transparent;
  min-width: auto;
}

/* ── Single: Breadcrumb ───────────────────────────────────────────────────── */
.tv-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--tv-text-3);
  margin-bottom: 16px;
}

.tv-breadcrumb a { color: var(--tv-text-2); transition: color .15s; }
.tv-breadcrumb a:hover { color: var(--tv-primary); }
.tv-breadcrumb .sep { color: var(--tv-border); }

/* ── Single: Ads ──────────────────────────────────────────────────────────── */
.tv-ad-block { margin-bottom: 16px; text-align: center; }

/* ── Single: Player shell ─────────────────────────────────────────────────── */
.tv-player-shell {
  position: relative;
  background: #000;
  border-radius: var(--tv-radius);
  overflow: hidden;
  margin-bottom: 20px;
  /* Prevent tall portrait embeds from overflowing viewport */
  max-height: calc(100vh - var(--tv-header-h) - 48px);
}

.tv-player-blur-bg {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(.45);
  z-index: 0;
}

.tv-vjs-wrap { position: relative; z-index: 1; }

/* VideoJS: limit height so controls always visible */
.tv-vjs-wrap .video-js {
  max-height: calc(100vh - var(--tv-header-h) - 48px);
}

.tv-embed-wrap {
  position: relative;
  z-index: 1;
  /* Center embed inside player shell */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-height: calc(100vh - var(--tv-header-h) - 48px);
  overflow: hidden;
}

.tv-embed-wrap iframe {
  display: block;
  height: calc(100vh - var(--tv-header-h) - 80px);
  max-height: calc(100vh - var(--tv-header-h) - 80px);
  width: 100%;
  max-width: 100%;
  border: none;
  aspect-ratio: unset;
}

/* 16:9 landscape — standard streaming embed */
.tv-embed-wrap.ratio-16x9 iframe {
  height: auto;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: calc(100vh - var(--tv-header-h) - 80px);
}

/* 9:16 portrait — vertical/social video: fixed height, auto width, black bars on sides */
.tv-embed-wrap.ratio-9x16 {
  align-items: center;
  justify-content: center;
}
.tv-embed-wrap.ratio-9x16 iframe {
  height: calc(100vh - var(--tv-header-h) - 80px);
  max-height: calc(100vh - var(--tv-header-h) - 80px);
  width: auto;
  aspect-ratio: 9/16;
  max-width: 100%;
}

/* 4:3 classic */
.tv-embed-wrap.ratio-4x3 iframe {
  height: auto;
  width: 100%;
  aspect-ratio: 4/3;
  max-height: calc(100vh - var(--tv-header-h) - 80px);
}

/* 1:1 square */
.tv-embed-wrap.ratio-1x1 iframe {
  height: auto;
  width: 100%;
  aspect-ratio: 1/1;
  max-height: calc(100vh - var(--tv-header-h) - 80px);
}

/* Server switcher */
.tv-servers {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}

.tv-servers-label {
  font-size: 12px;
  color: rgba(255,255,255,.55);
  margin-right: 4px;
  font-weight: 500;
}

.tv-srv-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8);
  font-size: 12px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}

.tv-srv-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.tv-srv-btn.active { background: var(--tv-primary); border-color: var(--tv-primary); color: #fff; }

/* VideoJS overrides */
.video-js { width: 100%; }
.video-js .vjs-big-play-button {
  border-radius: 50% !important;
  width: 64px !important;
  height: 64px !important;
  line-height: 64px !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%,-50%) !important;
  margin: 0 !important;
  background: rgba(124,58,237,.85) !important;
  border: none !important;
  box-shadow: 0 4px 16px rgba(124,58,237,.5) !important;
}

.video-js .vjs-control-bar { background: linear-gradient(transparent, rgba(0,0,0,.75)) !important; }
.video-js .vjs-play-progress,
.video-js .vjs-volume-level { background: var(--tv-primary) !important; }
.video-js .vjs-slider:focus { box-shadow: none !important; }

/* ── Single: Post meta ────────────────────────────────────────────────────── */
.tv-post-title {
  font-size: clamp(17px, 2.5vw, 22px);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 14px;
  color: var(--tv-text);
}

.tv-post-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.tv-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--tv-text-2);
}

/* Reactions */
.tv-reactions { display: flex; gap: 8px; margin-left: auto; }

.tv-react-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 24px;
  border: 1px solid var(--tv-border);
  background: var(--tv-surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text-2);
  transition: border-color .15s, background .15s, color .15s;
}

.tv-react-btn:hover { border-color: var(--tv-primary); color: var(--tv-primary); background: var(--tv-primary-light); }
.tv-react-btn.voted { background: var(--tv-primary); border-color: var(--tv-primary); color: #fff; }

/* ── Series bar ───────────────────────────────────────────────────────────── */
.tv-series-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-left: 3px solid var(--tv-primary);
  padding: 11px 16px;
  border-radius: var(--tv-radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--tv-text-2);
}

.tv-series-link { color: var(--tv-primary); font-weight: 600; }
.tv-series-link:hover { text-decoration: underline; }

.tv-series-season {
  background: var(--tv-surface-3);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tv-text-2);
}

.tv-series-ep-badge {
  background: var(--tv-primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Taxonomy pills ───────────────────────────────────────────────────────── */
.tv-taxonomy-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.tv-taxonomy-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-text-3);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-right: 4px;
}

.tv-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--tv-surface-3);
  color: var(--tv-text-2);
  border: 1px solid var(--tv-border);
  transition: background .15s, color .15s, border-color .15s;
}

.tv-tag:hover {
  background: var(--tv-primary-light);
  color: var(--tv-primary);
  border-color: var(--tv-primary);
}

/* ── Post content ─────────────────────────────────────────────────────────── */
.tv-post-content {
  background: var(--tv-surface);
  border-radius: var(--tv-radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--tv-text-2);
  line-height: 1.7;
  border: 1px solid var(--tv-border);
}

.tv-meta-desc-text {
  font-size: 14px;
  color: var(--tv-text-2);
  margin: 0;
}

/* ── Episode list ─────────────────────────────────────────────────────────── */
.tv-episode-list {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.tv-episode-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--tv-border);
  font-size: 14px;
  font-weight: 600;
  color: var(--tv-text);
}

.tv-ep-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--tv-text-3);
}

.tv-episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--tv-surface-3);
  transition: background .15s;
}

.tv-episode-item:last-child { border-bottom: none; }
.tv-episode-item:hover { background: var(--tv-surface-2); }
.tv-episode-item.current { background: var(--tv-primary-light); }

.tv-ep-num {
  flex-shrink: 0;
  width: 40px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tv-primary);
  text-align: center;
}

.tv-ep-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 5px;
}

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

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

.tv-ep-dur {
  font-size: 11px;
  color: var(--tv-text-3);
  margin-top: 2px;
}

.tv-ep-now {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--tv-primary);
  letter-spacing: .4px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .tv-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 768px) {
  .tv-header-inner { gap: 12px; }
  .tv-nav { display: none; }
  .tv-search-form input[type="search"] { width: 140px; }
  .tv-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .tv-grid.portrait { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .tv-post-meta-row { gap: 10px; }
  .tv-reactions { margin-left: 0; }
  .tv-footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .tv-container { padding: 0 14px; }
  .tv-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tv-grid.portrait { grid-template-columns: repeat(3, 1fr); }
}
