/*
 * 
 * Soultrob Video Web Layer — Master Stylesheet v5
 *
 * Sections:
 *   1.  Custom properties (design tokens)
 *   2.  Base reset & typography
 *   3.  Custom scrollbar
 *   4.  Layout — sidebar, main offset, bottom nav
 *   5.  Feed — container, slides, overlays, player, controls
 *   6.  Feed — top bar (counter pill, title, action buttons)
 *   7.  Feed — heart burst animation & like button
 *   8.  Feed — end slide ("all caught up")
 *   9.  Search — bar, discover hero, trending, category tiles
 *   10. Search — results header, filter pills, video grid, cards
 *   11. Liked — hero, stats bar, sort bar, video grid, cards
 *   12. Detail page — player, description, related grid
 *   13. Shared components — chips, spinners, skeletons, badges, ads
 *   14. Auth modal (sign-in prompt)
 *   15. Watch history
 *   16. Animations & transitions
 *   17. Responsive overrides
 */


/* ===========================================================
   1. CUSTOM PROPERTIES (design tokens)
   =========================================================== */

:root {
  /* Backgrounds */
  --bg-page:        #0d0e1a;
  --bg-elevated:    #141526;
  --bg-card:        rgba(255, 255, 255, 0.04);
  --bg-card-hover:  rgba(255, 255, 255, 0.07);

  /* Brand colours */
  --purple:         #8B5CF6;
  --purple-light:   #A78BFA;
  --purple-glow:    rgba(139, 92, 246, 0.25);
  --blue:           #3B82F6;
  --pink:           #EC4899;
  --heart:          #f43f5e;
  --heart-glow:     rgba(244, 63, 94, 0.25);

  /* Text */
  --text-1:         #F8FAFC;
  --text-2:         #CBD5E1;
  --text-3:         #94A3B8;
  --text-muted:     rgba(255, 255, 255, 0.38);

  /* Borders & dividers */
  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.14);
  --divider:        rgba(255, 255, 255, 0.06);

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #8B5CF6, #3B82F6);
  --grad-accent:    linear-gradient(135deg, #A78BFA, #EC4899);
  --grad-scrim-top: linear-gradient(to bottom, rgba(0,0,0,0.68) 0%, transparent 100%);
  --grad-scrim-btm: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.5) 45%, transparent 100%);

  /* Surfaces */
  --glass-bg:       rgba(13, 14, 26, 0.88);
  --glass-border:   rgba(255, 255, 255, 0.08);

  /* Layout dimensions */
  --sidebar-width:      240px;
  --bottom-nav-height:  60px;

  /* Radii */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* Shadows */
  --shadow-card:  0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lift:  0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(139, 92, 246, 0.2);
}


/* ===========================================================
   2. BASE RESET & TYPOGRAPHY
   =========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg-page);
  color: var(--text-1);
  font-family: 'DM Sans', 'Poppins', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; }
img { display: block; }
button { font-family: inherit; }


/* ===========================================================
   3. CUSTOM SCROLLBAR (WebKit)
   =========================================================== */

::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }


/* ===========================================================
   4. LAYOUT — SIDEBAR, MAIN OFFSET, BOTTOM NAV
   =========================================================== */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--divider);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 0 24px;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

