/* =============================================
   Modales — composant générique
   Utilisé via templates/components/modal.html.twig
   ============================================= */

/* ── Overlay ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: modal-fade-in 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Contenu ── */
.modal__content {
    background: linear-gradient(145deg, var(--bg-surface-1), var(--bg-surface-2));
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px var(--bg-primary-muted);
    animation: modal-slide-up 0.25s ease;
}

@keyframes modal-slide-up {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Variantes de taille */
.modal__content--sm { max-width: 420px; }
.modal__content--lg { max-width: 860px; }

/* ── Header ── */
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

/* ── Bouton fermeture ── */
.modal__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease,
                color 0.2s ease, transform 0.2s ease;
}

.modal__close:hover {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.4);
    color: var(--color-danger);
    transform: rotate(90deg);
}

/* ── Corps ── */
.modal__body {
    padding: 1.75rem 2rem;
    overflow-y: auto;
    flex: 1;
    color: var(--text-primary);
}

/* Let custom select dropdowns escape modal bounds while open. */
body.has-open-filter-select .modal__content,
body.has-open-filter-select .modal__body {
    overflow: visible;
}

/* ── Footer ── */
.modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* ── Variante danger (confirmation de suppression) ── */
.delete-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 0;
}

.delete-warning svg {
    color: var(--color-danger);
    margin-bottom: 1.5rem;
}

.delete-warning-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.delete-warning-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .modal__content {
        width: 96%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal__header { padding: 1.25rem 1.25rem; }
    .modal__body   { padding: 1.25rem 1.25rem; }
    .modal__footer { padding: 1rem 1.25rem;    }
}
