/* FlowCraft Video Player — catalogue demo styles (extends site.css)
   Mirrors the buyer-delivered Tailwind widget with the site's own tokens.
   The state classes (.is-playing, .is-idle, .is-scrubbing) and .hidden/.flex
   are toggled by the unchanged buyer app.js. */

.vp { margin: 0; }
.vp .hidden, .vp [hidden] { display: none !important; }

/* ---------- Player box ---------- */
.vp-player {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 18px;
  background: #000; box-shadow: 0 24px 50px -20px rgba(15, 27, 61, .55); outline: none;
}
.vp-player:focus-visible { box-shadow: 0 0 0 4px #b8a8ff, 0 24px 50px -20px rgba(15, 27, 61, .55); }
.vp-player video { display: block; width: 100%; height: 100%; object-fit: contain; }
.vp-player.is-idle { cursor: none; }

/* ---------- Big play button ---------- */
.vp-big-play {
  position: absolute; z-index: 20; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .92); color: var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transition: opacity 200ms ease, transform 200ms ease, background-color 150ms ease;
}
@media (min-width: 640px) { .vp-big-play { width: 80px; height: 80px; } }
.vp-big-play svg { width: 36px; height: 36px; margin-left: 4px; }
.vp-big-play:hover { background: #fff; transform: translate(-50%, -50%) scale(1.05); }
.vp-big-play:focus-visible { outline: none; box-shadow: 0 0 0 4px #b8a8ff; }
.vp-player.is-playing .vp-big-play { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.85); }

/* ---------- Spinner ---------- */
.vp-spinner { position: absolute; z-index: 20; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.vp-spinner svg { width: 48px; height: 48px; color: #fff; animation: vp-spin 1s linear infinite; }
@keyframes vp-spin { to { transform: rotate(360deg); } }

/* ---------- End screen ---------- */
.vp-end {
  position: absolute; inset: 0; z-index: 30; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center; color: #fff;
  background: rgba(10, 16, 38, .82); backdrop-filter: blur(4px);
}
.vp-end.flex { display: flex; }
.vp-end-title { margin: 0; font-size: clamp(1.3rem, 1rem + 1.5vw, 1.9rem); font-weight: 800; color: #fff; }
.vp-end-text { margin: 0; max-width: 28em; font-size: .95rem; color: #c9cfe3; }
.vp-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.vp-end-actions button {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 12px;
  font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; border: 0;
}
.vp-end-cta { background: var(--accent); color: #fff; }
.vp-end-cta:hover { background: var(--accent-strong); }
.vp-end-replay { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3) !important; }
.vp-end-replay:hover { background: rgba(255, 255, 255, .2); }
.vp-end-replay svg { width: 16px; height: 16px; }

/* ---------- Control bar ---------- */
.vp-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 24px 8px 8px; color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, .5) 50%, transparent);
  transition: opacity 250ms ease, transform 250ms ease;
}
@media (min-width: 640px) { .vp-controls { padding: 40px 16px 12px; } }
.vp-player.is-idle .vp-controls { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* Progress bar: track → buffered → played → thumb, plus the time bubble */
.vp-progress { position: relative; display: flex; align-items: center; height: 20px; cursor: pointer; outline: none; touch-action: none; }
.vp-track { position: relative; width: 100%; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .25); transition: height 150ms ease; }
.vp-buffered, .vp-played { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 999px; }
.vp-buffered { background: rgba(255, 255, 255, .35); }
.vp-played { background: #7c63ec; }
.vp-progress:hover .vp-track, .vp-player.is-scrubbing .vp-track { height: 8px; }
.vp-progress:focus-visible .vp-track { box-shadow: 0 0 0 2px #b8a8ff; }
.vp-thumb {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transform: translate(-50%, -50%) scale(0); transition: transform 150ms ease;
}
.vp-progress:hover .vp-thumb, .vp-progress:focus-visible .vp-thumb, .vp-player.is-scrubbing .vp-thumb { transform: translate(-50%, -50%) scale(1); }
.vp-tooltip {
  position: absolute; bottom: 24px; transform: translateX(-50%); pointer-events: none;
  padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .8);
  font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff;
  opacity: 0; transition: opacity 150ms ease;
}
.vp-progress:hover .vp-tooltip, .vp-player.is-scrubbing .vp-tooltip { opacity: 1; }

/* Buttons row */
.vp-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
@media (min-width: 640px) { .vp-row { gap: 8px; } }
.vp-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border-radius: 10px; color: #fff;
  background: transparent; border: 0; cursor: pointer; padding: 0;
  transition: background-color 150ms ease;
}
.vp-btn svg { width: 24px; height: 24px; }
.vp-btn .vp-sm { width: 20px; height: 20px; }
.vp-btn:hover { background: rgba(255, 255, 255, .15); }
.vp-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px #b8a8ff; }
.vp-volume { display: flex; align-items: center; }
.vp-time { margin: 0 0 0 4px; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .9); white-space: nowrap; }
@media (min-width: 640px) { .vp-time { font-size: .875rem; } }
.vp-time i { font-style: normal; color: rgba(255, 255, 255, .5); }
.vp-spacer { flex: 1; }

/* Volume slider (--vp-fill is set by app.js) */
.vp-range {
  -webkit-appearance: none; appearance: none; width: 80px; height: 4px; margin: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, #fff var(--vp-fill, 100%), rgba(255, 255, 255, .3) var(--vp-fill, 100%));
}
@media (min-width: 640px) { .vp-range { width: 96px; } }
.vp-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.vp-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.vp-range:focus-visible { outline: none; box-shadow: 0 0 0 3px #b8a8ff; }
@media (max-width: 480px) {
  .vp-volume .vp-range { width: 0; opacity: 0; transition: width 200ms ease, opacity 200ms ease; }
  .vp-volume:hover .vp-range, .vp-volume:focus-within .vp-range { width: 64px; opacity: 1; }
}

/* Fullscreen */
.vp-player:fullscreen { border-radius: 0; }
.vp-player:-webkit-full-screen { border-radius: 0; }

/* ---------- Caption + form ---------- */
.vp-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 12px 4px 0; font-size: .9rem; color: var(--ink-muted); }
.vp-caption strong { color: var(--ink); }
.vp-keys { display: none; font-size: .82rem; }
@media (min-width: 640px) { .vp-keys { display: inline; } }
.vp .lead-form { margin-top: 18px; background: #fff; }

/* Compact version on the catalogue card */
.vp-compact .vp-player { border-radius: 14px; }
.vp-compact .vp-caption { font-size: .82rem; padding-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .vp-controls, .vp-big-play, .vp-thumb, .vp-tooltip, .vp-btn, .vp-track { transition: none; }
  .vp-spinner svg { animation-duration: 3s; }
}

/* Stage inside the demo frame */
.vp-stage { padding: 22px 14px 26px; background: var(--bg); }
@media (min-width: 600px) { .vp-stage { padding: 32px 28px 32px; } }
.vp-stage .vp { max-width: 880px; margin: 0 auto; }

/* Small players (phones, the catalogue card): keep the end screen inside the video */
@media (max-width: 639px) {
  .vp-end { gap: 8px; padding: 12px; }
  .vp-end-title { font-size: 1.15rem; }
  .vp-end-text { display: none; }
  .vp-end-actions button { padding: 8px 16px; }
}
.vp-compact .vp-end { gap: 8px; padding: 12px; }
.vp-compact .vp-end-title { font-size: 1.15rem; }
.vp-compact .vp-end-text { display: none; }
