/* ==========================================================================
   TOP1SUB - ARCHITECTURAL OBSIDIAN SIDEBAR NAVIGATION SYSTEM
   Cohesive icon squircle grid, IDE-style submenu tree rail, luminous active
   indicator, instant keyboard command filter, and responsive mini-rail.
   ========================================================================== */

:root {
    --sb-bg-top: #0b101b;
    --sb-bg-bottom: #0d1424;
    --sb-border: rgba(148, 163, 184, 0.12);
    --sb-surface-hover: rgba(255, 255, 255, 0.055);
    --sb-surface-open: rgba(255, 255, 255, 0.075);
    --sb-text-muted: #94a3b8;
    --sb-text-default: #cbd5e1;
    --sb-text-bright: #f8fafc;
    --sb-accent: var(--primary-color, #2563eb);
    --sb-cyan: #38bdf8;
}

/* --------------------------------------------------------------------------
   1. BRAND HEADER STAGE (.nav-header) & SIDEBAR SHELL (.icnav)
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
    .nav-header {
        background: var(--sb-bg-top) !important;
        border-right: 1px solid var(--sb-border) !important;
        border-bottom: 1px solid var(--sb-border) !important;
        box-shadow: inset 0 -1px 0 rgba(56, 189, 248, 0.08) !important;
    }

    .nav-header-left .hamburger-btn,
    .sidebar-toggle-btn {
        background: rgba(15, 23, 42, 0.9) !important;
        border: 1px solid rgba(148, 163, 184, 0.22) !important;
        border-radius: 9px !important;
        color: #cbd5e1 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    }

    .nav-header-left .hamburger-btn:hover,
    .sidebar-toggle-btn:hover {
        background: rgba(37, 99, 235, 0.24) !important;
        border-color: rgba(59, 130, 246, 0.55) !important;
        color: #ffffff !important;
        box-shadow: 0 0 14px rgba(37, 99, 235, 0.35) !important;
    }
}

.icnav {
    background: linear-gradient(180deg, var(--sb-bg-top) 0%, var(--sb-bg-bottom) 100%) !important;
    border-right: 1px solid var(--sb-border) !important;
    display: flex;
    flex-direction: column;
}

.icnav::-webkit-scrollbar {
    width: 4px;
}

.icnav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
}

.icnav::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.38);
}

.icnav .sidebar-menu {
    padding: 10px 10px 16px !important;
    flex: 1 0 auto;
}

/* --------------------------------------------------------------------------
   2. QUICK COMMAND FILTER BAR (#sidebar-search-item)
   -------------------------------------------------------------------------- */
.sidebar-search-item {
    list-style: none;
    margin: 4px 2px 10px;
}

.sidebar-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    padding: 0 10px;
    height: 36px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.sidebar-search-box:focus-within {
    background: rgba(15, 23, 42, 1);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.sidebar-search-icon {
    color: #64748b;
    font-size: 12px;
    margin-right: 8px;
    flex-shrink: 0;
    transition: color 0.18s ease;
}

.sidebar-search-box:focus-within .sidebar-search-icon {
    color: var(--sb-cyan);
}

.sidebar-search-input {
    width: 100%;
    min-width: 0;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--sb-text-bright) !important;
    font-size: 12.5px !important;
    font-weight: 500;
    padding: 0 !important;
    box-shadow: none !important;
}

.sidebar-search-input::placeholder {
    color: #64748b;
    font-weight: 400;
}

.sidebar-search-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 5px;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    font-size: 10.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    flex-shrink: 0;
    user-select: none;
}

.sidebar-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.18);
    border: none;
    color: #cbd5e1;
    font-size: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-search-clear:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.sidebar-search-box.has-query .sidebar-search-kbd {
    display: none;
}

.sidebar-search-box.has-query .sidebar-search-clear {
    display: inline-flex;
}

.sidebar-filter-empty {
    list-style: none;
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 20px 12px;
    margin: 6px 4px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    font-size: 12px;
}

.sidebar-filter-empty.visible {
    display: flex;
}

/* --------------------------------------------------------------------------
   3. ARCHITECTURAL SECTION DIVIDERS (.menu-heading)
   -------------------------------------------------------------------------- */
.icnav .menu-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 8px 7px !important;
    font-size: 10.5px !important;
    font-weight: 800 !important;
    color: #64748b !important;
    letter-spacing: 0.11em !important;
    text-transform: uppercase;
    user-select: none;
}

.icnav .menu-heading:first-of-type {
    padding-top: 4px !important;
}

.icnav .menu-heading::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.22) 0%, transparent 100%);
}

/* --------------------------------------------------------------------------
   4. MENU ITEMS, SQUIRCLE ICON WELLS & LUMINOUS ACTIVE PILL
   -------------------------------------------------------------------------- */
.icnav .sidebar-item {
    margin-bottom: 3px !important;
}

.icnav .sidebar-link {
    position: relative;
    padding: 7.5px 10px !important;
    border-radius: 11px !important;
    color: var(--sb-text-default) !important;
    font-size: 13.3px !important;
    font-weight: 500 !important;
    border: 1px solid transparent;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}

.icnav .sidebar-link .left-content {
    gap: 11px !important;
    min-width: 0;
}

.icnav .sidebar-link .left-content > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Unified 28x28 Borderless Icon Stage for ALL System & Platform Items */
.icnav .sidebar-link .menu-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #94a3b8 !important;
    font-size: 16.5px !important;
    transition: transform 0.2s ease, color 0.2s ease !important;
}