@media (min-width: 1024px) {
  .sidebar { display: flex; }
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 800;
  font-family: 'DM Serif Display', serif;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar-logo p {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 20px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.sidebar-nav a:hover {
  background: rgba(139, 92, 246, 0.07);
  color: var(--text-1);
}

.sidebar-nav a.active {
  background: rgba(139, 92, 246, 0.11);
  color: var(--purple-light);
  font-weight: 600;
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  inset-block: 0;
  width: 3px;
  background: var(--grad-primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon-lg {
  font-size: 17px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-category-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.sidebar-category-label {
  padding: 4px 20px 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-category-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 20px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  transition: color 0.15s;
}

.sidebar-category-link:hover { color: var(--text-1); }

/* ── Mobile bottom navigation bar ─────────────────────── */

.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--bottom-nav-height);
  background: rgba(13, 14, 26, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--divider);
  z-index: 200;
  display: none;
}

@media (max-width: 1023px) {
  .bottom-nav { display: flex; }
}

.bottom-nav ul {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  list-style: none;
  height: 100%;
  padding: 0 4px;
}

.bottom-nav li { flex: 1; }

.mb-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 9px;
  font-weight: 500;
  height: 100%;
  width: 100%;
  transition: color 0.18s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.mb-nav-link .nav-icon {
  font-size: 19px;
  line-height: 1;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mb-nav-link:hover,
.mb-nav-link.active {
  color: var(--purple-light);
}

.mb-nav-link:hover .nav-icon,
.mb-nav-link.active .nav-icon {
  transform: scale(1.18);
}

.mb-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: var(--purple-light);
  border-radius: 50%;
}


/* ===========================================================
   5. FEED — CONTAINER, SLIDES, OVERLAYS, PLAYER, CONTROLS
   =========================================================== */

/* ── Feed container ────────────────────────────────────── */

.feed-container {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* z-index BELOW the top bar (top bar is z-index 500+) */
  z-index: 1;
}

.feed-container::-webkit-scrollbar { display: none; }

@media (min-width: 1024px) {
  .feed-container { left: var(--sidebar-width); }
}

/* ── Feed slide ────────────────────────────────────────── */

.feed-slide {
  position: relative;
  width: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Gradient scrims ───────────────────────────────────── */

.feed-overlay-top {
  position: absolute;
  inset: 0 0 auto 0;
  height: 140px;
  background: var(--grad-scrim-top);
  pointer-events: none;
  z-index: 10;
}

.feed-overlay-bottom {
  position: absolute;
  inset: auto 0 0 0;
  height: 240px;
  background: var(--grad-scrim-btm);
  pointer-events: none;
  z-index: 10;
}

/* ── Video info at bottom-left ─────────────────────────── */

.feed-info {
  position: absolute;
  /* leave 74px on right for like button */
  inset: auto 74px 0 0;
  z-index: 20;
  padding: 48px 12px 28px 16px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.feed-video-title {
  font-size: 13.5px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: rgba(139, 92, 246, 0.82);
  backdrop-filter: blur(6px);
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  color: white;
  margin-bottom: 7px;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: background 0.15s;
}

.category-badge:hover { background: rgba(139, 92, 246, 1); }

/* ── Feed like button — right side, well above controls ── */

.feed-like-btn {
  position: absolute;
  right: 14px;
  bottom: 120px;   /* enough above the controls bar */
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.feed-like-btn .heart-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feed-like-btn:hover .heart-icon,
.feed-like-btn.liked .heart-icon {
  transform: scale(1.12);
}

.feed-like-btn .like-count {
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ── YouTube player wrapper ────────────────────────────── */

.player-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.yt-iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 56.25vw;
  min-height: 100%;
  min-width: 177.78vh;
  border: none;
  pointer-events: none;
}

/* Click-capture sits above iframe, below controls */
.player-click-capture {
  position: absolute;
  inset: 0;
  /* z-index 5 — below controls (z-index 20) */
  z-index: 5;
  cursor: pointer;
}

/* Error overlay */
.player-error-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.85);
}

.player-error-overlay.visible {
  display: flex;
}

.player-error-overlay p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 0 32px;
}

.player-error-icon {
  font-size: 44px;
}

/* ── Thumbnail placeholder ─────────────────────────────── */

.thumb-placeholder {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  /* z-index 2 — below iframe controls layer */
  z-index: 2;
  transition: opacity 0.35s ease;
}

.thumb-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Custom video controls bar ─────────────────────────── */
/*
 * IMPORTANT z-index stack inside .player-wrapper:
 *   2  — thumb-placeholder
 *   3  — yt-iframe (pointer-events:none so clicks pass through)
 *   5  — player-click-capture  (catches taps for double-tap logic)
 *   20 — custom-controls       (sits ABOVE click-capture so buttons receive clicks)
 *
 * controls must be ABOVE click-capture — otherwise ctrl button taps land on
 * the capture layer and trigger double-tap logic instead of the control action.
 */

.custom-controls {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 20;
  padding: 12px 16px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
}

/* Show controls on explicit toggle or hover */
.player-wrapper:hover .custom-controls,
.player-wrapper.controls-visible .custom-controls {
  opacity: 1;
  pointer-events: auto;
}

/* ── Play/Pause button ─────────────────────────────────── */

.ctrl-play-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 0;
  transition: background 0.18s, transform 0.15s;
}

.ctrl-play-btn:hover {
  background: rgba(139, 92, 246, 0.65);
  transform: scale(1.06);
}

.ctrl-play-btn svg {
  width: 22px;
  height: 22px;
}

/* ── Seek bar ──────────────────────────────────────────── */

.ctrl-seek-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s;
}

.ctrl-seek-track:hover { height: 7px; }

.ctrl-seek-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 4px;
  pointer-events: none;
  transition: width 0.1s linear;
}

