/* ============================================================
   CST LAYOUT — Sidebar + Topbar
   Global stylesheet — no ::deep, no scoping issues
   ============================================================ */

/* ── Sidebar shell ────────────────────────────────────────── */
.sb {
    width: 260px;
    background-color: #0D2241;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}

/* ── Brand ─────────────────────────────────────────────────── */
/* Logo image */
.sb-logo-img {
    width: 160px;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.sb-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.sb-logo-box {
    width: 40px;
    height: 40px;
    background: #C8102E;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -.5px;
    flex-shrink: 0;
    font-family: 'Segoe UI', sans-serif;
}
.sb-brand-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
}
.sb-brand-sub {
    font-size: 11px;
    color: rgba(255,255,255,.4);
    margin-top: 2px;
    margin-bottom: 0;
}

/* ── User card ─────────────────────────────────────────────── */
.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 12px 10px 4px;
    background: rgba(255,255,255,.05);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.sb-av {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(200,16,46,.5);
    flex-shrink: 0;
}
.sb-av-init {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #C8102E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(200,16,46,.4);
    font-family: 'Segoe UI', sans-serif;
}
.sb-u-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin: 0;
}
.sb-u-role {
    font-size: 10.5px;
    color: rgba(255,255,255,.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.sb-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

/* ── Nav scroll area ───────────────────────────────────────── */
.sb-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

/* ── Section label ─────────────────────────────────────────── */
.sb-group-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: rgba(255,255,255,.28);
    padding: 14px 18px 5px;
    user-select: none;
    font-family: 'Segoe UI', sans-serif;
}

/* ── Nav link — base ───────────────────────────────────────── */
.sb-link {
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    margin: 1px 8px !important;
    padding: 9px 12px !important;
    border-radius: 8px !important;
    color: rgba(255,255,255,.62) !important;
    text-decoration: none !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    transition: background .15s, color .15s !important;
    cursor: pointer !important;
    line-height: 1.3 !important;
    border: none !important;
    background: transparent !important;
    position: relative !important;
    font-family: 'Segoe UI', sans-serif !important;
}
.sb-link i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: rgba(255,255,255,.45);
    transition: color .15s;
}
.sb-link:hover {
    background: rgba(255,255,255,.07) !important;
    color: #ffffff !important;
    text-decoration: none !important;
}
.sb-link:hover i {
    color: rgba(255,255,255,.8) !important;
}

/* Active state — Blazor NavLink adds .active class */
.sb-link.active {
    background: rgba(200,16,46,.16) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}
.sb-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #C8102E;
}
.sb-link.active i {
    color: #C8102E !important;
}

/* ── Footer / logout ───────────────────────────────────────── */
.sb-footer {
    padding: 10px 10px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}
.sb-logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(200,16,46,.3);
    color: rgba(255,150,150,.8);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all .18s;
    font-family: 'Segoe UI', sans-serif;
}
.sb-logout-btn:hover {
    background: rgba(200,16,46,.15);
    color: #fca5a5;
    border-color: rgba(200,16,46,.55);
}
.sb-logout-btn i { font-size: 15px; }

/* ── Mobile overlay ────────────────────────────────────────── */
.sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ── Toggle behaviour ──────────────────────────────────────── */
@media (min-width: 768px) {
    body:not(.sidebar-collapsed) .main-content { margin-left: 260px !important; }
    body.sidebar-collapsed .main-content      { margin-left: 0 !important; }
    body.sidebar-collapsed .sb                 { transform: translateX(-260px); }
}
@media (max-width: 767px) {
    .main-content                  { margin-left: 0 !important; }
    .sb                            { transform: translateX(-260px); }
    body.sidebar-open .sb          { transform: translateX(0) !important; box-shadow: 8px 0 32px rgba(0,0,0,.5); }
    body.sidebar-open .sb-overlay  { display: block !important; }
}
.main-content { transition: margin-left .3s cubic-bezier(0.4,0,0.2,1) !important; }

