/*
 * videos/static/videos/css/discover.css
 *
 * YouTube-style Discover page — Soultrob.
 *
 * Rules:
 *   - All colours via CSS custom properties (--st-*).
 *   - No Tailwind colour utility classes.
 *   - No colour gradients anywhere.
 *   - Brand constants permitted in :root only: #7c3aed (purple), #ef4444 (heart).
 *   - Shimmer animation uses solid colour steps, not colour gradients.
 */

/* ══════════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --st-bg:               #ffffff;
  --st-surface:          #f8f9fa;
  --st-border:           #e5e7eb;

  /* Text */
  --st-text-primary:     #0f0f0f;
  --st-text-muted:       #606060;

  /* Chips */
  --st-chip-bg:          #f2f2f2;
  --st-chip-text:        #0f0f0f;
  --st-chip-active-bg:   #0f0f0f;
  --st-chip-active-text: #ffffff;

  /* Search */
  --st-search-bg:        #f2f2f2;
  --st-search-border:    transparent;

  /* Elevation */
  --st-card-shadow:       0 1px 4px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.05);
  --st-card-shadow-hover: 0 4px 16px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);

  /* Skeleton */
  --st-skel-a:           #e5e7eb;
  --st-skel-b:           #eeeff1;

  /* Brand */
  --st-purple:           #7c3aed;
  --st-heart:            #ef4444;

  /* Layout */
  --st-topbar-h:         56px;
  --st-chip-h:           52px;
}

body.dark-mode {
  /* Dark mode bg matches sidebar (#0d0f1a) for visual continuity */
  --st-bg:               #0d0f1a;
  --st-surface:          #141620;
  --st-border:           #1e2030;
  --st-text-primary:     #e8eaf2;
  --st-text-muted:       #7a84a0;
  --st-chip-bg:          #181b28;
  --st-chip-text:        #c8d0e0;
  --st-chip-active-bg:   #c8d0e0;
  --st-chip-active-text: #0d0f1a;
  --st-search-bg:        #0f1120;
  --st-search-border:    #252836;
  --st-card-shadow:       0 1px 4px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.35);
  --st-card-shadow-hover: 0 4px 16px rgba(0,0,0,0.7), 0 1px 4px rgba(0,0,0,0.5);
  --st-skel-a:           #181b28;
  --st-skel-b:           #1e2130;
}


/* ══════════════════════════════════════════════════════════════════
   PAGE WRAPPER
   ══════════════════════════════════════════════════════════════════ */

.discover-wrapper {
  background: var(--st-bg);
  color: var(--st-text-primary);
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  transition: background 200ms ease, color 200ms ease;
}


/* ══════════════════════════════════════════════════════════════════
   TOPBAR
   ══════════════════════════════════════════════════════════════════ */

.discover-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--st-topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--st-bg);
  border-bottom: 1px solid var(--st-border);
  transition: background 200ms ease, border-color 200ms ease;
}

.discover-topbar-left   { flex: 0 0 auto; }
.discover-topbar-centre { flex: 1 1 auto; display: flex; justify-content: center; }
.discover-topbar-right  { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

/* Logo */
.discover-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.discover-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--st-purple);
  letter-spacing: -0.3px;
}

/* Search */
.discover-search-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
}
.discover-search-input {
  width: 100%;
  height: 36px;
  padding: 0 44px 0 16px;
  background: var(--st-search-bg);
  border: 1.5px solid var(--st-search-border);
  border-radius: 20px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--st-text-primary);
  outline: none;
  transition: border-color 150ms ease, background 200ms ease;
  box-sizing: border-box;
}
.discover-search-input:focus {
  border-color: var(--st-text-primary);
  background: var(--st-bg);
}
.discover-search-input::placeholder { color: var(--st-text-muted); }

.discover-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--st-text-muted);
  display: flex;
  align-items: center;
  transition: color 150ms ease;
}
.discover-search-btn:hover { color: var(--st-text-primary); }

