/* ============================================================
   StreamX Main CSS — v1.0.0
   Mobile-first, dark by default, perfect 16:9 thumbnails
============================================================ */

/* ── Variables ── */
:root {
  --accent:        #ff6200;
  --accent-dark:   #cc4e00;
  --accent-glow:   rgba(255,98,0,0.15);

  --bg:            #0d0d0d;
  --surface:       #161616;
  --surface2:      #1e1e1e;
  --surface3:      #2a2a2a;
  --border:        #2e2e2e;
  --overlay:       rgba(0,0,0,0.75);

  --text:          #f0f0f0;
  --text-muted:    #aaaaaa;
  --text-dim:      #666666;

  --header-h:      58px;
  --sidebar-w:     230px;
  --sidebar-col:   62px;
  --mobile-nav-h:  58px;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --radius-full:   9999px;

  --shadow:        0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.7);

  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --trans:         0.18s ease;
}

/* Light mode */
html.sx-light {
  --bg:       #f2f2f2;
  --surface:  #ffffff;
  --surface2: #f8f8f8;
  --surface3: #ebebeb;
  --border:   #dddddd;
  --text:     #111111;
  --text-muted:#555555;
  --text-dim: #999999;
  --overlay:  rgba(0,0,0,0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* overflow-x on html, NOT body — body overflow:hidden kills vertical scroll on iOS */
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  /* NO overflow-x:hidden here — it prevents scrolling on iOS Safari */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Scroll lock — iOS-safe approach using position:fixed + stored scroll offset */
body.sx-no-scroll {
  overflow: hidden;
  position: fixed;
  left: 0;
  right: 0;
  /* top is set dynamically via JS to preserve scroll position */
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ── Layout Wrapper ── */
.sx-wrap { display: flex; flex-direction: column; min-height: 100vh; }

.sx-layout {
  display: flex;
  flex: 1;
}

/* ── Header ── */
.sx-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: box-shadow var(--trans);
}
.sx-header.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,0.6); }
.sx-header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  gap: 10px;
}
.sx-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Hamburger */
.sx-hamburger {
  width: 38px; height: 38px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  transition: background var(--trans);
}
.sx-hamburger:hover { background: var(--surface2); }
.sx-hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--trans), opacity var(--trans);
}
.sx-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sx-hamburger.open span:nth-child(2) { opacity: 0; }
.sx-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Logo */
.sx-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}
.sx-logo-icon { color: var(--accent); flex-shrink: 0; }
.sx-logo-text em { color: var(--accent); font-style: normal; }

/* Desktop: logo in left, mobile logo hidden */
.sx-logo-mobile { display: none; }
.sx-logo-desktop { display: flex; }

/* Header center — holds search on desktop, logo on mobile */
.sx-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* Search */
.sx-header-search {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
}
.sx-search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: border-color var(--trans);
}
.sx-search-wrap:focus-within { border-color: var(--accent); }
.sx-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 9px 14px;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
}
.sx-search-input::placeholder { color: var(--text-dim); }
.sx-search-btn {
  padding: 0 14px;
  height: 38px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: color var(--trans);
  border-left: 1px solid var(--border);
}
.sx-search-btn:hover { color: var(--accent); }

/* Header right */
.sx-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.sx-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--trans), color var(--trans);
}
.sx-icon-btn:hover { background: var(--surface2); color: var(--text); }

/* Theme toggle icon switching */
body:not(.sx-light) .sx-icon-sun { display: none !important; }
body:not(.sx-light) .sx-icon-moon { display: block !important; }
html.sx-light body .sx-icon-moon { display: none !important; }
html.sx-light body .sx-icon-sun  { display: block !important; }

/* Sign in button */
.sx-btn-signin {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  transition: background var(--trans), transform var(--trans);
}
.sx-btn-signin:hover { background: var(--accent-dark); transform: translateY(-1px); }
.sx-btn-signin span { display: none; }

/* User dropdown */
.sx-user-wrap { position: relative; }
.sx-user-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color var(--trans);
}
.sx-user-btn:hover { border-color: var(--accent); }
.sx-avatar { width: 100%; height: 100%; object-fit: cover; }
.sx-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  display: none;
}
.sx-dropdown.open { display: block; }
.sx-dropdown-name {
  padding: 12px 14px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sx-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  transition: background var(--trans), color var(--trans);
}
.sx-dd-item:hover { background: var(--surface2); color: var(--text); }
.sx-dd-divider { height: 1px; background: var(--border); }

