/**
 * WPSell Learnly — Secure Video Player Styles
 *
 * @package WPSell_Learnly
 */

/* ==========================================================================
   Player Container
   ========================================================================== */

.wpsell-video-player-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: var(--wpsell-radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    outline: none;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.wpsell-video-player-wrap *,
.wpsell-video-player-wrap *::before,
.wpsell-video-player-wrap *::after {
    box-sizing: border-box;
}

/* Fullscreen */
.wpsell-video-player-wrap.is-fullscreen {
    border-radius: 0;
    max-width: none;
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
}

/* ==========================================================================
   Video Element
   ========================================================================== */

.wpsell-vp-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
    /* Prevent native controls on iOS */
    -webkit-media-controls: none !important;
}

.wpsell-vp-video::-webkit-media-controls {
    display: none !important;
}

.wpsell-vp-video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* ==========================================================================
   Protection Overlay (transparent layer above video, prevents right-click on video element)
   ========================================================================== */

.wpsell-vp-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    cursor: pointer;
}

/* ==========================================================================
   Big Play Button (center)
   ========================================================================== */

.wpsell-vp-big-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wpsell-vp-big-play svg {
    width: 36px;
    height: 36px;
    fill: #fff;
    margin-left: 4px; /* optical centering for play triangle */
}

.wpsell-vp-big-play:hover {
    background: rgba(200, 169, 81, 0.8);
    border-color: #fff;
    transform: translate(-50%, -50%) scale(1.1);
}

.wpsell-vp-big-play.hidden {
    display: none;
}

/* Hide big play when playing */
.wpsell-video-player-wrap.is-playing .wpsell-vp-big-play {
    display: none;
}

/* ==========================================================================
   Loader / Spinner
   ========================================================================== */

.wpsell-vp-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.wpsell-vp-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--wpsell-gold);
    border-radius: 50%;
    animation: wpsell-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Controls Bar
   ========================================================================== */

.wpsell-vp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 0 12px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Show controls on hover / paused / ended */
.wpsell-video-player-wrap.show-controls .wpsell-vp-controls,
.wpsell-video-player-wrap.is-paused .wpsell-vp-controls,
.wpsell-video-player-wrap.is-ended .wpsell-vp-controls,
.wpsell-video-player-wrap:not(.is-playing) .wpsell-vp-controls {
    opacity: 1;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.wpsell-vp-progress {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s ease;
}

.wpsell-vp-progress:hover {
    height: 8px;
}

.wpsell-vp-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    width: 0;
    transition: width 0.3s ease;
    pointer-events: none;
}

.wpsell-vp-progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--wpsell-gold);
    border-radius: 3px;
    width: 0;
    pointer-events: none;
}

/* Scrubber dot */
.wpsell-vp-progress-filled::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.wpsell-vp-progress:hover .wpsell-vp-progress-filled::after {
    transform: translateY(-50%) scale(1);
}

/* ==========================================================================
   Controls Row (buttons + time)
   ========================================================================== */

.wpsell-vp-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpsell-vp-controls-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wpsell-vp-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* ==========================================================================
   Control Buttons
   ========================================================================== */

.wpsell-vp-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--wpsell-radius-sm);
    transition: background 0.2s, transform 0.15s;
    position: relative;
    outline: none;
    line-height: 1;
}

.wpsell-vp-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.wpsell-vp-btn:active {
    transform: scale(0.9);
}

.wpsell-vp-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ==========================================================================
   Time Display
   ========================================================================== */

.wpsell-vp-time {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    padding: 0 4px;
    white-space: nowrap;
}

.wpsell-vp-time-separator {
    opacity: 0.5;
}

/* ==========================================================================
   Volume Slider
   ========================================================================== */

.wpsell-vp-volume-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wpsell-vp-volume-slider {
    width: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: width 0.2s ease;
}

.wpsell-vp-volume-group:hover .wpsell-vp-volume-slider {
    width: 70px;
}

.wpsell-vp-volume-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 100%;
    pointer-events: none;
}

/* ==========================================================================
   Speed Menu
   ========================================================================== */

