/**
 * ==============================================================================
 * ESTILOS DEL REPRODUCTOR SEGURO DE YOUTUBE (ESLABÓN FINANCIERO)
 * Capas visuales: Contenedor protegido, Shield, Watermark dinámico, Controles
 * ==============================================================================
 */

.secure-yt-player {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    background: #000000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 1. Iframe del Video */
.secure-video-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    z-index: 1;
}

.secure-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; /* Clics absorbidos por el shield superior */
}

/* 2. CAPA 7: Shield / Overlay Transparente */
.secure-click-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(0, 0, 0, 0.001); /* Transparente pero detectable */
    cursor: pointer;
}

/* 3. CAPA 6: Marca de Agua Dinámica del Alumno */
.secure-watermark {
    position: absolute;
    top: 25px;
    left: 25px;
    z-index: 15;
    pointer-events: none;
    user-select: none;
    transition: top 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), left 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
    opacity: 0.85;
}

.secure-watermark .watermark-content {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: rgba(10, 10, 15, 0.55);
    border: 1px solid rgba(242, 201, 76, 0.3);
    border-radius: 40px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.secure-watermark .watermark-icon {
    color: var(--accent-color, #f2c94c);
    font-size: 0.85rem;
    opacity: 0.9;
}

/* 4. Botón Central de Play/Pause */
.secure-center-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    z-index: 12;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(242, 201, 76, 0.95);
    color: #050508;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    padding-left: 5px; /* Centrado óptico del icono play */
    pointer-events: none;
    box-shadow: 0 0 35px rgba(242, 201, 76, 0.45);
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
}

.secure-yt-player.is-playing .secure-center-play-btn {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
    pointer-events: none;
}

/* 5. Barra de Controles Personalizados */
.secure-player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: linear-gradient(180deg, transparent 0%, rgba(5, 5, 8, 0.92) 80%, rgba(3, 3, 5, 0.98) 100%);
    padding: 30px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Auto-ocultar controles cuando reproduce y no hay actividad del cursor */
.secure-yt-player.is-playing:not(.is-hovered) .secure-player-controls {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
}

/* Barra de Progreso */
.secure-progress-container {
    position: relative;
    width: 100%;
    height: 18px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.secure-progress-bar {
    position: relative;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: visible;
    transition: height 0.15s ease;
}

.secure-progress-container:hover .secure-progress-bar {
    height: 8px;
}

.secure-progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.secure-progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--accent-color, #f2c94c);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(242, 201, 76, 0.6);
}

.secure-progress-handle {
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(0);
    transition: transform 0.15s ease;
}

.secure-progress-container:hover .secure-progress-handle {
    transform: translateY(-50%) scale(1);
}

.secure-progress-tooltip {
    position: absolute;
    bottom: 22px;
    left: 0;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* Fila de Botones de Control */
.secure-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.secure-controls-left,
.secure-controls-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.secure-ctrl-btn {
    background: none;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 1.05rem;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.15s ease;
}

.secure-ctrl-btn:hover {
    color: var(--accent-color, #f2c94c);
    transform: scale(1.12);
}

.secure-volume-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.secure-slider-container {
    width: 70px;
    display: flex;
    align-items: center;
}

.secure-volume-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.secure-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color, #f2c94c);
    cursor: pointer;
}

.secure-volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color, #f2c94c);
    cursor: pointer;
    border: none;
}

.secure-time-display {
    color: #d4d4d4;
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
}

.secure-badge-protected {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 30px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #4ade80;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* 6. Modo Pantalla Completa Mejorado (Preserva Watermark y Protección) */
.secure-yt-player.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    z-index: 9999999 !important;
    border: none !important;
}

/* 7. Overlays de Advertencia de Seguridad */
.secure-warning-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(5, 5, 8, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    animation: secureFadeIn 0.3s ease;
}

@keyframes secureFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.secure-warning-card {
    background: rgba(20, 20, 25, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    padding: 36px 28px;
    max-width: 460px;
    width: 100%;
}

.secure-warning-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 18px;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.secure-warning-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 10px;
}

.secure-warning-message {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 12px;
}

.secure-warning-sub {
    display: block;
    color: #888888;
    font-size: 0.8rem;
}

/* Responsividad Móvil */
@media (max-width: 768px) {
    .secure-watermark .watermark-content {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
    
    .secure-volume-wrapper {
        display: none; /* Ahorro de espacio en pantallas pequeñas */
    }
    
    .secure-player-controls {
        padding: 20px 12px 10px;
    }
    
    .secure-time-display {
        font-size: 0.75rem;
    }
    
    .secure-center-play-btn {
        width: 56px;
        height: 56px;
        font-size: 1.4rem;
    }
}
