@import url('./vars.css');

/* Video Overlay */
.video-overlay {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Video Container — sizes to the video’s real aspect ratio */
.video-container {
    position: relative;
    width: fit-content;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 0 60px var(--accent-glow);
}

.video-container video {
    display: block;
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
}

.video-container--landscape video {
    width: min(1200px, 90vw);
    height: auto;
    max-height: 90vh;
}

.video-container--portrait video {
    height: min(90vh, 100dvh - 48px);
    width: auto;
    max-width: min(90vw, calc((100dvh - 48px) * 9 / 16));
}

/* Custom Video Controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
    padding: 20px;
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.video-controls.hidden {
    opacity: 0;
    transform: translateY(10px);
}

/* Progress Bar */
.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    cursor: pointer;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    width: 0%;
    border-radius: 999px;
    transition: width 0.1s linear;
    position: relative;
}

.progress-handle {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-container:hover .progress-handle {
    opacity: 1;
}

/* Controls Row */
.controls-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Control Buttons */
.video-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.video-btn:focus-visible,
.volume-btn:focus-visible,
.video-close:focus-visible,
.volume-slider:focus-visible,
.progress-container:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 3px;
}

/* Time Display */
.time-display {
    color: #fff;
    font-size: 14px;
    font-family: var(--font-heading);
    font-weight: 500;
    min-width: 120px;
}

/* Volume Container */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.volume-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.volume-btn:hover {
    transform: scale(1.1);
}

.volume-slider {
    width: 80px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Close Button */
.video-close {
    position: fixed;
    top: 30px;
    right: 40px;
    font-size: 2rem;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 1001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.video-close:hover {
    background: var(--accent);
    transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .video-container--landscape video {
        width: min(95vw, 1200px);
    }

    .video-container--portrait video {
        height: min(88dvh, 100dvh - 40px);
        max-width: min(92vw, calc((100dvh - 40px) * 9 / 16));
    }

    .volume-slider {
        width: 60px;
    }

    .time-display {
        font-size: 12px;
        min-width: 100px;
    }

    .video-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}
