﻿/* ========================================================================== */
/* 🏗️ THE MASTER SHELL PHYSICS                                                 */
/* ========================================================================== */

.ledger-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--paper-bg);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.page-wrapper {
    flex: 1; /* Automatically takes up all remaining space */
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.ledger-sidebar {
    background-color: var(--paper-sheet);
    /* The brutalist border uses the mathematically generated colors */
    border-color: var(--ink-border);
    transition: all 0.3s ease-in-out;
    z-index: 40;
}

/* ========================================================================== */
/* ⬅️ THE LEFT AXIS (Vertical Sidebar)                                        */
/* ========================================================================== */

.layout-left {
    flex-direction: row; /* Content flows left-to-right */
}

    .layout-left .ledger-sidebar {
        width: 260px;
        height: 100vh;
        border-right: 4px solid var(--ink-border);
        flex-shrink: 0;
        position: sticky;
        top: 0;
        overflow-y: auto;
    }

    .layout-left .ledger-nav-list {
        display: flex;
        flex-direction: column; /* Stack nav links vertically */
        gap: 0.5rem;
    }

/* ========================================================================== */
/* ⬆️ THE TOP AXIS (Horizontal Navbar)                                        */
/* ========================================================================== */

.layout-top {
    flex-direction: column; /* Content flows top-to-bottom */
}

    .layout-top .ledger-sidebar {
        width: 100%;
        height: auto;
        min-height: 70px;
        border-bottom: 4px solid var(--ink-border);
        border-right: none;
        /* Pivot the sidebar internal contents to sit side-by-side */
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 2rem;
    }

    /* Force the internal menu groups to display horizontally */
    .layout-top .ledger-sidebar-content {
        display: flex;
        flex-direction: row;
        width: 100%;
        align-items: center;
        justify-content: space-between;
    }

    .layout-top .ledger-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 2rem;
    }

    .layout-top .ledger-nav-list {
        display: flex;
        flex-direction: row; /* Flow nav links horizontally */
        gap: 1rem;
        margin: 0;
        padding: 0;
    }

    /* Hide section headers in top mode to save space, or adjust as needed */
    .layout-top .ledger-section-header {
        display: none;
    }


/* 🚀 THE PHYSICS ENGINE */

/* 1. Viewport Lock: Prevents the footer from jerking up and down */
.triage-viewport {
    min-height: 330px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.brutal-row {
    display: flex;
    align-items: center;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    max-height: 100px;
    overflow: hidden;
    background-color: transparent;
}

/* 2. Entry Physics: New rows smoothly slide up into the empty slot */
.brutal-row:not(.row-exiting) {
    animation: slideInUp 0.4s ease-out forwards;
}

.brutal-cell {
    padding: 1rem;
    flex: 1;
}

/* 3. Exit Sequence: Slide right, then collapse height */
.row-exiting {
    animation: slideOutRight 0.4s forwards cubic-bezier(0.8, 0, 0.2, 1), collapseRow 0.3s 0.4s forwards ease;
}

/* KEYFRAMES */
@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutRight {
    0% {
        transform: translateX(0);
        opacity: 1;
    }

    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes collapseRow {
    0% {
        max-height: 100px;
        padding-top: 1rem;
        padding-bottom: 1rem;
        border-width: 2px;
    }

    100% {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
        margin: 0;
    }
}