/* ==========================================================
   Floating Video Player  -  floating_video.css
   Theme: picks --brand-primary from the active theme.
   To move it above a sticky WhatsApp / call button:
       .fvp, .fvp-bubble { --fvp-bottom: 84px; }
   ========================================================== */

.fvp,
.fvp-bubble,
.fvp-backdrop,
.fvp-welcome {
  --fvp-accent: var(--brand-primary, #1f8f66);
  --fvp-ink: #0c1512;
  --fvp-panel: #13211c;
  --fvp-line: rgba(255, 255, 255, .12);
  --fvp-mini-w: 320px;
  --fvp-gap: 20px;
  --fvp-bottom: 20px;
  --fvp-ease: cubic-bezier(.22, .9, .28, 1);
}

/* the section itself only holds markup; JS moves the widgets to <body> */
.fvp-section:not([data-admin]) { display: none; }

/* ---------- player shell ---------- */
.fvp {
  position: fixed;
  z-index: 9990;
  right: var(--fvp-gap);
  bottom: var(--fvp-bottom);
  width: var(--fvp-mini-w);
  display: flex;
  flex-direction: column;
  background: var(--fvp-ink);
  color: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .42), 0 0 0 1px rgba(255, 255, 255, .08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(28px) scale(.94);
  transform-origin: bottom right;
  transition:
    width .5s var(--fvp-ease),
    right .5s var(--fvp-ease),
    bottom .5s var(--fvp-ease),
    transform .5s var(--fvp-ease),
    border-radius .4s ease,
    opacity .3s ease,
    visibility 0s linear .5s;
}
.fvp.is-left { right: calc(100% - var(--fvp-mini-w) - var(--fvp-gap)); transform-origin: bottom left; }

.fvp[data-state="mini"],
.fvp[data-state="large"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition-delay: 0s;
}

/* large = centred, with dimmed backdrop */
.fvp[data-state="large"] {
  right: 50%;
  bottom: 50%;
  transform: translate(50%, 50%);
  width: max(300px, min(980px, 94vw, calc((100vh - 200px) * 1.7778)));
  border-radius: 22px;
  z-index: 9995;
}

/* full screen (native API + CSS fallback for iPhone) */
.fvp.is-fs[data-state] {
  right: 0; bottom: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  transform: none;
  border-radius: 0;
  z-index: 10000;
  background: #000;
}
.fvp.is-fs .fvp-stage { flex: 1; min-height: 0; aspect-ratio: auto; }
.fvp.is-fs .fvp-extra { display: none !important; }

.fvp.is-dragging,
.fvp.no-anim { transition: none !important; }
.fvp.is-dragging { cursor: grabbing; }

/* ---------- top bar ---------- */
.fvp-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  touch-action: none;
  user-select: none;
}
.fvp-live {
  flex: 0 0 8px; height: 8px; border-radius: 50%;
  background: #ff5a5f;
  animation: fvp-live 1.8s infinite;
}
.fvp-titles { flex: 1; min-width: 0; line-height: 1.25; }
.fvp-title,
.fvp-sub {
  display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fvp-title { font-size: 13.5px; font-weight: 700; letter-spacing: .1px; }
.fvp-sub { font-size: 11.5px; opacity: .72; }
.fvp-actions { display: flex; gap: 6px; }

.fvp-ico {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: rgba(255, 255, 255, .13);
  color: #fff; font-size: 12px; cursor: pointer;
  transition: background .2s ease, transform .15s ease;
  padding: 0px;
}
.fvp-ico:hover { background: var(--fvp-accent); }
.fvp-ico:active { transform: scale(.92); }
.fvp button:focus-visible,
.fvp-bubble:focus-visible,
.fvp-cta:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- stage ---------- */
.fvp-stage { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.fvp-media,
.fvp-media iframe,
.fvp-media video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }

.fvp-poster {
  position: absolute; inset: 0;
  background: #16231e center / cover no-repeat;
  display: grid; place-items: center;
  transition: opacity .6s ease;
}
.fvp-poster::after {
  content: "\f04b";
  font: 900 18px/1 "Font Awesome 6 Free", "Font Awesome 5 Free";
  width: 52px; height: 52px; padding-left: 4px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
  color: #fff;
}
.fvp.is-ready .fvp-poster { opacity: 0; pointer-events: none; }

.fvp-shield { position: absolute; inset: 0; z-index: 2; border: 0; background: transparent; cursor: pointer; }

.fvp-sound {
  position: absolute; z-index: 3; left: 10px; bottom: 46px;
  display: none; align-items: center; gap: 7px;
  padding: 7px 12px; border: 0; border-radius: 999px;
  background: rgba(0, 0, 0, .62); backdrop-filter: blur(8px);
  color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}
.fvp.is-ready.is-muted .fvp-sound { display: inline-flex; }
.fvp[data-state="large"] .fvp-sound { bottom: 12px; left: 12px; }
/* browser blocked sound: make the prompt hard to miss */
.fvp.sound-blocked .fvp-sound { background: var(--fvp-accent); animation: fvp-nudge 2.2s ease-in-out infinite; }

/* ---------- controls ---------- */
.fvp-controls { display: flex; align-items: center; gap: 8px; padding: 9px 12px; }
.fvp-progress { flex: 1; height: 22px; display: flex; align-items: center; cursor: pointer; }
.fvp-track {
  position: relative; display: block; width: 100%; height: 4px;
  border-radius: 4px; background: rgba(255, 255, 255, .26); overflow: hidden;
  transition: height .15s ease;
}
.fvp-progress:hover .fvp-track { height: 6px; }
.fvp-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--fvp-accent); }
.fvp-tick { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0, 0, 0, .65); }
.fvp-time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; white-space: nowrap; }

