/**
 * CSS SPÉCIFIQUE ANTI-HEADER-BANNER POUR PLANTES ET NATURE
 * Fichier nommé "zzzzz_" pour être chargé en DERNIER ABSOLU
 * Cible spécifiquement les problèmes du thème planteetnature
 */

/* RÈGLE GLOBALE - Force le z-index maximum sur TOUS les éléments de la modal */
html body #ps-chatbot-search-modal,
html body #ps-chatbot-search-modal *,
html body #ps-chatbot-search-modal input,
html body #ps-chatbot-search-modal button,
html body #ps-chatbot-search-modal div,
html body #ps-chatbot-search-modal span,
html body #ps-chatbot-search-modal form,
html body #ps-chatbot-search-modal .ps-chatbot-modal-content,
html body #ps-chatbot-search-modal .ps-chatbot-modal-header,
html body #ps-chatbot-search-modal .ps-chatbot-modal-body {
    z-index: 9999999999 !important; /* 10 fois 9 - MAXIMUM ABSOLU */
}

/* SPÉCIFIQUE POUR COMBATTRE LE HEADER-BANNER DE PLANTEETNATURE */
.header-banner,
.header-top,
.header-main,
#header,
.navbar,
.nav,
.navigation {
    z-index: 1 !important; /* Forcer les headers à rester en arrière */
}

/* Protection contre les éléments fixed/sticky du thème planteetnature */
[style*="position: fixed"],
[style*="position: sticky"],
.fixed,
.sticky {
    z-index: 1 !important;
}

/* Exception UNIQUEMENT pour notre modal de recherche */
#ps-chatbot-search-modal,
#ps-chatbot-search-modal *,
#ps-chatbot-search-modal[style*="position: fixed"],
#ps-chatbot-search-modal .ps-chatbot-modal-content[style*="position: fixed"] {
    z-index: 9999999999 !important;
}

/* MOBILE SPÉCIFIQUE - Force au premier plan */
@media screen and (max-width: 767px) {
    /* Tous les éléments de la modal */
    #ps-chatbot-search-modal,
    #ps-chatbot-search-modal .ps-chatbot-modal-content,
    #ps-chatbot-search-modal .ps-chatbot-modal-header,
    #ps-chatbot-search-modal .ps-chatbot-modal-body,
    #ps-chatbot-search-modal .ps-chatbot-modal-close,
    #ps-chatbot-search-modal form,
    #ps-chatbot-search-modal input,
    #ps-chatbot-search-modal button,
    #ps-chatbot-search-modal textarea,
    #ps-chatbot-search-modal select {
        z-index: 9999999999 !important;
        position: relative !important;
    }

    /* Force l'overlay de la modal */
    #ps-chatbot-search-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 9999999999 !important;
    }

    /* Supprime tous les z-index élevés du thème SEULEMENT sur mobile */
    .header-banner,
    .header-top,
    .header-main,
    #header,
    .navbar,
    .nav,
    .navigation,
    .dropdown-menu,
    .tooltip,
    .popover {
        z-index: 1 !important;
    }
}

/* SÉLECTEURS ULTRA-SPÉCIFIQUES pour contrer les thèmes récalcitrants */
html body div#ps-chatbot-search-modal.ps-chatbot-modal-overlay,
html body div#ps-chatbot-search-modal.ps-chatbot-modal-container,
html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content,
html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content div.ps-chatbot-modal-header,
html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content div.ps-chatbot-modal-body,
html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content form#ps-chatbot-modal-search-form,
html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content form#ps-chatbot-modal-search-form input#ps-chatbot-modal-search-input,
html body div#ps-chatbot-search-modal div.ps-chatbot-modal-content form#ps-chatbot-modal-search-form button#ps-chatbot-modal-search-btn {
    z-index: 9999999999 !important;
}

/* Protection contre les styles inline avec z-index */
#ps-chatbot-search-modal[style*="z-index: 999"],
#ps-chatbot-search-modal[style*="z-index: 1000"],
#ps-chatbot-search-modal[style*="z-index: 10000"],
#ps-chatbot-search-modal[style*="z-index: 99999"],
#ps-chatbot-search-modal .ps-chatbot-modal-content[style*="z-index"],
#ps-chatbot-search-modal .ps-chatbot-modal-header[style*="z-index"],
#ps-chatbot-search-modal .ps-chatbot-modal-body[style*="z-index"] {
    z-index: 9999999999 !important;
}

/* RÈGLE DE SECOURS - Force TOUT dans la modal à avoir le z-index maximum */
#ps-chatbot-search-modal > *,
#ps-chatbot-search-modal * {
    z-index: inherit !important;
}

/* Attribution du z-index maximum au parent pour que inherit fonctionne */
#ps-chatbot-search-modal {
    z-index: 9999999999 !important;
}

/* ANTI-COHABITATION avec d'autres modals/overlays */
.modal,
.overlay,
.popup,
.dialog {
    z-index: 1 !important;
}

/* Exception pour notre modal uniquement */
#ps-chatbot-search-modal.modal,
#ps-chatbot-search-modal.overlay,
#ps-chatbot-search-modal.popup,
#ps-chatbot-search-modal.dialog {
    z-index: 9999999999 !important;
}