/* ========================================
   COMMERCIFY MODAL EXPORT ADS
   Conforme Dashboard : header/footer via commercify_modal_dashboard_family.css
   Body : surface sombre unique + accents or, façon SweetAlert (thème code PIN,
   commercify_swal_pin_theme.css) — cartes de sélection au lieu de list-group/btn-group.
   Bouton Exporter (footer) : vert distinct, inchangé.
   ======================================== */

/* Backdrop masqué : overlay + flou portés par le modal */
body:has(#modalExportAds.show) .modal-backdrop {
    display: none !important;
}

/* Conteneur modal : full viewport, overlay flou + halo doré façon SweetAlert (code PIN) */
#modalExportAds {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background:
        radial-gradient(circle at 50% 35%, rgba(255, 204, 0, 0.14), transparent 60%),
        rgba(3, 7, 14, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0;
}

#modalExportAds.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Confirmation par code PIN (commercify_export_ads.js, confirmPinForExport()) : le temps que
   la popup SweetAlert2 est affichée, on efface le fond opaque/flouté propre à la modale (sinon
   il recouvrirait la popup, dont le z-index standard est bien plus bas) et on rend son contenu
   invisible/non interactif. La modale reste techniquement "shown" pour Bootstrap (pas de
   hide()/show()) : SweetAlert2 est inséré DANS #modalExportAds (option `target`), qui reste
   donc son propre conteneur - seul l'habillage visuel de la modale disparaît. */
#modalExportAds.show.export-modal-pin-pending {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#modalExportAds.export-modal-pin-pending .modal-dialog {
    opacity: 0 !important;
    pointer-events: none !important;
}

#modalExportAds .modal-dialog {
    max-width: 560px !important;
    width: calc(100% - 2rem) !important;
    margin: auto !important;
}

/* modal-content : surface unique sombre façon SweetAlert (coins arrondis, ombre profonde) */
#modalExportAds .modal-content {
    position: relative !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 204, 0, 0.35) !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65) !important;
}

/* Titre du header : légèrement réduit pour ce modal afin d'éviter tout chevauchement
   avec le logo / les boutons (titre centré en position absolute dans le gabarit partagé). */
#modalExportAds .dashboard-modal-header .dashboard-modal-title {
    font-size: 1.15rem !important;
}

/* ═══ BODY : surface sombre unique (toujours, indépendamment du thème clair/sombre du site,
   même logique que les autres modales plein écran) ═══ */
#modalExportAds .modal-body.dashboard-modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 1.5rem 1.25rem !important;
    margin: 0 !important;
    background: #0a0a0a !important;
    color: #f3ead9 !important;
}

#modalExportAds .form-label {
    display: block !important;
    color: #ffcc00 !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
    margin-bottom: 0.65rem !important;
}

/* ═══ Cartes de sélection (périmètre + format) ═══ */
#modalExportAds .export-section {
    margin-bottom: 1.5rem !important;
}

#modalExportAds .export-grid-scope {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.55rem !important;
}

#modalExportAds .export-grid-format {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem !important;
}

#modalExportAds .export-card {
    position: relative !important;
    display: block !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 2px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 0.5rem !important;
    cursor: pointer !important;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease !important;
}

#modalExportAds .export-card-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    pointer-events: none !important;
}

#modalExportAds .export-card-inner {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.7rem 0.9rem !important;
}

#modalExportAds .export-card-icon {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: rgba(255, 204, 0, 0.14) !important;
    color: #ffcc00 !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

#modalExportAds .export-card-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
    min-width: 0 !important;
}

#modalExportAds .export-card-title {
    color: #f3ead9 !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

#modalExportAds .export-card-description {
    color: rgba(243, 234, 217, 0.62) !important;
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
}

#modalExportAds .export-card:hover {
    border-color: rgba(255, 204, 0, 0.55) !important;
    background: rgba(255, 204, 0, 0.06) !important;
}

#modalExportAds .export-card:has(.export-card-input:focus-visible) {
    outline: none !important;
    border-color: #ffcc00 !important;
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.25) !important;
}

#modalExportAds .export-card:has(.export-card-input:checked) {
    border-color: #ffcc00 !important;
    background: rgba(255, 204, 0, 0.12) !important;
}

#modalExportAds .export-card:has(.export-card-input:checked) .export-card-icon {
    background: #ffcc00 !important;
    color: #0a0a0a !important;
}

