/* ── CricHit – Demo Page Styles ── */

/* ── SHOT SELECTOR BAR ── */
.shot-selector {
  position: sticky;
  top: 64px;
  z-index: 90;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 12px 0;
}
.shot-selector-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.shot-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--dim);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-user-select: none;
  user-select: none;
}
.shot-pill:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--gold-lt);
}
.shot-pill.active {
  background: linear-gradient(135deg, var(--gold-lt), #d97706);
  color: #000;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
}
.shot-pill.active .pill-icon { filter: none; }
.pill-icon { font-size: 15px; filter: grayscale(1); transition: filter 0.25s; }
.pill-label { white-space: nowrap; }

/* ── CAROUSEL ── */
.carousel-viewport {
  overflow: hidden;
  position: relative;
  max-width: 100vw;
}
.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  max-width: 100%;
}
.carousel-panel {
  min-width: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

/* Carousel dot indicators */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.25s ease;
}
.carousel-dot:hover {
  background: rgba(245, 158, 11, 0.3);
}
.carousel-dot.active {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Demo sections */
.demo-section { padding: 80px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.step-badge { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step-num {
  background: linear-gradient(135deg, var(--gold-lt), #d97706);
  color: #000; font-size: 11px; font-weight: 900; letter-spacing: 1px;
  padding: 5px 14px; border-radius: 20px; text-transform: uppercase;
}
.step-label { font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.demo-section h2 {
  font-size: clamp(26px, 3.5vw, 42px); font-weight: 900;
  letter-spacing: -0.8px; color: #fff; margin-bottom: 12px;
}
.demo-section .desc { font-size: 16px; color: var(--dim); line-height: 1.8; max-width: 700px; margin-bottom: 32px; }

/* Dual video grid */
.dual-video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 8px; width: 100%; }
.video-card {
  border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); background: #000;
  width: 100%;
}
.video-card video { width: 100%; max-width: calc(100vw - 20px); display: block; pointer-events: none; }
.video-card-label {
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(30,41,59,0.97), rgba(15,23,42,0.97));
  font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--dim); display: flex; align-items: center; gap: 8px;
}
.video-card-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }

/* Clip video (kept for backwards compat) */
.clip-video-wrapper {
  max-width: 900px; margin: 0 auto;
  border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); background: #000;
}
.clip-video-wrapper video { width: 100%; display: block; }

/* Stage Container - unified view for all stages */
.stage-container {
  position: relative;
  width: 100%;
  min-height: 500px;
}

.stage-view {
  width: 100%;
  transition: opacity 0.5s ease;
}

.stage-view[hidden] {
  display: none;
}

/* 3D canvas - now supports multiple instances */
.canvas-container {
  position: relative; width: 100%; height: 70vh; min-height: 500px;
  border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); background: #05070c;
}
.canvas-container canvas { width: 100% !important; height: 100% !important; display: block; }
#canvas-container {
  position: relative; width: 100%; height: 70vh; min-height: 500px;
  border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); background: #05070c;
}
#canvas-container canvas { width: 100% !important; height: 100% !important; display: block; }

/* ── SCENE BUTTONS (Replay / Reset View) ── */
.scene-btn {
  position: absolute;
  z-index: 20;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}
.scene-btn:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--gold);
}
.scene-btn svg { width: 20px; height: 20px; }
.scene-btn-replay { bottom: 16px; right: 16px; }
.scene-btn-reset  { bottom: 16px; right: 68px; }

