/* =====================================================================
   Clyptus ATS — Sidebar theme: Sleek & Professional (Dark Glassmorphism)
   Site-wide default. Linked from Site.master AFTER theme.css so it wins.
   Smoked translucent panel, deep purple/navy ambient glow, neon-lit
   active item. Main content stays light for readability.
   ===================================================================== */

.sb {
    /* NOTE: keep theme.css's `position: fixed` — do NOT set relative here, or the
       fixed sidebar re-enters the flex flow and doubles the left offset (dead gap). */
    overflow: visible;
    background: linear-gradient(165deg, rgba(24,21,48,.94) 0%, rgba(14,16,33,.96) 100%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    backdrop-filter: blur(20px) saturate(140%);
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: inset -1px 0 0 rgba(255,255,255,.05), 6px 0 30px rgba(0,0,0,.4);
    color: #e6e8f5;
}

/* Ambient lighting behind the glass */
.sb::before {
    content: '';
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(440px 320px at 8% 6%,   rgba(124,77,255,.32), transparent 60%),
        radial-gradient(480px 380px at 96% 26%, rgba(46,80,210,.30),  transparent 62%),
        radial-gradient(520px 420px at 24% 104%, rgba(96,60,200,.24), transparent 60%);
}

/* Glossy top edge highlight */
.sb::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px; z-index: 2;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    pointer-events: none;
}

.sb-brand, .sb-nav { position: relative; z-index: 1; }

