/* =====================================================
 * Watawdeh — Free Video Player (public site)
 * Stylesheet for JS/free-video-player.js
 * Self-contained, no external CSS deps.
 * ===================================================== */

:root {
    --fvp-bg-overlay: rgba(8, 13, 27, 0.92);
    --fvp-modal-bg: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --fvp-header-bg: linear-gradient(135deg, #0A2463 0%, #1E3A8A 50%, #06B6D4 100%);
    --fvp-accent: #06B6D4;
    --fvp-accent-2: #10B981;
    --fvp-accent-warn: #F59E0B;
    --fvp-accent-danger: #DC2626;
    --fvp-text: #fff;
    --fvp-text-mute: rgba(255, 255, 255, 0.7);
    --fvp-text-faint: rgba(255, 255, 255, 0.45);
    --fvp-progress-track: rgba(255, 255, 255, 0.18);
    --fvp-progress-buffer: rgba(255, 255, 255, 0.32);
    --fvp-progress-fill: linear-gradient(90deg, #06B6D4, #10B981);
}

/* Lock scroll while modal open */
body.fvp-body-locked {
    overflow: hidden;
}

/* Overlay */
.fvp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: var(--fvp-bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    direction: rtl;

    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.fvp-modal-overlay.fvp-show {
    opacity: 1;
    pointer-events: auto;
}

/* Modal */
.fvp-modal {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: var(--fvp-modal-bg);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1);
    color: var(--fvp-text);
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

.fvp-modal-overlay.fvp-show .fvp-modal {
    transform: translateY(0) scale(1);
}

/* Header */
.fvp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    background: var(--fvp-header-bg);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.fvp-modal-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(6, 182, 212, 0.25) 0, transparent 50%),
        radial-gradient(circle at 10% 90%, rgba(16, 185, 129, 0.18) 0, transparent 45%);
    pointer-events: none;
}

.fvp-title-section {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.fvp-title {
    margin: 0 0 4px;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fvp-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
}

.fvp-subtitle i {
    color: var(--fvp-accent);
}

.fvp-close-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.fvp-close-btn:hover {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(220, 38, 38, 1);
    transform: rotate(90deg) scale(1.05);
}

/* Body */
.fvp-modal-body {
    padding: 0;
    background: #000;
}

/* Player wrapper */
.fvp-player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.fvp-player-wrapper #fvpYouTubePlayer,
.fvp-player-wrapper #fvpYTContainer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.fvp-player-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Cover the top area where YouTube title / "Watch on YouTube" appears */
.fvp-cover-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, #000 0%, #000 50%, rgba(0,0,0,0.85) 70%, transparent 100%);
    z-index: 8;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fvp-cover-top.controls-hidden {
    opacity: 0;
    visibility: hidden;
}

/* Click overlay — intercepts clicks for play/pause and prevents iframe interaction */
.fvp-click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 90px; /* leave room for custom controls */
    z-index: 5;
    cursor: pointer;
    pointer-events: auto;
    transition: bottom 0.3s ease;
}

.fvp-click-overlay.controls-hidden {
    bottom: 0;
}

/* A second silent layer that further isolates the iframe from direct interaction */
.fvp-protection-layer {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: transparent;
}

/* ============ Custom Controls ============ */
.fvp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 12px 18px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 60%, transparent 100%);
    pointer-events: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fvp-controls.controls-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.fvp-controls * {
    pointer-events: auto;
}

.fvp-controls.controls-hidden * {
    pointer-events: none;
}

/* Progress row */
.fvp-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.fvp-time {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 46px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.fvp-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--fvp-progress-track);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: height 0.2s ease;
}

.fvp-progress-bar:hover {
    height: 10px;
}

.fvp-progress-buffered {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 0%;
    background: var(--fvp-progress-buffer);
    border-radius: 3px;
}

.fvp-progress-fill {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 0%;
    background: var(--fvp-progress-fill);
    border-radius: 3px;
    z-index: 2;
    transition: width 0.1s linear;
}

.fvp-progress-handle {
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.45);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.fvp-progress-bar:hover .fvp-progress-handle {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* Controls row */
.fvp-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.fvp-controls-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fvp-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.fvp-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.08);
}

.fvp-btn:active {
    transform: scale(0.95);
}

.fvp-btn-play {
    width: 46px;
    height: 46px;
    font-size: 1.15rem;
    background: linear-gradient(135deg, var(--fvp-accent) 0%, var(--fvp-accent-2) 100%);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
}

.fvp-btn-play:hover {
    background: linear-gradient(135deg, #0891B2 0%, #059669 100%);
    box-shadow: 0 8px 22px rgba(6, 182, 212, 0.55);
}

/* Volume */
.fvp-volume-control {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fvp-volume-wrap {
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
}

.fvp-volume-wrap.visible {
    width: 88px;
}

.fvp-volume-slider {
    width: 88px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--fvp-accent), var(--fvp-accent-2));
    border-radius: 2px;
    cursor: pointer;
    direction: ltr;
}

.fvp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.fvp-volume-slider::-moz-range-thumb {
    width: 13px;
    height: 13px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Speed */
.fvp-speed-control {
    position: relative;
    display: flex;
    align-items: center;
}

.fvp-speed-btn {
    min-width: 44px;
    padding: 0 10px;
    border-radius: 19px;
    width: auto;
}

.fvp-speed-label {
    font-size: 0.85rem;
    font-weight: 700;
}

.fvp-speed-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 150px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    z-index: 200;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.fvp-speed-menu.visible {
    opacity: 1;
    visibility: visible;
}

.fvp-speed-menu::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.97) transparent transparent transparent;
}