/* Mobile search button — hidden on desktop */
.discover-mobile-search-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--st-text-primary);
  align-items: center;
  justify-content: center;
}

/* Theme toggle */
.discover-theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.discover-theme-track {
  display: flex;
  align-items: center;
  width: 52px;
  height: 28px;
  background: var(--st-chip-bg);
  border-radius: 14px;
  padding: 3px;
  border: 1.5px solid var(--st-border);
  transition: background 200ms ease;
  box-sizing: border-box;
}
.discover-theme-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--st-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 200ms ease, background 200ms ease;
  color: var(--st-text-muted);
}
body.dark-mode .discover-theme-thumb { transform: translateX(24px); }

.icon-sun  { display: block; }
.icon-moon { display: none;  }
body.dark-mode .icon-sun  { display: none;  }
body.dark-mode .icon-moon { display: block; }


/* ══════════════════════════════════════════════════════════════════
   CHIP STRIP
   ══════════════════════════════════════════════════════════════════ */

.discover-chip-strip {
  position: sticky;
  top: var(--st-topbar-h);
  z-index: 39;
  height: var(--st-chip-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  background: var(--st-bg);
  border-bottom: 1px solid var(--st-border);
  overflow-x: auto;
  scrollbar-width: none;
  transition: background 200ms ease;
}
.discover-chip-strip::-webkit-scrollbar { display: none; }

.discover-chip {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  background: var(--st-chip-bg);
  color: var(--st-chip-text);
  border: 1.5px solid var(--st-border);
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease,
              border-color 150ms ease, transform 100ms ease;
  line-height: 1;
  letter-spacing: 0.01em;
}
.discover-chip:hover {
  transform: translateY(-1px);
  border-color: var(--st-text-muted);
  color: var(--st-text-primary);
}
.discover-chip--active {
  background: var(--st-chip-active-bg);
  color: var(--st-chip-active-text);
  border-color: transparent;
  font-weight: 700;
}
/* Preferred but not active — purple outline, no fill */
.discover-chip--preferred:not(.discover-chip--active) {
  border-color: var(--st-purple);
  color: var(--st-purple);
}


/* ══════════════════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════════════════ */

.discover-main {
  padding: 24px 32px 64px;
}


/* ══════════════════════════════════════════════════════════════════
   FEATURED HERO
   ══════════════════════════════════════════════════════════════════ */

.discover-hero { margin-bottom: 40px; }

.discover-hero-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.discover-hero-main {
  display: block;
  text-decoration: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  box-shadow: var(--st-card-shadow);
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
}
.discover-hero-main:hover {
  transform: scale(1.01);
  box-shadow: var(--st-card-shadow-hover);
}

.discover-hero-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--st-border);
}
.discover-hero-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.discover-hero-body { padding: 14px 16px 16px; }
.discover-hero-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--st-text-primary);
  margin: 0 0 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}

/* Hero play overlay */
.discover-hero-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.discover-hero-play-overlay svg {
  width: 48px;
  height: 48px;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  padding: 12px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 180ms ease;
}
.discover-hero-main:hover .discover-hero-play-overlay svg { opacity: 1; }

/* Mini stack */
.discover-hero-stack { display: flex; flex-direction: column; gap: 12px; }
.discover-mini-card {
  display: flex;
  gap: 10px;
  text-decoration: none;
  padding: 8px;
  border-radius: 10px;
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  box-shadow: var(--st-card-shadow);
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
}
.discover-mini-card:hover {
  transform: translateX(3px);
  box-shadow: var(--st-card-shadow-hover);
}
.discover-mini-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  height: 67px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--st-border);
}
.discover-mini-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.discover-mini-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 0;
}
.discover-mini-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--st-text-primary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  font-family: 'DM Sans', sans-serif;
}
.discover-mini-stats { margin-top: 6px; }


/* ══════════════════════════════════════════════════════════════════
   CATEGORY SECTIONS
   ══════════════════════════════════════════════════════════════════ */

.discover-section { margin-bottom: 40px; }