.icnav .sidebar-link .menu-icon i.ti {
    font-size: 17.5px !important;
}

.icnav .sidebar-link .menu-icon .dtt-plat-icon svg > circle[stroke*="rgba"] {
    stroke: none !important;
}

/* Semantic subtle icon accents on system rows */
#nav-item-home .menu-icon { color: #60a5fa !important; }
#menu-account .menu-icon { color: #818cf8 !important; }
#nav-item-recharge .menu-icon { color: #34d399 !important; }
#nav-item-subsite .menu-icon { color: #c084fc !important; }
#nav-item-apiv2 .menu-icon { color: #fbbf24 !important; }
#nav-item-rule .menu-icon { color: #94a3b8 !important; }
#nav-item-massorder .menu-icon { color: #38bdf8 !important; }

/* Hover Effect */
.icnav .sidebar-link:hover {
    background-color: var(--sb-surface-hover) !important;
    border-color: rgba(148, 163, 184, 0.12);
    color: var(--sb-text-bright) !important;
    transform: translateX(2px);
}

.icnav .sidebar-link:hover .menu-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(1.06);
}

/* Active View Pill Indicator */
.icnav .sidebar-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.24) 0%, rgba(14, 165, 233, 0.08) 100%) !important;
    border-color: rgba(59, 130, 246, 0.36) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 8px 20px -14px rgba(37, 99, 235, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.icnav .sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #38bdf8 0%, #3b82f6 100%);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
}

.icnav .sidebar-link.active .menu-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
}

/* Open Accordion Parent Highlight */
.icnav .sidebar-item.open > .sidebar-link {
    background-color: var(--sb-surface-open) !important;
    border-color: rgba(148, 163, 184, 0.16);
    color: #ffffff !important;
}

.icnav .sidebar-link .arrow-icon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 12px !important;
    color: #64748b !important;
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, color 0.2s ease !important;
}

.icnav .sidebar-item.open > .sidebar-link .arrow-icon {
    transform: rotate(90deg);
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd !important;
}

/* --------------------------------------------------------------------------
   5. IDE-STYLE SUBMENU TREE RAIL (.submenu & .submenu-link)
   -------------------------------------------------------------------------- */
.icnav .submenu {
    margin: 3px 0 6px !important;
    padding: 3px 0 3px 0 !important;
}

.icnav .submenu::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 4px;
    bottom: 6px;
    width: 1px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.45) 0%, rgba(148, 163, 184, 0.14) 100%);
}

.icnav .sidebar-item.open > .submenu {
    animation: dttSubmenuReveal 0.2s ease-out;
}

@keyframes dttSubmenuReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.icnav .submenu-link {
    padding: 7.5px 10px 7.5px 38px !important;
    margin: 1px 2px;
    border-radius: 8px !important;
    font-size: 12.8px !important;
    color: #94a3b8 !important;
    transition: all 0.16s ease !important;
}

.icnav .submenu-link::before {
    left: 20.5px !important;
    width: 6px !important;
    height: 6px !important;
    background: #334155 !important;
    border: 1.5px solid #0b101b;
}

.icnav .submenu-link:hover {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.055) !important;
}

.icnav .submenu-link:hover::before {
    background: var(--sb-cyan) !important;
}

.icnav .submenu-link.active {
    color: #ffffff !important;
    font-weight: 600 !important;
    background: rgba(56, 189, 248, 0.13) !important;
}

.icnav .submenu-link.active::before {
    background: var(--sb-cyan) !important;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.9) !important;
}

/* --------------------------------------------------------------------------
   6. STICKY BOTTOM STATUS RAIL FOOTER (.sidebar-rail-footer)
   -------------------------------------------------------------------------- */
.sidebar-rail-footer {
    margin: 8px 10px 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.72) 0%, rgba(15, 23, 42, 0.92) 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-rail-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sidebar-rail-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    flex-shrink: 0;
}

.sidebar-rail-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-rail-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.25;
}

.sidebar-rail-sub {
    font-size: 10.5px;
    color: #64748b;
    line-height: 1.2;
}

.sidebar-rail-topup-btn {
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.22);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd !important;
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-rail-topup-btn:hover {
    background: #2563eb;
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   7. MINI-SIDEBAR COLLAPSED & MOBILE ADJUSTMENTS
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
    body:not(.sidebar-collapsed) .icnav {
        padding-bottom: 14px !important;
    }

    body.sidebar-collapsed .icnav .sidebar-search-item,
    body.sidebar-collapsed .icnav .sidebar-rail-footer,
    body.sidebar-collapsed .icnav .sidebar-filter-empty {
        display: none !important;
    }

    body.sidebar-collapsed .icnav .sidebar-link {
        width: 44px !important;
        height: 44px !important;
        border-radius: 12px !important;
    }

    body.sidebar-collapsed .icnav .sidebar-link.active::before {
        display: none;
    }

    body.sidebar-collapsed .icnav .sidebar-link .menu-icon {
        width: 30px !important;
        height: 30px !important;
        background: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }
}

@media (max-width: 991px) {
    .sidebar-user-card-mob {
        flex-shrink: 0;
    }

    .sidebar-search-box {
        height: 42px;
    }

    #sidebarMenu .sidebar-search-input {
        font-size: 16px !important;
        line-height: 1.4 !important;
    }

    .sidebar-rail-footer {
        display: none !important;
    }
}
