:root {
    --athnav-primary: #2f5d8a;
    --athnav-primary-dark: #234869;
    --athnav-accent: #2ea88f;
    --athnav-bg: #ffffff;
    --athnav-surface: #ffffff;
    --athnav-border: #e2e6ec;
    --athnav-text: #1f2933;
    --athnav-text-muted: #6b7684;
    --athnav-sidebar-width: 240px;
    --athnav-header-height: 60px;
    --athnav-footer-height: 48px;
}

html {
    font-size: 12px;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--athnav-bg);
    color: var(--athnav-text);
    font-family: "Segoe UI", Roboto, -apple-system, sans-serif;
}

/* Sticky sidebar: pins to the viewport as the page scrolls normally. Its own
   nav list gets an independent vertical scroll region (bounded by the 100vh
   box) so hovering the sidebar and scrolling never moves the whole page. */
.athnav-sidebar {
    width: var(--athnav-sidebar-width);
    background-color: #ffffff;
    height: calc(100vh - var(--athnav-footer-height));
    position: sticky;
    top: 0;
    color: var(--athnav-text);
    border-right: 1px solid var(--athnav-border);
}

/* Bootstrap's .overflow-auto utility sets overflow: auto !important on both
   axes; force vertical-only so wheel scroll never gets hijacked sideways. */
.athnav-sidebar .nav.overflow-auto {
    min-height: 0;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.athnav-content {
    min-width: 0; /* lets wide tables scroll inside their own container instead of widening the page */
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + var(--athnav-footer-height));
}

/* Custom responsive sidebar (no Bootstrap offcanvas component — it kept
   fighting our theme with !important resets, so this is hand-rolled instead).
   Desktop: sticky, always visible, part of normal flex flow (rules above).
   Below lg: taken out of flow and slid off-screen; a tiny inline script in
   layouts/main.php toggles .is-open on both this and the backdrop. */
.athnav-sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .athnav-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform 0.25s ease-in-out;
    }

    .athnav-sidebar.is-open {
        transform: translateX(0);
    }

    .athnav-sidebar-backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
    }
}

/* Navigation modes (desktop). Fixed is the default. With auto-hide (html.sidebar-autohide) the menu is taken out of the
   page flow and slid off-screen, so the page uses the full width; touching the left edge, or the menu button, slides it
   back over the page, and it goes again when the pointer leaves it. */
.athnav-sidebar-edge {
    display: none;
}

@media (min-width: 992px) {
    html:not(.sidebar-autohide) .athnav-menu-btn {
        display: none !important;
    }

    html.sidebar-autohide .athnav-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    }

    html.sidebar-autohide .athnav-sidebar.is-peek {
        transform: translateX(0);
        box-shadow: 6px 0 24px rgba(0, 0, 0, 0.18);
    }

    html.sidebar-autohide .athnav-sidebar-edge {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 10px;
        height: calc(100vh - var(--athnav-footer-height));
        z-index: 1044;
    }
}

@media (max-width: 991.98px) {
    #athnavSidebarPin {
        display: none !important;
    }
}
.athnav-sidebar .brand {
    height: var(--athnav-header-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--athnav-text);
    border-bottom: 1px solid var(--athnav-border);
}

.athnav-sidebar-logo {
    max-height: calc(var(--athnav-header-height) - 1rem);
    max-width: 160px;
    object-fit: contain;
}

.athnav-sidebar .nav-link {
    color: var(--athnav-text-muted);
    padding: 0.6rem 1rem;
    font-size: 12px;
}

.athnav-sidebar .nav-link:hover,
.athnav-sidebar .nav-link.active {
    color: var(--athnav-primary);
    background-color: rgba(47, 93, 138, 0.08);
}

.athnav-sidebar .text-white-50 {
    color: var(--athnav-text-muted) !important;
    opacity: 0.75;
}

/* Section header labels ("Profiles", "Run Payroll", "Approvals", etc.) share the
   footer's blue, lightened toward a soft pastel, so the sidebar reads as one
   consistent brand color throughout, without overpowering the list. */
.athnav-sidebar .nav-item.small.text-uppercase {
    background-color: #C8D4E6;
    color: #2D68C4 !important;
    opacity: 1;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
}

/* Section header labels use Bootstrap's .small utility (0.875em) for
   the uppercase-label look, but that also shrinks them below the actual
   nav-link items — override back to match. */
.athnav-sidebar .nav-item.small {
    font-size: 12px;
}

/* Colorful nav icons: cycle a fixed palette by position so every icon down
   the sidebar gets a distinct color, instead of one flat muted tone. */