/* ── Next Shot CTA button ── */
.btn-next-shot {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 30px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(217,119,6,0.22));
  backdrop-filter: blur(10px);
  color: var(--gold-lt);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.4s ease;
  animation: nextShotFadeIn 0.5s ease both;
}
.btn-next-shot[hidden] { display: none; }
.btn-next-shot svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-next-shot:hover {
  background: linear-gradient(135deg, rgba(245,158,11,0.35), rgba(217,119,6,0.4));
  border-color: var(--gold);
  box-shadow: 0 4px 24px rgba(245,158,11,0.35);
  color: #fff;
}
@keyframes nextShotFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Step progression buttons (Track Ball / Simulate Outcome) ── */
.step-next-wrap {
  display: none; /* Hidden - automatic progression enabled */
  justify-content: center;
  margin-top: 40px;
}
.step-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 30px;
  border-radius: 30px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(217,119,6,0.2));
  color: var(--gold-lt);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  animation: stepBtnFadeIn 0.5s ease both;
}
.step-next-btn[hidden] { display: none; }
.step-next-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.step-next-btn:hover {
  background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(217,119,6,0.38));
  border-color: var(--gold);
  box-shadow: 0 4px 24px rgba(245,158,11,0.3);
  color: #fff;
}
@keyframes stepBtnFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HUD OVERLAYS ── */
.hud-overlay {
  position: absolute; z-index: 10; pointer-events: none;
  opacity: 0; transition: opacity 0.6s ease;
}
.hud-overlay.visible { opacity: 1; }