/* ── Overlay — GLOBALLY hidden by default, shown only when sidebar opens on mobile ── */
.sx-overlay {
  display: none;           /* hidden at ALL breakpoints unless .open */
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 900;
}
.sx-overlay.open { display: block; }

/* ── Mobile search panel ── */
.sx-mobile-search {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--surface);
  padding: 10px 14px;
  z-index: 1100;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sx-mobile-search.open { display: flex; }
.sx-mobile-search form { flex: 1; display: flex; gap: 8px; }
.sx-mobile-search input {
  flex: 1;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 9px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.sx-mobile-search input:focus { border-color: var(--accent); }
.sx-mobile-search button { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0 6px; }
.sx-mobile-search-close { font-size: 22px; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 4px; }

/* ── Sidebar ── */
.sx-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 800;
  transition: transform var(--trans), width var(--trans);
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.sx-sidebar::-webkit-scrollbar { width: 4px; }
.sx-sidebar::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

.sx-sidebar.collapsed {
  width: var(--sidebar-col);
}
.sx-sidebar.collapsed .sx-nav-label,
.sx-sidebar.collapsed .sx-nav-heading,
.sx-sidebar.collapsed .sx-cat-count,
.sx-sidebar.collapsed .sx-badge,
.sx-sidebar.collapsed .sx-sidebar-copy,
.sx-sidebar.collapsed .sx-nav-footer-links { display: none; }
.sx-sidebar.collapsed .sx-nav-link { justify-content: center; padding: 10px 0; }
.sx-sidebar.collapsed .sx-cat-dot { margin: 0; }

.sx-sidebar-inner { padding: 12px 0 24px; }
.sx-nav-section { padding: 4px 0; }
.sx-nav-heading {
  display: block;
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sx-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 0;
  transition: background var(--trans), color var(--trans);
  position: relative;
  white-space: nowrap;
}
.sx-nav-link svg { flex-shrink: 0; }
.sx-nav-link:hover { background: var(--surface2); color: var(--text); }
.sx-nav-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 700;
}
.sx-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.sx-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.sx-cat-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--surface3);
  flex-shrink: 0;
  transition: background var(--trans);
}
.sx-nav-link.active .sx-cat-dot { background: var(--accent); }
.sx-cat-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
}
.sx-nav-divider { height: 1px; background: var(--border); margin: 8px 0; }
.sx-sidebar-copy {
  font-size: 11px;
  color: var(--text-dim);
  padding: 12px 16px 0;
  line-height: 1.5;
}

/* ── Main content ── */
.sx-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 20px) 20px 40px;
  transition: margin-left var(--trans);
}
.sx-main.sidebar-collapsed { margin-left: var(--sidebar-col); }

/* ── Category Chips ── */
.sx-chips-wrap {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-bottom: 20px;
}
.sx-chips-wrap::-webkit-scrollbar { display: none; }
.sx-chips {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  white-space: nowrap;
}
.sx-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--trans);
  white-space: nowrap;
  cursor: pointer;
}
.sx-chip:hover { border-color: var(--accent); color: var(--accent); }
.sx-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Section ── */
.sx-section { margin-bottom: 40px; }
.sx-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sx-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.sx-see-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: opacity var(--trans);
}
.sx-see-all:hover { opacity: 0.75; }

.sx-page-indicator {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}


/* ── Video Grid ── */
.sx-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* ── Video Card ── */
.sx-card { display: flex; flex-direction: column; }
.sx-card-thumb-link { display: block; text-decoration: none; }
.sx-card-thumb {
  position: relative;
  width: 100%;
  /* Perfect 16:9 — no black bars, no white space */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface3);
}
.sx-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;       /* fills the 16:9 box — never letterboxed */
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}
.sx-card:hover .sx-card-thumb img { transform: scale(1.04); }
.sx-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: var(--surface3);
}
.sx-duration {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  pointer-events: none;
}
.sx-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.2s;
  color: #fff;
}
.sx-card:hover .sx-card-play { opacity: 1; }
.sx-card-info { padding: 10px 2px 0; }
.sx-card-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
  display: block;
}
.sx-card-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sx-card-title a { color: inherit; }
.sx-card-title a:hover { color: var(--accent); }
.sx-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.sx-card-dot { color: var(--text-dim); font-size: 10px; }

