/* ============================================================
   🎥 VIDEO BLOCK — STRUCTURE GLOBALE
   ============================================================ */

.video-block {
    margin: 2rem 0;
    padding: 1rem;
    border-radius: 12px;
    background: #111;
    background: var(--video-bg, #111);
    color: #eee;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    overflow: hidden;
}

/* Thème sombre */
.video-theme-dark {
    --video-bg: #0d0d0d;
    --video-border: #222;
    --video-text: #eee;
    --video-accent: #00b3ff;
}

/* ============================================================
   🎬 VIDEO FRAME — RESPONSIVE + PLYR
   ============================================================ */

.video-frame {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding-top: 56.25%; /* ratio 16:9 */
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* L’iframe ou la vidéo occupe tout l’espace */
.video-frame iframe,
.video-frame video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    display: block;
    object-fit: contain;
}

/* Supprime les tailles imposées par Joomla/JCE */
.video-frame iframe[width],
.video-frame iframe[height],
.video-frame video[width],
.video-frame video[height] {
    width: 100% !important;
    height: 100% !important;
}

/* ============================================================
   🛠️ CORRECTION PLYR — ANTI ÉCRASEMENT (DÉFINITIVE)
   ============================================================ */

.video-frame .plyr__video-wrapper,
.video-frame .plyr__video-embed,
.video-frame .plyr__video-embed__container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* L’iframe dans le conteneur interne */
.video-frame .plyr__video-embed__container iframe,
.video-frame .plyr__video-wrapper iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* ============================================================
   📄 TRANSCRIPTION
   ============================================================ */

.video-transcript {
    margin-top: 1rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #ddd;
}

.video-transcript summary {
    cursor: pointer;
    font-weight: bold;
    color: #00b3ff;
    padding: 0.5rem 0;
}

.video-transcript p {
    margin: 0.5rem 0 1rem;
    line-height: 1.6;
}

/* ============================================================
   📥 BOUTON TÉLÉCHARGER
   ============================================================ */

.video-actions {
    margin-top: 1rem;
    text-align: right;
}

.video-actions a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #00b3ff;
    color: #fff !important;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.2s ease;
}

.video-actions a:hover {
    background: #008fcc;
}

/* ============================================================
   🎛️ PLYR — THÈME SOMBRE PERSONNALISÉ
   ============================================================ */

.plyr--full-ui input[type=range] {
    color: #00b3ff;
}

.plyr__control--overlaid {
    background: rgba(0,0,0,0.6);
}

.plyr__control--overlaid:hover {
    background: rgba(0,0,0,0.8);
}

.plyr__menu__container {
    background: #1a1a1a !important;
    color: #eee !important;
}

.plyr__menu__container .plyr__control {
    color: #eee !important;
}

.plyr__menu__container .plyr__control:hover {
    background: #333 !important;
}

/* ============================================================
   📱 RESPONSIVE — PETITS ÉCRANS
   ============================================================ */

@media (max-width: 600px) {
    .video-block {
        padding: 0.8rem;
    }

    .video-transcript {
        font-size: 0.9rem;
    }

    .video-actions a {
        padding: 0.35rem 0.7rem;
        font-size: 0.9rem;
    }
}

/* ============================================================
   🌞 THÈME CLAIR — VIDEO BLOCK
   ============================================================ */

.video-theme-light {
    --video-bg: #f9f9f9;
    --video-border: #ddd;
    --video-text: #222;
    --video-accent: #0077cc;
    background: var(--video-bg);
    color: var(--video-text);
    border: 1px solid var(--video-border);
    border-radius: 12px;
    padding: 1rem;
}

/* Cadre vidéo clair */
.video-theme-light .video-frame {
    background: #fff;
    border: 1px solid #ddd;
}

/* Transcription claire */
.video-theme-light .video-transcript {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.video-theme-light .video-transcript summary {
    color: var(--video-accent);
}

/* Bouton télécharger clair */
.video-theme-light .video-actions a {
    background: var(--video-accent);
    color: #fff !important;
}

.video-theme-light .video-actions a:hover {
    background: #005fa3;
}

/* ============================================================
   🌞 THÈME CLAIR — PLYR
   ============================================================ */

.video-theme-light .plyr {
    --plyr-color-main: #0077cc;
    --plyr-video-background: #fff;
}

.video-theme-light .plyr__control--overlaid {
    background: rgba(255,255,255,0.7);
}

.video-theme-light .plyr__control--overlaid:hover {
    background: rgba(255,255,255,0.9);
}

.video-theme-light .plyr__menu__container {
    background: #fff !important;
    color: #222 !important;
    border: 1px solid #ddd !important;
}

.video-theme-light .plyr__menu__container .plyr__control:hover {
    background: #eee !important;
}

/* ============================================================
   🖼️ FIGURE — CORRECTION DES VIDÉOS ÉCRASÉES
   ============================================================ */

figure,
figure[data-wf-figure] {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    margin: 1rem 0;
    padding: 0;
}

figure iframe,
figure video {
    width: 100% !important;
    height: auto !important;
}

/* ============================================================
   📦 VIDEO-RESPONSIVE — CORRECTION
   ============================================================ */

.video-responsive {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    margin: 1rem 0;
    padding: 0;
}

.video-responsive iframe,
.video-responsive video {
    width: 100% !important;
    height: auto !important;
}

/* ============================================================
   🛠️ NEUTRALISATION TOTALE DES ANCIENS CONTENEURS RESPONSIVE
   ============================================================ */

.video-responsive,
.video-responsive * {
    all: unset !important;
    display: contents !important;
}
