/* Système de modales élégantes */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    padding: 24px 28px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.modal-icon.info {
    background: #dbeafe;
    color: #2563eb;
}

.modal-icon.success {
    background: #dcfce7;
    color: #16a34a;
}

.modal-icon.warning {
    background: #fef3c7;
    color: #d97706;
}

.modal-icon.error {
    background: #fee2e2;
    color: #dc2626;
}

.modal-icon.question {
    background: #e0e7ff;
    color: #6366f1;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.modal-body {
    padding: 20px 28px;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.6;
    overflow-y: auto;
}

.modal-input {
    margin-top: 16px;
}

.modal-input input,
.modal-input textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.modal-input input:focus,
.modal-input textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e5e7eb;
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-btn:active {
    transform: translateY(0);
}

.modal-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-btn.primary:hover {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.modal-btn.success {
    background: #16a34a;
    color: white;
}

.modal-btn.success:hover {
    background: #15803d;
}

.modal-btn.danger {
    background: #dc2626;
    color: white;
}

.modal-btn.danger:hover {
    background: #b91c1c;
}

.modal-btn.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-btn.secondary:hover {
    background: #e5e7eb;
}

/* Animation de sortie */
.modal-overlay.closing {
    animation: fadeOut 0.2s forwards;
}

.modal-overlay.closing .modal-box {
    animation: slideOut 0.2s forwards;
}

@keyframes slideOut {
    to {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
}

/* Responsive modal for mobile */
@media (max-width: 600px) {
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-box {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
        animation: slideInBottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes slideInBottom {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .modal-header {
        padding: 18px 20px 12px;
    }

    .modal-title {
        font-size: 17px;
    }

    .modal-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .modal-body {
        padding: 15px 20px;
        font-size: 14px;
    }

    .modal-footer {
        padding: 12px 20px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-btn {
        flex: 1;
        min-width: 100px;
        text-align: center;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}
