/* ============================================
   STYLES POUR LE SYSTÈME DE MODALES
   Remplace alert, confirm et prompt natifs
   ============================================ */

/* --------- Fond sombre derrière la modale --------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

/* --------- Boîte de dialogue --------- */
.modal-box {
    background: white;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    animation: slideIn 0.25s ease;
    font-family: Arial, sans-serif;
}

/* --------- Titre de la modale --------- */
.modal-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* --------- Message --------- */
.modal-message {
    margin: 0 0 20px 0;
    color: #555;
    line-height: 1.5;
    font-size: 14px;
}

/* --------- Champ de saisie (pour openPrompt) --------- */
.modal-input {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.modal-input:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15);
}

/* --------- Conteneur des boutons --------- */
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --------- Bouton "Annuler" --------- */
.btn-cancel {
    background: #e9ecef;
    color: #333;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    font-family: inherit;
}

.btn-cancel:hover {
    background: #d3d7db;
}

.btn-cancel:active {
    background: #c0c4c8;
}

/* --------- Bouton "Confirmer / OK" --------- */
.btn-confirm {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    font-family: inherit;
}

.btn-confirm:hover {
    background: #b02a37;
}

.btn-confirm:active {
    background: #962030;
}

/* --------- Classe utilitaire pour le bouton déclencheur --------- */
.btn-danger-action {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-family: inherit;
}

.btn-danger-action:hover {
    background-color: #b02a37;
}

.btn-danger-action:active {
    transform: scale(0.98);
}

/* --------- Animations --------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --------- Adaptation mobile --------- */
@media (max-width: 500px) {
    .modal-box {
        padding: 20px;
        max-width: 95%;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-message {
        font-size: 13px;
    }
    
    .modal-buttons {
        flex-direction: column-reverse;
    }
    
    .btn-cancel,
    .btn-confirm {
        width: 100%;
        padding: 10px;
    }
}