.ctrl-seek-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: var(--purple-light);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.ctrl-seek-track:hover .ctrl-seek-thumb { opacity: 1; }

/* ── Duration text ─────────────────────────────────────── */

.ctrl-duration {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Mute & Fullscreen buttons ─────────────────────────── */

.ctrl-mute-btn,
.ctrl-fullscreen-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.18s, color 0.18s, transform 0.15s;
}

.ctrl-mute-btn:hover,
.ctrl-fullscreen-btn:hover {
  background: rgba(139, 92, 246, 0.55);
  color: white;
  transform: scale(1.06);
}

.ctrl-mute-btn svg,
.ctrl-fullscreen-btn svg {
  width: 20px;
  height: 20px;
}

/* Watch progress bar at bottom of slide */
.feed-watched-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #8B5CF6, #3B82F6);
  border-radius: 0;
  z-index: 22;
  transition: width 0.5s linear;
  pointer-events: none;
}


/* ===========================================================
   6. FEED — TOP BAR
   =========================================================== */

/*
 * All top-bar elements are position:fixed with z-index > feed-container (z-index:1).
 * z-index 500 puts them above everything including auth modal backdrop.
 * The auth-modal backdrop uses z-index 9000 so auth modal is above top bar.
 */

.feed-counter-pill {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 62px;
  z-index: 500;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
  pointer-events: none;
  letter-spacing: 0.02em;
}

.feed-title-bar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

.feed-home-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 12px;
  z-index: 500;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: white;
  font-size: 19px;
  transition: background 0.2s, transform 0.18s;
}

.feed-home-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.06);
}

.feed-search-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: 12px;
  z-index: 500;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: white;
  transition: background 0.2s, transform 0.18s;
}

.feed-search-btn:hover {
  background: rgba(139, 92, 246, 0.45);
  transform: scale(1.06);
}


/* ===========================================================
   7. FEED — HEART BURST & LIKE BUTTON
   =========================================================== */

.heart-burst-overlay {
  position: fixed;
  z-index: 9500;
  pointer-events: none;
  font-size: 80px;
  animation: heartBurst 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  transform-origin: center;
  filter: drop-shadow(0 4px 20px rgba(255, 50, 80, 0.7));
}

@keyframes heartBurst {
  0%   { transform: scale(0.2) rotate(-12deg); opacity: 1; }
  55%  { transform: scale(1.35) rotate(4deg);  opacity: 1; }
  100% { transform: scale(1.7)  rotate(0deg);  opacity: 0; }
}

@keyframes heartPop {
  0%   { transform: scale(1);   }
  40%  { transform: scale(1.45); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1);   }
}

.heart-pop { animation: heartPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }


/* ===========================================================
   8. FEED — END SLIDE
   =========================================================== */

.caught-up-slide {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-page) !important;
}

.caught-up-icon {
  font-size: 56px;
  margin-bottom: 6px;
  animation: floatUp 2s ease-in-out infinite alternate;
}

@keyframes floatUp {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}

.caught-up-title {
  font-size: 17px;
  font-weight: 800;
  color: white;
  margin: 0;
}

.caught-up-sub {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
}

.caught-up-refresh {
  margin-top: 16px;
  padding: 11px 28px;
  border-radius: 24px;
  background: var(--grad-primary);
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
  transition: opacity 0.18s;
}

.caught-up-refresh:hover { opacity: 0.88; }

/* Load more spinner */
#feed-load-spinner {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: none;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

#feed-load-spinner.visible {
  display: flex;
}


/* ===========================================================
   9. SEARCH — BAR, HERO, TRENDING, CATEGORIES
   =========================================================== */

.search-page-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

.search-bar-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-page);
  padding: 14px 0 10px;
}

.search-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 0 16px;
  height: 46px;
  transition: border-color 0.2s;
}

.search-bar-inner:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-glow);
}

.search-bar-inner input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-1);
  font-family: inherit;
}

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

