/* =====================================================================
   Left menu for logged-in pages (includes/app_sidebar.php) — 2026-10-09.

   Its own file rather than part of style.css: style.css is taken from
   I-Church on every rebuild, this is I-Transact's own.

   Desktop: a fixed navy column on the left, the page beside it.
   Below 960px: hidden off-canvas, opened by the button in the slim top
   bar, over a dimmed page.
   ===================================================================== */

:root { --itx-sidebar-width: 264px; }

/* The menu replaces the header's links; the two section menu bars above
   the page content would repeat them, so they go too. Their read-only
   notice is a separate element and stays. */
body.itx-has-sidebar .accounting-nav { display: none; }

body.itx-has-sidebar { padding-left: var(--itx-sidebar-width); }

.itx-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--itx-sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--brand);
    color: var(--soft-white);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 900;
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.06);
}

.itx-brand {
    display: flex;
    align-items: center;
    padding: 20px 20px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.3px;
    text-decoration: none;
}
.itx-brand .brand-icon { height: 28px; }

.itx-company {
    margin: 0 14px 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.itx-company-name { color: var(--accent); font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.itx-user { color: rgba(251, 251, 251, 0.75); font-size: 0.82rem; overflow-wrap: anywhere; }

.itx-nav { flex: 1 0 auto; padding: 4px 10px 16px; }
.itx-nav-section + .itx-nav-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.itx-nav-heading {
    padding: 6px 10px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--teal-bright);
}

.itx-nav-link {
    display: block;
    padding: 7px 10px 7px 12px;
    border-radius: 6px;
    color: rgba(251, 251, 251, 0.88);
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1.3;
    border-left: 3px solid transparent;
}
.itx-nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.itx-nav-link:focus-visible,
.itx-nav-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.itx-nav-link.active {
    background: rgba(0, 164, 189, 0.22);
    border-left-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.itx-nav-top { font-weight: 600; }

.itx-nav-group > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px 7px 15px;
    border-radius: 6px;
    cursor: pointer;
    color: rgba(251, 251, 251, 0.92);
    font-size: 0.92rem;
    font-weight: 600;
    user-select: none;
}
.itx-nav-group > summary::-webkit-details-marker { display: none; }
.itx-nav-group > summary::after {
    content: "";
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    opacity: 0.6;
    transition: transform 0.15s ease;
    flex: 0 0 auto;
}
.itx-nav-group[open] > summary::after { transform: rotate(45deg); }
.itx-nav-group > summary:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.itx-nav-group.current > summary { color: #fff; }

.itx-nav-step {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}
.itx-nav-group.current .itx-nav-step { background: var(--accent); color: var(--brand-dark); }

.itx-nav-sub { padding: 2px 0 6px 21px; }
.itx-nav-sub .itx-nav-link { font-size: 0.88rem; padding-top: 6px; padding-bottom: 6px; }

.itx-foot {
    padding: 12px 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.itx-lang-select {
    width: 100%;
    margin: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 0.88rem;
}
.itx-lang-select option { color: var(--text); }
.itx-nav-logout { font-weight: 600; }

/* The WhatsApp button. The accounting pages move it to the bottom LEFT
   (style.css), clear of their Save buttons — which is now where the menu
   is, so on a desktop it sits just to the right of the menu instead. It
   steps aside while the phone menu is open. */
@media (min-width: 960px) {
    body.itx-has-sidebar:has(.accounting-nav) .whatsapp-float { left: calc(var(--itx-sidebar-width) + 16px); right: auto; }
}
body.itx-menu-open .whatsapp-float { display: none; }

/* Top bar: only below 960px, where the menu is off-canvas. */
.itx-topbar { display: none; }

.itx-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 19, 59, 0.45);
    z-index: 899;
}
.itx-backdrop[hidden] { display: none; }

@media (max-width: 959px) {
    body.itx-has-sidebar { padding-left: 0; }

    .itx-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 800;
        padding: 10px 16px;
        background: var(--brand);
        color: #fff;
    }
    .itx-topbar-brand { display: inline-flex; align-items: center; color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
    .itx-topbar-brand .brand-icon { height: 26px; }

    .itx-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin: 0;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.25);
        border-radius: 8px;
        background: transparent;
        cursor: pointer;
    }
    .itx-menu-toggle-bars,
    .itx-menu-toggle-bars::before,
    .itx-menu-toggle-bars::after {
        display: block;
        width: 18px;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        position: relative;
    }
    .itx-menu-toggle-bars::before,
    .itx-menu-toggle-bars::after { content: ""; position: absolute; left: 0; }
    .itx-menu-toggle-bars::before { top: -6px; }
    .itx-menu-toggle-bars::after { top: 6px; }

    .itx-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        width: min(86vw, var(--itx-sidebar-width));
    }
    body.itx-menu-open .itx-sidebar { transform: translateX(0); }
    body.itx-menu-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .itx-sidebar, .itx-nav-group > summary::after { transition: none; }
}

@media print {
    body.itx-has-sidebar { padding-left: 0; }
    .itx-sidebar, .itx-topbar, .itx-backdrop { display: none !important; }
}