/* ---------- overlay layout (mini + fullscreen) ---------- */
.fvp:is([data-state="mini"], .is-fs) :is(.fvp-bar, .fvp-controls) {
  position: absolute; left: 0; right: 0; z-index: 4;
  opacity: 0; transition: opacity .25s ease;
}
.fvp:is([data-state="mini"], .is-fs) .fvp-bar { top: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent); cursor: grab; }
.fvp:is([data-state="mini"], .is-fs) .fvp-controls { bottom: 0; padding-top: 26px; background: linear-gradient(0deg, rgba(0, 0, 0, .8), transparent); }
.fvp[data-state="mini"]:hover :is(.fvp-bar, .fvp-controls),
.fvp.is-intro :is(.fvp-bar, .fvp-controls),
.fvp.is-fs :is(.fvp-bar, .fvp-controls),
.fvp.is-inline :is(.fvp-bar, .fvp-controls) { opacity: 1; }
@media (hover: none) {
  .fvp[data-state="mini"] :is(.fvp-bar, .fvp-controls) { opacity: 1; }
}
.fvp[data-state="mini"] :is(.fvp-time, .fvp-fs) { display: none; }
.fvp.is-fs .fvp-bar { cursor: default; }

/* ---------- large mode panels ---------- */
.fvp[data-state="large"]:not(.is-fs) .fvp-bar { background: var(--fvp-panel); border-bottom: 1px solid var(--fvp-line); }
.fvp[data-state="large"]:not(.is-fs) .fvp-controls { background: var(--fvp-ink); }
.fvp[data-state="large"]:not(.is-fs) .fvp-title { font-size: 15px; }

.fvp-extra {
  display: none; align-items: center; gap: 14px;
  padding: 12px 14px 14px;
  background: var(--fvp-panel); border-top: 1px solid var(--fvp-line);
}
.fvp[data-state="large"] .fvp-extra { display: flex; }
.fvp-chapters { position: relative; flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.fvp-chapters::-webkit-scrollbar { display: none; }
.fvp-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: 999px;
  border: 1px solid var(--fvp-line); background: rgba(255, 255, 255, .05);
  color: #fff; font-size: 12.5px; cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.fvp-chip b { font-weight: 700; font-variant-numeric: tabular-nums; opacity: .75; }
.fvp-chip:hover { border-color: var(--fvp-accent); }
.fvp-chip.is-active { background: var(--fvp-accent); border-color: transparent; }
.fvp-chip.is-active b { opacity: 1; }
.fvp-cta {
  flex: 0 0 auto; padding: 10px 20px; border-radius: 999px;
  background: var(--fvp-accent); color: #fff !important;
  font-size: 13.5px; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: filter .2s ease, transform .15s ease;
}
.fvp-cta:hover { filter: brightness(1.1); }
.fvp-cta:active { transform: scale(.97); }

/* ---------- welcome card ---------- */
.fvp-welcome {
  position: fixed; z-index: 9991;
  right: var(--fvp-gap); bottom: var(--fvp-bottom);
  width: min(340px, calc(100vw - 2 * var(--fvp-gap)));
  background: var(--fvp-ink); color: #fff;
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .08);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(26px) scale(.96); transform-origin: bottom right;
  transition: transform .55s var(--fvp-ease), opacity .35s ease, visibility 0s linear .55s;
}
.fvp-welcome.is-left { right: auto; left: var(--fvp-gap); transform-origin: bottom left; }
.fvp-welcome.is-on { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }

.fvp-welcome-media { position: relative; aspect-ratio: 16 / 9; background: #16231e; }
.fvp-welcome-poster { position: absolute; inset: 0; background: center / cover no-repeat; }
.fvp-welcome-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .06), rgba(0, 0, 0, .5));
}
.fvp-welcome-play {
  position: absolute; z-index: 1; left: 50%; top: 50%;
  width: 54px; height: 54px; margin: -27px 0 0 -27px; padding-left: 3px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, .96); color: var(--fvp-ink); font-size: 18px;
}
.fvp-welcome-play::before {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid #fff; opacity: 0;
  animation: fvp-ring 2s ease-out infinite;
}
.fvp-welcome-x {
  position: absolute; z-index: 2; top: 10px; right: 10px;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px); color: #fff; font-size: 12px; cursor: pointer;
  transition: background .2s ease;
}
.fvp-welcome-x:hover { background: var(--fvp-accent); }