.search-bar-inner .search-icon-inner {
  color: var(--text-3);
  flex-shrink: 0;
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  display: none;
}

.search-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}

.category-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-decoration: none;
  color: var(--text-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
  text-align: center;
}

.category-tile:hover {
  background: var(--bg-card-hover);
  border-color: var(--purple);
  transform: translateY(-2px);
}

.category-tile-emoji { font-size: 28px; line-height: 1; }

.category-tile-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}

.trending-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.trending-card {
  display: flex;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  text-decoration: none;
  color: var(--text-1);
  transition: background 0.18s, border-color 0.18s;
}

.trending-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.trending-thumb {
  width: 72px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}

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

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

.trending-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 5px;
}


/* ===========================================================
   10. SEARCH — RESULTS
   =========================================================== */

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.search-results-count {
  font-size: 13px;
  color: var(--text-3);
}

.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: 16px;
}

.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-elevated);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.filter-pill:hover { border-color: var(--purple); color: var(--purple-light); }

.filter-pill.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--purple);
  color: var(--purple-light);
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-1);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.video-card-thumb {
  position: relative;
  aspect-ratio: 9/14;
  overflow: hidden;
  background: var(--bg-elevated);
}

.video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

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

.video-card-gradient {
  position: absolute;
  inset: auto 0 0 0;
  height: 70%;
  background: var(--grad-scrim-btm);
  pointer-events: none;
}

.video-card-duration {
  position: absolute;
  bottom: 36px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: rgba(0, 0, 0, 0.58);
  padding: 2px 6px;
  border-radius: 5px;
}

.video-card-likes {
  position: absolute;
  bottom: 36px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 7px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.video-card-category {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 9.5px;
  font-weight: 700;
  color: white;
  background: rgba(139, 92, 246, 0.85);
  padding: 2px 8px;
  border-radius: 5px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 8px 10px 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ===========================================================
   11. LIKED — HERO, STATS, SORT, GRID
   =========================================================== */

.liked-hero {
  text-align: center;
  padding: 40px 20px 28px;
}

.liked-hero-icon {
  font-size: 52px;
  margin-bottom: 12px;
  display: block;
}

.liked-hero h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.liked-hero p {
  font-size: 13.5px;
  color: var(--text-3);
}

.liked-stats-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}

.liked-stat { text-align: center; }

.liked-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--purple-light);
}

.liked-stat-label {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.liked-sort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.liked-sort-bar::-webkit-scrollbar { display: none; }

.liked-sort-label {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.sort-chip {
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.15s;
}

.sort-chip:hover,
.sort-chip.active {
  border-color: var(--purple);
  color: var(--purple-light);
  background: rgba(139, 92, 246, 0.12);
}

.liked-grid-wrapper { padding: 16px; }


/* ===========================================================
   12. DETAIL PAGE — PLAYER, DESCRIPTION, RELATED
   =========================================================== */

.detail-player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.detail-player-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

.detail-player-wrapper .player-click-capture {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* Detail controls live in the player wrapper and must be above click-capture */
.detail-player-wrapper .custom-controls {
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
  padding: 14px 16px 20px;
  gap: 12px;
}

/* Show when hovered or class toggled */
.detail-player-wrapper:hover .custom-controls,
.detail-player-wrapper.controls-visible .custom-controls {
  opacity: 1;
  pointer-events: auto;
}

.detail-like-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.2s, border-color 0.2s;
}

.detail-like-btn.liked {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.32);
}

.detail-like-btn .like-count {
  color: var(--text-3);
  transition: color 0.2s;
}

.detail-like-btn.liked .like-count {
  color: #FF6B6B;
}


/* ===========================================================
   13. SHARED COMPONENTS
   =========================================================== */

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Fade in up */
.fade-in-up {
  animation: fadeInUp 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Ad container */
.ad-slide {
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}


/* ===========================================================
   14. AUTH MODAL (beautiful sign-in prompt)
   =========================================================== */

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: authBackdropIn 0.28s ease forwards;
}

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

.auth-modal-backdrop.closing {
  animation: authBackdropOut 0.22s ease forwards;
}

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

.auth-modal-sheet {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(170deg, #1c1d30 0%, #141526 100%);
  border-radius: 28px 28px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  border-top: 1px solid rgba(139, 92, 246, 0.24);
  box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255,255,255,0.04);
  animation: authSheetIn 0.34s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  position: relative;
  overflow: hidden;
}

@keyframes authSheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.auth-modal-backdrop.closing .auth-modal-sheet {
  animation: authSheetOut 0.22s ease forwards;
}

@keyframes authSheetOut {
  from { transform: translateY(0); }
  to   { transform: translateY(110%); }
}

/* Background glow */
.auth-modal-glow {
  position: absolute;
  top: -70px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

/* Drag handle */
.auth-modal-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin: 14px auto 0;
}

/* Close button */
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
  line-height: 1;
}