/* ── Trending Row — horizontal scroll strip, never wraps ── */
.sx-trending-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;           /* NEVER wrap to next line */
  gap: 14px;
  overflow-x: auto;            /* scroll horizontally */
  overflow-y: hidden;
  padding-bottom: 8px;         /* room for scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
  /* Smooth momentum scroll on iOS */
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.sx-trending-row::-webkit-scrollbar { height: 4px; }
.sx-trending-row::-webkit-scrollbar-track { background: transparent; }
.sx-trending-row::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

.sx-trending-card {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;              /* never squish */
  width: 220px;                /* fixed card width */
  scroll-snap-align: start;
}
/* On desktop show wider cards */
@media (min-width: 1024px) {
  .sx-trending-card { width: 240px; }
}
@media (min-width: 1280px) {
  .sx-trending-card { width: 260px; }
}

.sx-trending-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface3);
  display: block;
  flex-shrink: 0;
}
.sx-trending-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
  transition: transform 0.3s;
}
.sx-trending-card:hover .sx-trending-thumb img { transform: scale(1.04); }
.sx-trending-rank {
  position: absolute;
  top: 8px; left: 8px;
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.sx-trending-info { padding: 8px 2px 0; }
.sx-trending-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sx-trending-title a:hover { color: var(--accent); }

/* ── Load More ── */
.sx-load-more-wrap { text-align: center; margin-top: 28px; }
.sx-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  transition: all var(--trans);
  cursor: pointer;
}
.sx-load-more:hover { border-color: var(--accent); color: var(--accent); }
.sx-load-more.loading { opacity: 0.6; pointer-events: none; }

/* ── Archive header ── */
.sx-archive-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sx-archive-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}
.sx-archive-title span { color: var(--accent); }
.sx-archive-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.sx-archive-count {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Empty state ── */
.sx-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.sx-empty h3 { font-size: 18px; margin: 16px 0 8px; color: var(--text); }
.sx-empty p { font-size: 14px; }

/* ── Single video page ── */
.sx-single-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sx-video-primary { min-width: 0; }

/* Player */
.sx-player-wrap {
  width: 100%;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}
.sx-player-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  cursor: pointer;
}
.sx-player-embed img.sx-player-poster {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.sx-big-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  color: #fff;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}
.sx-big-play:hover { background: rgba(0,0,0,0.2); }
.sx-big-play svg { filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7)); }
.sx-player-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
}
.sx-player-no-source {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sx-player-no-source img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.3; }
.sx-no-source-msg {
  position: relative;
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  z-index: 1;
}
.sx-no-source-msg p { margin-top: 10px; font-size: 13px; }

/* Video info */
.sx-video-title {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 12px;
}
.sx-video-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.sx-video-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.sx-video-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sx-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--trans);
  cursor: pointer;
}
.sx-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.sx-action-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* Tags */
.sx-video-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}
.sx-tag-chip {
  display: inline-block;
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--trans);
}
.sx-tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.sx-tag-chip--tag { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-glow); }

/* Description */
.sx-video-desc { margin-bottom: 20px; }
.sx-desc-inner {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  overflow: hidden;
  max-height: none;
}
.sx-desc-inner.collapsed { max-height: 60px; position: relative; }
.sx-desc-inner.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  background: linear-gradient(transparent, var(--bg));
}
.sx-desc-toggle {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.sx-desc-toggle:hover { opacity: 0.8; }

/* Related sidebar */
.sx-related-sidebar { display: none; } /* hidden on mobile, shown on desktop */
.sx-related-card {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.sx-related-thumb {
  position: relative;
  flex-shrink: 0;
  width: 140px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface3);
  display: block;
}
.sx-related-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.sx-related-info { flex: 1; min-width: 0; }
.sx-related-title-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.sx-related-title-text:hover { color: var(--accent); }
.sx-related-title { font-size: 15px; font-weight: 800; margin-bottom: 12px; color: var(--text); }
.sx-mobile-related { margin-top: 30px; }

/* ── Comments ── */
.sx-comments-wrap { margin-top: 28px; }
.sx-comments-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 18px;
}
.sx-comment {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.sx-cm-av img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.sx-cm-body { flex: 1; min-width: 0; }
.sx-cm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.sx-cm-name { font-size: 13px; font-weight: 700; color: var(--text); }
.sx-cm-date { font-size: 12px; color: var(--text-dim); }
.sx-cm-text { font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.sx-cm-text p { margin: 0; }
.sx-cm-actions { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.sx-clike, .sx-reply-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  background: none; border: none; cursor: pointer;
  transition: color var(--trans); padding: 0;
}
.sx-clike:hover, .sx-reply-btn:hover { color: var(--accent); }
.sx-clike.active { color: var(--accent); }

/* Comment form */
.sx-comments-section { margin-top: 28px; }
.sx-comments-section .comment-form { margin-top: 0; }
.sx-cf-row { display: flex; gap: 12px; }
.sx-cf-field { flex: 1; margin-bottom: 12px; }
.sx-cf-field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.sx-cf-field input,
.sx-cf-field textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--trans);
  resize: vertical;
}
.sx-cf-field input:focus,
.sx-cf-field textarea:focus,
.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--accent); }
.sx-comment-form-title { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 14px; }
.sx-comment-submit-row { margin-top: 8px; }
.sx-comment-form-wrap .comment-reply-title { display: none; }
.sx-btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background var(--trans), transform var(--trans);
  text-decoration: none;
}
.sx-btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.sx-comments-closed { font-size: 14px; color: var(--text-muted); padding: 20px 0; }

