/* Modern Premium Design System & Components */
:root {
  --primary: #ff2e54;
  --primary-hover: #ff5874;
  --primary-soft: rgba(255, 46, 84, 0.12);
  --accent: #6366f1;
  --accent-2: #a855f7;
  
  /* Dark Theme Tokens (Default) */
  --bg-main: #06060c;
  --bg-surface: #0e0e1a;
  --bg-card: rgba(17, 17, 28, 0.75);
  --bg-card-hover: rgba(24, 24, 38, 0.9);
  --bg-input: #121222;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-hover: rgba(255, 255, 255, 0.12);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --glass-bg: rgba(6, 6, 12, 0.7);
}

html:not(.dark) {
  /* Light Theme Tokens */
  --bg-main: #f4f5f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: #f1f2f6;
  --border-color: rgba(0, 0, 0, 0.06);
  --border-color-hover: rgba(0, 0, 0, 0.12);
  --text-main: #111827;
  --text-muted: #6b7280;
  --glass-bg: rgba(255, 255, 255, 0.7);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  background-image: 
    radial-gradient(circle at 80% -10%, rgba(255, 46, 84, 0.12), transparent 50%),
    radial-gradient(circle at -10% 20%, rgba(99, 102, 241, 0.08), transparent 45%);
  background-attachment: fixed;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 10px 0;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
html:not(.dark) ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Typography & Brand */
.brand-mark {
  font-family: var(--mono, ui-monospace);
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 6px;
  border-radius: 6px;
  align-self: center;
  letter-spacing: 0;
}
.brand-accent {
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Header & Search */
.search-form {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 3px 4px 3px 14px;
  transition: all 0.2s ease;
}
.search-form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 46, 84, 0.16);
}
.search-form input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: inherit;
  font-size: 14px;
  padding: 7px 4px;
}
.search-form button {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.search-form button:hover {
  transform: scale(1.06);
  box-shadow: 0 3px 10px rgba(255, 46, 84, 0.4);
}

/* Desktop Header Navigation */
.header-nav a {
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.18s ease;
  position: relative;
}
.header-nav a:hover, .header-nav a.is-active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
html:not(.dark) .header-nav a:hover, html:not(.dark) .header-nav a.is-active {
  background: rgba(0, 0, 0, 0.04);
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: inherit;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: rotate(15deg) scale(1.05);
}

/* Category Strip (Chips) */
.cat-chip {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  transition: all 0.2s ease;
}
.cat-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}
.cat-chip.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 46, 84, 0.3);
}
.cat-strip-inner {
  scrollbar-width: none;
}
.cat-strip-inner::-webkit-scrollbar {
  display: none;
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  max-width: 600px;
  margin: 0 auto;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  flex: 1;
  height: 100%;
  transition: all 0.2s ease;
}
.bottom-nav-item svg {
  margin-bottom: 3px;
  transition: transform 0.2s ease;
}
.bottom-nav-item:hover {
  color: var(--text-main);
}
.bottom-nav-item.is-active {
  color: var(--primary);
  font-weight: 700;
}
.bottom-nav-item.is-active svg {
  transform: translateY(-2px) scale(1.05);
  stroke: var(--primary);
}

/* Mobile Search Overlay */
.mobile-search-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  z-index: 100;
  display: none;
  flex-direction: column;
  padding: 16px;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.mobile-search-overlay.is-open {
  display: flex;
}

/* Video Grid and Card Overhaul (compact) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform .28s cubic-bezier(.2,.7,.3,1), border-color .28s, box-shadow .28s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: 0 12px 28px -10px rgba(255, 46, 84, .18), 0 2px 8px rgba(0,0,0,.06);
}
.thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-surface), #14141f);
  overflow: hidden;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.25,.8,.25,1);
}
.card:hover .thumb img { transform: scale(1.06); }
.thumb-fail img { display: none; }
.thumb .duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  border: 1px solid rgba(255, 255, 255, .06);
}
.thumb .views {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  padding: 2px 7px 2px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, .06);
}
.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(255, 46, 84, .22), rgba(0, 0, 0, .5));
  transition: opacity .28s ease;
}
.card:hover .play-overlay { opacity: 1; }
.play-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255,255,255,.4);
  backdrop-filter: blur(4px);
  transform: scale(.8);
  transition: transform .28s cubic-bezier(.175,.885,.32,1.275);
}
.card:hover .play-btn { transform: scale(1); }
.card-body { padding: 8px 10px 9px; }
.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.64em;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-muted);
}
.meta-ago { font-variant-numeric: tabular-nums; }
.meta-cat {
  color: var(--primary);
  font-weight: 600;
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons & Chips */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: 0;
  padding: 10px 22px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: 0 4px 14px -3px rgba(255, 46, 84, 0.35);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(255, 46, 84, 0.5);
}
.btn:active {
  transform: translateY(0);
}
.btn-ghost {
  background: var(--bg-surface);
  color: inherit;
  border: 1px solid var(--border-color);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 46, 84, 0.08);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}