/* ============================================================
   TOPBAR
   ============================================================ */
.tb {
    position: sticky;
    top: 0;
    z-index: 900;
    height: 58px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 20px 0 16px;
    gap: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.tb::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #C8102E 0%, #0D2241 100%);
}

/* Hamburger */
.tb-burger {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
    padding: 0;
}
.tb-burger:hover { background: #f1f5f9; }
.tb-burger-lines { display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.tb-burger-lines span {
    display: block;
    width: 20px;
    height: 2px;
    background: #475569;
    border-radius: 2px;
    transition: transform .25s cubic-bezier(0.4,0,0.2,1), opacity .2s ease;
    transform-origin: center;
}
body.sidebar-collapsed .tb-burger-lines span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.sidebar-collapsed .tb-burger-lines span:nth-child(2) { opacity: 0; transform: scaleX(0); }
body.sidebar-collapsed .tb-burger-lines span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
body.sidebar-open      .tb-burger-lines span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.sidebar-open      .tb-burger-lines span:nth-child(2) { opacity: 0; transform: scaleX(0); }
body.sidebar-open      .tb-burger-lines span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.tb-divider { width: 1px; height: 22px; background: #e2e8f0; flex-shrink: 0; }

.tb-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Segoe UI', sans-serif;
}
.tb-title .tb-sep { color: #94a3b8; font-weight: 400; margin: 0 6px; }

/* Actions */
.tb-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.tb-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background .15s;
    color: #64748b;
    font-size: 17px;
}
.tb-icon-btn:hover { background: #f1f5f9; color: #1e293b; }
.tb-notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #C8102E;
    border: 2px solid #fff;
}

/* Theme dots */
.tb-theme-wrap { display: flex; align-items: center; gap: 5px; padding: 0 4px; }
.tb-dot {
    width: 15px; height: 15px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: transform .15s, border-color .15s;
    flex-shrink: 0;
}
.tb-dot:hover { transform: scale(1.2); }
.tb-dot.tb-active { border-color: rgba(0,0,0,.3); }
.tb-dot-red  { background: #C8102E; }
.tb-dot-blue { background: #0D2241; }

/* User chip */
.tb-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 9px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-left: 2px;
    max-width: 200px;
}
.tb-user-av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C8102E, #0D2241);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    font-family: 'Segoe UI', sans-serif;
    overflow: hidden;
}
.tb-user-av img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.tb-user-nm {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Segoe UI', sans-serif;
}

@media (max-width: 500px) {
    .tb-title { display: none; }
    .tb-user-nm { display: none; }
    .tb-theme-wrap { display: none; }
}

/* Suppress old hamburger */
.hamburger-btn  { display: none !important; }
.sidebar-toggle { display: none !important; }

/* ── Theme accent line only — topbar stays white ── */
body.theme-red  .tb::before { background: #C8102E; }
body.theme-blue .tb::before { background: #0D2241; }

/* ── Gender avatars ── */
.sb-av-gender {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.2);
}
.sb-av-gender svg {
    width: 100%;
    height: 100%;
    display: block;
}
.sb-av-male   { border-color: rgba(13,34,65,.5);   }
.sb-av-female { border-color: rgba(200,16,46,.45); }

/* ── Gender avatars — NavMenu + Sidebar ── */
.gender-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.6rem;
}
.gender-avatar i { font-size: 3rem; color: #fff; line-height: 1; }
.male-avatar   { background: #0D2241; border: 3px solid rgba(255,255,255,.25); }
.female-avatar { background: #C8102E; border: 3px solid rgba(255,255,255,.25); }

/* Sidebar compact gender avatar */
.sb-av-gender {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sb-av-gender i   { font-size: 1.1rem; color: #fff; }
.sb-av-male       { background: #0D2241; border: 2px solid rgba(255,255,255,.25); }
.sb-av-female     { background: #C8102E; border: 2px solid rgba(255,255,255,.25); }
