/* ====================================================
   MODAL STYLES - UNE SEULE BARRE (celle de la modale)
   ==================================================== */

/* Structure de base de la modale */
.modal-content {
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    border: none;
}

.modal-dialog.modal-lg {
    width: 90%;
    max-width: 1400px;
    min-width: 600px;
    margin: 30px auto;
}

/* Header de la modale */
.modal-header {
    background-color: black;
    padding: 15px 20px;
    color: white;
    position: relative;
    border-bottom: 1px solid #eaeaea;
    border-radius: 14px 14px 0 0;
}

.modal-header .modal-title {
    margin: 0;
    font-size: 15px;
    color: white !important;
    text-align: center;
}

.modal-header .btn-danger {
    margin: 5px 5px 0px 0px;
    position: absolute;
    right: 0;
    top: 3px;
}

.modal-header .btn-danger:hover {
    background-color: #c82333;
}

/* ===== CORPS DE LA MODALE - LA SEULE BARRE DE DÉFILEMENT ===== */
.modal-body {
    padding: 20px;
    background-color: #f7f9fc;
    max-height: 85vh;
    overflow-y: auto;          /* ← UNE SEULE BARRE : celle-ci */
    display: flex;
    flex-direction: column;
}

/* ===== IFRAME - NE DÉPASSE JAMAIS LA MODALE ===== */
.modal-body iframe {
    width: 100%;
    height: 100%;              /* Remplit le modal-body */
    min-height: 550px;
    max-height: 100%;          /* Empêche de dépasser */
    border: none;
    display: block;
    flex: 1;
    overflow: hidden;          /* Pas de barre dans l'iframe */
}

/* Style pour modale plein écran */
.modal.modal-fullscreen .modal-content {
    background: rgba(194, 210, 208, 0.95);
}

.modal.modal-fullscreen .modal-header {
    border: 0;
    color: #fff;
}

.modal.modal-fullscreen .modal-footer {
    border-color: rgba(0, 0, 0, .5);
}

/* Style pour carrousel dans modale */
#myModal .carousel-caption {
    background-color: rgba(255, 255, 255, 0.5);
    bottom: -100%;
    -webkit-transition: bottom 1s;
    transition: bottom 1s;
}

#myModal .item.active > .carousel-caption {
    bottom: 0;
}

/* Layout de visualisation dans modale - côte à côte */
.visualisation-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    flex-wrap: wrap;
}

.map-card {
    flex: 2;
    min-width: 500px;
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    display: flex;
    justify-content: center;
    align-items: center;
}

.map-card svg {
    width: 100%;
    height: auto;
    min-height: 550px;
}

.control-card {
    flex: 1.5;
    min-width: 380px;
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,.15);
    font-size: 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Tooltip dans modale */
#tooltip {
    margin-top: 25px;
    background: #f1f3f5;
    padding: 18px;
    border-radius: 12px;
    box-shadow: inset 0 0 12px rgba(0,0,0,.06);
    font-size: 18px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.source {
    font-size: 15px;
    color: #6c757d;
    text-align: right;
}

/* Graphique dans modale */
.modal-content .row:last-child {
    height: calc(100% - 150px);
    min-height: 500px;
}

.modal-content .row {
    margin: 0;
}

.col-sm-12 {
    padding: 0;
}

#chart {
    width: 100%;
    height: 100%;
    min-height: 500px;
    max-height: 600px;
}

.modal-body h4 {
    background: #fff;
    padding: 14px 22px;
    border-left: 5px solid #040404;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    margin-bottom: 30px;
}

/* ===== AJOUT POUR CENTRER LA MODALE (SANS CASSER BOOTSTRAP) ===== */
.modal-dialog {
    margin: 0 !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* ===== GARDE LA BARRE UNIQUEMENT DANS LA MODALE ===== */
.modal {
    overflow-y: auto !important;
}

/* Responsive modales */
@media (max-width: 991px) {
    .modal-header {
        padding-left: 20px !important;
    }
    .modal-header .modal-title {
        font-size: 18px !important;
    }
    .modal-dialog.modal-lg {
        width: 95% !important;
        min-width: auto !important;
    }
    .visualisation-container {
        flex-direction: column;
    }
    .control-card {
        flex: 1;
        font-size: 20px;
        min-width: auto;
    }
    .map-card {
        min-width: auto;
    }
    .map-card svg {
        min-height: 450px;
    }
    .modal-body iframe {
        min-height: 450px;
    }
}

@media (max-width: 768px) {
    .modal-header .btn-danger {
        padding: 0 !important;
        font-size: 14px !important;
        width: 35px;
        height: 35px;
    }
    .modal-body iframe {
        min-height: 400px;
    }
}