/* ============================================
   YOUTUBE PLAYER - Custom Player with Mask
   ============================================ */

.custom-youtube-player {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* YouTube Iframe */
.custom-youtube-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; /* Bloqueia cliques no iframe */
}

/* Máscara Transparente Anti-Clique */
.player-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.player-mask:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Ícone de Play Central */
.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 0, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    transition: all 0.3s ease;
    pointer-events: none;
}

.play-icon-overlay:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 0, 0, 1);
}

.play-icon-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.play-icon-overlay svg {
    width: 35px;
    height: 35px;
    fill: white;
    margin-left: 5px;
}

/* Controles Customizados */
.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 15px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-youtube-player:hover .player-controls {
    opacity: 1;
}

.custom-youtube-player.playing .player-controls {
    opacity: 1;
}

/* Barra de Progresso */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 10px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: #ff0000;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #ff0000;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-bar-container:hover .progress-bar::after {
    opacity: 1;
}

/* Controles Inferiores */
.controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botão Play/Pause */
.play-pause-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.play-pause-btn:hover {
    transform: scale(1.1);
}

.play-pause-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* Tempo */
.time-display {
    color: white;
    font-size: 13px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    white-space: nowrap;
}

/* Controle de Velocidade */
.speed-control {
    position: relative;
}

.speed-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: 'Roboto', sans-serif;
}

.speed-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(28, 28, 28, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 8px 0;
    margin-bottom: 8px;
    min-width: 80px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.speed-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.speed-option {
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s ease;
    font-family: 'Roboto', sans-serif;
}

.speed-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.speed-option.active {
    color: #ff0000;
    font-weight: 600;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.volume-slider {
    width: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
}

.volume-control:hover .volume-slider {
    width: 60px;
    opacity: 1;
}

.volume-level {
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 100%;
    position: relative;
}

.volume-level::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Fullscreen Button */
.fullscreen-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* Loading Spinner */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
}

.loading-spinner.active {
    opacity: 1;
    visibility: visible;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .custom-youtube-player {
        border-radius: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .play-icon-overlay {
        width: 80px;
        height: 80px;
    }
    
    .play-icon-overlay svg {
        width: 35px;
        height: 35px;
    }
    
    .player-controls {
        padding: 10px;
    }
    
    .time-display {
        font-size: 11px;
    }
    
    .volume-control {
        display: none;
    }
}

@media (max-width: 480px) {
    .speed-control {
        display: none;
    }
}
