/**
 * Styles pour le bloc Auto Category Video
 * 
 * @package AutoCategoryVideoBlock
 */

.auto-category-video-block {
    margin: 20px 0;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
}

/* Styles pour le placeholder vidéo */
.video-placeholder-wrapper {
    position: relative;
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.video-placeholder-wrapper:hover {
    transform: scale(1.02);
}

.video-placeholder-wrapper:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.video-placeholder-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Bouton play sur le placeholder */
.video-play-button {
    position: absolute;
    z-index: 99;
    top: calc(50% - 50px);
    left: calc(50% - 50px);
    width: 100px;
    height: 100px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: none;
}

.video-play-button svg {
    width: 40px;
    height: 40px;
    color: #fff;
    margin-left: 4px; /* Ajustement visuel pour centrer le triangle */
}

.video-placeholder-wrapper:hover .video-play-button {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.video-placeholder-wrapper:active .video-play-button {
    transform: scale(0.95);
}

/* Animation de chargement */
.video-container.video-loading {
    position: relative;
}

.video-container.video-loading::after {
    content: '';
    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: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* État actif de la vidéo */
.video-container.video-active video {
    display: block !important;
}

.video-caption {
    padding: 10px;
    background: #f8f9fa;
    font-style: italic;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
}

.video-source-info {
    padding: 5px 10px;
    background: #e9ecef;
    text-align: right;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
}

.video-source-info small {
    font-size: 0.875em;
}

/* Styles pour la prévisualisation dans l'éditeur */
.block-preview {
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    margin-bottom: 10px;
}

.block-preview h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #856404;
}

.block-preview p {
    margin: 0;
    font-size: 12px;
    color: #856404;
}

/* Styles pour le message "pas de vidéo" */
.no-video-found {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
}

.no-video-found p {
    margin: 0 0 10px 0;
}

.no-video-found small {
    font-size: 0.875em;
    color: #adb5bd;
}

/* Styles responsifs */
@media (max-width: 768px) {
    .auto-category-video-block {
        margin: 15px 0;
    }
    
    .video-caption,
    .video-source-info {
        padding: 8px;
        font-size: 14px;
    }
    
    .block-preview {
        padding: 8px;
    }
    
    .no-video-found {
        padding: 15px;
    }
    
    /* Ajuster la taille du bouton play sur mobile */
    .video-play-button {
        top: calc(50% - 40px);
        left: calc(50% - 40px);
        width: 80px;
        height: 80px;
    }
    
    .video-play-button svg {
        width: 35px;
        height: 35px;
    }
    
    /* Désactiver le zoom au hover sur mobile */
    .video-placeholder-wrapper:hover {
        transform: none;
    }
}

/* Amélioration de l'accessibilité */
.video-container:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Animation de chargement pour les vidéos */
.video-container video[preload="metadata"] {
    background-color: #000;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-2-4l6-4-6-4v8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 48px 48px;
}

/* Support pour les blocs alignés */
.alignwide .auto-category-video-block,
.alignfull .auto-category-video-block {
    max-width: none;
}

.alignwide .video-container,
.alignfull .video-container {
    border-radius: 0;
}

.alignfull .auto-category-video-block {
    margin-left: 0;
    margin-right: 0;
}
