/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100vw; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0e0e13;
  color: #fff;
}
a { color: inherit; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Fade in on load */
.page-fade { animation: pageFade 220ms ease both; }
@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid #ff2aa8;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============================================================
   Grid / cards
   ============================================================ */
.video-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
  width: 100%;
}
@media (min-width: 540px) {
  .video-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (min-width: 1024px) {
  .video-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}
@media (min-width: 1280px) {
  .video-grid { grid-template-columns: repeat(5, 1fr); }
}

.video-card {
  display: block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #1c1c25;
  border: 1px solid rgba(255,255,255,.06);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  cursor: pointer;
}
.video-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,42,168,.45);
  box-shadow: 0 8px 22px rgba(255,42,168,.12);
}

.thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #111118;
  overflow: hidden;
}
.thumbnail img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.duration {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.78);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 5px; letter-spacing: .01em;
}
.video-info { padding: 9px 10px 10px; }
.video-info h3 {
  font-size: 12.5px; font-weight: 500; line-height: 1.45; color: #e5e5ef;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta { font-size: 11px; color: #6b7280; margin-top: 3px; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  padding: 40px 0;
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  padding-top: 8px;
}
.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #1c1c25;
  border: 1px solid rgba(255,255,255,.06);
  color: #9ca3af;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.page-btn:hover:not(:disabled):not(.active) {
  border-color: rgba(255,42,168,.45);
  color: #fff;
}
.page-btn.active {
  background: #ff2aa8;
  border-color: #ff2aa8;
  color: #fff;
}
.page-btn:disabled {
  opacity: .35;
  cursor: default;
}
.page-ellipsis {
  color: #6b7280;
  font-size: 13px;
  padding: 0 4px;
  user-select: none;
}

/* List view */
.video-grid.list-mode { display: flex; flex-direction: column; gap: 8px; }
.video-grid.list-mode .video-card { display: flex; flex-direction: row; align-items: stretch; }
.video-grid.list-mode .thumbnail { flex-shrink: 0; width: 130px; padding-top: 0; height: 73px; }
.video-grid.list-mode .thumbnail img { position: static; width: 130px; height: 73px; }
@media (min-width: 540px) {
  .video-grid.list-mode .thumbnail { width: 160px; height: 90px; }
  .video-grid.list-mode .thumbnail img { width: 160px; height: 90px; }
}
.video-grid.list-mode .video-info {
  padding: 10px 13px; display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0;
}
.video-grid.list-mode .video-info h3 { font-size: 13px; }
.video-grid.list-mode .meta { display: flex; gap: 8px; }

/* Card click loading overlay */
.card-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); z-index: 10;
}
.spinner {
  width: 22px; height: 22px; border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #ff2aa8; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Sidebar (desktop)
   ============================================================ */
.sidebar { transition: width 220ms ease; width: 70px; }
.sidebar:hover { width: 200px; }
.sidebar:hover .side-label { opacity: 1 !important; }
@media (min-width: 1024px) {
  .main-wrap { margin-left: 70px; transition: margin-left 220ms ease; }
  .sidebar:hover ~ .main-wrap { margin-left: 200px; }
}
.side-label {
  opacity: 0; white-space: nowrap; overflow: hidden; transition: opacity 200ms ease;
}

/* ============================================================
   Header / search
   ============================================================ */
.site-header {
  background: rgba(14,14,19,.9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.search-box {
  background: #16161d;
  border: 1px solid rgba(255,255,255,.07);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.search-box.search-glow {
  border-color: #ff2aa8;
  box-shadow: 0 0 0 2px rgba(255,42,168,.25), 0 0 14px rgba(255,42,168,.35);
}

/* ============================================================
   Toggle / pagination buttons
   ============================================================ */
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: #1c1c25; border: 1px solid rgba(255,255,255,.07);
  color: #9ca3af; transition: all 150ms ease;
}
.icon-btn:hover { border-color: #ff2aa8; color: #fff; }

/* ============================================================
   Bottom nav (mobile)
   ============================================================ */
.bottom-nav {
  transition: transform 250ms ease, opacity 250ms ease;
  background: rgba(18,18,26,.88);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 6px 28px rgba(0,0,0,.55);
}
.bottom-nav.hide { transform: translateY(130%); opacity: 0; }

/* Ripple */
.ripple-el {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.18);
  transform: translate(-50%,-50%);
  animation: ripple 500ms ease; pointer-events: none;
}
@keyframes ripple {
  0%   { opacity: .5; transform: translate(-50%,-50%) scale(0); }
  100% { opacity: 0;  transform: translate(-50%,-50%) scale(2.5); }
}

/* ============================================================
   Player (detail page)
   ============================================================ */
.player-wrap {
  position: relative; width: 100%; padding-top: 56.25%;
  background: #000; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
}
.player-wrap video, .player-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
/* Portrait source: constrain height, center horizontally */
.player-wrap.is-portrait video,
.player-wrap.is-portrait iframe {
  inset: auto; top: 0; left: 50%; transform: translateX(-50%);
  height: 100%; width: auto; aspect-ratio: 9/16;
}
.player-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #000; z-index: 5; transition: opacity 200ms ease;
}