.hud-scoreboard { top: 16px; left: 16px; }
.hud-score-card {
  background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.95));
  border-radius: 12px; padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5); min-width: 180px;
}
.hud-runs { font-size: 36px; font-weight: 900; color: #fff; line-height: 1; }
.hud-wkts { font-size: 24px; font-weight: 700; color: var(--dim); }
.hud-overs { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hud-player { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.hud-player-line { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.hud-player-line .name { color: var(--text); font-weight: 700; }
.hud-player-line .stat { color: var(--gold-lt); font-weight: 600; }
.hud-player-line .bowl { color: var(--muted); }

.hud-result { bottom: 40px; right: 32px; text-align: right; }
.hud-result-val {
  font-size: 72px; font-weight: 900; line-height: 1; letter-spacing: -2px;
  background: linear-gradient(140deg, #fbbf24 0%, #f59e0b 40%, #ef4444 80%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 20px rgba(245,158,11,0.8));
}
.hud-result-label {
  font-size: 13px; font-weight: 700; letter-spacing: 4px; text-transform: uppercase;
  color: var(--gold-lt); margin-top: -4px;
  text-shadow: 0 0 10px rgba(251,191,36,0.6);
}

.hud-analytics { bottom: 16px; left: 16px; }
.hud-analytics-card {
  background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.95));
  border-radius: 12px; padding: 18px 22px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5); min-width: 260px;
}
.hud-analytics-title { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 12px; }
.hud-stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hud-stat-row:last-child { margin-bottom: 0; }
.hud-stat-lbl { font-size: 13px; color: var(--dim); }
.hud-stat-val { font-size: 14px; font-weight: 700; color: var(--text); }
.hud-stat-val.amber { color: var(--gold); }
.hud-stat-val.green { color: var(--green); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .shot-selector-inner { padding: 0 20px; gap: 8px; }
  .shot-pill { padding: 8px 16px; font-size: 12px; }
  .pill-icon { font-size: 13px; }
  .dual-video-grid { grid-template-columns: 1fr; }
  .demo-section { padding: 60px 0; }

  /* Zero out .inner padding so videos go edge-to-edge;
     add padding back on text-only children */
  .demo-section .inner { padding: 0; }
  .demo-section .section-intro { padding: 0 5px; max-width: calc(100vw - 10px); }
  .demo-section .carousel-dots { padding: 0 20px; }
  .demo-section .step-next-wrap { padding: 0 20px; }

  .stage-container { min-height: auto; width: 100%; }
  .dual-video-grid { gap: 8px; padding: 0; width: 100%; }
  .video-card { 
    border-radius: 0; border-left: none; border-right: none; 
    width: 100%;
  }
  .video-card video { 
    width: 100%; display: block;
  }
  .canvas-container, #canvas-container {
    max-width: calc(100vw - 20px); aspect-ratio: 16 / 9;
    height: auto; min-height: unset; border-radius: 0;
  }
  .scene-btn { width: 36px; height: 36px; }
  .scene-btn svg { width: 16px; height: 16px; }
  .scene-btn-replay { bottom: 12px; right: 12px; }
  .scene-btn-reset  { bottom: 12px; right: 56px; }
  .btn-next-shot { padding: 10px 20px; font-size: 13px; bottom: 16px; }
  .step-next-btn { padding: 11px 22px; font-size: 13px; }
  .hud-result-val { font-size: 48px; }
  .hud-analytics { bottom: 12px; left: 12px; }
  .hud-analytics-card { min-width: 200px; padding: 14px 16px; }
  .hud-scoreboard { top: 12px; left: 12px; }
}

/* ── Tablets / small laptops ── */
@media (max-width: 768px) {
  .demo-section { padding: 48px 0; }
}

/* ── Phones landscape / small tablets ── */
@media (max-width: 600px) {
  .shot-selector-inner { padding: 0 12px; gap: 6px; }
  .shot-pill { padding: 7px 12px; font-size: 11px; gap: 5px; }
  .pill-icon { font-size: 12px; }
  .demo-section { padding: 36px 0; }
  .demo-section .desc { font-size: 14px; margin-bottom: 20px; }

  .demo-section .section-intro { padding: 0 16px; }
  .demo-section .carousel-dots { padding: 0 16px; }
  .demo-section .step-next-wrap { padding: 0 16px; }

  .carousel-dots { margin-top: 16px; }
  .video-card-label { padding: 8px 12px; font-size: 10px; }

  /* HUD: scale down, keep overlaid */
  .hud-scoreboard { top: 8px; left: 8px; }
  .hud-score-card { min-width: 140px; padding: 10px 12px; border-radius: 8px; }
  .hud-runs { font-size: 26px; }
  .hud-wkts { font-size: 18px; }
  .hud-overs { font-size: 10px; }
  .hud-player { margin-top: 6px; padding-top: 6px; }
  .hud-player-line { font-size: 10px; gap: 8px; }

  .hud-result { bottom: 24px; right: 16px; }
  .hud-result-val { font-size: 36px; letter-spacing: -1px; }
  .hud-result-label { font-size: 10px; letter-spacing: 2px; }

  .hud-analytics { bottom: 8px; left: 8px; }
  .hud-analytics-card { min-width: 160px; padding: 10px 14px; border-radius: 8px; }
  .hud-analytics-title { font-size: 9px; margin-bottom: 8px; }
  .hud-stat-row { margin-bottom: 4px; }
  .hud-stat-lbl { font-size: 10px; }
  .hud-stat-val { font-size: 11px; }

  .scene-btn { width: 32px; height: 32px; }
  .scene-btn svg { width: 14px; height: 14px; }
  .scene-btn-replay { bottom: 10px; right: 10px; }
  .scene-btn-reset  { bottom: 10px; right: 48px; }
  .btn-next-shot { padding: 8px 16px; font-size: 12px; bottom: 12px; }
}

/* ── Standard phones ── */
@media (max-width: 480px) {
  .demo-section .section-intro { padding: 0 12px; }
  .demo-section .carousel-dots { padding: 0 12px; }
  .demo-section .step-next-wrap { padding: 0 12px; }

  .canvas-container, #canvas-container { aspect-ratio: 4 / 3; }
  .hud-result-val { font-size: 28px; }
  .hud-result-label { font-size: 9px; letter-spacing: 1.5px; }
  .hud-analytics-card { min-width: 130px; padding: 8px 10px; }
  .hud-stat-lbl { font-size: 9px; }
  .hud-stat-val { font-size: 10px; }
  .hud-score-card { min-width: 120px; padding: 8px 10px; }
  .hud-runs { font-size: 22px; }
  .hud-wkts { font-size: 16px; }
  .hud-player-line { font-size: 9px; }
  .demo-section h2 { margin-bottom: 8px; }
  .demo-section .desc { font-size: 13px; line-height: 1.6; }
}

/* ── Narrow phones (≤360px) ── */
@media (max-width: 360px) {
  .shot-pill { padding: 6px 10px; font-size: 10px; }
  .hud-analytics-card { min-width: unset; width: calc(100% - 16px); max-width: 160px; }
  .hud-result-val { font-size: 24px; }
  .canvas-container, #canvas-container { min-height: unset; }
}

/* ── Landscape phones ── */
@media (max-height: 500px) {
  .canvas-container, #canvas-container { aspect-ratio: 16 / 9; height: auto; min-height: unset; }
  .demo-section { padding: 24px 0; }
  .shot-selector { padding: 8px 0; }
}
