/**
 * Style CSS dla frontendu
 * Video Embed Manager
 */

/* Główny kontener filmu */
.vem-video-container {
    position: relative;
    width: 100%;
    max-width: 850px;
    margin: 20px auto;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Wrapper dla zachowania proporcji */
.vem-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Proporcje 16:9 */
    height: 0;
    overflow: hidden;
    background: #000000;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Iframe z filmem */
.vem-video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Komunikat o błędzie */
.vem-error {
    padding: 15px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    text-align: center;
    margin: 20px auto;
    max-width: 850px;
    font-size: 14px;
    font-weight: 500;
}

/* Lazy loading placeholder */
.vem-video-container.vem-lazy {
    min-height: 200px;
    background: #f0f0f0;
    border-radius: 8px;
    position: relative;
}

.vem-video-container.vem-lazy::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

.vem-video-container.vem-lazy::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 20px solid #ffffff;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 5px;
}

/* Responsywność */
@media (max-width: 870px) {
    .vem-video-container {
        max-width: 100%;
        padding: 0 10px;
    }
}

@media (max-width: 600px) {
    .vem-video-container {
        margin: 15px auto;
    }
    
    .vem-video-wrapper {
        border-radius: 4px;
    }
    
    .vem-video-iframe {
        border-radius: 4px;
    }
}

/* Obsługa ciemnego motywu */
@media (prefers-color-scheme: dark) {
    .vem-video-container.vem-lazy {
        background: #2c2c2c;
    }
    
    .vem-video-container.vem-lazy::before {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .vem-error {
        background: #2c1818;
        border-color: #4a2020;
        color: #ff9999;
    }
}

/* Animacja pojawiania się */
.vem-video-container {
    animation: vemFadeInUp 0.5s ease;
}

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

/* Wsparcie dla różnych układów stron */
.entry-content .vem-video-container,
.post-content .vem-video-container,
.page-content .vem-video-container,
.content-area .vem-video-container,
article .vem-video-container {
    margin-left: auto;
    margin-right: auto;
}

/* Wsparcie dla pełnej szerokości */
.alignfull .vem-video-container {
    max-width: 100%;
    padding: 0;
}

.alignfull .vem-video-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* Wsparcie dla szerokiego wyrównania */
.alignwide .vem-video-container {
    max-width: 1200px;
}

/* Wsparcie dla wyrównania do lewej/prawej */
.alignleft .vem-video-container {
    float: left;
    margin-right: 20px;
    max-width: 50%;
}

.alignright .vem-video-container {
    float: right;
    margin-left: 20px;
    max-width: 50%;
}

.aligncenter .vem-video-container {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Kompatybilność z popularnymi motywami */
.twentytwenty .vem-video-container,
.twentytwentyone .vem-video-container,
.twentytwentytwo .vem-video-container {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Wsparcie dla Gutenberg */
.wp-block-group .vem-video-container,
.wp-block-column .vem-video-container {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Print styles */
@media print {
    .vem-video-container {
        display: none;
    }
}

/* Accessibility */
.vem-video-iframe:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .vem-video-wrapper {
        border: 2px solid currentColor;
    }
    
    .vem-error {
        border-width: 2px;
    }
}
