/* ==========================================================================
   Siebert layout additions, loaded on every page after smartapp.min.css and
   before the colour theme (#theme-style), so they work with any theme.

   - Brand: the Siebert Realty logo in place of SmartAdmin's mark.
   - Menu labels: the top bar uses the short names dash2 used (Maint, HSKP...),
     the sidebar and the phone menu the full ones (includes/menu.php).
   - Top menu (html.set-nav-top, desktop only): SmartAdmin v5's top-navigation
     setting only re-grids the page and leaves the menu vertical (with debug
     colours), so the horizontal bar and its dropdowns are ours. Colours come
     from the theme's own nav variables, so the bar follows whichever colour
     theme the person picks in Layout Settings.
   ========================================================================== */

/* ---- brand ---- */
.app-logo > img.brand-logo { width: auto; min-width: 0; height: 2.25rem; }

/* ---- menu labels ---- */
.nav-link-text .nl-short { display: none; }
/* A group's total (includes/menu.php) is for while it's closed: open, the sidebar shows each item's own count. */
.primary-nav li.open > a > .menu-badge-sum { display: none; }
/* ...and sits left of the group's arrow, not under it (the top bar sets its own margin below). */
.primary-nav .menu-badge-sum { margin-right: 1.6rem !important; }

@media (min-width: 992px) {
    .set-nav-top .nav-link-text .nl-short { display: inline; }
    .set-nav-top .nav-link-text .nl-full { display: none; }
    /* On the bar an open group is a dropdown under its name: the total stays. */
    .set-nav-top .primary-nav li.open > a > .menu-badge-sum { display: inline-block; }

    /* ---- top menu: page grid. The bar's row grows if the menu has to wrap onto a second line on a narrow screen. ---- */
    .set-nav-top .app-wrap { grid-template-rows: var(--app-header-height) auto 1fr; }
    /* the logo sits on the header strip; Dark Navigation colours its block for the sidebar layout */
    .set-nav-top .app-header .app-logo,
    .set-nav-top.set-nav-dark:not([data-bs-theme=dark]) .app-header .app-logo {
        width: auto; margin-right: 1.5rem; border-right: 0; padding-left: 1.5rem; background: transparent;
    }
    .set-nav-top .app-header .collapse-icon { display: none !important; }

    .set-nav-top .app-sidebar {
        flex-direction: row !important; align-items: stretch; height: auto; min-height: 2.875rem;
        padding: 0 .75rem; border: 0; border-bottom: 1px solid var(--app-layout-border-color);
        position: relative; z-index: calc(var(--z-index-master) - 1); overflow: visible;
    }
    /* SmartAdmin's fixed-header + fixed-nav combination paints the bar red; keep the theme's colour and pin it under the header */
    .set-nav-fixed.set-nav-top.set-header-fixed .app-sidebar { position: sticky; top: var(--app-header-height); background-color: var(--app-nav-background); overflow: visible; }
    .set-nav-top .app-sidebar > .app-logo,
    .set-nav-top .app-sidebar > .app-menu-filter-container,
    .set-nav-top .app-sidebar > .nav-footer { display: none !important; }
    .set-nav-top .primary-nav { overflow: visible !important; display: flex; flex-grow: 1; width: auto; padding: 0; margin: 0; }
    /* smartSlimscroll.js wraps the sidebar menu in a sidebar-wide box that hides overflow, which would clip the dropdowns */
    .set-nav-top .app-sidebar > .slimScrollDiv { flex: 1 1 auto; width: auto !important; height: auto !important; overflow: visible !important; }
    .set-nav-top .app-sidebar .slimScrollBar,
    .set-nav-top .app-sidebar .slimScrollRail { display: none !important; }

    .set-nav-top .primary-nav .nav-menu { flex-direction: row; flex-wrap: wrap; gap: 0; margin: 0; padding: 0; }
    .set-nav-top .primary-nav .nav-menu > li { position: relative; }
    .set-nav-top .primary-nav .nav-menu > li > a {
        height: 2.875rem; padding: 0 .6rem; gap: .4rem; margin: 0; border-radius: 0;
        font-size: .8125rem; font-weight: 400; white-space: nowrap;
        color: var(--app-nav-link-color); background: transparent;
        border-top: 3px solid transparent; border-bottom: 3px solid transparent;
    }
    .set-nav-top .primary-nav .nav-menu > li > a > .sa-icon { --sa-icon-size: 1.05rem; width: 1.05rem; height: 1.05rem; margin: 0; }
    .set-nav-top .primary-nav .nav-menu > li > a .badge { margin: 0 0 0 .1rem !important; }
    .set-nav-top .primary-nav .nav-menu > li > a > .collapse-sign { display: none; }
    .set-nav-top .primary-nav .nav-menu > li.has-ul > a::after {
        content: ""; width: .38rem; height: .38rem; margin: -.2rem 0 0 .15rem; flex-shrink: 0;
        border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: .7;
    }
    .set-nav-top .primary-nav .nav-menu > li:hover > a,
    .set-nav-top .primary-nav .nav-menu > li.is-open > a { color: var(--app-nav-link-hover-color); background: var(--app-nav-item-hover-bg); }
    .set-nav-top .primary-nav .nav-menu > li.active > a {
        color: var(--app-nav-link-active-color); background: var(--app-nav-item-active-bg);
        border-bottom-color: var(--app-nav-item-active-indicator, rgba(var(--primary), 1));
    }
    /* SmartAdmin's sidebar markers (the dot after the active item, the guide line beside a sub-menu) don't belong on a bar */
    .set-nav-top .primary-nav li.active > a .nav-link-text::before,
    .set-nav-top .primary-nav ul ul::before,
    .set-nav-top .primary-nav ul ul li::before { display: none !important; }

    /* dropdowns: open on hover, or on click / Enter for touch screens and keyboards (scripts/app/top-menu.js) */
    .set-nav-top .primary-nav .nav-menu > li > ul {
        display: none !important; position: absolute; top: 100%; left: 0; z-index: var(--z-index-master);
        min-width: 14rem; height: auto !important; overflow: visible !important; padding: .45rem 0; gap: 0;
        background: var(--bs-body-bg); border-radius: 0 0 .5rem .5rem; box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
    }
    .set-nav-top .primary-nav .nav-menu > li:hover > ul,
    .set-nav-top .primary-nav .nav-menu > li.is-open > ul { display: flex !important; }
    .set-nav-top .primary-nav .nav-menu > li:nth-last-child(-n+2) > ul { left: auto; right: 0; }
    /* dropdown links are dark on the white panel; "html ... .app-sidebar" outranks Dark Navigation's white links */
    html.set-nav-top .app-sidebar .primary-nav .nav-menu > li > ul a {
        display: flex; padding: .5rem 1.35rem; margin: 0; border-radius: 0; white-space: nowrap;
        color: var(--bs-body-color); font-size: .8125rem; font-weight: 400; background: transparent;
    }
    html.set-nav-top .app-sidebar .primary-nav .nav-menu > li > ul a:hover,
    html.set-nav-top .app-sidebar .primary-nav .nav-menu > li > ul a:focus-visible { background: rgba(var(--primary), .08); color: rgba(var(--primary), 1); }
    html.set-nav-top .app-sidebar .primary-nav .nav-menu > li > ul li.active > a,
    html.set-nav-top .app-sidebar .primary-nav .nav-menu > li > ul a[aria-current=page] {
        color: rgba(var(--primary), 1); font-weight: 500; box-shadow: inset 3px 0 0 rgba(var(--primary), 1);
    }

    /* 1366/1440 laptops: names only, so all of the menu fits on one line */
    @media (max-width: 1599.98px) {
        .set-nav-top .primary-nav .nav-menu > li > a { padding: 0 .5rem; }
        .set-nav-top .primary-nav .nav-menu > li > a > .sa-icon { display: none; }
    }
}

