/* ═══════════════════════════════════════════════════════════════
   Frame — player.css
   Dark theme • Space Grotesk • Plyr custom theme
   Used by frontend/index.html (standalone) and the Cloudflare
   Worker embed page (/embed/:id → body.frame-embed).
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0A0A0F;
    --surface: #14141B;
    --accent: #E85D4E;
    --accent-dim: #E85D4E22;
    --text: #F5F5F0;
    --border: #1E1E28;
    --font: 'Space Grotesk', sans-serif;
    --skip-size: 52px;
    --skip-icon: 22px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    line-height: 1.5;
    overflow-x: hidden;
    gap: 16px;
}

/* ── Player Wrapper ── */
.player-wrapper {
    width: 100%;
    max-width: 660px;
    position: relative;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.6);
}

.video-container {
    position: relative;
    z-index: 1;
    background: #000;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.video-container video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* ── Video Title Overlay ── */
.video-title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    padding: 20px 24px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}
.video-title.show {
    opacity: 1;
}
.video-title h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    margin: 0;
    line-height: 1.3;
    max-width: 80%;
}

/* ── Skip Overlay ── */
.skip-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.skip-btn {
    pointer-events: auto;
    width: var(--skip-size);
    height: var(--skip-size);
    border-radius: 50%;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.5));
}

/* Show state — controlled by JS via .show class */
.skip-overlay.show .skip-btn {
    opacity: 1;
    transform: scale(1);
}

.skip-btn svg {
    width: var(--skip-icon);
    height: var(--skip-icon);
    color: #fff;
    transition: color 0.25s ease, transform 0.25s ease;
    display: block;
    filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.3));
}

.skip-btn .skip-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.6px;
    opacity: 0;
    transition: opacity 0.25s ease;
    white-space: nowrap;
    text-transform: uppercase;
    pointer-events: none;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.skip-btn:hover {
    transform: scale(1.15) !important;
}

.skip-btn:hover svg {
    color: var(--accent);
    transform: scale(1.05);
}

.skip-btn:hover .skip-label {
    opacity: 1;
}

.skip-btn:active {
    transform: scale(0.88) !important;
}
.skip-btn:active svg {
    transform: scale(0.9);
}

/* ── Plyr Custom Theme ── */
.plyr {
    --plyr-color-main: var(--accent);
    --plyr-video-control-color: var(--text);
    --plyr-video-control-color-hover: #fff;
    --plyr-video-control-background-hover: var(--accent);
    --plyr-menu-background: var(--surface);
    --plyr-menu-color: var(--text);
    --plyr-tooltip-background: var(--surface);
    --plyr-tooltip-color: var(--text);
    --plyr-progress-loading-background: var(--border);
    --plyr-range-fill-background: var(--accent);
    --plyr-range-thumb-background: var(--accent);
    --plyr-range-thumb-shadow: 0 0 0 5px var(--accent-dim);
    --plyr-video-progress-buffered-background: var(--border);
    --plyr-control-icon-size: 16px;
    --plyr-control-spacing: 16px;
    --plyr-font-family: var(--font);
    background: var(--bg);
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.plyr__controls {
    background: linear-gradient(to top, rgba(10, 10, 15, 0.97) 0%, rgba(10, 10, 15, 0.5) 60%, transparent 100%) !important;
    padding: 24px 18px 18px !important;
}

.plyr__control {
    border-radius: 10px !important;
    transition: all 0.2s ease;
}

.plyr__control:hover {
    background: var(--accent) !important;
    color: #fff !important;
    transform: none !important;
}

/* ── Center play button: hover pe move/shift NA ho ──
   (Plyr ise translate(-50%,-50%) se center karta hai — hamara
   .plyr__control:hover reset usay hilata tha. Ab permanently pinned.) */
.plyr__control--overlaid,
.plyr__control--overlaid:hover,
.plyr__control--overlaid:active,
.plyr__control--overlaid:focus,
.plyr__control--overlaid:focus-visible {
    transform: translate(-50%, -50%) !important;
}

.plyr__time {
    font-family: var(--font) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    letter-spacing: 0.2px;
}

.plyr__progress__container {
    margin-left: 4px;
}

.plyr__menu__container {
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

.plyr__menu__container .plyr__control {
    border-radius: 8px !important;
}

.plyr__tooltip {
    border-radius: 6px !important;
    font-weight: 600;
    font-size: 11px;
}

.plyr__badge {
    border-radius: 10px !important;
    font-weight: 600;
    font-size: 10px;
}

.plyr__volume input[type='range'] {
    min-width: 0;
}

/* ── Fullscreen (mobile landscape bhi): poori video nazar aaye ── */
.plyr:fullscreen video,
.plyr:-webkit-full-screen video {
    object-fit: contain;
}

/* ── Desktop: fixed 660×370 ── */
@media (min-width: 769px) {
    .player-wrapper {
        width: 660px;
        height: 370px;
        max-width: none;
    }

    .video-container {
        width: 100%;
        height: 100%;
        aspect-ratio: auto;
    }

    .video-container video {
        height: 100%;
        object-fit: cover;
    }
}

/* ── Tablet ── */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    :root {
        --skip-size: 48px;
        --skip-icon: 20px;
    }

    .skip-overlay {
        padding: 0 16px;
    }

    .skip-btn .skip-label {
        font-size: 9px;
        bottom: -18px;
    }

    .video-title {
        padding: 16px 18px;
    }
    .video-title h2 {
        font-size: 13px;
    }

    .plyr {
        --plyr-control-icon-size: 20px;
        --plyr-control-spacing: 12px;
    }

    .plyr__controls {
        padding: 18px 12px 14px !important;
    }

    .plyr__control {
        padding: 11px !important;
    }

    .plyr__control__icon {
        width: 20px;
        height: 20px;
    }

    .plyr__control--overlaid {
        padding: 16px !important;
    }

    .plyr__time {
        font-size: 12px !important;
    }

    /* 📱 Mobile: cover crop ke bajaye POORI video nazar aaye */
    .video-container video {
        object-fit: contain;
    }
}

/* ── Mobile ── */
@media (max-width: 480px) {
    body {
        padding: 8px;
        gap: 10px;
    }

    :root {
        --skip-size: 44px;
        --skip-icon: 18px;
    }

    .skip-overlay {
        padding: 0 10px;
    }

    .skip-btn .skip-label {
        font-size: 8px;
        bottom: -16px;
        letter-spacing: 0.4px;
    }

    .video-title {
        padding: 12px 14px;
    }
    .video-title h2 {
        font-size: 12px;
        max-width: 75%;
    }

    .plyr {
        --plyr-control-icon-size: 22px;
        --plyr-control-spacing: 12px;
    }

    :root {
        --skip-size: 52px;
        --skip-icon: 24px;
    }

    .plyr__controls {
        padding: 14px 8px 12px !important;
    }

    .plyr__time {
        font-size: 12.5px !important;
    }

    .plyr__control {
        padding: 12px !important;
    }

    .plyr__control--overlaid {
        padding: 18px !important;
    }

    .plyr__control__icon {
        width: 22px;
        height: 22px;
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ── Embed mode (Cloudflare Worker /embed/:id) ──
   Standalone: 660×370 • Embed: 100% width / 100% height */
html.frame-embed {
    height: 100%;
}

body.frame-embed {
    padding: 0;
    gap: 0;
    min-height: 100%;
    height: 100%;
}

body.frame-embed .player-wrapper {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
}

body.frame-embed .video-container {
    aspect-ratio: auto;
    height: 100%;
}


