/* ─── CSS Variables (from Tailwind Config) ───────────────── */
:root {
    --alertara-900: #1c3636;
    --alertara-700: #274d4c;
    --alertara-600: #2f5f5e;
    --alertara-400: #5fbfb8;
    --alertara-300: #95d5d0;
    --alertara-200: #c3e7e4;
    --alertara-100: #e1f3f1;
}

/* ─── Scrollbar ──────────────────────────────────────────── */
.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ─── Dropdown slide animation ───────────────────────────── */
.dropdown-menu {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.22s ease;
}
.dropdown-menu.is-open {
    max-height: 900px;
    opacity: 1;
}

/* ─── Chevron rotation ───────────────────────────────────── */
.chevron-icon {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.is-open-trigger .chevron-icon {
    transform: rotate(90deg);
}

/* ─── L1 hierarchy line (e.g. Crime Data children) ──────── */
.submenu-tree {
    margin-left: 1.125rem;
    padding-left: 0.875rem;
    border-left: 1.5px solid #e2e8f0;
    padding-bottom: 0.125rem;
}

/* ─── L2 hierarchy line (e.g. Trend Analytics children) ─── */
.submenu-tree-l2 {
    margin-left: 0.875rem;
    padding-left: 0.75rem;
    border-left: 1.5px solid #edf2f7;
    padding-bottom: 0.125rem;
}

/* ─── Tree connector horizontal branches ─────────────────── */
/*
    Each .tree-node gets a short horizontal line (├──) that
    connects the vertical border-left to the item itself.
*/
.tree-node {
    position: relative;
}

/* L1 branch: items that are direct children of .submenu-tree,
   or one level deeper (inside a wrapper <div>) */
.submenu-tree > .tree-node::before,
.submenu-tree > div > .tree-node::before {
    content: '';
    position: absolute;
    left: -0.875rem;      /* reaches the border-left of .submenu-tree */
    top: 50%;
    width: 0.6rem;
    height: 1px;
    background: #d1d5db; /* gray-300 */
    transform: translateY(-50%);
    pointer-events: none;
}

/* L2 branch: items inside .submenu-tree-l2 */
.submenu-tree-l2 > .tree-node::before,
.submenu-tree-l2 > div > .tree-node::before {
    content: '';
    position: absolute;
    left: -0.75rem;       /* reaches the border-left of .submenu-tree-l2 */
    top: 50%;
    width: 0.5rem;
    height: 1px;
    background: #e2e8f0; /* gray-200 — lighter for depth */
    transform: translateY(-50%);
    pointer-events: none;
}

/* ─── Top-level section label ────────────────────────────── */
.section-label {
    display: block;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #718096;
    padding: 0.45rem 0.75rem 0.2rem;
    line-height: 1.2;
    border-bottom: none;
}

/* ─── Subsection label (inside collapsible) ──────────────── */
.subsection-label {
    display: block;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #718096;
    padding: 0.4rem 0.75rem 0.15rem;
    margin-top: 0.3rem;
    line-height: 1.2;
}

/* ─── Active item styling ────────────────────────────────── */

/* Main dropdown button - Dark active color (alertara-700) */
button.active-nav-item:not(.tree-node) {
    background-color: var(--alertara-700) !important;
    color: var(--alertara-100) !important;
    font-weight: 600;
}
button.active-nav-item:not(.tree-node) span {
    color: var(--alertara-100) !important;
}
button.active-nav-item:not(.tree-node) i {
    color: var(--alertara-100) !important;
}

/* Sub-dropdown button - Light active color (alertara-200) */
button.active-nav-item.tree-node {
    background-color: var(--alertara-200) !important;
    color: var(--alertara-900) !important;
    font-weight: 600;
    padding: 0.5rem 0.75rem !important;
    margin: 0.25rem 0 !important;
}
button.active-nav-item.tree-node span {
    color: var(--alertara-900) !important;
}
button.active-nav-item.tree-node i {
    color: var(--alertara-900) !important;
}

/* Content link - Very light active color (alertara-300) */
a.active-nav-item {
    background-color: var(--alertara-100) !important;
    color: var(--alertara-900) !important;
    font-weight: 600;
    padding: 0.375rem 0.75rem !important;
    margin: 0.15rem 0 !important;
}
a.active-nav-item i {
    color: var(--alertara-900) !important;
}

/* ─── Section spacing via adjacent sibling ───────────────── */
.nav-section + .nav-section {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* ─── Account section border ───────────────────────────────── */
.nav-section:last-of-type {
    border-top: 1px solid #e2e8f0;
    padding-top: 0.5rem;
}

/* ─── Search Modal Overlay ────────────────────────────────── */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 70;
    justify-content: center;
    align-items: center;
}
.search-overlay.is-active {
    display: flex;
}

.search-modal {
    background: #fff;
    border-radius: 10px;
    width: auto;
    min-width: 520px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    gap: 10px;
}
.search-modal-input-wrap i {
    color: #a0aec0;
    font-size: 14px;
    flex-shrink: 0;
}
.search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #1a202c;
    background: transparent;
}
.search-modal-input::placeholder {
    color: #a0aec0;
}
.search-modal-esc {
    font-size: 11px;
    color: #a0aec0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    flex-shrink: 0;
    cursor: pointer;
}

.search-modal-results {
    overflow-y: auto;
    padding: 8px 0;
    flex: 1;
    min-height: 0;
}

.search-modal-label {
    font-size: 11px;
    font-weight: 500;
    color: #718096;
    padding: 8px 16px 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    border-radius: 6px;
    margin: 4px 8px;
}
.search-result-item:hover,
.search-result-item.is-selected {
    background: #f0f4f8;
}
.search-result-item .result-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f7fafc;
    flex-shrink: 0;
    color: #718096;
    font-size: 14px;
}
.search-result-item .result-text {
    flex: 1;
    min-width: 0;
}
.search-result-item .result-breadcrumb {
    font-size: 13px;
    color: #4a5568;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}
.search-result-item .result-breadcrumb .breadcrumb-sep {
    color: #a0aec0;
    margin: 0 4px;
    font-size: 11px;
}
.search-result-item .result-arrow {
    color: #cbd5e0;
    font-size: 12px;
    flex-shrink: 0;
}

/* Yellow highlight for matching text */
.search-highlight {
    background: #fefcbf;
    color: #744210;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}

.search-no-results {
    padding: 24px 16px;
    text-align: center;
    color: #a0aec0;
    font-size: 14px;
}

/* Keyboard nav hints at bottom */
.search-modal-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #a0aec0;
}
.search-modal-footer kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-size: 10px;
    font-family: inherit;
    color: #718096;
    background: #f7fafc;
    margin-right: 3px;
}
