/* ═══════════════════════════════════════════════════════════════════════
   Sidebar Theme — Minimal Flat (ChatGPT-inspired)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --sidebar-width: 170px;
}

/* ── Layout root ────────────────────────────────────────────────────── */
.wrapper {
    display: flex !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.main {
    flex: 1 !important;
    min-width: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100vh !important;
}

/* ── Sidebar shell ──────────────────────────────────────────────────── */
.sidebar {
    background: #171717 !important;
    border-right: none !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    height: 100vh !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
}

[data-theme="dark"] .sidebar {
    background: #293042 !important;
}
[data-theme="light"] .sidebar {
    background: #ffffff !important;
}

/* ── Sidebar content (simplebar host) ───────────────────────────────── */
.sidebar-content {
    background-color: transparent !important;
    flex: 1 !important;
    min-height: 0 !important;
}

body[data-sidebar-behavior=sticky] .sidebar-content[data-simplebar] {
    flex: 1 !important;
    min-height: 0 !important;
}

.sidebar-content .simplebar-content-wrapper {
    overflow: hidden auto !important;
}

/* ── Brand / Logo ───────────────────────────────────────────────────── */
.sidebar-brand {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px 0 8px;
    height: auto !important;
}

.sidebar-brand .sidebar-logo {
    width: auto !important;
    max-height: 64px !important;
    object-fit: contain !important;
}

/* ── Nav list ───────────────────────────────────────────────────────── */
.sidebar-nav {
    list-style: none;
    padding: 0 !important;
    margin: 0;
}

/* ── Sidebar link (pill style) ──────────────────────────────────────── */
.sidebar-nav .sidebar-item .sidebar-link {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    color: #a1a1a1 !important;
    background: transparent !important;
    font-size: 0.82rem;
    font-weight: 400;
    padding: 7px 12px !important;
    margin: 1px 8px;
    border-radius: 8px;
    border-left: none !important;
    transition: background 150ms ease, color 150ms ease;
    text-decoration: none !important;
}

/* Light theme link color */
[data-theme="light"] .sidebar-nav .sidebar-item .sidebar-link {
    color: #6b7280 !important;
}

/* Hover */
.sidebar-nav .sidebar-item .sidebar-link:hover {
    color: #e5e5e5 !important;
    background: rgba(255,255,255,0.06) !important;
    border-left: none !important;
}
[data-theme="light"] .sidebar-nav .sidebar-item .sidebar-link:hover {
    color: #111827 !important;
    background: rgba(0,0,0,0.04) !important;
}

/* Active */
.sidebar-nav .sidebar-item.active > .sidebar-link {
    color: #ffffff !important;
    background: rgba(255,255,255,0.10) !important;
    font-weight: 600;
    border-left: none !important;
}
[data-theme="light"] .sidebar-nav .sidebar-item.active > .sidebar-link {
    color: #111827 !important;
    background: rgba(0,0,0,0.07) !important;
}

/* Icon inherits link color */
.sidebar-nav .sidebar-item .sidebar-link i {
    color: inherit !important;
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Section labels (small uppercase text with line) ────────────────── */
.sidebar-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.3);
    padding: 10px 16px 4px;
    list-style: none;
}
.sidebar-section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.07);
}
[data-theme="light"] .sidebar-section-label {
    color: rgba(0,0,0,0.3);
}
[data-theme="light"] .sidebar-section-label::after {
    background: rgba(0,0,0,0.07);
}

/* Legacy sidebar-header — style as section label */
.sidebar-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    font-size: 0.6rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.3) !important;
    background: transparent !important;
    padding: 10px 16px 4px !important;
    margin: 0 !important;
    height: auto !important;
    border: none !important;
}
[data-theme="light"] .sidebar-header {
    color: rgba(0,0,0,0.3) !important;
}

/* ── Dropdown (sub-nav) ─────────────────────────────────────────────── */
.sidebar-dropdown {
    background: transparent !important;
}

.sidebar-dropdown .sidebar-dropdown {
    background: transparent !important;
}

/* ── Tree structure (nested dropdowns) ──────────────────────────────── */

/* Toggle link (parent with children) */
.sidebar-tree-toggle {
    font-weight: 600 !important;
    color: #e5e5e5 !important;
    cursor: pointer;
}
[data-theme="light"] .sidebar-tree-toggle {
    color: #111827 !important;
}

