/* YouTube Video Background Block Styles */
.youtube-video-background {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.youtube-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.youtube-video-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw; /* 16:9 aspect ratio */
    min-height: 100vh;
    min-width: 177.77vh; /* 16:9 aspect ratio */
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.youtube-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.youtube-video-content {
    position: relative;
    z-index: 2;
    color: white;
    padding: 2rem;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Apply container alignment */
.youtube-content-align-center .youtube-video-content {
    text-align: center;
}

.youtube-content-align-left .youtube-video-content {
    text-align: left;
}

.youtube-content-align-right .youtube-video-content {
    text-align: right;
}

/* Override alignment for specific blocks that should stay left-aligned */
.youtube-video-content .wp-block-list {
    text-align: left !important;
}

.youtube-video-content .wp-block-list li {
    text-align: left !important;
}

.youtube-video-content .wp-block-table {
    text-align: left !important;
}

.youtube-video-content .wp-block-code {
    text-align: left !important;
}

/* Allow WordPress alignment classes to override */
.youtube-video-content .has-text-align-left {
    text-align: left !important;
}

.youtube-video-content .has-text-align-center {
    text-align: center !important;
}

.youtube-video-content .has-text-align-right {
    text-align: right !important;
}

/* Ensure all text is white */
.youtube-video-content * {
    color: white !important;
}

.youtube-video-content h1,
.youtube-video-content h2,
.youtube-video-content h3,
.youtube-video-content h4,
.youtube-video-content h5,
.youtube-video-content h6 {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
    margin-bottom: 1rem;
}

.youtube-video-content p {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    margin-bottom: 1rem;
}

.youtube-video-content .wp-block-button .wp-block-button__link {
    text-shadow: none;
}

/* Handle buttons alignment */
.youtube-content-align-center .youtube-video-content .wp-block-buttons {
    justify-content: center;
}

.youtube-content-align-right .youtube-video-content .wp-block-buttons {
    justify-content: flex-end;
}

.youtube-content-align-left .youtube-video-content .wp-block-buttons {
    justify-content: flex-start;
}

/* Error and placeholder styles */
.youtube-bg-placeholder,
.youtube-bg-error {
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    font-style: italic;
}

.youtube-bg-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .youtube-video-content {
        padding: 1rem;
    }
    
    .youtube-video-container iframe {
        width: 100vw;
        height: 56.25vw;
        min-height: 100%;
        min-width: 177.77vh;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .youtube-video-container iframe {
        background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    }
}