/* ============================================================
   Modal teVitaForge (tvf-modal). Controlado por JS
   (window.tvfModal.open(id)/close(id) — ver web/static/js/components/modal.js)
   y con markup desde la macro render_modal (generic/componentes/modal.html).
   .tvf-modal* no existe todavía en t-vita-forge.css: vive acá, compartido,
   hasta que el DS lo adopte como componente.
   ============================================================ */
.tvf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--tvf-space-16);
    background: rgba(2, 17, 36, 0.48);
}
/* [hidden] vive en el stylesheet del navegador (prioridad más baja que cualquier
   regla de autor): sin este override, el display:flex de arriba lo pisa y el
   modal queda visible siempre en vez de solo al abrirse. */
.tvf-modal-overlay[hidden] { display: none; }
.tvf-modal {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - var(--tvf-space-32));
    overflow-y: auto;
    background: #FFF;
    border-radius: var(--tvf-radius-12);
    display: flex;
    flex-direction: column;
    gap: var(--tvf-space-24);
    padding: var(--tvf-space-24);
    &:focus { outline: none; }
    &.tvf-modal--narrow { max-width: 420px; }
    &.tvf-modal--wide { max-width: 640px; }
}
.tvf-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--tvf-space-16);
}
.tvf-modal__header-main {
    display: flex;
    flex-direction: column;
    gap: var(--tvf-space-8);
}
.tvf-modal__title {
    margin: 0;
    font-size: 20px;
    font-weight: var(--tvf-fw-bold);
    color: var(--tvf-neutral-900);
}
.tvf-modal__desc {
    margin: 0;
    font-size: 14px;
    color: var(--tvf-neutral-600);
    text-wrap: pretty;
}
.tvf-modal__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 0;
    border-radius: var(--tvf-radius-8);
    color: var(--tvf-neutral-500);
    cursor: pointer;
}
.tvf-modal__close:hover { background: var(--tvf-neutral-100); color: var(--tvf-neutral-900); }
.tvf-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--tvf-space-16);
}
.tvf-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tvf-space-16);
    padding-top: var(--tvf-space-16);
    border-top: var(--tvf-border-1) solid var(--tvf-neutral-200);
}
/* Con o sin link a la izquierda, la acción principal queda siempre a la derecha. */
.tvf-modal__footer-main { display: flex; align-items: center; gap: var(--tvf-space-16); margin-left: auto; }

@media (max-width: 767px) {
    .tvf-modal__footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .tvf-modal__footer-main {
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        & .tvf-btn { width: 100%; justify-content: center; }
    }
    .tvf-modal__footer > .tvf-link { text-align: center; }
    .tvf-modal__footer > .tvf-btn { width: 100%; justify-content: center; }
}
