﻿/* ═══════════════════════════════════════════════
   Professional Custom Video Player
   ═══════════════════════════════════════════════ */

/* Container */
.vp-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    aspect-ratio: 16 / 9;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    outline: none;
    user-select: none;
}

    .vp-container:focus {
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), 0 8px 40px rgba(0, 0, 0, 0.6);
    }

/* Video element */
.vp-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* ── Poster / Thumbnail ── */
.vp-poster {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .vp-poster::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.25);
        transition: background 0.2s;
    }

    .vp-poster:hover::before {
        background: rgba(0, 0, 0, 0.4);
    }

.vp-poster-dark {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.vp-big-play {
    position: relative;
    z-index: 1;
    width: 80px;
    height: 80px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
}

.vp-poster:hover .vp-big-play {
    transform: scale(1.1);
}

.vp-poster-title {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 1;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Buffering Spinner ── */
.vp-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.vp-spinner-ring {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vp-spin 0.75s linear infinite;
}

@keyframes vp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Seek Notification ── */
.vp-seek-notification {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 30px;
    pointer-events: none;
    animation: vp-notif-fade 0.8s ease forwards;
}

.seek-forward {
    right: 15%;
}

.seek-backward {
    left: 15%;
}

@keyframes vp-notif-fade {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }

    20% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.95);
    }
}

/* ── Controls Wrapper ── */
.vp-controls-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient( to bottom, rgba(0,0,0,0.5) 0%, transparent 20%, transparent 60%, rgba(0,0,0,0.8) 100% );
    opacity: 1;
    transition: opacity 0.35s ease;
    z-index: 5;
    direction: ltr;
}

.controls-hidden .vp-controls-wrapper {
    opacity: 0;
}

.controls-hidden {
    cursor: none;
}

/* ── Top bar ── */
.vp-top-bar {
    padding: 16px 20px 10px;
    text-align: end;
}

.vp-title {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    letter-spacing: 0.02em;
}

/* ── Progress Area ── */
.vp-progress-area {
    padding: 0 16px;
    margin-bottom: 6px;
}

.vp-progress-track {
    position: relative;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: height 0.15s ease;
}

    .vp-progress-track:hover {
        height: 8px;
    }

.vp-progress-buffer {
    position: absolute;
    height: 100%;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    pointer-events: none;
    transition: width 0.3s linear;
}

.vp-progress-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #275fe0, rgba(39, 95, 224, 0.341));
    border-radius: 4px;
    pointer-events: none;
    transition: width 0.1s linear;
}

.vp-progress-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.15s ease;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.vp-progress-track:hover .vp-progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

/* Hover time tooltip */
.vp-hover-time {
    position: absolute;
    bottom: 16px;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

    .vp-hover-time::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 4px solid transparent;
        border-top-color: rgba(0,0,0,0.85);
    }

/* ── Bottom Bar ── */
.vp-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px 12px;
    gap: 8px;
}

.vp-controls-left,
.vp-controls-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Buttons ── */
.vp-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #fff;
    transition: background 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
}

    .vp-btn svg {
        width: 20px;
        height: 20px;
    }

    .vp-btn:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: scale(1.05);
    }

    .vp-btn:active {
        transform: scale(0.95);
    }

.vp-btn-text {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    min-width: 36px;
    padding: 6px 8px;
}

/* ── Volume ── */
.vp-volume-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vp-volume-bar {
    width: 72px;
    cursor: pointer;
    padding: 8px 0;
}

.vp-volume-track {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

.vp-volume-fill {
    position: absolute;
    height: 100%;
    background: #fff;
    border-radius: 3px;
    pointer-events: none;
}

.vp-volume-thumb {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    transition: transform 0.15s ease;
}

.vp-volume-bar:hover .vp-volume-thumb {
    transform: translate(-50%, -50%) scale(1);
}

/* ── Time display ── */
.vp-time {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 6px;
    letter-spacing: 0.03em;
}

/* ── Speed Menu ── */
.vp-speed-menu {
    position: relative;
}

.vp-speed-options {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    min-width: 80px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 50;
}

.vp-speed-menu.open .vp-speed-options {
    display: block;
    animation: vp-dropdown-in 0.15s ease;
}

@keyframes vp-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vp-speed-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 9px 16px;
    cursor: pointer;
    text-align: center;
    transition: background 0.1s, color 0.1s;
}

    .vp-speed-item:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }

    .vp-speed-item.active {
        background: rgba(229, 9, 20, 0.3);
        color: #ff6b6b;
        font-weight: 700;
    }

/* ── Fullscreen ── */
.vp-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
    width: 100vw !important;
    height: 100vh !important;
    aspect-ratio: unset !important;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .vp-volume-bar {
        width: 50px;
    }

    .vp-time {
        font-size: 0.7rem;
    }

    .vp-btn svg {
        width: 18px;
        height: 18px;
    }

    .vp-big-play {
        width: 60px;
        height: 60px;
    }
}