.athnav-sidebar .nav-link i.fa-solid {
    width: 1.15em;
    text-align: center;
}

.athnav-sidebar > ul > li:nth-of-type(6n+1) > .nav-link i.fa-solid { color: #7c3aed; }
.athnav-sidebar > ul > li:nth-of-type(6n+2) > .nav-link i.fa-solid { color: #2563eb; }
.athnav-sidebar > ul > li:nth-of-type(6n+3) > .nav-link i.fa-solid { color: #16a34a; }
.athnav-sidebar > ul > li:nth-of-type(6n+4) > .nav-link i.fa-solid { color: #ea580c; }
.athnav-sidebar > ul > li:nth-of-type(6n+5) > .nav-link i.fa-solid { color: #db2777; }
.athnav-sidebar > ul > li:nth-of-type(6n) > .nav-link i.fa-solid { color: #0d9488; }

/* A JS accordion feature moves each section's items into a nested
   `li.collapse > ul` wrapper at runtime, so the top-level cycle above
   only ever reaches items outside any section — repeat the same cycle
   scoped to each section's own inner list. */
.athnav-sidebar li.collapse > ul > li:nth-of-type(6n+1) > .nav-link i.fa-solid { color: #7c3aed; }
.athnav-sidebar li.collapse > ul > li:nth-of-type(6n+2) > .nav-link i.fa-solid { color: #2563eb; }
.athnav-sidebar li.collapse > ul > li:nth-of-type(6n+3) > .nav-link i.fa-solid { color: #16a34a; }
.athnav-sidebar li.collapse > ul > li:nth-of-type(6n+4) > .nav-link i.fa-solid { color: #ea580c; }
.athnav-sidebar li.collapse > ul > li:nth-of-type(6n+5) > .nav-link i.fa-solid { color: #db2777; }
.athnav-sidebar li.collapse > ul > li:nth-of-type(6n) > .nav-link i.fa-solid { color: #0d9488; }

.athnav-header {
    height: var(--athnav-header-height);
    background-color: var(--athnav-surface);
    border-bottom: 1px solid var(--athnav-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Per-page title bar (h1 + action buttons like Edit / Save Changes / Cancel).
   Sticks directly under the header bar above so it stays visible on scroll. */
.page-header-sticky {
    position: sticky;
    top: var(--athnav-header-height);
    z-index: 1020;
    background-color: var(--athnav-bg);
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    margin-top: -1rem;
}

/* Page title bar — no background highlight (removed per request; class kept as a no-op
   so the ~75 view files that apply it don't need to be touched). */
.header-highlight {
    background-color: transparent !important;
}

.athnav-tile-card {
    border-radius: 0.75rem;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a:hover > .athnav-tile-card {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22), 0 4px 10px rgba(15, 23, 42, 0.14);
}

.profile-heading {
    background-color: #C3C3C3;
}

.profile-asset-preview {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
}

.btn-view-add {
    background-color: #DBDBDB;
    border-color: #DBDBDB;
    color: var(--athnav-text);
}

.btn-view-add:hover,
.btn-view-add:focus {
    background-color: #cacaca;
    border-color: #cacaca;
    color: var(--athnav-text);
}

.athnav-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 1rem 1.5rem;
    background-color: #2D68C4;
    color: #ffffff;
    font-size: 0.85rem;
    border-top: none;
    z-index: 1030;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
    overflow-x: auto;
}

.athnav-footer-links { font-size: 0.8rem; }
.athnav-footer-links a { color: #ffffff; text-decoration: none; opacity: 0.92; }
.athnav-footer-links a:hover { text-decoration: underline; opacity: 1; }

/* Auth layout */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--athnav-primary) 0%, var(--athnav-primary-dark) 100%);
    padding-bottom: var(--athnav-footer-height);
    box-sizing: border-box;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--athnav-surface);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Error pages */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--athnav-bg);
    font-family: "Segoe UI", Roboto, -apple-system, sans-serif;
}

.error-box {
    text-align: center;
}

.error-box h1 {
    font-size: 4rem;
    color: var(--athnav-primary);
    margin-bottom: 0.5rem;
}

.debug-trace {
    text-align: left;
    background: #fff3f3;
    border: 1px solid #f2c2c2;
    padding: 1rem;
    border-radius: 0.25rem;
    max-width: 600px;
    overflow-x: auto;
}

.btn-link {
    color: var(--athnav-primary);
    text-decoration: none;
    font-weight: 500;
}