#modalExportAds .export-card:has(.export-card-input:checked) .export-card-title {
    color: #ffcc00 !important;
}

/* Alerte info : surface teintée cohérente avec le reste du body */
#modalExportAds #exportInfo {
    background: rgba(255, 204, 0, 0.1) !important;
    border: 1px solid rgba(255, 204, 0, 0.4) !important;
    border-radius: 0.5rem !important;
    color: #f3ead9 !important;
    padding: 0.6rem 0.85rem !important;
    margin-top: 0.75rem !important;
    font-size: 0.8rem !important;
}

#modalExportAds #exportInfo.alert-warning {
    background: rgba(220, 53, 69, 0.16) !important;
    border-color: rgba(220, 53, 69, 0.5) !important;
    color: #f3ead9 !important;
}

/* ═══ BOUTON EXPORTER (footer) : couleur distincte, hover distinct, ordre Retour | Exporter | Fermer ═══ */
#modalExportAds .modal-footer .btn-export-primary,
#modalExportAds .modal-footer #btnConfirmExport {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    border-radius: 0;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    /* Couleur distincte (vert succès) pour différencier de Fermer (or) */
    background: #198754 !important;
    border: 2px solid #198754 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(25, 135, 84, 0.35) !important;
}

#modalExportAds .modal-footer .btn-export-primary:hover,
#modalExportAds .modal-footer #btnConfirmExport:hover {
    background: #157347 !important;
    border-color: #146c43 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.45) !important;
    transform: translateY(-2px) !important;
}

#modalExportAds .modal-footer .btn-export-primary:disabled,
#modalExportAds .modal-footer #btnConfirmExport:disabled {
    background: rgba(25, 135, 84, 0.5) !important;
    border-color: rgba(25, 135, 84, 0.5) !important;
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

#modalExportAds .modal-footer .btn-export-primary i,
#modalExportAds .modal-footer #btnConfirmExport i {
    font-size: 0.9rem !important;
}

/* Dark mode : bouton Exporter (vert conservé, bordure plus claire) */
body.dark-mode #modalExportAds .modal-footer .btn-export-primary,
body.dark-mode #modalExportAds .modal-footer #btnConfirmExport {
    background: #198754 !important;
    border: 2px solid #20c997 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.4) !important;
}

body.dark-mode #modalExportAds .modal-footer .btn-export-primary:hover,
body.dark-mode #modalExportAds .modal-footer #btnConfirmExport:hover {
    background: #20c997 !important;
    border-color: #20c997 !important;
    color: #0d0d0d !important;
    box-shadow: 0 4px 14px rgba(32, 201, 151, 0.5) !important;
    transform: translateY(-2px) !important;
}

body.dark-mode #modalExportAds .modal-footer .btn-export-primary:disabled,
body.dark-mode #modalExportAds .modal-footer #btnConfirmExport:disabled {
    background: rgba(25, 135, 84, 0.4) !important;
    border-color: rgba(32, 201, 151, 0.3) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

[data-bs-theme="dark"] #modalExportAds .modal-footer .btn-export-primary,
[data-bs-theme="dark"] #modalExportAds .modal-footer #btnConfirmExport {
    background: #198754 !important;
    border: 2px solid #20c997 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] #modalExportAds .modal-footer .btn-export-primary:hover,
[data-bs-theme="dark"] #modalExportAds .modal-footer #btnConfirmExport:hover {
    background: #20c997 !important;
    border-color: #20c997 !important;
    color: #0d0d0d !important;
    transform: translateY(-2px) !important;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    #modalExportAds .modal-dialog {
        width: calc(100% - 1rem) !important;
    }
    #modalExportAds .modal-body.dashboard-modal-body {
        padding: 1rem 0.85rem !important;
    }
    #modalExportAds .export-grid-format {
        grid-template-columns: 1fr !important;
    }
    #modalExportAds .export-card-inner {
        padding: 0.55rem 0.7rem !important;
    }
    #modalExportAds .export-card-icon {
        width: 34px !important;
        height: 34px !important;
    }
}

/* Mode performance : pas de flou ni transform */
body.performance-mode #modalExportAds {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
body.performance-mode #modalExportAds .modal-footer .btn-export-primary:hover,
body.performance-mode #modalExportAds .modal-footer #btnConfirmExport:hover {
    transform: none !important;
}
