/**
 * YouTube Lazy Player Pro - Styles
 * Versão 2.0.0
 */

/* Container principal */
.ylp-container {
    position: relative;
    padding-bottom: 56.25%; /* Aspect ratio 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    margin: 0 0 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
}

.ylp-container:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Iframe do YouTube */
.ylp-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: transparent;
    border: none;
    border-radius: 8px;
}

/* Wrapper da thumbnail */
.ylp-thumbnail-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 5;
}

/* Thumbnail do vídeo */
.ylp-thumbnail {
    object-fit: cover;
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border: none;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.ylp-container:hover .ylp-thumbnail {
    transform: scale(1.02);
    filter: brightness(0.85);
}

/* Overlay escuro sobre a thumbnail */
.ylp-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.3) 100%
    );
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ylp-container:hover .ylp-overlay {
    opacity: 0.8;
}

/* Botão de play SVG */
.ylp-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    z-index: 6;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.ylp-container:hover .ylp-play-button {
    transform: translate(-50%, -50%) scale(1.15);
}

.ylp-container:active .ylp-play-button {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Animação do círculo de fundo */
.ylp-play-bg {
    transition: all 0.3s ease;
}

.ylp-container:hover .ylp-play-bg {
    fill: rgba(255, 0, 0, 0.9);
    r: 85;
}

.ylp-container:hover {
    stroke: #fff;
    opacity: 1;
    stroke-width: 4;
}

/* Ícone de play (triângulo) */
.ylp-play-icon {
    transition: all 0.3s ease;
}

.ylp-container:hover .ylp-play-icon {
    transform: translateX(3px);
}

/* Animação de rotação sutil */
@keyframes rotate {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 502;
    }
}

/* Animação de pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

.ylp-play-button {
    animation: pulse 2s ease-in-out infinite;
}

.ylp-container:hover .ylp-play-button {
    animation: none;
}

/* Estado de carregamento */
.ylp-container.loading .ylp-thumbnail-wrapper {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Mensagem de erro (apenas para editores) */
.ylp-error {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    padding: 15px 20px;
    margin: 20px 0;
    color: #856404;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Fallback para noscript */
.ylp-container noscript {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.ylp-container noscript a {
    display: inline-block;
    padding: 12px 24px;
    background: #ff0000;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.ylp-container noscript a:hover {
    background: #cc0000;
}

/* Responsividade */
@media (max-width: 768px) {
    .ylp-play-button {
        width: 80px;
        height: 80px;
    }
    
    .ylp-container {
        margin: 0 0 20px;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .ylp-play-button {
        width: 70px;
        height: 70px;
    }
    
    .ylp-container {
        border-radius: 4px;
    }
}

/* Acessibilidade */
.ylp-container:focus-within {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* Reduz movimento para usuários que preferem */
@media (prefers-reduced-motion: reduce) {
    .ylp-container,
    .ylp-thumbnail,
    .ylp-play-button,
    .ylp-play-bg,
    .ylp-play-icon,
    .ylp-overlay {
        transition: none !important;
        animation: none !important;
    }
}

/* Modo escuro */
@media (prefers-color-scheme: dark) {
    .ylp-container {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
    
    .ylp-container:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    }
}