/* ── 404 ── */
.sx-404 { padding: 20px; }
.sx-404-inner { text-align: center; padding: 60px 20px; }
.sx-404-code { font-size: 80px; font-weight: 900; color: var(--accent); line-height: 1; }
.sx-404-title { font-size: 22px; font-weight: 900; margin: 12px 0 8px; color: var(--text); }
.sx-404-msg { font-size: 15px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Static page ── */
.sx-page-wrap { max-width: 800px; padding: 20px 0; }
.sx-page-title { font-size: 26px; font-weight: 900; margin-bottom: 20px; }
.sx-page-body { font-size: 15px; line-height: 1.7; color: var(--text-muted); }
.sx-page-body h2,h3,h4 { color: var(--text); margin: 20px 0 8px; }
.sx-page-body p { margin-bottom: 14px; }
.sx-page-body a { color: var(--accent); text-decoration: underline; }

/* ── Footer ── */
/* ============================================================
   FOOTER — Professional layout
============================================================ */
.sx-footer {
  background: var(--surface);
  border-top: 2px solid var(--border);
  margin-left: var(--sidebar-w);
  transition: margin-left var(--trans);
}
.sx-footer.sidebar-collapsed { margin-left: var(--sidebar-col); }

.sx-footer-inner {
  padding: 40px 32px 24px;
}

/* ── Footer top: logo + tagline ── */
.sx-footer-top {
  margin-bottom: 28px;
}
.sx-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.sx-footer-logo:hover { color: var(--accent); }
.sx-footer-tagline {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── Divider ── */
.sx-footer-divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 28px;
}

/* ── Links grid: 3 columns, clean pill-style links ── */
.sx-footer-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 24px;
  margin-bottom: 28px;
}
.sx-footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all var(--trans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sx-footer-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.sx-footer-link-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Bottom legal bar ── */
.sx-footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}
.sx-footer-copy {
  font-size: 13px;
  color: var(--text-muted);
}
.sx-footer-copy strong { color: var(--text); }
.sx-footer-legal {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── Mobile bottom nav ── */
.sx-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 900;
  align-items: stretch;
}
.sx-mn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--trans);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 6px 0;
}
.sx-mn-item:hover, .sx-mn-item.active { color: var(--accent); }


/* Footer links list */
.sx-footer-links { list-style: none; padding: 0; margin: 0; }
.sx-footer-links li { margin-bottom: 8px; }
.sx-footer-links a,
.sx-footer-links li a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--trans);
  text-decoration: none;
}
.sx-footer-links a:hover,
.sx-footer-links li a:hover { color: var(--accent); }
.sx-footer-col-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.sx-footer-legal {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}


/* ── Numbered Pagination ── */
.sx-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.sx-pagination a,
.sx-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--trans);
}
.sx-pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.sx-pagination span.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sx-pagination span.dots {
  border: none;
  background: none;
  color: var(--text-dim);
  min-width: 24px;
}
.sx-pagination .sx-page-prev,
.sx-pagination .sx-page-next {
  font-size: 13px;
  padding: 0 14px;
  gap: 5px;
}

/* ── Scrollbar global ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Skeleton loader ── */
.sx-skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: sxSkel 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes sxSkel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ============================================================
   TABLET  768px+