/* Preferred sections: purple left-border accent */
.discover-section--preferred .discover-section-header {
  border-left: 3px solid var(--st-purple);
  padding-left: 12px;
}

.discover-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.discover-section-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.discover-section-emoji { font-size: 20px; line-height: 1; }
.discover-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--st-text-primary);
  margin: 0;
  font-family: 'DM Sans', sans-serif;
}

/* "For You" badge */
.discover-pref-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--st-purple);
  background: rgba(124,58,237,0.09);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(124,58,237,0.18);
  font-family: 'DM Sans', sans-serif;
}

/* "View more" link */
.discover-viewmore {
  font-size: 13px;
  font-weight: 500;
  color: var(--st-purple);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 150ms ease;
  position: relative;
  font-family: 'DM Sans', sans-serif;
}
.discover-viewmore::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--st-purple);
  transition: width 200ms ease;
}
.discover-viewmore:hover::after { width: 100%; }
.discover-viewmore:hover { opacity: 0.8; }


/* ══════════════════════════════════════════════════════════════════
   CAROUSEL
   ══════════════════════════════════════════════════════════════════ */

.discover-carousel { position: relative; }

.discover-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 2px 10px;
}
.discover-row::-webkit-scrollbar { display: none; }
.discover-row-item { flex-shrink: 0; }

/* Arrow buttons */
.discover-arrow {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--st-bg);
  border: 1.5px solid var(--st-border);
  color: var(--st-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 2;
  opacity: 0;
  transition: opacity 180ms ease, transform 150ms ease, background 200ms ease;
}
.discover-carousel:hover .discover-arrow:not(.discover-arrow--hidden) { opacity: 1; }
.discover-arrow:hover {
  transform: translateY(-50%) scale(1.08);
  background: var(--st-surface);
}
.discover-arrow--left  { left: -18px; }
.discover-arrow--right { right: -18px; }
.discover-arrow--hidden { opacity: 0 !important; pointer-events: none; }


/* ══════════════════════════════════════════════════════════════════
   VIDEO CARD
   ══════════════════════════════════════════════════════════════════ */

.discover-card {
  width: 220px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  box-shadow: var(--st-card-shadow);
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
  cursor: pointer;
}
.discover-card:hover {
  transform: scale(1.025);
  box-shadow: var(--st-card-shadow-hover);
}

.discover-card-thumb-link { display: block; text-decoration: none; }
.discover-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--st-border);
}
.discover-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 180ms ease;
}
.discover-card:hover .discover-card-thumb { filter: brightness(1.05); }

/* Duration badge */
.discover-card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

/* Category badge overlay on card thumb */
.discover-card-cat-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(124,58,237,0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  padding: 3px 9px;
  border-radius: 6px;
  line-height: 1.4;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Play overlay */
.discover-card-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.discover-card-play-overlay span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: background 180ms ease, opacity 180ms ease;
}
.discover-card:hover .discover-card-play-overlay span {
  background: rgba(0,0,0,0.58);
  opacity: 1;
}

/* Card body */
.discover-card-body { padding: 10px 12px 12px; }
.discover-card-title-link { text-decoration: none; }
.discover-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--st-text-primary);
  margin: 0 0 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
  font-family: 'DM Sans', sans-serif;
  transition: color 150ms ease;
}
.discover-card:hover .discover-card-title { color: var(--st-purple); }

/* Stats */
.discover-card-stats { display: flex; gap: 12px; align-items: center; }
.discover-card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--st-text-muted);
  font-family: 'DM Sans', sans-serif;
}
.discover-stat-icon--heart {
  color: var(--st-heart);
  stroke: var(--st-heart);
}


/* ══════════════════════════════════════════════════════════════════
   SKELETON
   No colour gradients — alternating solid opacity steps only.
   ══════════════════════════════════════════════════════════════════ */

@keyframes discover-shimmer {
  0%   { opacity: 1; }
  50%  { opacity: 0.5; }
  100% { opacity: 1; }
}