.fvp-welcome-body { padding: 14px 16px 12px; }
.fvp-welcome-body strong { display: block; font-size: 15.5px; line-height: 1.3; }
.fvp-welcome-body p {
  margin: 4px 0 14px; font-size: 12.5px; line-height: 1.45; opacity: .74;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fvp-welcome-cta {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 16px; border: 0; border-radius: 12px;
  background: var(--fvp-accent); color: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: filter .2s ease, transform .15s ease;
}
.fvp-welcome-cta:hover { filter: brightness(1.1); }
.fvp-welcome-cta:active { transform: scale(.98); }
.fvp-welcome-later {
  display: block; width: 100%; margin-top: 4px; padding: 8px;
  border: 0; background: none; color: rgba(255, 255, 255, .68);
  font-size: 12.5px; cursor: pointer; transition: color .2s ease;
}
.fvp-welcome-later:hover { color: #fff; }
.fvp-welcome button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fvp-section[data-admin] .fvp-welcome { display: none; }

/* ---------- backdrop ---------- */
.fvp-backdrop {
  position: fixed; inset: 0; z-index: 9980;
  background: rgba(6, 14, 11, .68); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility 0s linear .35s;
}
.fvp-backdrop.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }

/* ---------- minimised bubble ---------- */
.fvp-bubble {
  position: fixed; z-index: 9990;
  right: var(--fvp-gap); bottom: var(--fvp-bottom);
  width: 62px; height: 62px; padding: 0;
  border: 2px solid #fff; border-radius: 50%;
  background: var(--fvp-ink) center / cover no-repeat;
  box-shadow: inset 0 0 0 40px rgba(0, 0, 0, .38), 0 14px 34px rgba(0, 0, 0, .35);
  color: #fff; font-size: 16px; cursor: pointer;
  opacity: 0; visibility: hidden; transform: scale(.4);
  transition: transform .45s var(--fvp-ease), opacity .3s ease, visibility 0s linear .45s;
}
.fvp-bubble.is-left { right: auto; left: var(--fvp-gap); }
.fvp-bubble.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.fvp-bubble::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--fvp-accent); opacity: 0;
}
.fvp-bubble.is-on.is-playing::before { animation: fvp-ring 2s ease-out infinite; }

/* ---------- admin preview (website builder) ---------- */
.fvp-section[data-admin] { padding: 28px 16px; background: #f3f6f4; }
.fvp-admin-note {
  display: flex; gap: 12px; align-items: flex-start;
  max-width: 640px; margin: 0 auto 16px; padding: 12px 16px;
  border: 1px dashed var(--brand-primary, #1f8f66); border-radius: 12px;
  background: #fff; color: #24332d; font-size: 13.5px; line-height: 1.5;
}
.fvp-admin-note i { color: var(--brand-primary, #1f8f66); font-size: 20px; margin-top: 2px; }
.fvp-admin-note p { margin: 0; }
.fvp-admin-note code { word-break: break-all; }
.fvp.is-inline[data-state] {
  position: relative; right: auto; bottom: auto;
  width: min(640px, 100%); margin: 0 auto;
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
}
.fvp.is-inline .fvp-controls,
.fvp.is-inline .fvp-shield { display: none; }

/* ---------- motion ---------- */
@keyframes fvp-live {
  0%   { box-shadow: 0 0 0 0 rgba(255, 90, 95, .65); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 90, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 90, 95, 0); }
}
@keyframes fvp-nudge {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes fvp-ring {
  0%   { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.35); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fvp, .fvp-bubble, .fvp-backdrop, .fvp-poster, .fvp-welcome { transition: none !important; }
  .fvp-live, .fvp-bubble::before, .fvp-sound, .fvp-welcome-play::before { animation: none !important; }
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .fvp, .fvp-bubble, .fvp-backdrop, .fvp-welcome { --fvp-mini-w: 176px; --fvp-gap: 12px; --fvp-bottom: 14px; }
  .fvp { border-radius: 14px; }
  .fvp[data-state="mini"] :is(.fvp-titles, .fvp-live, .fvp-progress, [data-act="minimize"]) { display: none; }
  .fvp[data-state="mini"] .fvp-bar { justify-content: flex-end; padding: 8px; }
  .fvp[data-state="mini"] .fvp-controls { padding: 18px 8px 8px; }
  .fvp[data-state="mini"] .fvp-controls { justify-content: space-between; }
  .fvp[data-state="mini"] .fvp-sound { bottom: 36px; left: 8px; padding: 5px 10px; font-size: 11px; }
  .fvp[data-state="mini"] .fvp-ico { width: 26px; height: 26px; flex-basis: 26px; }
  .fvp[data-state="large"] { width: 94vw; }
  .fvp-extra { flex-direction: column; align-items: stretch; }
  .fvp-cta { text-align: center; }
  .fvp-bubble { width: 56px; height: 56px; }
  .fvp-welcome-media { aspect-ratio: auto; height: 112px; }
}