/* ============================================================================
 * MX MASTI / NovaStream Pro — Strict 16:9 Responsive Video Player (v5.0)
 * Reference Screenshot Match: Top Back/Gear/CC/Fullscreen, Dark Ring Center Play,
 * Crimson Progress Bar + Bottom Timestamp & 720p / 1x / Fullscreen Pills
 * ============================================================================ */

.mxm-player-shell {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    background: #000000;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(45, 212, 255, 0.22);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.62);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

@supports not (aspect-ratio: 16 / 9) {
    .mxm-player-shell::before {
        content: "";
        display: block;
        padding-top: 56.25%;
    }
}

.mxm-player-shell:fullscreen,
.mxm-player-shell:-webkit-full-screen,
.mxm-player-shell.is-pseudo-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    aspect-ratio: auto;
    border-radius: 0;
    border: 0;
}

.mxm-player-shell video,
.mxm-player-shell iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    object-fit: cover;
    background: #000000;
}
.mxm-player-shell:fullscreen video,
.mxm-player-shell.is-pseudo-fullscreen video {
    object-fit: contain;
}

/* Top Controls Bar (`‹` on Left + `⚙` `CC` `⛶` on Right) */
.mxm-player-top-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mxm-player-shell.is-embed .mxm-player-back {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 8;
    opacity: 0.72;
}
.mxm-player-shell.is-embed:hover .mxm-player-back {
    opacity: 1;
}

.mxm-player-back {
    pointer-events: auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(6, 12, 18, 0.56);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.mxm-player-back:hover {
    background: rgba(6, 12, 18, 0.85);
}

.mxm-player-top-actions {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.mxm-top-icbtn {
    border: none;
    background: rgba(6, 12, 18, 0.44);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #FFFFFF;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.mxm-top-icbtn:hover, .mxm-top-icbtn.active {
    color: #00F0FF;
    background: rgba(6, 12, 18, 0.78);
}

.mxm-cc-box {
    border: 1.7px solid currentColor;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 900;
    padding: 1px 4px;
    line-height: 1.1;
}

.mxm-player-shell.controls-hidden {
    cursor: none;
}
.mxm-player-shell.controls-hidden .mxm-player-top-badges,
.mxm-player-shell.controls-hidden .mxm-player-center-controls,
.mxm-player-shell.controls-hidden .mxm-player-bar {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Center Play Circle (Dark Translucent Circle + Crisp White 2px Ring) */
.mxm-player-center-controls {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mxm-center-btn,
.mxm-skip-btn {
    pointer-events: auto;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mxm-center-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(10, 14, 20, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}
.mxm-center-btn svg {
    width: 26px;
    height: 26px;
    margin-left: 2px;
}
.mxm-center-btn:hover { transform: scale(1.06); background: rgba(10, 14, 20, 0.8); }
.mxm-center-btn:active { transform: scale(0.95); }

.mxm-skip-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(8, 12, 18, 0.58);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 0.68rem;
    font-weight: 800;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.15s ease;
}
.mxm-player-shell:hover .mxm-skip-btn {
    opacity: 1;
}

/* Spinner & Error Overlay */
.mxm-player-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 42px; height: 42px;
    margin: -21px 0 0 -21px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #00F0FF;
    border-radius: 50%;
    z-index: 7;
    display: none;
    pointer-events: none;
    animation: mxm-spin 0.8s linear infinite;
}
.mxm-player-shell.is-loading .mxm-player-spinner { display: block; }
@keyframes mxm-spin { to { transform: rotate(360deg); } }

.mxm-player-error {
    position: absolute;
    inset: 0;
    z-index: 12;
    background: rgba(4, 12, 20, 0.94);
    color: #FFFFFF;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 22px;
    gap: 10px;
}
.mxm-player-error.is-visible { display: flex; }
.mxm-player-error p { margin: 0; color: #9BB8CC; font-size: 0.85rem; max-width: 420px; line-height: 1.45; }

/* Bottom Timeline + Readout Controls (Matching Reference Screenshot) */
.mxm-player-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9;
    padding: 20px 12px 9px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(3,8,14,0.88) 100%);
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mxm-seek-wrap {
    width: 100%;
    display: flex;
    align-items: center;
}
.mxm-seek-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    outline: none;
    cursor: pointer;
    margin: 0;
}
.mxm-seek-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #F43F5E;
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.85);
    cursor: pointer;
}
.mxm-seek-range::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: none;
    border-radius: 50%;
    background: #F43F5E;
    cursor: pointer;
}

.mxm-bar-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.mxm-bar-left {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.mxm-bar-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mxm-pbtn {
    background: transparent;
    border: none;
    color: #FFFFFF;
    padding: 3px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mxm-pbtn:hover { color: #00F0FF; }

.mxm-ptime {
    font-size: 0.78rem;
    font-weight: 600;
    color: #F1F7FB;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.mxm-bar-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(6, 12, 18, 0.72);
    color: #FFFFFF;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}
.mxm-bar-pill:hover {
    border-color: #00F0FF;
    color: #00F0FF;
}
.mxm-fs-mini {
    padding: 4px 7px;
}

.mxm-vol-wrap {
    display: none;
    align-items: center;
    gap: 5px;
}
@media (min-width: 720px) {
    .mxm-vol-wrap { display: inline-flex; }
}
.mxm-vol-slider {
    width: 60px;
    height: 4px;
    accent-color: #00F0FF;
    cursor: pointer;
}

/* Settings Gear Popover */
.mxm-gear-popover {
    position: absolute;
    right: 12px;
    bottom: 62px;
    z-index: 15;
    width: 215px;
    background: rgba(6, 20, 32, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 240, 255, 0.28);
    border-radius: 14px;
    padding: 12px;
    display: none;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
}
.mxm-gear-popover.is-open { display: block; }
.mxm-gear-label {
    font-size: 0.69rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #88A4B8;
    margin-bottom: 6px;
}
.mxm-gear-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}
.mxm-gear-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #E2F1FA;
    border-radius: 7px;
    padding: 4px 8px;
    font-size: 0.73rem;
    font-weight: 700;
    cursor: pointer;
}
.mxm-gear-chip.active {
    background: #00F0FF;
    border-color: transparent;
    color: #021D2A;
}
