/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
    overflow: hidden;
}

:root {
    --ev-accent: #00d4aa;
}

/* Main container */
.embed-video-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: #000;
}

/* Video wrapper */
.video-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    height: 100%;
    overflow: hidden;
}

/* Video player */
.embed-video-player {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
    cursor: pointer;
}

/* kill the default mobile tap highlight box on interactive elements */
.video-wrapper,
.embed-video-player,
.ev-btn,
.ev-bigplay,
.ev-unmute,
.ev-progress,
.ev-quality-opt,
.watch-full {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
.ev-btn,
.ev-bigplay,
.ev-unmute,
.ev-quality-opt {
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

/* ---------- Loading spinner ---------- */
.ev-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ev-spin 0.8s linear infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 6;
}
.video-wrapper.is-loading .ev-spinner { opacity: 1; }

@keyframes ev-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Big center play ---------- */
.ev-bigplay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.15s ease, background 0.2s ease;
    z-index: 7;
}
.ev-bigplay:hover { background: rgba(0, 0, 0, 0.75); transform: translate(-50%, -50%) scale(1.05); }
.ev-bigplay svg { width: 38px; height: 38px; fill: #fff; margin-left: 4px; }
.video-wrapper.is-playing .ev-bigplay,
.video-wrapper.is-loading .ev-bigplay { opacity: 0; pointer-events: none; }

/* ---------- Tap for sound badge (autoplay previews) ---------- */
.ev-unmute {
    position: absolute;
    top: 12px;
    left: 12px;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 12px 7px 9px;
    border: 0;
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    z-index: 8;
    backdrop-filter: blur(2px);
}
.ev-unmute svg { width: 18px; height: 18px; fill: #fff; }
.video-wrapper.is-mutedhint .ev-unmute { display: inline-flex; }

/* ---------- Controls bar ---------- */
.ev-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 12px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0) 100%);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9;
    user-select: none;
}
.video-wrapper.is-hidden-ui .ev-controls {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

.ev-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s ease;
}
.ev-btn:hover { background: rgba(255, 255, 255, 0.15); }
.ev-btn .ev-ic { width: 22px; height: 22px; fill: #fff; }

/* play/pause + mute icon toggling */
.ev-ic-pause,
.ev-ic-muted,
.ev-ic-fsexit { display: none; }
.video-wrapper.is-playing .ev-play .ev-ic-play { display: none; }
.video-wrapper.is-playing .ev-play .ev-ic-pause { display: block; }
.video-wrapper.is-muted .ev-mute .ev-ic-vol { display: none; }
.video-wrapper.is-muted .ev-mute .ev-ic-muted { display: block; }
.video-wrapper.is-fullscreen .ev-fs .ev-ic-fs { display: none; }
.video-wrapper.is-fullscreen .ev-fs .ev-ic-fsexit { display: block; }

/* progress / seek bar */
.ev-progress {
    flex: 1;
    min-width: 40px;
    height: 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}
.ev-track {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.3);
    transition: height 0.12s ease;
}
.ev-progress:hover .ev-track { height: 6px; }
.ev-buffered,
.ev-played {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 4px;
}
.ev-buffered { background: rgba(255, 255, 255, 0.35); width: 0; }
.ev-played { background: var(--ev-accent); width: 0; }
.ev-handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: var(--ev-accent);
    transform: translateY(-50%) scale(0);
    transition: transform 0.12s ease;
}
.ev-progress:hover .ev-handle,
.ev-progress.is-scrubbing .ev-handle { transform: translateY(-50%) scale(1); }

/* time */
.ev-time {
    flex-shrink: 0;
    color: #fff;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: 0.92;
}

/* volume — vertical slider popup above the icon (does not shift the bar) */
.ev-volume {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.ev-vol-pop {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 34px;
    height: 104px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 20, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
/* invisible bridge so moving the cursor from the icon to the slider keeps :hover */
.ev-vol-pop::after {
    content: "";
    position: absolute;
    left: -4px;
    right: -4px;
    bottom: -10px;
    height: 12px;
}
.ev-volume:hover .ev-vol-pop,
.ev-vol-pop:hover,
.ev-volume.is-open .ev-vol-pop { display: flex; }
.ev-vol {
    flex-shrink: 0;
    width: 84px!important;
    height: 4px;
    transform: rotate(-90deg);
    transform-origin: center;
    cursor: pointer;
    accent-color: var(--ev-accent);
}

/* quality */
.ev-quality {
    position: relative;
    flex-shrink: 0;
}
.ev-quality-btn {
    width: auto;
    min-width: 34px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
}
.ev-quality-menu {
    position: absolute;
    bottom: 42px;
    right: 0;
    background: rgba(20, 20, 20, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 4px;
    min-width: 96px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.ev-quality-menu.hidden { display: none; }
.ev-quality-opt {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 13px;
    border-radius: 5px;
    cursor: pointer;
}
.ev-quality-opt:hover { background: rgba(255, 255, 255, 0.12); }
.ev-quality-opt.active { color: var(--ev-accent); font-weight: 600; }

/* Video info bar */
.embed-video-info {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9));
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
    font-size: 13px;
}

.video-title {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.video-branding {
    flex-shrink: 0;
}

.watch-full {
    color: var(--ev-accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.watch-full:hover {
    color: #00f5c4;
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 600px) {
    .embed-video-info {
        padding: 6px 8px;
        font-size: 12px;
        min-height: 32px;
    }
    .video-title { font-size: 12px; }
    .watch-full { font-size: 11px; }

    .ev-controls { gap: 6px; padding: 20px 8px 8px; }
    .ev-time { font-size: 11px; }
}

/* Hide info bar for very small heights */
@media (max-height: 200px) {
    .embed-video-info { display: none; }
}

/* Focus states for accessibility */
.ev-btn:focus-visible,
.watch-full:focus-visible,
.ev-quality-opt:focus-visible {
    outline: 2px solid var(--ev-accent);
    outline-offset: 2px;
}

/* Error state */
.embed-video-error {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 20;
}