/* Layout Settings: the menu-position choice only applies on desktop, so it's hidden where the menu always slides out */
.menu-position-choice .btn { flex: 1 1 0; }

/* ---- top menu: one line, with < > arrows when it doesn't fit (Darrius, 2026-11-25: "keep one line like dash2 did").
   The bar never wraps. scripts/app/top-menu.js slides the list sideways with a transform and shows an arrow at each
   end that has more menu past it. overflow-x CLIP (not hidden) is what lets the dropdowns still hang below the bar:
   clip on one axis may sit beside visible on the other, where hidden would turn the other axis into a scroll box. */
@media (min-width: 992px) {
    html.set-nav-top .app-sidebar .primary-nav { overflow-x: clip !important; overflow-y: visible !important; position: relative; min-width: 0; }
    .set-nav-top .app-sidebar > .slimScrollDiv { min-width: 0; }
    .set-nav-top .primary-nav .nav-menu { flex: 0 0 auto; flex-wrap: nowrap; transition: transform .2s ease; will-change: transform; }
    .set-nav-top .top-menu-arrow {
        display: none; position: absolute; top: 0; bottom: 0; z-index: 2; width: 2rem; padding: 0; border: 0;
        align-items: center; justify-content: center; cursor: pointer;
        color: var(--app-nav-link-hover-color); background: var(--app-nav-background);
    }
    .set-nav-top .top-menu-arrow.is-shown { display: flex; }
    .set-nav-top .top-menu-arrow:hover,
    .set-nav-top .top-menu-arrow:focus-visible { background: var(--app-nav-item-hover-bg); }
    .set-nav-top .top-menu-arrow-prev { left: 0; box-shadow: 6px 0 8px -4px rgba(0, 0, 0, .45); }
    .set-nav-top .top-menu-arrow-next { right: 0; box-shadow: -6px 0 8px -4px rgba(0, 0, 0, .45); }
    .set-nav-top .top-menu-arrow::before {
        content: ""; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    }
    .set-nav-top .top-menu-arrow-prev::before { transform: rotate(135deg); margin-left: .2rem; }
    .set-nav-top .top-menu-arrow-next::before { transform: rotate(-45deg); margin-right: .2rem; }
    /* A dropdown that would run past the bar's right end opens leftwards instead (set by top-menu.js). */
    .set-nav-top .primary-nav .nav-menu > li.drop-left > ul { left: auto; right: 0; }
}
