/* ==========================================
   FENÊTRE MODALE
   ========================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
    overflow: visible;
    position: relative;
}

.modal.show .modal-content {
    transform: scale(1) translateY(0);
}

/* Header de la modale */
.modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Bouton fermeture - bien visible en haut à droite */
.modal .close {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transition: all 0.3s ease;
    line-height: 1;
    float: none;
    position: absolute;
    top: -15px;
    right: -15px;
    z-index: 10001;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    border: 3px solid #fff;
}

.modal .close:hover,
.modal .close:focus {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: scale(1.1);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

/* Loader */
.modal-loader {
    display: none;
    text-align: center;
    padding: 60px 40px;
    background: #fff;
}

.modal-loader.show {
    display: block;
}

.modal-loader::after {
    content: '';
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: modalSpin 1s linear infinite;
}

@keyframes modalSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Iframe */
#modalIframe {
    display: block;
    border: none;
    width: 100%;
    min-height: 500px;
    background: #fff;
}

/* ==========================================
   RESPONSIVE DESIGN - GRILLE MODERNE
   ========================================== */

/* Tablette / petit desktop : ajustements fins */
@media screen and (max-width: 960px) {
    .modal-content {
        max-width: 80%;
        margin: 8% auto;
    }

    #modalIframe {
        min-height: 450px;
    }
}

/* Mobile : colonne unique avec espacement fluide */
@media screen and (max-width: 640px) {
    .modal-content {
        max-width: 95%;
        margin: 3% auto;
        border-radius: 12px;
    }

    .modal .close {
        width: 32px;
        height: 32px;
        font-size: 24px;
        top: 8px;
        right: 8px;
    }

    #modalIframe {
        min-height: 400px;
    }

    .modal-loader {
        padding: 40px 20px;
    }
}