/* ============================================================
   pages.css — topbar, tabs, hero, queue/watched panels,
   stats drawer content, footer, responsive
   ============================================================ */

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px clamp(16px, 4vw, 40px);
  background: rgba(7, 7, 11, 0.72);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--line);
}
.brand {
  line-height: 1.25;
  flex-shrink: 0;
}
.brand-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-dot {
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ---- Tabs ---- */
.tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tab-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  /* Resting position. The pre-paint inline script in index.html sets
     --pill-left/--pill-width from the saved tab so a reload renders the
     pill already under the right tab — it never glides from Discover.
     moveTabPill() then takes over with inline left/width styles. */
  left: var(--pill-left, 4px);
  width: var(--pill-width, 0);
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  transition: left 0.4s var(--ease), width 0.4s var(--ease);
  z-index: 0;
}
.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.22s ease;
}
.tab:hover {
  color: var(--text-1);
}
.tab.is-active {
  color: var(--accent);
}
.tab-badge {
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-align: center;
  transition: color 0.22s ease, border-color 0.22s ease;
}
.tab.is-active .tab-badge {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* ---- Stage / panels ---- */
.stage {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px) 80px;
}
.panel[hidden] {
  display: none;
}
.panel.is-active {
  animation: panelIn 0.5s var(--ease) both;
}

/* ---- Panel heads ---- */
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.panel-title {
  font-size: clamp(26px, 4vw, 36px);
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0;
}

/* ---- Hero (discover) ---- */
.hero {
  text-align: center;
  padding: clamp(20px, 4vw, 48px) 0 4px;
}
.hero-title {
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1.08;
  max-width: 18ch;
  margin: 0 auto clamp(26px, 4.5vw, 44px);
}
.hero-title em {
  font-style: italic;
  background: linear-gradient(120deg, var(--accent), #ff9a6b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- Search bar ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 8px 8px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease, box-shadow 0.34s var(--ease), transform 0.2s var(--ease);
}
.search-bar:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg);
  transform: translateY(-1px);
}
.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  padding: 10px 6px;
}
.search-input::placeholder {
  color: var(--text-3);
}
.search-go {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #ff8a3d));
  color: var(--on-accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px var(--accent-glow);
  transition: transform 0.18s var(--ease), box-shadow 0.25s ease, filter 0.2s ease;
}
.search-go:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.06);
}
.search-go:active {
  transform: scale(0.94);
}
.hero-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-3);
}
.search-result {
  margin-top: clamp(28px, 5vw, 48px);
}

/* ---- Stats drawer content ---- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: border-color 0.2s ease, transform 0.2s var(--ease);
}
.stat-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
}
.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-3);
}
.stat-card.stat-wide {
  grid-column: 1 / -1;
}
.stat-card.stat-wide .stat-value {
  font-size: 20px;
}

.insights {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}
.insight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--line);
  animation: riseIn 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.insight-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.insight-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.insight-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  text-align: right;
  max-width: 60%;
}

.section-title {
  margin: 26px 0 4px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}
.histogram {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 150px;
  margin-top: 14px;
}
.hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 7px;
}
.hist-bar {
  width: 100%;
  max-width: 44px;
  height: 0;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(to top, var(--accent-border), var(--accent));
  transition: height 0.85s var(--ease);
  box-shadow: 0 0 18px var(--accent-soft);
}
.hist-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.hist-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 10px 20px 34px;
  font-size: 12px;
  color: var(--text-3);
}
.footer-name {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .spotlight-inner {
    grid-template-columns: 1fr;
  }
  .spotlight-poster {
    max-width: 210px;
    margin: 0 auto;
  }
  .tabs {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-actions {
    margin-left: auto;
  }
}

@media (max-width: 560px) {
  :root {
    --tile-min: 104px;
  }
  .search-bar {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
  }
  .search-bar .seg {
    width: 100%;
    justify-content: center;
  }
  .search-input {
    order: 2;
  }
  .search-go {
    order: 3;
  }
  .row-actions .btn-sm {
    padding: 8px 11px;
    font-size: 11.5px;
  }
  .row-card {
    gap: 12px;
    padding: 10px 12px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .toolbar .field-search {
    max-width: none;
  }
  .tab {
    padding: 9px 13px;
    font-size: 12.5px;
  }
}