============================================================ */
@media (min-width: 768px) {
  .sx-btn-signin span { display: inline; }
  .sx-footer { margin-left: var(--sidebar-w); }
  .sx-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .sx-video-actions-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .sx-cf-row { flex-direction: row; }
  .sx-footer { margin-left: var(--sidebar-w); }
}

/* ============================================================
   DESKTOP  1024px+
============================================================ */
@media (min-width: 1024px) {
  .sx-sidebar { transform: none; }
  .sx-grid { grid-template-columns: repeat(4, 1fr); }
  .sx-single-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
  }
  .sx-related-sidebar { display: block; }
  .sx-mobile-related { display: none; }
  .sx-footer.sidebar-collapsed { margin-left: var(--sidebar-col); }
}

/* ============================================================
   WIDE  1280px+
============================================================ */
@media (min-width: 1280px) {
  .sx-grid { grid-template-columns: repeat(5, 1fr); }
  .sx-single-layout { grid-template-columns: 1fr 360px; }
  .sx-header-inner { padding: 0 20px; }
}

/* ============================================================
   ULTRA-WIDE  1600px+
============================================================ */
@media (min-width: 1600px) {
  .sx-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ============================================================
   MOBILE  max 767px  — sidebar slides in, no freeze
============================================================ */
@media (max-width: 767px) {
  .sx-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    z-index: 950;
  }
  .sx-sidebar.mobile-open {
    transform: translateX(0);
  }
  .sx-main {
    margin-left: 0 !important;
    padding: calc(var(--header-h) + 14px) 12px calc(var(--mobile-nav-h) + 16px);
  }
  .sx-footer {
    margin-left: 0 !important;
    padding-bottom: calc(var(--mobile-nav-h) + 8px);
  }
  .sx-mobile-nav { display: flex; }

  /* Mobile header layout: hamburger | LOGO CENTERED | theme toggle */
  .sx-header-inner {
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 0;
  }
  .sx-header-left {
    flex-shrink: 0;
    gap: 0;
  }
  /* Hide desktop logo (in left div), show mobile logo (in center div) */
  .sx-logo-desktop { display: none; }
  .sx-logo-mobile  {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
  }
  /* Search hidden on mobile — replaced by centered logo */
  .sx-header-search { display: none; }
  /* Center div takes all remaining space, centers its content */
  .sx-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .sx-header-right {
    flex-shrink: 0;
    justify-content: flex-end;
  }
  .sx-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  /* Taller thumbnails on mobile — near-square, matches reference layout */
  .sx-card-thumb { aspect-ratio: 1 / 1; }
  .sx-video-title { font-size: 16px; }
  .sx-action-btn span { display: none; }
  .sx-action-btn { padding: 7px 11px; }
  .sx-single-layout { gap: 16px; }
  .sx-footer { margin-left: 0 !important; }
  .sx-footer-inner { padding: 28px 16px 20px; }
  .sx-footer-links-grid { grid-template-columns: repeat(2, 1fr); gap: 8px 10px; }
  .sx-footer-link { font-size: 12px; padding: 6px 10px; }
  .sx-footer-logo { font-size: 18px; }
  .sx-archive-title { font-size: 18px; }
  .sx-404-code { font-size: 60px; }
  .sx-cf-row { flex-direction: column; gap: 0; }
}

/* ============================================================
   VERY SMALL  max 360px
============================================================ */
@media (max-width: 360px) {
  .sx-grid { grid-template-columns: 1fr; }

  .sx-card-thumb { aspect-ratio: 1/1; }
}

/* ============================================================
   AUTHOR / UPLOADER — card name, single page, author page, follow
============================================================ */

/* Uploader name under card title */
.sx-card-author {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  margin: 2px 0 3px;
  transition: color 0.15s ease;
}
.sx-card-author:hover { color: var(--accent); }

/* Uploader on single video page */
.sx-video-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  margin: 4px 0 10px;
  transition: color 0.15s ease;
}
.sx-video-author:hover { color: var(--accent); }
.sx-video-author-av { border-radius: 50%; width: 28px; height: 28px; }

