/* ============================================================
   EcomNightHQ — Shared custom video controls
   Injected by includes/video-controls.js on every <video> on the
   site: a bottom progress bar + remaining time + ±10s seek buttons
   + a Stop button. Autoplay/Loop/±10s-visibility are owner-configured
   per video (via admin panel + data attributes), not visitor toggles.
   ============================================================ */

.ecn-vc-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 14px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.75), rgba(0,0,0,0.35) 65%, rgba(0,0,0,0));
    direction: ltr;
}

.ecn-vc-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ecn-vc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.16);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}
.ecn-vc-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.08); }
.ecn-vc-btn svg { width: 16px; height: 16px; pointer-events: none; }

.ecn-vc-chip {
    width: auto;
    height: 26px;
    border-radius: 100px;
    padding: 0 10px;
    gap: 5px;
    font-size: 10.5px;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.ecn-vc-chip svg { width: 13px; height: 13px; }
.ecn-vc-chip span { pointer-events: none; }

.ecn-vc-track {
    position: relative;
    flex: 1;
    height: 5px;
    border-radius: 100px;
    background: rgba(255,255,255,0.28);
    cursor: pointer;
    touch-action: none;
}
.ecn-vc-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    border-radius: 100px;
    background: var(--accent, #4D7CFF);
    pointer-events: none;
}
.ecn-vc-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.18);
    pointer-events: none;
}

.ecn-vc-time {
    flex-shrink: 0;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 11px;
    color: #fff;
    min-width: 40px;
    text-align: right;
    letter-spacing: 0.2px;
}

@media (max-width: 480px) {
    .ecn-vc-bar { padding: 6px 10px 10px; gap: 4px; }
    .ecn-vc-btn { width: 28px; height: 28px; }
    .ecn-vc-time { font-size: 10px; min-width: 34px; }
    .ecn-vc-chip span { display: none; }
    .ecn-vc-chip { width: 26px; height: 26px; padding: 0; border-radius: 50%; }
}

/* Fullscreen button toggles fullscreen on the WHOLE video box (this bar's
   own container), not the bare <video> element — that way this custom
   control bar stays visible and usable in fullscreen instead of being
   replaced by the browser's native video controls. The container normally
   has a fixed aspect-ratio (16:9 for the hero video, 9:16 for testimonial
   cards); override that while fullscreen so it actually fills the screen. */
.ecn-vc-host:fullscreen,
.ecn-vc-host:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background: #000;
}

/* ============================================================
   Fullscreen-only control for YouTube/Vimeo iframe embeds.
   Cross-origin iframes can't get the full play/seek/stop bar above
   (we don't control their internal playback state), but a fullscreen
   toggle on the whole box — consistent with the native <video> bar —
   was missing entirely for this case. Shown once playback starts
   (see script.js on the dropshipping course page and the coaching
   page), sitting above the iframe.
   ============================================================ */
.ecn-embed-fs-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 25;
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.ecn-embed-fs-btn:hover { background: rgba(0, 0, 0, 0.7); transform: scale(1.08); }
.ecn-embed-fs-btn svg { width: 16px; height: 16px; pointer-events: none; }
[dir="rtl"] .ecn-embed-fs-btn { right: auto; left: 12px; }

.ecn-embed-fs-host:fullscreen,
.ecn-embed-fs-host:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background: #000;
}

/* iOS Safari (and every iOS browser — WebKit-enforced) has no Fullscreen
   API for arbitrary elements, only for a real <video> tag. That means the
   .ecn-embed-fs-btn's native requestFullscreen()/webkitRequestFullscreen()
   call silently does nothing on iPhone/iPad for cross-origin iframe or
   Wistia embeds (there's no <video> element to hand off to). script.js
   detects that case and toggles these classes instead as a CSS-only
   fallback, so the button still works on iOS.
   First attempt just forced the box to 100vw x 100vh — on a tall phone
   screen that stretches a landscape (16:9) video vertically, since the
   box's own aspect-ratio was overridden along with its size. Fixed by
   keeping the 16:9 ratio and using min()/calc() to size the box as large
   as possible WITHOUT exceeding either viewport dimension (the same
   effect as object-fit:contain), centered over a dedicated full-black
   backdrop so the letterboxed edges look intentional. */
.ecn-fake-fs-backdrop {
    display: none;
}
.ecn-fake-fs-backdrop.ecn-fake-fs-backdrop-active {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: #000;
}
.ecn-fake-fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(100vw, calc(100vh * 16 / 9)) !important;
    height: min(100vh, calc(100vw * 9 / 16)) !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    aspect-ratio: 16 / 9 !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    background: #000;
}
body.ecn-fs-lock { overflow: hidden !important; }

/* Visible ✕ close button shown only while the fake-fullscreen fallback
   above is active — real fullscreen has an obvious OS/browser-provided
   way out (Esc, swipe-down, etc.), this CSS-only fallback doesn't, so one
   has to be provided explicitly. Sits above both the box and the backdrop
   (higher z-index than both). */
.ecn-fake-fs-close-btn {
    display: none;
}
.ecn-fake-fs-close-btn.ecn-fake-fs-close-btn-active {
    display: flex;
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    z-index: 100000;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.ecn-fake-fs-close-btn:hover { background: rgba(0, 0, 0, 0.8); transform: scale(1.08); }
.ecn-fake-fs-close-btn svg { width: 20px; height: 20px; pointer-events: none; }
[dir="rtl"] .ecn-fake-fs-close-btn.ecn-fake-fs-close-btn-active { right: auto; left: max(16px, env(safe-area-inset-left)); }