/* Brand block */
.sb-brand, .sb-brand .bm-org { color: #fff; }
.sb-brand .bm-prod { color: rgba(255,255,255,.55); }
.sb-mark {
    background: linear-gradient(135deg, #7c4dff, #4361ee);
    color: #fff;
    box-shadow: 0 4px 16px rgba(124,77,255,.5), inset 0 1px 0 rgba(255,255,255,.35);
}

.sb-nav { padding: 12px 12px 28px; }
.sb-nav::-webkit-scrollbar { width: 8px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }

/* Section header (collapsible group toggle) */
.sb-group { margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.06); }
.sb-group:first-of-type { border-top: none; }
.sb-group-label {
    display: flex; align-items: center; justify-content: space-between;
    opacity: 1 !important;
    color: rgba(226,228,245,.72);
    font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    padding: 9px 12px; margin: 0; border-radius: 11px;
    cursor: pointer; user-select: none;
    transition: background .18s ease, color .18s ease;

    /* Every group row is exactly one line high.
       "Interviews & Screening" wrapped onto two lines, so that one row sat
       taller than the other nine and the icon no longer lined up with the
       column. Uppercase plus .08em tracking makes a long label about 30%
       wider than it reads, which is easy to miss when writing the markup.
       Rather than rely on every future label being short enough, the row is
       pinned to a single line and any overflow is truncated. */
    min-height: 38px;
    white-space: nowrap;
}
/* The icon and the chevron hold their size; only the text gives way. */
.sb-group-label > .sb-gi,
.sb-group-label > .bi-chevron-down { flex: 0 0 auto; }
.sb-group-label > span {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin: 0 8px 0 10px;
}
/* Sub-items get the same treatment — a long page name shouldn't reflow the
   flyout either. */
.sb-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   Module 64 — navigation restructure
   ============================================================ */

/* Caption band inside a flyout. Admin was 18 flat items; past about nine a
   list stops being scanned and starts being hunted through. Three labelled
   bands cost one line each and give the eye somewhere to land. */
.sb-cap {
    display: block;
    margin: 10px 0 3px; padding: 0 10px;
    font-size: .62rem; font-weight: 700; letter-spacing: .10em;
    text-transform: uppercase;
    color: rgba(226,228,245,.42);
}
.sb-cap:first-child { margin-top: 2px; }
.sb-cap + .sb-link { margin-top: 0; }
/* hairline above every band but the first */
.sb-cap:not(:first-child) {
    border-top: 1px solid rgba(255,255,255,.07);
    padding-top: 9px;
}

/* Two columns once a flyout would otherwise scroll. */
.sb-flyout.wide { min-width: 430px; }
.sb-flyout.wide .sb-inner { column-count: 2; column-gap: 14px; }
.sb-flyout.wide .sb-link,
.sb-flyout.wide .sb-cap { break-inside: avoid; -webkit-column-break-inside: avoid; }
@media (max-width: 900px) {
    .sb-flyout.wide { min-width: 240px; }
    .sb-flyout.wide .sb-inner { column-count: 1; }
}

/* Live count on a group label, fed by Notifications.cs. Sits before the
   chevron so the row height never changes. */
.sb-badge {
    flex: 0 0 auto; margin-left: auto; margin-right: 8px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: rgba(124,77,255,.85); color: #fff;
    font-size: .62rem; font-weight: 700; line-height: 18px; text-align: center;
}
.sb-badge:empty { display: none; }

/* Per-link count, e.g. inside the Reports flyout next to "Attendance".
   Smaller and inline (not pushed to the row edge like .sb-badge on the
   group label) since it sits inside link text, not a flex row. */
.sb-badge-sm {
    display: inline-block; margin-left: 6px; vertical-align: 1px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: rgba(124,77,255,.55); color: #fff;
    font-size: .58rem; font-weight: 700; line-height: 16px; text-align: center;
}
.sb-badge-sm:empty { display: none; }

/* ============================================================
   Command palette (Ctrl+K)
   ============================================================ */
.cp-back {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(10,12,24,.55);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    display: none;
}
.cp-back.on { display: block; }
.cp-box {
    position: absolute; top: 14vh; left: 50%; transform: translateX(-50%);
    width: 620px; max-width: 92vw;
    background: linear-gradient(160deg, rgba(38,35,70,.97), rgba(19,21,42,.98));
    border: 1px solid rgba(255,255,255,.14); border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0,0,0,.55);
    overflow: hidden;
}
.cp-in {
    width: 100%; border: 0; outline: 0; background: transparent;
    color: #fff; font-size: 1rem; padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.10);
}
.cp-in::placeholder { color: rgba(226,228,245,.42); }
.cp-list { max-height: 46vh; overflow-y: auto; padding: 6px; }
.cp-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 10px;
    color: rgba(226,228,245,.85); text-decoration: none; font-size: .875rem;
}
.cp-row .cp-grp { margin-left: auto; font-size: .7rem; color: rgba(226,228,245,.40); }
.cp-row.sel, .cp-row:hover {
    background: linear-gradient(90deg, rgba(124,77,255,.34), rgba(67,97,238,.18));
    color: #fff;
}
.cp-row mark { background: transparent; color: #b9a3ff; font-weight: 700; padding: 0; }
.cp-none { padding: 26px; text-align: center; color: rgba(226,228,245,.45); font-size: .85rem; }
.cp-foot {
    display: flex; gap: 14px; padding: 8px 14px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .7rem; color: rgba(226,228,245,.40);
}
.cp-foot kbd {
    background: rgba(255,255,255,.10); border-radius: 4px;
    padding: 1px 5px; font-size: .68rem; color: rgba(226,228,245,.75);
}
.sb-group-label:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sb-group-label[aria-expanded="true"] { color: #fff; }
.sb-group-label .bi-chevron-down { font-size: .7rem; opacity: .8; transition: transform .18s ease; }
.sb-group-label[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); opacity: 1; }

/* Links */
.sb-link {
    position: relative; border-radius: 11px; margin: 2px 0; font-weight: 500;
    color: rgba(226,228,245,.78);
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.sb-link i { opacity: .85; }
.sb-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-link:hover i { opacity: 1; }

/* Neon-lit active item */
.sb-link.active {
    color: #fff; font-weight: 600;
    background: linear-gradient(90deg, rgba(124,77,255,.38), rgba(67,97,238,.20));
    border: 1px solid rgba(150,120,255,.45);
    box-shadow: 0 0 18px rgba(124,77,255,.4), inset 0 0 14px rgba(124,77,255,.22);
}
.sb-link.active i { color: #cdbcff; opacity: 1; }
.sb-link.active::before {
    content: '';
    position: absolute; left: 4px; top: 22%; bottom: 22%; width: 3px;
    border-radius: 3px;
    background: linear-gradient(#b79cff, #6aa8ff);
    box-shadow: 0 0 10px #7c4dff, 0 0 4px #6aa8ff;
}

/* Indent items inside a collapsed group for hierarchy */
.sb-group .collapse .sb-link,
.sb-group .collapsing .sb-link { padding-left: 22px; }

/* =====================================================================
   Flyout submenus — side popups instead of downward accordions.
   Dark glass finish, soft 3D elevation. Reverts to an inline list on
   mobile (no hover). Role-based rendering is unchanged (server-side).
   ===================================================================== */
.sb, .sb-nav { overflow: visible; }           /* let popups escape the rail */

.sb-group { position: relative; }
.sb-group-label { cursor: default; }
.sb-group-label .bi-chevron-down { transform: rotate(-90deg); opacity: .55; }
.sb-group-label:hover .bi-chevron-down,
.sb-group-label.open .bi-chevron-down { opacity: 1; }
.sb-group-label.open,
.sb-group:hover > .sb-group-label { color: #fff; background: rgba(255,255,255,.06); }

.sb-flyout {
    position: absolute; top: -6px; left: 100%; margin-left: 4px;
    min-width: 224px; padding: 8px;
    background: linear-gradient(160deg, rgba(34,31,64,.90), rgba(17,19,38,.94));
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    box-shadow: 0 22px 48px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.07);
    opacity: 0; visibility: hidden; transform: translateX(-8px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 400;
}
/* invisible bridge so moving the cursor across the gap keeps it open */
.sb-flyout::before { content: ''; position: absolute; top: 0; left: -10px; width: 12px; height: 100%; }
.sb-group:hover > .sb-flyout,
.sb-flyout:hover { opacity: 1; visibility: visible; transform: translateX(0); }

/* Applied via JS when the default (downward) position would run off the
   bottom of the viewport — anchors the flyout to the bottom of its trigger
   and grows upward instead.

   Module 64 fix: this alone was not safe. It anchors the BOTTOM and lets the
   flyout grow upward without limit, so a tall menu near the middle of the
   sidebar had its top pushed above the window — you'd see the last few items
   and no way to reach the first. app-ui.js now sets an explicit clamped top
   instead, and this rule only applies while JS hasn't measured yet. */
.sb-flyout.flip-up { top: auto; bottom: -6px; }

/* A flyout can never be taller than the window. If it would be, it scrolls
   inside itself — which is always reachable, unlike off-screen. */
.sb-flyout {
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.sb-flyout::-webkit-scrollbar { width: 8px; }
.sb-flyout::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 8px; }
/* The hover bridge must span the full height even when the panel scrolls. */
.sb-flyout::before { top: 0; height: 100%; }

.sb-flyout .sb-link { padding-left: 12px; margin: 1px 0; color: rgba(230,232,245,.86); }
.sb-flyout .sb-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-flyout .sb-link.active {
    background: linear-gradient(90deg, rgba(124,77,255,.42), rgba(67,97,238,.24));
    color: #fff; border: 1px solid rgba(150,120,255,.4);
}

/* Mobile / touch: fall back to an inline expandable list.
   The sidebar itself becomes a slide-in drawer at 992px, so the flyouts
   must collapse at the same breakpoint — otherwise between 768px and 992px
   the sidebar opens but every submenu is still a hover-only popup that
   touch devices can never reach. */
@media (max-width: 992px) {
    .sb, .sb-nav { overflow: auto; }
    .sb-flyout {
        position: static; margin-left: 0; min-width: 0; padding: 2px 0 6px 10px;
        background: none; border: none; box-shadow: none;
        -webkit-backdrop-filter: none; backdrop-filter: none;
        opacity: 1; visibility: visible; transform: none;
    }
    .sb-flyout::before { display: none; }
    .sb-group-label .bi-chevron-down { transform: rotate(0deg); }
}
 
/* =====================================================================
   Global search / command palette (Ctrl+K)
   ===================================================================== */
.gk-search-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #f1f3f8; border: 1px solid #e2e6ef; color: #6b7280;
    border-radius: 10px; padding: 6px 12px; font-size: .85rem; cursor: text;
    min-width: 220px;
}
.gk-search-btn:hover { border-color: #c9cfdd; }
.gk-search-btn kbd {
    margin-left: auto; background: #fff; border: 1px solid #dfe3ec; border-radius: 6px;
    padding: 1px 6px; font-size: .7rem; color: #6b7280;
}
.gk-overlay {
    position: fixed; inset: 0; z-index: 2000; display: none;
    background: rgba(16,19,34,.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.gk-overlay.show { display: block; }
.gk-panel {
    width: min(600px, 92vw); margin: 12vh auto 0;
    background: #fff; border-radius: 16px; overflow: hidden;
    box-shadow: 0 30px 70px rgba(0,0,0,.35); border: 1px solid #e6e8ee;
}
.gk-input {
    width: 100%; border: 0; border-bottom: 1px solid #eef1f6; outline: none;
    padding: 16px 18px; font-size: 1.05rem; color: #1a1a1a;
}
.gk-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.gk-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-radius: 10px; cursor: pointer; color: #263043; font-size: .92rem; text-decoration: none;
}
.gk-item .gk-grp { margin-left: auto; font-size: .72rem; color: #9aa1ac; }
.gk-item:hover, .gk-item.gk-active { background: #eef2ff; color: #1b2a52; }
.gk-empty { padding: 18px; text-align: center; color: #9aa1ac; }

/* =====================================================================
   Icon-only collapse (toggle in the top bar; state remembered)
   ===================================================================== */
.sb { transition: width .18s ease; }
.main { transition: margin-left .18s ease; }

.sb-collapse-btn { display: none; background: none; border: 0; color: #4b5563;
    font-size: 1.1rem; cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.sb-collapse-btn:hover { background: #eef1f6; }
@media (min-width: 993px) { .sb-collapse-btn { display: inline-flex; align-items: center; } }

.shell.sb-collapsed .sb { width: 72px; }
.shell.sb-collapsed .main { margin-left: 72px; }
.shell.sb-collapsed .sb-brand { justify-content: center; }
.shell.sb-collapsed .sb-brand .bm { display: none; }
.shell.sb-collapsed .sb-nav { padding-left: 8px; padding-right: 8px; }

/* Top-level links (Jobs, etc.) — hide text, keep icon */
.shell.sb-collapsed .sb-nav > .sb-link { justify-content: center; font-size: 0; }
.shell.sb-collapsed .sb-nav > .sb-link i { font-size: 1.05rem; }

/* Group headers — show only the leading icon */
.shell.sb-collapsed .sb-group-label { justify-content: center; }
.shell.sb-collapsed .sb-group-label span,
.shell.sb-collapsed .sb-group-label .bi-chevron-down { display: none; }
.shell.sb-collapsed .sb-group-label .sb-gi { font-size: 1.05rem; margin: 0; }

/* Flyout submenu links keep their text (they open on hover) */
.shell.sb-collapsed .sb-flyout .sb-link { font-size: .855rem; justify-content: flex-start; }

.shell.sb-collapsed .sb-collapse-btn i { transform: rotate(180deg); }

/* leading group icon spacing when expanded */
.sb-group-label .sb-gi { margin-right: 8px; opacity: .85; }