/* Author page */
.sx-author-page { padding: 4px 0 20px; }
.sx-author-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 18px;
  flex-wrap: wrap;
}
.sx-author-avatar { border-radius: 50%; width: 84px; height: 84px; flex-shrink: 0; }
.sx-author-meta { flex: 1; min-width: 180px; }
.sx-author-name { font-size: 24px; font-weight: 800; margin: 0 0 4px; color: var(--text); }
.sx-author-bio { font-size: 14px; color: var(--text-muted); margin: 0 0 6px; }
.sx-author-stats { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.sx-author-stats strong { color: var(--text); }

/* Follow button */
.sx-follow-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 26px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}
.sx-follow-btn:hover { background: var(--accent-dark); }
.sx-follow-btn.following {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--surface3);
}
.sx-follow-btn.following:hover { border-color: #e0245e; color: #e0245e; }
.sx-follow-btn.following:hover::after { content: ' — Unfollow'; }
.sx-follow-btn.loading { opacity: 0.6; pointer-events: none; }

/* Videos / Pictures tabs */
.sx-author-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--surface3);
  margin-bottom: 18px;
}
.sx-author-tab {
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.sx-author-tab:hover { color: var(--text); }
.sx-author-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sx-tab-count {
  font-size: 12px;
  background: var(--surface3);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.sx-author-tab.active .sx-tab-count { background: var(--accent-glow); color: var(--accent); }

@media (max-width: 767px) {
  .sx-author-name { font-size: 20px; }
  .sx-author-avatar { width: 64px; height: 64px; }
  .sx-follow-btn { padding: 9px 22px; font-size: 13px; }
  .sx-author-tab { padding: 11px 16px; font-size: 14px; }
}

/* ============================================================
   AUTH PAGES (login / register)
============================================================ */
.sx-auth-wrap { display: flex; justify-content: center; padding: 30px 16px 60px; }
.sx-auth-box {
  width: 100%; max-width: 380px;
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: var(--radius-md);
  padding: 26px 24px;
}
.sx-auth-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--surface3); }
.sx-auth-tab {
  flex: 1; text-align: center; padding: 10px; text-decoration: none;
  font-weight: 700; font-size: 15px; color: var(--text-muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.sx-auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sx-auth-box h1 { font-size: 22px; margin: 0 0 12px; }
.sx-auth-error {
  background: rgba(224,36,94,0.12); color: #ff5c85;
  border: 1px solid rgba(224,36,94,0.3); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; margin-bottom: 16px;
}
.sx-auth-form label, .login-username, .login-password, .login-remember {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 14px;
}
.sx-auth-form input, .sx-auth-box input[type="text"], .sx-auth-box input[type="email"],
.sx-auth-box input[type="password"] {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--surface3);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
}
.sx-auth-form input:focus, .sx-auth-box input:focus { outline: none; border-color: var(--accent); }
.login-remember { font-weight: 500; }
.login-remember input { width: auto; margin: 0 6px 0 0; }
.sx-auth-btn, .sx-auth-box .button-primary, .sx-auth-box #wp-submit {
  display: inline-block; width: 100%; text-align: center;
  background: var(--accent); color: #fff; border: none;
  padding: 12px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none;
  margin-top: 4px;
}
.sx-auth-btn:hover, .sx-auth-box #wp-submit:hover { background: var(--accent-dark); }
.sx-auth-foot { margin-top: 16px; font-size: 13px; text-align: center; color: var(--text-muted); }
.sx-auth-foot a { color: var(--accent); text-decoration: none; }
.sx-auth-foot span { margin: 0 6px; }
.sx-auth-link { color: var(--text-muted); text-decoration: none; margin-left: 10px; font-size: 13px; }

/* Single-page author row + inline follow */
.sx-video-author-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; flex-wrap: wrap; }
.sx-video-author-name { font-weight: 700; }
.sx-follow-inline { padding: 8px 20px; font-size: 13px; border-radius: 20px; }

/* ============================================================
   MY LIBRARY — following list rows
============================================================ */
.sx-following-list { display: flex; flex-direction: column; gap: 8px; }
.sx-follow-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: var(--radius-md);
  text-decoration: none; color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sx-follow-row:hover { border-color: var(--accent); background: var(--surface3); }
.sx-follow-row-av { border-radius: 50%; width: 48px; height: 48px; flex-shrink: 0; }
.sx-follow-row-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sx-follow-row-name { font-weight: 700; font-size: 15px; }
.sx-follow-row-sub { font-size: 12.5px; color: var(--text-muted); }
.sx-follow-row-go { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ============================================================
   PICTURE POST GALLERY (single page)
============================================================ */
.sx-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.sx-gallery-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  background: var(--surface3);
}