.discover-skel {
  background: var(--st-skel-a);
  animation: discover-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.discover-skeleton-section { margin-bottom: 40px; }
.discover-skeleton-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}
.discover-skel--title  { width: 180px; height: 24px; }
.discover-skel--link   { width: 80px;  height: 18px; }
.discover-skeleton-row { display: flex; gap: 14px; overflow: hidden; }
.discover-skeleton-card { width: 220px; flex-shrink: 0; }
.discover-skel--thumb  { width: 220px; height: 124px; border-radius: 12px; margin-bottom: 10px; }
.discover-skel--line   { height: 14px; margin-bottom: 6px; }
.discover-skel--line-long  { width: 80%; }
.discover-skel--line-short { width: 50%; }
.discover-skel--stats  { width: 100px; height: 12px; border-radius: 4px; }


/* ══════════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════════ */

.discover-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  color: var(--st-text-muted);
}
.discover-empty-title {
  font-size: 18px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--st-text-primary);
  font-family: 'DM Sans', sans-serif;
}
.discover-empty-sub {
  font-size: 14px;
  margin: 0;
  font-family: 'DM Sans', sans-serif;
}


/* ══════════════════════════════════════════════════════════════════
   CAUGHT-UP STATE
   ══════════════════════════════════════════════════════════════════ */

.discover-caught-up {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 8px;
  color: var(--st-text-muted);
}
.discover-caught-up p {
  font-size: 16px;
  font-weight: 600;
  color: var(--st-text-primary);
  margin: 10px 0 4px;
  font-family: 'DM Sans', sans-serif;
}
.discover-caught-up span {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}


/* ══════════════════════════════════════════════════════════════════
   SECTION FADE-IN ANIMATION
   ══════════════════════════════════════════════════════════════════ */

@keyframes discover-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.discover-section-new {
  animation: discover-fade-in 240ms ease-out both;
}


/* ══════════════════════════════════════════════════════════════════
   MOBILE SEARCH OVERLAY
   ══════════════════════════════════════════════════════════════════ */

.discover-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--st-bg);
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 12px;
}
.discover-search-overlay.open { display: flex; }

.discover-search-overlay-input {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  background: var(--st-surface);
  border: 1.5px solid var(--st-border);
  border-radius: 10px;
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  color: var(--st-text-primary);
  outline: none;
  box-sizing: border-box;
}
.discover-search-overlay-close {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--st-purple);
  cursor: pointer;
  padding: 4px;
  align-self: flex-end;
  font-family: 'DM Sans', sans-serif;
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
  .discover-hero-grid   { grid-template-columns: 1fr; }
  .discover-hero-stack  { display: none; }
  .discover-main        { padding: 20px 20px 64px; }
  .discover-topbar      { padding: 0 16px; }
  .discover-chip-strip  { padding: 0 16px; }
  .discover-card        { width: 200px; }
  .discover-skeleton-card { width: 200px; }
  .discover-skel--thumb { width: 200px; height: 112px; }
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .discover-topbar-centre        { display: none; }
  .discover-mobile-search-btn    { display: flex; }
  .discover-topbar               { gap: 8px; padding: 0 12px; }
  .discover-chip-strip           { padding: 0 12px; height: 44px; }
  .discover-chip                 { padding: 5px 10px; font-size: 11px; }
  .discover-main                 { padding: 12px 12px 80px; }
  .discover-hero                 { display: none; }
  .discover-card                 { width: 160px; }
  .discover-skeleton-card        { width: 160px; }
  .discover-skel--thumb          { width: 160px; height: 90px; }
  .discover-row                  { gap: 10px; }
  /* Arrows always hidden on mobile — CSS only, no JS involvement */
  .discover-arrow                { display: none; }
  .discover-section-header       { flex-wrap: wrap; gap: 6px; }
  .discover-viewmore             { font-size: 12px; }
  .discover-section-title        { font-size: 16px; }
  .discover-card-title           { font-size: 12px; }
  .discover-card-stat            { font-size: 11px; }
}