.wpsell-vp-speed {
    font-size: 13px;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
}

.wpsell-vp-speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: rgba(20, 20, 20, 0.95);
    border-radius: var(--wpsell-radius);
    padding: 4px 0;
    min-width: 80px;
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.wpsell-vp-speed-menu.active {
    display: block;
}

.wpsell-vp-speed-option {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}

.wpsell-vp-speed-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.wpsell-vp-speed-option.active {
    color: var(--wpsell-gold);
    font-weight: 700;
}

/* ==========================================================================
   Watermark
   ========================================================================== */

.wpsell-vp-watermark {
    position: absolute;
    z-index: 3;
    color: rgba(255, 255, 255, 0.15);
    font-size: 14px;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    animation: wpsell-watermark-move 30s linear infinite;
    white-space: nowrap;
}

@keyframes wpsell-watermark-move {
    0%   { top: 10%; left: 10%; }
    25%  { top: 70%; left: 75%; }
    50%  { top: 30%; left: 50%; }
    75%  { top: 80%; left: 15%; }
    100% { top: 10%; left: 10%; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .wpsell-vp-big-play {
        width: 60px;
        height: 60px;
    }
    .wpsell-vp-big-play svg {
        width: 28px;
        height: 28px;
    }

    .wpsell-vp-controls {
        padding: 0 8px 8px;
    }

    .wpsell-vp-btn svg {
        width: 18px;
        height: 18px;
    }

    .wpsell-vp-time {
        font-size: 11px;
    }

    .wpsell-vp-pip {
        display: none;
    }

    .wpsell-vp-volume-group:hover .wpsell-vp-volume-slider {
        width: 50px;
    }
}

/* ==========================================================================
   Admin Upload UI
   ========================================================================== */

.wpsell-video-upload-area {
    border: 2px dashed #c3c4c7;
    border-radius: var(--wpsell-radius);
    padding: 30px;
    text-align: center;
    background: var(--wpsell-50);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.wpsell-video-upload-area:hover,
.wpsell-video-upload-area.drag-over {
    border-color: var(--wpsell-gold);
    background: #f0f3ff;
}

.wpsell-video-upload-area .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #c3c4c7;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.wpsell-video-upload-area:hover .dashicons {
    color: var(--wpsell-gold);
}

.wpsell-video-upload-area p {
    margin: 5px 0;
    color: var(--wpsell-500);
}

.wpsell-video-upload-area .upload-hint {
    font-size: 12px;
    color: var(--wpsell-400);
}

/* Upload Progress */
.wpsell-upload-progress {
    margin-top: 15px;
    display: none;
}

.wpsell-upload-progress.active {
    display: block;
}

.wpsell-upload-progress-bar {
    height: 6px;
    background: var(--wpsell-200);
    border-radius: 3px;
    overflow: hidden;
}

.wpsell-upload-progress-fill {
    height: 100%;
    background: var(--wpsell-gold);
    width: 0;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.wpsell-upload-progress-text {
    font-size: 12px;
    color: var(--wpsell-500);
    margin-top: 5px;
    text-align: center;
}

/* Video File Info (after upload) */
.wpsell-video-file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--wpsell-success-bg);
    border: 1px solid #bbf7d0;
    border-radius: var(--wpsell-radius);
    margin-top: 10px;
}

.wpsell-video-file-info .file-icon {
    font-size: 36px;
    color: var(--wpsell-success);
}

.wpsell-video-file-info .file-details {
    flex: 1;
}

.wpsell-video-file-info .file-name {
    font-weight: 600;
    color: var(--wpsell-800);
    margin: 0 0 4px;
}

.wpsell-video-file-info .file-meta {
    font-size: 12px;
    color: var(--wpsell-500);
    margin: 0;
}

.wpsell-video-file-info .file-actions {
    display: flex;
    gap: 8px;
}

/* Security Badge */
.wpsell-video-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f0f3ff;
    color: var(--wpsell-gold);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--wpsell-radius-lg);
    margin-top: 8px;
}

.wpsell-video-security-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