.chip {
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  font-size: 11.5px;
  color: inherit;
  transition: all 0.2s ease;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* Pagination */
.pg {
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--bg-card);
  color: inherit;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
}
.pg:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.pg.is-current {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px -4px rgba(255, 46, 84, 0.4);
}
.pg.is-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Modern Filter Panel Styling */
.filters {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.filters summary {
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  user-select: none;
  transition: background-color 0.2s ease;
}
.filters summary:hover {
  background: rgba(255, 255, 255, 0.02);
}
html:not(.dark) .filters summary:hover {
  background: rgba(0, 0, 0, 0.02);
}
.filters summary::-webkit-details-marker {
  display: none;
}
.filters[open] summary {
  border-bottom: 1px solid var(--border-color);
}
.f-field input, .f-field select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: inherit;
  padding: 8px 12px;
  border-radius: 12px;
  font: inherit;
  transition: all 0.2s ease;
  width: 100%;
}
.f-field input:focus, .f-field select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 46, 84, 0.15);
}
.f-field input[type=checkbox] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Video Player Details Page */
.player-wrap {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.55);
}
.player-frame {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
}
.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.player-fallback {
  display: grid;
  place-items: center;
  gap: 14px;
  background-size: cover;
  background-position: center;
  color: #fff;
  aspect-ratio: 16/9;
}
.player-fallback p {
  margin: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.85);
  font-weight: 600;
  font-size: 14px;
}

/* Detail sidebar */
.related-aside {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 14px;
  align-self: start;
  position: sticky;
  top: 64px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.desc-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
}

/* Related Video Items (compact) */
.related-item {
  display: flex;
  gap: 9px;
  padding: 6px;
  border-radius: 9px;
  transition: background 0.18s ease;
  text-decoration: none;
  color: inherit;
}
.related-item:hover {
  background: var(--bg-card-hover);
}
.related-item img {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-input);
}
.related-item h4 {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 3px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-item .ri-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* Categories & Tags Page Redesigns */
.tag-pill {
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  color: inherit;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tag-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -8px rgba(255, 46, 84, 0.4);
}
.tag-count {
  color: var(--text-muted);
  font-size: .82em;
  font-variant-numeric: tabular-nums;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  text-decoration: none;
  color: inherit;
}
.cat-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 12px 30px -10px rgba(255, 46, 84, 0.3);
}
.cat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 50%);
  pointer-events: none;
}
.cat-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-variant-numeric: tabular-nums;
}
.cat-name-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 22px 10px 8px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
}

/* Empty State / Error Layouts */
.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-error h1 {
  font-size: 80px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 10px 0;
}

/* Description Collapse Toggler (Read More) */
.desc-text {
  max-height: 4.8em;
  overflow: hidden;
  position: relative;
  transition: max-height 0.3s ease;
}
.desc-text.expanded {
  max-height: 2000px;
}
.desc-toggle-btn {
  display: inline-block;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

/* Responsive Overrides */
@media (max-width: 768px) {
  /* On mobile, pad bottom main layout so floating nav doesn't overlap content */
  body {
    padding-bottom: 74px;
  }
}

/* Legal / Info Pages */
.legal-content { display: flex; flex-direction: column; gap: 22px; }
.legal-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
}
.legal-section h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-main);
}
.legal-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}
.legal-section a { color: var(--primary); font-weight: 600; }
.legal-section a:hover { text-decoration: underline; }
.legal-section ul { margin: 8px 0 0; padding-left: 20px; }
.legal-section ul li { margin-bottom: 6px; font-size: 14px; line-height: 1.6; color: var(--text-muted); }
.legal-nav { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.legal-nav-title { margin: 0 0 12px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.legal-nav-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* Footer RTA badge */
.footer-nav a { transition: color 0.18s ease; }
.footer-nav a:hover { color: var(--primary); }
.rta-badge {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 10px; border: 1.5px solid var(--primary); border-radius: 6px;
  text-decoration: none; transition: all 0.18s ease;
}
.rta-badge:hover { background: var(--primary-soft); }
.rta-text { font-size: 13px; font-weight: 800; letter-spacing: .05em; color: var(--primary); line-height: 1; }
.rta-sub { font-size: 7.5px; font-weight: 600; color: var(--text-muted); line-height: 1; text-transform: uppercase; letter-spacing: .04em; }

/* Popular search chips below header search form */
.popular-searches { margin-top: 2px; }
.ps-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 500; line-height: 1.6;
  background: var(--chip-bg, #f4f4f5); color: var(--text-muted);
  text-decoration: none; white-space: nowrap;
  transition: all 0.15s ease;
}
.ps-chip:hover { background: var(--primary-soft); color: var(--primary); }
