/**
 * VideoGuard Hardware-Accelerated Blur & Protection Overlay Layer
 * Version: 1.0.6 - Full Click-to-Play Video Control Restoration
 */

/* Container wrapper position setup */
.videoguard-protected-container {
    position: relative !important;
    overflow: hidden !important;
    min-height: 220px;
    pointer-events: auto !important;
}

/* Video DOM element blur styling ONLY when vg-blurred is active */
.videoguard-protected-container.vg-blurred video,
.videoguard-protected-container.vg-blurred iframe,
.videoguard-protected-container.vg-blurred canvas,
.videoguard-protected-container.vg-blurred .plyr,
.videoguard-protected-container.vg-blurred .plyr__video-wrapper,
.videoguard-protected-container.vg-blurred .tutor-video-player,
.videoguard-protected-container.vg-blurred .tutor-single-lesson-segment {
    filter: blur(45px) brightness(0.15) grayscale(0.8) !important;
    -webkit-filter: blur(45px) brightness(0.15) grayscale(0.8) !important;
    opacity: 0.1 !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    transition: filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, transform 0.2s ease !important;
    transform: scale(1.08) !important;
}

/* When NOT blurred, ensure full clickability & normal player pointer events */
.videoguard-protected-container:not(.vg-blurred) video,
.videoguard-protected-container:not(.vg-blurred) iframe,
.videoguard-protected-container:not(.vg-blurred) canvas,
.videoguard-protected-container:not(.vg-blurred) .plyr,
.videoguard-protected-container:not(.vg-blurred) .tutor-video-player,
.videoguard-protected-container:not(.vg-blurred) .tutor-single-lesson-segment {
    filter: none !important;
    -webkit-filter: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    transform: none !important;
}

/* Fullscreen Overlay Layer (Hidden completely when unblurred) */
.videoguard-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: -1 !important;
    display: none !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(8, 12, 22, 0.95) !important;
    backdrop-filter: blur(30px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(200%) !important;
    color: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    text-align: center !important;
    padding: 24px !important;
    box-sizing: border-box !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.2s ease, visibility 0.2s ease !important;
    pointer-events: none !important;
}

/* Display overlay ONLY when container is blurred */
.videoguard-protected-container.vg-blurred .videoguard-overlay {
    z-index: 9999999 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Shield Icon & Typography */
.videoguard-shield-icon {
    width: 68px;
    height: 68px;
    margin-bottom: 14px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0) 75%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    animation: vg-pulse 2s infinite ease-in-out;
}

.videoguard-shield-icon svg {
    width: 44px;
    height: 44px;
    fill: currentColor;
}

.videoguard-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    margin: 0 0 6px 0 !important;
    color: #ffffff !important;
    letter-spacing: -0.3px !important;
}

.videoguard-state-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.videoguard-message {
    font-size: 14px !important;
    font-weight: 400 !important;
    margin: 0 0 20px 0 !important;
    color: #94a3b8 !important;
    max-width: 440px !important;
    line-height: 1.5 !important;
}

/* Installer Action Buttons */
.videoguard-action-group {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
}

.videoguard-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.videoguard-btn-download {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
}

.videoguard-btn-download:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.6) !important;
    color: #ffffff !important;
}

.videoguard-btn-launch {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4) !important;
}

.videoguard-btn-launch:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.6) !important;
    color: #ffffff !important;
}

@keyframes vg-pulse {
    0% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 0.85; }
}

/* Hide controls ONLY when container is actively blurred */
.videoguard-protected-container.vg-blurred .plyr__controls,
.videoguard-protected-container.vg-blurred .tutor-player-control {
    display: none !important;
}

/* Mobile Mode Specific Styling */
.videoguard-protected-container.vg-mobile-mode .videoguard-action-group {
    display: none !important;
}

.videoguard-protected-container.vg-mobile-mode .videoguard-overlay {
    padding: 16px !important;
}

/* Mobile State Badge Variants */
.videoguard-state-badge[data-state*="MOBILE_ACTIVE"] {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #6ee7b7 !important;
}

.videoguard-state-badge[data-state*="MOBILE_SCREEN_CAPTURE"],
.videoguard-state-badge[data-state*="MOBILE_SCREEN_RECORDING"],
.videoguard-state-badge[data-state*="MOBILE_BUILTIN_RECORDING"] {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.7) !important;
    color: #fca5a5 !important;
    animation: vg-pulse 1s infinite ease-in-out !important;
}

.videoguard-state-badge[data-state*="MOBILE_BLURRED"] {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    color: #fcd34d !important;
}

/* Dynamic Forensic Watermark Overlay Layer */
.videoguard-watermark {
    position: absolute !important;
    top: 20px;
    left: 20px;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    z-index: 9999 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
    letter-spacing: 0.8px !important;
    white-space: nowrap !important;
    padding: 5px 10px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 4px !important;
    opacity: 0.85 !important;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease !important;
}

/* Fast Instant Blur Transition on Mobile */
.videoguard-protected-container.vg-mobile-mode.vg-blurred video,
.videoguard-protected-container.vg-mobile-mode.vg-blurred iframe,
.videoguard-protected-container.vg-mobile-mode.vg-blurred canvas {
    filter: blur(55px) brightness(0.05) grayscale(1) !important;
    -webkit-filter: blur(55px) brightness(0.05) grayscale(1) !important;
    opacity: 0.05 !important;
    transition: filter 0.05s ease-out, opacity 0.05s ease-out !important;
}
