/* ==========================================================================
   Sidebar.css - Collapsible midnight sidebar (same palette as the command bar)
   ========================================================================== */

.sb-wrap {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width, 272px);
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    z-index: var(--z-sidebar, 5000);
    background: #0B0F19;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.18);
    user-select: none;
    transition: width 0.2s ease;
    overflow: hidden;
}

.sb-wrap.is-collapsed {
    width: var(--sidebar-collapsed, 76px);
}

.sb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    min-height: 72px;
}

.sb-app-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    flex-shrink: 0;
}

.sb-app-icon svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
}

.sb-brand-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.sb-brand-title {
    font-size: 14px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.02em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-brand-sub {
    font-size: 10px;
    font-weight: 700;
    color: #818CF8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sb-collapse {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: #CBD5E1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.sb-collapse:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.sb-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #111827;
    padding: 12px 10px 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.sb-main::-webkit-scrollbar {
    width: 6px;
}

.sb-main::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 99px;
}

.sb-main > .sb-section-label:first-child {
    margin-top: 2px;
}

.sb-section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 12px 0 4px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #818CF8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: inherit;
    cursor: pointer;
    text-align: start;
}

.sb-section-label:hover,
.sb-section-label.active {
    background: rgba(99, 102, 241, 0.14);
    color: #C7D2FE;
}

.sb-section-label span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-caret {
    margin-inline-start: auto;
    flex-shrink: 0;
    opacity: 0.75;
    transform: rotate(-90deg);
    transition: transform 0.18s ease;
}

.sb-section-label.is-open .sb-caret {
    transform: rotate(0deg);
}

.sb-wrap--rtl .sb-caret {
    transform: rotate(90deg);
}

.sb-wrap--rtl .sb-section-label.is-open .sb-caret {
    transform: rotate(0deg);
}

.sb-nav {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 4px 8px;
    margin-inline-start: 22px;
    padding-inline-start: 16px;
    animation: sb-drop 0.16s ease;
}

@keyframes sb-drop {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.sb-nav-item,
.sb-actions .sb-strip-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: #94A3B8;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    text-align: start;
    position: relative;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease;
}

.sb-nav-item svg,
.sb-section-label svg,
.sb-actions .sb-strip-btn svg {
    flex-shrink: 0;
}

.sb-nav-item:hover,
.sb-actions .sb-strip-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #F8FAFC;
}

.sb-nav-item.active,
.sb-actions .sb-strip-btn.active {
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
}

.sb-nav-item.active svg,
.sb-actions .sb-strip-btn.active svg {
    stroke: #FFFFFF;
}

/* Tree rail: sub items sit under their section, indented, joined by a line */
.sb-nav-item::before {
    content: "";
    position: absolute;
    inset-inline-start: -16px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(129, 140, 248, 0.55);
    pointer-events: none;
}

.sb-nav-item:first-child::before {
    top: -8px;
}

.sb-nav-item:last-child::before {
    bottom: 50%;
}

.sb-nav-item:first-child:last-child::before {
    top: -8px;
    bottom: 50%;
}

.sb-nav-item::after {
    content: "";
    position: absolute;
    inset-inline-start: -20px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #111827;
    border: 1.5px solid #818CF8;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.sb-nav-item:hover::after {
    background: #4F46E5;
    border-color: #C7D2FE;
}

.sb-nav-item.active::after {
    background: #FFFFFF;
    border-color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.45);
}

.sb-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
    padding: 4px 0 8px;
}

.sb-store-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.sb-store-icon,
.sb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
}

.sb-store-icon {
    background: rgba(99, 102, 241, 0.25);
    border: 1px solid rgba(129, 140, 248, 0.4);
    color: #C7D2FE;
}

.sb-store-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #E2E8F0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-avatar {
    background: linear-gradient(135deg, #312E81 0%, #4338CA 100%);
    border: 1px solid rgba(129, 140, 248, 0.35);
    color: #E0E7FF;
    align-self: center;
}

.sb-strip-btn.has-unread {
    color: #C7D2FE;
}

.sb-notif-badge {
    margin-inline-start: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #EF4444;
    color: #fff;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    font-weight: 800;
}

.sb-notif-hint {
    display: none;
}

.sb-wrap.is-collapsed .sb-brand {
    flex-direction: column;
    padding: 14px 8px;
    gap: 10px;
}

.sb-wrap.is-collapsed .sb-brand-meta,
.sb-wrap.is-collapsed .sb-section-label span,
.sb-wrap.is-collapsed .sb-caret,
.sb-wrap.is-collapsed .sb-nav-item span,
.sb-wrap.is-collapsed .sb-actions .sb-strip-btn span,
.sb-wrap.is-collapsed .sb-store-name,
.sb-wrap.is-collapsed .sb-notif-badge {
    display: none;
}

.sb-wrap.is-collapsed .sb-section-label,
.sb-wrap.is-collapsed .sb-nav-item,
.sb-wrap.is-collapsed .sb-actions .sb-strip-btn,
.sb-wrap.is-collapsed .sb-store-header {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
}

.sb-wrap.is-collapsed .sb-main,
.sb-wrap.is-collapsed .sb-actions {
    padding-left: 8px;
    padding-right: 8px;
}

.sb-wrap.is-collapsed .sb-nav {
    margin-inline-start: 0;
    padding-inline-start: 0;
}

.sb-wrap.is-collapsed .sb-nav-item::before,
.sb-wrap.is-collapsed .sb-nav-item::after {
    display: none;
}

.sb-wrap.is-collapsed .sb-strip-btn.has-unread::after {
    content: "";
    position: absolute;
    top: 8px;
    inset-inline-end: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EF4444;
    box-shadow: 0 0 0 2px #0B0F19;
}

.sb-wrap.is-collapsed .sb-nav-item:hover span,
.sb-wrap.is-collapsed .sb-section-label:hover span,
.sb-wrap.is-collapsed .sb-actions .sb-strip-btn:hover span {
    display: block;
    position: absolute;
    inset-inline-start: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #111827;
    color: #F8FAFC;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    z-index: 6200;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
    pointer-events: none;
}

/* Platform sidebar */
.platform-sidebar {
    width: 260px;
    background: #0B0F19;
    color: #e5e7eb;
    min-height: 100vh;
    padding: 20px 14px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1E293B;
}

.platform-sidebar-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 18px;
    color: #FFFFFF;
}

.platform-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.platform-nav-link {
    color: #94A3B8;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
    display: block;
    transition: all 0.15s;
}

.platform-nav-link.active {
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    color: #fff;
}

.platform-nav-link:hover {
    background: #1E293B;
    color: #fff;
}

.platform-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #1E293B;
    padding-top: 16px;
}

.platform-logout-btn {
    width: 100%;
    border: 1px solid #334155;
    background: #111827;
    color: #e5e7eb;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.platform-logout-btn:hover {
    background: #1E293B;
}