/* Info block: label + name stacked */
.sidebar-tree-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Tiny context label above name */
.sidebar-tree-label {
    font-size: 0.52rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 500;
    opacity: 0.45;
    line-height: 1;
    margin-bottom: 1px;
}

/* Name in toggle — truncate with ellipsis */
.sidebar-tree-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Chevron rotation */
.sidebar-tree-chevron {
    font-size: 0.55rem;
    opacity: 0.4;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.sidebar-tree-toggle:not(.collapsed) .sidebar-tree-chevron {
    transform: rotate(90deg);
}

/* Children container — indented with tree line */
.sidebar-tree-children {
    position: relative;
    margin-left: 20px !important;
    padding-left: 0 !important;
}
.sidebar-tree-children::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 8px;
    width: 1px;
    background: rgba(255,255,255,0.10);
}
[data-theme="light"] .sidebar-tree-children::before {
    background: rgba(0,0,0,0.10);
}

/* Child links — compact, smaller pill area */
.sidebar-nav .sidebar-tree-children > .sidebar-item > .sidebar-link {
    margin: 1px 4px 1px 10px !important;
    padding: 5px 8px 5px 8px !important;
    font-size: 0.78rem;
    position: relative;
    border-radius: 6px;
}
.sidebar-nav .sidebar-tree-children > .sidebar-item.active > .sidebar-link {
    border-left: none !important;
}

/* Horizontal tick mark for each child */
.sidebar-tree-children > .sidebar-item > .sidebar-link::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: rgba(255,255,255,0.10);
}
[data-theme="light"] .sidebar-tree-children > .sidebar-item > .sidebar-link::before {
    background: rgba(0,0,0,0.10);
}

/* Nested tree (instrument inside customer) — deeper indent */
.sidebar-tree-nested {
    margin-top: 2px;
}
.sidebar-tree-nested > .sidebar-tree-toggle {
    font-size: 0.8rem;
    padding: 6px 10px !important;
}

/* Nested children get their own tree line */
.sidebar-tree-nested .sidebar-tree-children {
    margin-left: 16px !important;
}

/* Root-level tree item spacing */
.sidebar-tree-root {
    margin-top: 4px;
}
.sidebar-tree-root > .sidebar-tree-toggle {
    margin: 1px 8px;
}

/* ── Theme toggle (bottom) ──────────────────────────────────────────── */
.sidebar-theme-toggle {
    flex-shrink: 0;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
    background: transparent;
    position: relative;
    z-index: 1;
}
[data-theme="light"] .sidebar-theme-toggle {
    border-top-color: rgba(0,0,0,0.07);
}

.sidebar-theme-toggle .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px;
    color: #737373 !important;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 150ms ease, color 150ms ease;
    text-decoration: none !important;
}

.sidebar-theme-toggle .nav-link:hover {
    color: #e5e5e5 !important;
    background: rgba(255,255,255,0.06);
}
[data-theme="light"] .sidebar-theme-toggle .nav-link:hover {
    color: #111827 !important;
    background: rgba(0,0,0,0.04);
}

.sidebar-theme-toggle .nav-link i {
    font-size: 0.85rem;
}

/* ── Scrollbar (ultra-thin) ─────────────────────────────────────────── */
.sidebar .simplebar-scrollbar::before {
    background: rgba(255,255,255,0.2) !important;
    opacity: 0 !important;
    width: 3px !important;
    border-radius: 3px !important;
    transition: opacity 200ms ease;
}

.sidebar .simplebar-scrollbar.simplebar-visible::before {
    opacity: 0.4 !important;
}

.sidebar .simplebar-track.simplebar-vertical {
    width: 5px !important;
    right: 1px !important;
}

.sidebar .simplebar-track.simplebar-horizontal {
    display: none !important;
}

/* ── Main scrollbar ─────────────────────────────────────────────────── */
.main::-webkit-scrollbar { width: 5px !important; }
.main::-webkit-scrollbar-track { background: transparent !important; }
.main::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2) !important; border-radius: 3px !important; }
.main::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.4) !important; }

/* ── Navbar ─────────────────────────────────────────────────────────── */
.navbar {
    padding: 0.35rem 0.75rem !important;
}

.navbar .nav-link,
.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: var(--bs-navbar-color) !important;
}

.navbar .nav-link span {
    color: inherit !important;
}

/* ── Card title (global) ────────────────────────────────────────────── */
.card-title {
    color: var(--bs-heading-color) !important;
}
