/* ===============================================================
   CSS BACK-OFFICE (Fiche produit / onglet « Vidéo tuto produit »)
   =============================================================== */

/* Style du champ de saisie de l’iframe (admin) */
.wc-product-video-html-input {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
    min-height: 120px;
    padding: 8px;
    box-sizing: border-box;
}

/* Messages d’erreur/succès pour la validation iframe */
.wc-product-video-iframe-alert {
    color: red;
    margin-bottom: 10px;
    display: none;
    font-size: 14px;
    line-height: 1.5;
}

/* Conteneur de prévisualisation d’iframe (admin) */
.wc-product-video-iframe-container {
    width: 300px;
    height: 150px;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

/* Style de la prévisualisation de l’iframe */
.wc-product-video-iframe-preview {
    width: 100%;
    height: 100%;
}

.wc-product-video-iframe-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Style des boutons “Ajouter” et “Supprimer” */
.wc-product-video-add-media,
.wc-product-video-remove-media,
.wc-product-video-add-placeholder-media,
.wc-product-video-remove-placeholder-media {
    display: inline-block;
    margin-top: 5px;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1.5;
    text-decoration: none;
}

/* Bouton “Valider le code iframe” */
.wc-product-video-validate-iframe {
    margin-bottom: 15px;
    padding: 6px 12px;
    font-size: 13px;
}

/* Espacement des champs */
.panel.woocommerce_options_panel .form-field {
    margin-bottom: 1.2em;
    padding: 0 16px;
}

/* ==========================================================
   CSS FRONT-END (Affichage shortcode / lazy-load vidéo)
   ========================================================== */

/* Conteneur pour la vidéo */
.wc-product-video-container {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    margin: 1em 0;
}

.wc-product-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Wrapper pour l’iframe */
.wc-product-video-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 1em 0;
    text-align: center;
}

.wc-product-video-wrapper iframe {
    max-width: 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto;
}

/* Bouton “Voir la vidéo” */
.wc-video-lazy-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
    text-align: center;
    text-decoration: none;
}

.wc-video-lazy-btn:hover,
.wc-video-lazy-btn:focus {
    background: #005d8e;
    outline: none;
}


.wc-video-lazy .wc-video-placeholder {
    display: block;
    visibility: visible;
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    width: 100%;
}

/* Conteneur lazy-load */
.wc-video-lazy {
    margin: 0 auto;
    text-align: center;
    max-width: 100%;
    position: relative;
}

/* Masquer les conteneurs vides */
.wc-video-lazy:not([data-content][data-content-type]) {
    display: none;
}

/* Bouton z-index */
.wc-video-lazy button {
    position: relative;
    z-index: 2;
}

/* Message d’erreur */
.wc-product-video-error {
    color: red;
    text-align: center;
    margin: 1em 0;
    font-size: 14px;
}

/* Responsivité mobile */
@media (max-width: 768px) {
    .wc-product-video-container,
    .wc-product-video-wrapper iframe {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .wc-video-lazy .wc-video-placeholder {
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    .wc-video-lazy-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .wc-product-video-iframe-container {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* Compatibilité Divi */
.et-fb-root-ancestor .wc-product-video-wrapper,
.et-fb-root-ancestor .wc-video-lazy,
.et-fb-root-ancestor .wc-product-video-container {
    max-width: 100%;
    overflow: hidden;
}

