/* =============================================
   Modals - Système amélioré avec scroll optimisé
   ============================================= */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border-top: 5px solid var(--secondary-color);
    margin: auto;
}

.modal.wide .modal-content {
    max-width: 1200px;
}

/* Header fixe */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #F0F0F0;
    flex-shrink: 0;
    background: white;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header h3 {
    color: var(--primary-color);
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    transition: var(--transition-fast);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #333;
    transform: rotate(90deg);
}

/* Body avec scroll */
.modal-body {
    padding: var(--spacing-xl);
    overflow-y: auto;
    flex: 1;
}

/* Sections dans le modal */
.modal-section {
    margin-bottom: var(--spacing-xl);
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid #F0F0F0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Actions fixées en bas */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 2px solid #F0F0F0;
    flex-shrink: 0;
    background: #FAFAFA;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
    }

    .modal-header,
    .modal-body,
    .modal-actions {
        padding: var(--spacing-md);
    }
}

/* =============================================
   Modal Actions (form buttons)
   ============================================= */

.modal-form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* =============================================
   Fullscreen Modal
   ============================================= */

.modal--fullscreen {
    background: rgba(0, 0, 0, 0.95);
}

.modal--fullscreen .modal-content {
    width: 95%;
    height: 95%;
    max-width: none;
    max-height: none;
    overflow-y: auto;
}

/* =============================================
   Confirmation Overlay
   ============================================= */

.confirmation-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.confirmation-overlay.active {
    display: flex;
}

.confirmation-dialog {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
}

.confirmation-dialog h3 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.confirmation-dialog p {
    margin: 0 0 var(--spacing-lg) 0;
    color: var(--text-dark);
    line-height: 1.6;
}

.confirmation-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}