.fvp-speed-title {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    padding: 4px 16px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
    text-align: center;
}

.fvp-speed-option {
    display: block;
    width: 100%;
    padding: 9px 16px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.fvp-speed-option:hover {
    background: rgba(6, 182, 212, 0.15);
}

.fvp-speed-option.active {
    color: var(--fvp-accent);
    font-weight: 700;
    background: rgba(6, 182, 212, 0.18);
}

.fvp-speed-option.active::before {
    content: '✓ ';
}

/* ============ Watermarks ============ */
.fvp-watermark {
    position: absolute;
    color: rgba(255, 255, 255, 0.18);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 6;
    text-shadow: 0 2px 6px rgba(0,0,0,0.7);
    white-space: nowrap;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

.fvp-wm-1 {
    top: 14%;
    right: 6%;
    animation: fvpWm1 35s ease-in-out infinite;
}

.fvp-wm-2 {
    top: 50%;
    left: 8%;
    transform: translateY(-50%);
    animation: fvpWm2 42s ease-in-out infinite;
}

.fvp-wm-3 {
    bottom: 20%;
    right: 35%;
    animation: fvpWm3 50s ease-in-out infinite;
}

@keyframes fvpWm1 {
    0%, 100% { top: 14%; right: 6%; opacity: 0.18; }
    33%      { top: 28%; right: 30%; opacity: 0.22; }
    66%      { top: 60%; right: 12%; opacity: 0.16; }
}

@keyframes fvpWm2 {
    0%, 100% { top: 50%; left: 8%; opacity: 0.16; }
    50%      { top: 25%; left: 35%; opacity: 0.22; }
}

@keyframes fvpWm3 {
    0%, 100% { bottom: 20%; right: 35%; opacity: 0.18; }
    50%      { bottom: 60%; right: 18%; opacity: 0.13; }
}

/* ============ States ============ */
.fvp-error-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.fvp-error-state i {
    font-size: 3rem;
    color: var(--fvp-accent-warn);
}

.fvp-error-state span {
    font-size: 1.05rem;
    font-weight: 600;
}

/* DevTools warning */
.fvp-devtools-warning {
    position: absolute;
    inset: 0;
    background: rgba(8, 13, 27, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fvpFade 0.3s ease;
}

.fvp-tampering-warning {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.fvp-warning-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
    max-width: 480px;
}

.fvp-warning-content i {
    font-size: 4rem;
    color: var(--fvp-accent-warn);
    margin-bottom: 1rem;
    display: block;
    animation: fvpPulse 2s infinite;
}

.fvp-warning-content i.fvp-warn-red {
    color: var(--fvp-accent-danger);
}

.fvp-warning-content h3 {
    font-size: 1.6rem;
    margin: 0 0 0.5rem;
    color: var(--fvp-accent-warn);
    font-weight: 800;
}

.fvp-tampering-warning .fvp-warning-content h3 {
    color: var(--fvp-accent-danger);
}

.fvp-warning-content p {
    color: #cbd5e1;
    font-size: 1rem;
    margin: 0.4rem 0;
    line-height: 1.6;
}

.fvp-warning-fine {
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 0.85rem !important;
    margin-top: 1rem !important;
}

@keyframes fvpPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.1); opacity: 0.85; }
}

@keyframes fvpFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Fullscreen */
.fvp-modal:-webkit-full-screen,
.fvp-modal:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

.fvp-modal:-webkit-full-screen .fvp-player-wrapper,
.fvp-modal:fullscreen .fvp-player-wrapper {
    aspect-ratio: auto;
    height: calc(100vh - 76px);
}

.fvp-modal:-webkit-full-screen .fvp-modal-header,
.fvp-modal:fullscreen .fvp-modal-header {
    border-radius: 0;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .fvp-modal-overlay {
        padding: 0;
    }

    .fvp-modal {
        max-width: 100%;
        height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .fvp-modal-header {
        padding: 12px 16px;
    }

    .fvp-title {
        font-size: 1rem;
    }

    .fvp-subtitle {
        font-size: 0.78rem;
    }

    .fvp-modal-body {
        flex: 1;
        display: flex;
        align-items: center;
        background: #000;
    }

    .fvp-player-wrapper {
        aspect-ratio: 16 / 9;
        max-height: 100%;
    }

    .fvp-controls {
        padding: 10px 12px 12px;
    }

    .fvp-controls-row {
        gap: 4px;
    }

    .fvp-btn {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .fvp-btn-play {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .fvp-time {
        font-size: 0.75rem;
        min-width: 38px;
    }

    .fvp-progress-row {
        gap: 8px;
        margin-bottom: 8px;
    }

    .fvp-volume-wrap {
        display: none !important;
    }

    .fvp-speed-btn {
        min-width: 38px;
        padding: 0 8px;
    }

    .fvp-speed-menu {
        min-width: 130px;
        right: 0;
        left: auto;
        transform: none;
    }

    .fvp-speed-menu::after {
        left: auto;
        right: 14px;
        transform: none;
    }

    .fvp-watermark {
        font-size: 13px;
    }
}

@media (max-width: 420px) {
    .fvp-title {
        font-size: 0.92rem;
        max-width: 220px;
    }

    .fvp-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}
