/* Container principal do YouTube Embed */
.youtube-embed-container {
    max-width: 100%;
    margin: 2em 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.youtube-embed-descricao {
    font-size: 1em;
    color: #666;
    margin: 0 0 1em 0;
    line-height: 1.6;
}

/* Wrapper do vídeo com aspect ratios */
.youtube-embed-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Aspect Ratios */
.youtube-embed-wrapper.ratio-16-9 {
    padding-bottom: 56.25%; /* 9/16 = 0.5625 */
}

.youtube-embed-wrapper.ratio-4-3 {
    padding-bottom: 75%; /* 3/4 = 0.75 */
}

.youtube-embed-wrapper.ratio-21-9 {
    padding-bottom: 42.857%; /* 9/21 ≈ 0.4286 */
}

.youtube-embed-wrapper.ratio-1-1 {
    padding-bottom: 100%; /* 1/1 = 1 */
}

/* Iframe responsivo */
.youtube-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
}

/* Thumbnail overlay (click to play) */
.youtube-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.youtube-thumbnail-overlay:hover {
    opacity: 0.9;
}

.youtube-thumbnail-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.youtube-thumbnail-overlay:hover img {
    transform: scale(1.05);
}

/* Botão de play customizado */
.youtube-play-button {
    position: absolute;
    width: 80px;
    height: 80px;
    background: rgba(255, 0, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.3);
}

.youtube-play-button:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(255, 0, 0, 0.4);
}

.youtube-play-button svg {
    width: 48px;
    height: 48px;
    margin-left: 2px;
}

.youtube-link {
    display: inline-block;
    color: #ff0000;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border: 2px solid #ff0000;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.youtube-link:hover {
    background: #ff0000;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

/* Error state */
.youtube-embed-error {
    padding: 2em;
    text-align: center;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 1em 0;
}

/* Estilos específicos para o editor */
.youtube-embed-editor {
    border: 2px dashed #ddd;
    box-shadow: none;
}

.youtube-embed-editor:hover {
    border-color: #007cba;
    transform: none;
}

.youtube-embed-placeholder {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsividade */
@media (max-width: 768px) {
    .youtube-embed-container {
        margin: 1em 0;
    }
}

/* Estilos específicos para o Gutenberg Editor */
.wp-block-youtube-embed-plugin-youtube-embed {
    margin: 1em 0;
}

.wp-block-youtube-embed-plugin-youtube-embed .youtube-embed-container {
    margin: 0;
}

.block-editor-block-list__block[data-type="youtube-embed-plugin/youtube-embed"]:hover {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Estilos para o painel de configurações */
.components-panel__body .youtube-embed-plugin-help {
    font-size: 12px;
    color: #757575;
    margin-top: 5px;
}

/* Loading state */
.youtube-embed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f0f0f0;
    border-radius: 8px;
}

.youtube-embed-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top: 4px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Acessibilidade */
.youtube-embed-container:focus-within {
    outline: 2px solid #005cee;
    outline-offset: 2px;
}

.youtube-link:focus {
    outline: 2px solid #005cee;
    outline-offset: 2px;
}