/* Correctif transversal des fenetres modales : boutons de taille homogene, toujours visibles et accessibles */
html body .modal-overlay {
    padding: 12px;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
html body .modal-overlay > .modal-container,
html body .modal-overlay > .modal-content,
html body .modal-overlay > .modal-box {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
html body .modal-overlay > .modal-container > .modal-header,
html body .modal-overlay > .modal-content > .modal-header,
html body .modal-overlay > .modal-container > .modal-footer,
html body .modal-overlay > .modal-content > .modal-footer {
    flex: 0 0 auto;
}
html body .modal-overlay > .modal-container > .modal-body,
html body .modal-overlay > .modal-content > .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Pied de fenetre : boutons de meme taille, a la ligne si besoin */
html body .modal-overlay .modal-footer,
html body .modal-overlay .modal-buttons,
html body .modal-overlay .modal-actions {
    display: flex;
    flex-flow: row wrap;
    gap: 10px;
    align-items: stretch;
    justify-content: center;
}
html body .modal-overlay .modal-footer > button,
html body .modal-overlay .modal-footer > a,
html body .modal-overlay .modal-buttons > button,
html body .modal-overlay .modal-buttons > a,
html body .modal-overlay .modal-actions > button {
    flex: 1 1 140px;
    min-width: 0;
    min-height: 44px;
    height: auto;
    padding: 10px 16px;
    box-sizing: border-box;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    overflow: visible;
}
@media (max-width: 480px) {
    html body .modal-overlay .modal-footer > button,
    html body .modal-overlay .modal-footer > a,
    html body .modal-overlay .modal-buttons > button,
    html body .modal-overlay .modal-buttons > a,
    html body .modal-overlay .modal-actions > button {
        flex: 1 1 100%;
    }
}
/* Bouton de fermeture : zone tactile correcte, jamais ecrasee */
html body .modal-overlay .modal-close,
html body .modal-overlay .close-modal {
    flex: 0 0 auto;
    min-width: 32px;
    min-height: 32px;
}
/* Icone Orange Money en blanc sur les boutons orange */
html body .btn-orange img[src$="om-mark.svg"],
html body .btn-coupon.primary img[src$="om-mark.svg"],
html body .btn-modal.primary img[src$="om-mark.svg"] {
    filter: brightness(0) invert(1);
}

/* Indicateur de connexion et boutons flottants : jamais au-dessus d'une fenetre ouverte */
html body:has(.modal-overlay.active, .modal-overlay.show, .modal-overlay.open, .modal-overlay[style*="flex"]:not([hidden]), .mobile-panel.active) .net-status-indicator {
    display: none !important;
}
html body:has(.mobile-panel.active) .subscription-display-btn,
html body:has(.mobile-panel.active) .ai-search-btn { display: none !important; }

/* Panneau lateral (version web) : hauteur reelle de l'ecran, defilement garanti */
html body .mobile-panel {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
html body .mobile-panel .mobile-content { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }

/* Fenetres a structure simple (.modal directement dans l'overlay) : defilement tactile garanti */
html body .modal-overlay { align-items: flex-start; justify-content: center; }
html body .modal-overlay > .modal,
html body .modal-overlay > .modal-container,
html body .modal-overlay > .modal-content,
html body .modal-overlay > .modal-box { margin: auto; }
html body .modal-overlay > .modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
