/* short-video-detail.css
 * Full-screen vertical "shorts" reels player — Aaj Tak style.
 * Layout: one full-viewport slide per video, native CSS scroll-snap (vertical,
 * mousewheel + touch), one YouTube <iframe> player per active/adjacent slide.
 */

:root {
  --svd-bg: #000;
  --svd-overlay-grad: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.35) 35%, rgba(0,0,0,0) 60%);
  --svd-overlay-grad-top: linear-gradient(to bottom, rgba(0,0,0,.6) 0%, rgba(0,0,0,0) 100%);
  --svd-accent: #ff3050;
}

html.svd-lock, body.svd-lock {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--svd-bg);
}

.svd-app {
  position: fixed;
  inset: 0;
  background: var(--svd-bg);
  z-index: 9999;
}

/* ---------- Scroller shell (native CSS scroll-snap, no library) ---------- */
.svd-scroller {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
/* Hide the scrollbar — this is a full-screen reels view, not a document */
.svd-scroller::-webkit-scrollbar { display: none; }
.svd-scroller { scrollbar-width: none; -ms-overflow-style: none; }

.svd-slide {
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--svd-bg);
  position: relative;
  overflow: hidden;
}

/* ---------- Video stage ---------- */
.svd-stage {
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #000;
}

.svd-player-mount {
  position: absolute;
  inset: 0;
}

.svd-player-mount iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-width: 100%;
  transform: translate(-50%, -50%);
  pointer-events: none; /* taps are handled by .svd-tap-catcher, not the iframe */
}

/* Poster shown until the YT player reports "playing" */
.svd-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity .25s ease;
  z-index: 2;
}
.svd-stage.is-playing .svd-poster,
.svd-stage.is-ready .svd-poster {
  opacity: 0;
  pointer-events: none;
}

.svd-tap-catcher {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* Center play/pause glyph, flashes briefly on tap */
.svd-center-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.7);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.svd-center-icon.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.svd-center-icon svg { width: 34px; height: 34px; fill: #fff; }

/* ---------- Progress bar (per-video, resets each slide) ---------- */
.svd-progress-track {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.25);
  z-index: 8;
}
.svd-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width .18s linear;
}

/* ---------- Top bar: close + mute ---------- */
.svd-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 16px 12px 28px;
  background: var(--svd-overlay-grad-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 9;
}
.svd-icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,.35);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  cursor: pointer;
}
.svd-icon-btn svg { width: 20px; height: 20px; fill: #fff; }

/* ---------- Bottom info + share rail ---------- */
.svd-bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 60px 14px 22px;
  background: var(--svd-overlay-grad);
  z-index: 9;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.svd-info {
  flex: 1;
  min-width: 0;
  color: #fff;
}
.svd-info .svd-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--svd-accent);
  background: rgba(255,255,255,.12);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 8px;
}
.svd-info .svd-title {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.svd-info .svd-meta {
  font-size: 12px;
  opacity: .75;
  margin: 0;
}

.svd-share-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.svd-share-rail button {
  background: none;
  border: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  cursor: pointer;
}
.svd-share-rail button svg { width: 26px; height: 26px; fill: #fff; }

/* ---------- Swipe-up hint (first slide only, auto-hides) ---------- */
.svd-swipe-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  color: rgba(255,255,255,.85);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  animation: svd-bounce 1.6s ease-in-out infinite;
  pointer-events: none;
}
.svd-swipe-hint.hide { display: none; }
@keyframes svd-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: .85; }
  50% { transform: translateX(-50%) translateY(-6px); opacity: .4; }
}

/* ---------- Loading spinner for the tail slide while AJAX fetches more ---------- */
.svd-loading-slide {
  color: rgba(255,255,255,.6);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.svd-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: svd-spin .7s linear infinite;
}
@keyframes svd-spin { to { transform: rotate(360deg); } }

/* ---------- Toast (copy link, etc.) ---------- */
.svd-toast {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 20px;
  z-index: 20;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.svd-toast.show { opacity: 1; }

@media (min-width: 768px) {
  .svd-stage { max-width: 420px; border-radius: 12px; overflow: hidden; }
  .svd-app { background: #111; display: flex; align-items: center; justify-content: center; }
  .svd-scroller { height: 92vh; max-height: 860px; }
}