/*
 * Layout System v1.0
 * Sistema base de tres zonas (header/body/footer) + densidad compacta global.
 */

:root {
    --layout-page-gap: var(--space-3, 0.75rem);
    --layout-card-padding: 2rem;
    --layout-card-margin-bottom: 2rem;
    --layout-form-gap: 1rem;
    --layout-input-height: 38px;
    --layout-table-font-size: 0.875rem;
    --layout-table-cell-py: 0.75rem;
    --layout-table-cell-px: 1rem;
}

.is-compact {
    --layout-card-padding: 1.2rem;
    --layout-card-margin-bottom: 1rem;
    --layout-form-gap: 0.625rem;
    --layout-input-height: 32px;
    --layout-table-font-size: 0.8125rem;
    --layout-table-cell-py: 0.375rem;
    --layout-table-cell-px: 0.75rem;
}

.content-area.is-compact {
    padding: 0.875rem 1rem;
}

/* ==========================================================================
   VIEWPORT-LOCK: cuando content-area contiene un layout-page,
   el scroll se desactiva a nivel de content-area y se delega
   exclusivamente a layout-page__body.
   ========================================================================== */
.content-area:has(> .layout-page) {
    overflow-y: hidden;
}

/* layout-page que es hijo directo de content-area no necesita margin-bottom;
   el card ocupa todo el alto disponible sin empujar fuera del viewport */
.content-area > .layout-page {
    margin-bottom: 0;
}

.layout-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: var(--layout-page-gap);
}

.content-area.is-compact .layout-page,
.content-area.is-compact > .card,
.content-area.is-compact > section {
    animation: compact-fade-in 0.14s ease-out;
}

@keyframes compact-fade-in {
    from {
        opacity: 0.96;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.layout-page__header,
.layout-page__footer {
    flex-shrink: 0;
}

.layout-page__body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.layout-page__body--table {
    overflow: hidden;
}

.is-compact .filters__row,
.is-compact .form-grid,
.is-compact .general-card__grid,
.is-compact .grupo-general-stack,
.is-compact .grupo-form__body,
.is-compact .form-group {
    gap: var(--layout-form-gap);
}

.is-compact input,
.is-compact select,
.is-compact .form-control,
.is-compact .filters__search-input {
    min-height: var(--layout-input-height);
}

.is-compact .table,
.is-compact .table-interactive {
    font-size: var(--layout-table-font-size);
}

.is-compact .table th,
.is-compact .table td,
.is-compact .table-interactive th,
.is-compact .table-interactive td {
    padding: var(--layout-table-cell-py) var(--layout-table-cell-px);
}