.auth-modal-close:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.auth-modal-body {
  padding: 20px 28px 28px;
}

.auth-modal-icon {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(139,92,246,0.22), rgba(59,130,246,0.16));
  border: 1px solid rgba(139,92,246,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  margin: 0 auto 18px;
}

.auth-modal-headline {
  font-size: 21px;
  font-weight: 800;
  color: white;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}

.auth-modal-subtext {
  font-size: 13.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.55;
  margin-bottom: 22px;
}

.auth-modal-benefits {
  list-style: none;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.auth-modal-benefits li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.4;
}

.auth-benefit-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.auth-benefit-icon.purple { background: rgba(139,92,246,0.16); }
.auth-benefit-icon.pink   { background: rgba(236,72,153,0.14); }
.auth-benefit-icon.blue   { background: rgba(59,130,246,0.14); }
.auth-benefit-icon.green  { background: rgba(16,185,129,0.14); }
.auth-benefit-icon.orange { background: rgba(245,158,11,0.14); }

.auth-modal-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.auth-btn-login {
  flex: 1;
  padding: 15px 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #8B5CF6, #3B82F6);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 4px 22px rgba(139,92,246,0.42);
  font-family: inherit;
}

.auth-btn-login:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.auth-btn-signup {
  flex: 1;
  padding: 15px 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.18s, transform 0.18s;
  font-family: inherit;
}

.auth-btn-signup:hover {
  background: rgba(255,255,255,0.13);
  transform: translateY(-1px);
}

.auth-modal-skip {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  padding: 6px;
  font-family: inherit;
  transition: color 0.18s;
}

.auth-modal-skip:hover { color: var(--text-3); }


/* ===========================================================
   15. WATCH HISTORY PAGE
   =========================================================== */

.history-page-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 20px;
}

.history-header h1 {
  font-size: 20px;
  font-weight: 800;
}

.history-clear-btn {
  padding: 7px 16px;
  border-radius: 99px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.24);
  color: var(--heart);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
  font-family: inherit;
}

.history-clear-btn:hover { background: rgba(244, 63, 94, 0.2); }

.history-group { margin-bottom: 28px; }

.history-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.history-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-1);
  margin-bottom: 8px;
  transition: background 0.15s;
  position: relative;
}

.history-card:hover { background: var(--bg-card-hover); }

.history-thumb {
  position: relative;
  width: 90px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-card);
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--purple);
  border-radius: 0 0 0 8px;
  min-width: 4px;
}

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

.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 5px;
}

.history-meta {
  font-size: 11px;
  color: var(--text-3);
}

.history-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
}

.history-card:hover .history-remove-btn { opacity: 1; }
.history-remove-btn:hover {
  background: rgba(244, 63, 94, 0.7);
  color: white;
}

.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.history-empty-icon { font-size: 52px; display: block; margin-bottom: 14px; }
.history-empty h2   { font-size: 17px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.history-empty p    { font-size: 13px; line-height: 1.5; }


/* ===========================================================
   16. ANIMATIONS
   =========================================================== */

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.slide-up    { animation: slideUp  0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.scale-in    { animation: scaleIn  0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards; }


/* ===========================================================
   17. RESPONSIVE OVERRIDES
   =========================================================== */

@media (max-width: 480px) {
  .feed-container { left: 0; }
  .category-grid  { grid-template-columns: 1fr 1fr; }
  .video-grid     { grid-template-columns: 1fr 1fr; gap: 8px; }
  .auth-modal-body { padding: 18px 20px 24px; }
}

@media (min-width: 1024px) {
  .feed-container { left: var(--sidebar-width); }
  .feed-home-btn,
  .feed-counter-pill,
  .feed-title-bar { left: calc(var(--sidebar-width) + 12px); }
  .feed-counter-pill { left: calc(var(--sidebar-width) + 62px); }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
}