/* =============================================
   Secure Video Player v2.0 - Styles
   ============================================= */

/* ---- Wrapper ---- */
.svp-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* ---- Toolbar ---- */
.svp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 10px 16px;
    border-bottom: 2px solid #0f3460;
}

.svp-title {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.svp-controls {
    display: flex;
    gap: 8px;
}

.svp-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 4px;
    width: 30px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
}
.svp-btn:hover                { background: rgba(255,255,255,0.2); transform: scale(1.08); }
.svp-btn.svp-hide:hover       { background: rgba(231,76,60,0.6); }
.svp-btn.svp-maximize:hover   { background: rgba(52,152,219,0.5); }
.svp-btn.svp-minimize:hover   { background: rgba(241,196,15,0.4); }

/* ---- Player Container ---- */
.svp-player-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
    transition: height 0.3s ease;
}

/* ---- iframe / YT API target div ---- */
.svp-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* YT API creates an iframe inside our div — make it fill */
.svp-iframe iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    pointer-events: auto;
}

/* ---- Canvas Watermark ---- */
.svp-canvas-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 3;
    pointer-events: none;
    display: none;
}

/* ---- Custom HTML Controls
        controls=0 removes ALL YouTube UI — we draw our own.
        No YouTube logo. No "Copy link". No "Watch on YouTube".
---- */
.svp-custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 6;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 8px 12px 10px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.svp-player-container:hover .svp-custom-controls,
.svp-custom-controls:hover,
.svp-custom-controls:focus-within {
    opacity: 1;
    pointer-events: all;
}

.svp-ctrl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.svp-ctrl-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.svp-ctrl-btn:hover { transform: scale(1.15); }

.svp-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.3);
    outline: none;
    cursor: pointer;
}
.svp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.svp-volume-slider::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
}

.svp-time {
    color: #fff;
    font-size: 12px;
    font-family: monospace;
    margin-left: auto;
    white-space: nowrap;
    user-select: none;
}

.svp-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}
.svp-progress-bar:hover { height: 7px; }

.svp-progress-fill {
    height: 100%;
    background: #e74c3c;
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s linear;
    pointer-events: none;
}

/* ---- Loading Spinner ---- */
.svp-loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 7;
    pointer-events: none;
}
.svp-spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: svp-spin 0.8s linear infinite;
}
@keyframes svp-spin { to { transform: rotate(360deg); } }

/* ---- Black Overlay (recording protection) ---- */
.svp-black-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.svp-black-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.svp-overlay-message {
    text-align: center;
    color: #fff;
    padding: 30px;
}
.svp-overlay-message p {
    font-size: 18px;
    font-weight: 600;
    margin: 12px 0 4px;
    color: #e74c3c;
}
.svp-overlay-message small {
    color: #aaa;
    font-size: 13px;
}

/* ---- Minimized Bar ---- */
.svp-minimized-bar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid #0f3460;
}

/* ---- Restore button (after hide) ---- */
.svp-restore-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0f3460, #533483);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s, transform 0.1s;
    margin: 8px 0;
}
.svp-restore-btn:hover { opacity: 0.85; transform: scale(1.02); }
.svp-restore-wrap { text-align: left; }

/* ---- Maximized / Fullscreen ---- */
.svp-wrapper.svp-is-maximized {
    position: fixed;
    top: 0; left: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw;
    z-index: 999999;
    border-radius: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}
.svp-wrapper.svp-is-maximized .svp-player-container {
    flex: 1;
    height: auto !important;
}
.svp-wrapper.svp-is-maximized .svp-iframe,
.svp-wrapper.svp-is-maximized .svp-iframe iframe {
    height: 100% !important;
}

/* ---- Error ---- */
.svp-error {
    color: #e74c3c;
    background: #fdf0ef;
    border: 1px solid #e74c3c;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
}

/* ---- Tap-to-play transparent overlay ---- */
/* Sits over the iframe center, lets users tap to play/pause on mobile */
/* Does NOT block YouTube's own click-to-play on first load              */
.svp-video-click-area {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    /* Leave bottom 60px for our custom controls bar */
    bottom: 60px;
    z-index: 4;
    background: transparent;
    cursor: pointer;
}

/* Make custom controls always visible on mobile (no hover on touch) */
@media (max-width: 768px) {
    .svp-custom-controls {
        opacity: 1 !important;
        pointer-events: all !important;
    }
}
