/* Système de modals pour Séquoia Desktop */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h3 i {
    color: #0891b2;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #334155;
    transform: rotate(90deg);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
    background: white;
}

/* Scrollbar personnalisée pour le modal */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}

/* Sections du modal */
.modal-section {
    margin-bottom: 28px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section h4 i {
    color: #0891b2;
    font-size: 14px;
}

/* Séparateur */
.modal-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 24px 0;
}

/* Grille pour organiser le contenu */
.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Animations d'entrée/sortie */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
}

.modal.closing {
    opacity: 0;
}

.modal.closing .modal-content {
    animation: modalFadeOut 0.3s ease-out;
}

/* État de chargement */
.modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.modal-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f1f5f9;
    border-top-color: #0891b2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Messages dans le modal */
.modal-message {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.modal-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.modal-message.warning {
    background: #fed7aa;
    color: #92400e;
    border: 1px solid #fdba74;
}

.modal-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Boutons spécifiques au modal */
.modal-footer .btn {
    min-width: 100px;
}

.modal-footer .btn-cancel {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.modal-footer .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Modal de confirmation */
.modal-confirm .modal-content {
    max-width: 450px;
}

.modal-confirm .modal-body {
    text-align: center;
    padding: 40px;
}

.modal-confirm .confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.modal-confirm .confirm-icon.warning {
    background: #fef3c7;
    color: #f59e0b;
}

.modal-confirm .confirm-icon.danger {
    background: #fee2e2;
    color: #ef4444;
}

.modal-confirm .confirm-icon.success {
    background: #d1fae5;
    color: #10b981;
}

.modal-confirm h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1e293b;
}

.modal-confirm p {
    color: #64748b;
    margin-bottom: 32px;
}

/* Design responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .modal-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibilité - réduction d'animations */
@media (prefers-reduced-motion: reduce) {
    .modal,
    .modal-content,
    .close-btn {
        transition: none;
        animation: none;
    }
}