/* ==========================================================================
   REVTRACK SIDEBAR — Pylon-Inspired Clean Layout
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. SIDEBAR CONTAINER
   -------------------------------------------------------------------------- */
.rt-sidebar {
    display: flex;
    flex-direction: column;
    width: 260px;
    min-width: 260px;
    height: 100dvh;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
    transition: transform 0.2s ease-in-out;
    z-index: 40;
}

/* Dark mode */
.dark .rt-sidebar {
    background-color: #1f2937;
    border-right-color: #374151;
}

/* Mobile: absolute overlay, hidden by default */
@media (max-width: 1023px) {
    .rt-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
        transform: translateX(-100%);
    }

    .rt-sidebar.is-open {
        transform: translateX(0);
    }
}

/* Desktop: static in flow */
@media (min-width: 1024px) {
    .rt-sidebar {
        position: static;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   2. SIDEBAR BACKDROP (Mobile overlay)
   -------------------------------------------------------------------------- */
.rt-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.3);
    z-index: 39;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.rt-sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1024px) {
    .rt-sidebar-backdrop {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   3. SIDEBAR HEADER (Company Switcher Area)
   -------------------------------------------------------------------------- */
.rt-sidebar-header {
    display: flex;
    align-items: center;
    padding: 8px 16px 12px;
    border-bottom: 2px solid #f3f3f3;
    flex-shrink: 0;
    background: #f7f7f7;
}

.dark .rt-sidebar-header {
    border-bottom-color: #374151;
}

.rt-company-switcher {
    width: 100%;
}

.rt-company-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    background: transparent;
    color: inherit;
}

.rt-company-btn:hover {
    background-color: #f9fafb;
}

.dark .rt-company-btn:hover {
    background-color: #374151;
}

.rt-company-btn .rt-company-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
}

.rt-company-btn .rt-company-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #111827;
    margin-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: left;
}

.dark .rt-company-btn .rt-company-name {
    color: #f3f4f6;
}

.rt-company-btn .rt-company-chevron {
    width: 14px;
    height: 14px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: 6px;
}

/* Company dropdown */
.rt-company-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    z-index: 50;
    padding: 4px;
}

.dark .rt-company-dropdown {
    background-color: #1f2937;
    border-color: #374151;
}

.rt-company-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.1s ease;
    text-decoration: none;
}

.rt-company-dropdown-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.dark .rt-company-dropdown-item {
    color: #d1d5db;
}

.dark .rt-company-dropdown-item:hover {
    background-color: #374151;
    color: #f9fafb;
}

.rt-company-dropdown-item .rt-company-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 50%;
    background-color: #eff6ff;
    color: #2563eb;
    flex-shrink: 0;
    margin-right: 10px;
}

.dark .rt-company-dropdown-item .rt-company-initial {
    background-color: #1e3a5f;
    color: #93c5fd;
}

.rt-company-dropdown-item .rt-company-check {
    width: 14px;
    height: 14px;
    color: #2563eb;
    flex-shrink: 0;
}

.rt-company-dropdown-footer {
    border-top: 1px solid #f3f4f6;
    margin-top: 4px;
    padding-top: 4px;
}

.dark .rt-company-dropdown-footer {
    border-top-color: #374151;
}

/* --------------------------------------------------------------------------
   4. NAVIGATION — Menu Scrollable Area
   -------------------------------------------------------------------------- */
.rt-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
    background: #f7f7f7;
}

.rt-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.rt-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.rt-sidebar-nav::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
}

.dark .rt-sidebar-nav {
    scrollbar-color: #374151 transparent;
}

.dark .rt-sidebar-nav::-webkit-scrollbar-thumb {
    background: #374151;
}

/* --------------------------------------------------------------------------
   5. MENU LIST
   -------------------------------------------------------------------------- */
.rt-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f7f7f7;
}

/* --------------------------------------------------------------------------
   6. SECTION DIVIDERS
   -------------------------------------------------------------------------- */
.rt-menu-section {
    padding: 10px 10px 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    user-select: none;
}

.rt-menu-section:first-child {
    padding-top: 8px;
}

.dark .rt-menu-section {
    color: #6b7280;
}

/* --------------------------------------------------------------------------
   7. MENU ITEMS — Regular Links
   -------------------------------------------------------------------------- */
.rt-menu-item {
    position: relative;
    margin-bottom: 10px;
}

.rt-menu li:first-of-type {
  margin-bottom: 0px !important;
}

.rt-menu-link {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.12s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    line-height: 1.4;
}

.rt-menu-link:hover {
    /* background-color: #f3f4f6; */
    color: #1d4ed8;
    font-weight: 400 !important;
}

.dark .rt-menu-link {
    color: #d1d5db;
}

.dark .rt-menu-link:hover {
    background-color: #374151;
    color: #f9fafb;
}

/* Active state — left accent bar + highlight */
.rt-menu-item.is-active .rt-menu-link {
    /* background-color: #eff6ff; */
    color: #1d4ed8;
    font-weight: 600 !important;
}

/* .rt-menu-item.is-active .rt-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background-color: #2563eb;
} */

.dark .rt-menu-item.is-active .rt-menu-link {
    background-color: rgba(37, 99, 235, 0.12);
    color: #93c5fd;
}

.dark .rt-menu-item.is-active .rt-menu-link::before {
    background-color: #3b82f6;
}

/* Icon styling */
.rt-menu-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #9ca3af;
    transition: color 0.12s ease;
}

.rt-menu-link:hover .rt-menu-icon {
    color: #6b7280;
}

.rt-menu-item.is-active .rt-menu-icon {
    color: #2563eb;
}

.dark .rt-menu-icon {
    color: #6b7280;
}

.dark .rt-menu-link:hover .rt-menu-icon {
    color: #9ca3af;
}

.dark .rt-menu-item.is-active .rt-menu-icon {
    color: #60a5fa;
}

/* Label text */
.rt-menu-label {
    margin-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   8. MENU ITEMS — Submenu / Dropdown
   -------------------------------------------------------------------------- */
.rt-menu-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.rt-menu-chevron {
    width: 14px;
    height: 14px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.rt-menu-chevron.is-open {
    transform: rotate(180deg);
}

.rt-submenu {
    list-style: none;
    margin: 2px 0 4px 0;
    padding: 0 0 0 28px;
}

.rt-submenu-link {
    display: block;
    padding: 5px 10px;
    font-size: 0.8125rem;
    font-weight: 450;
    color: #6b7280;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.12s ease;
}

.rt-submenu-link:hover {
    color: #111827;
    background-color: #f9fafb;
}

.rt-submenu-link.is-active {
    color: #2563eb;
    font-weight: 600;
}

.dark .rt-submenu-link {
    color: #9ca3af;
}

.dark .rt-submenu-link:hover {
    color: #f3f4f6;
    background-color: #374151;
}

.dark .rt-submenu-link.is-active {
    color: #60a5fa;
}

/* --------------------------------------------------------------------------
   9. SIDEBAR FOOTER
   -------------------------------------------------------------------------- */
.rt-sidebar-footer {
    flex-shrink: 0;
    padding: 12px 0;
    border-top: 2px solid #f3f3f3;
    background: #f7f7f7;
}

.dark .rt-sidebar-footer {
    border-top-color: #374151;
}

/* Footer utility actions row */
.rt-footer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #f3f3f3;
    justify-content: space-around;
}

.dark .rt-footer-actions {
    border-top-color: #374151;
}

.rt-footer-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #9ca3af;
    transition: all 0.12s ease;
    text-decoration: none;
}

.rt-footer-action:hover {
    background-color: #f3f4f6;
    color: #4b5563;
}

.dark .rt-footer-action:hover {
    background-color: #374151;
    color: #d1d5db;
}

.rt-footer-action svg {
    width: 18px;
    height: 18px;
}

/* --------------------------------------------------------------------------
   10. BADGE / COUNT INDICATOR
   -------------------------------------------------------------------------- */
.rt-menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.625rem;
    font-weight: 700;
    color: #ffffff;
    background-color: #2563eb;
    border-radius: 9px;
    margin-left: auto;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   11. MOBILE CLOSE BUTTON
   -------------------------------------------------------------------------- */
.rt-sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 12px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background-color 0.12s ease;
    z-index: 10;
}

.rt-sidebar-close:hover {
    background-color: #f3f4f6;
    color: #111827;
}

@media (max-width: 1023px) {
    .rt-sidebar-close {
        display: flex;
    }
}



/* ==========================================================================
   SIDEBAR COMPONENT
   ========================================================================== */
#sidebar {
    background: var(--sidebar-bg);
    position: sticky;
    box-shadow: none !important;
    border-right: 1px solid var(--border-sidebar);
}

#sidebar ul li {
    background-color: var(--white);
    border-radius: 0;
    font-weight: 400 !important;
    position: relative !important;
}

#sidebar ul li a svg,
#sidebar ul li a span {
    color: var(--text-dark);
    font-weight: 400;
}

#sidebar ul li.rt-menu-item:hover {
    /* background-color: var(--sidebar-hover) !important;
    border-radius: 5px; */
    color: #1C99FF !important;
}

#sidebar ul li.active {
    background-color: var(--sidebar-active) !important;
}

#sidebar ul li.active a {
    /* border-left: 4px solid #1C99FF !important; */
    color: 2px solid #1C99FF !important;
}


#sidebar ul li.active a::before {
    content: "";
    position: absolute;
    top: 12px;
    transform: none;
    left: 0px;
    width: 4px;
    height: 25px;
    border-radius: 2px;
    background-color: #1C99FF;
    transition: opacity 0.1s ease-in-out;
    opacity: 0;
}
#sidebar ul li.active a::before {
    opacity: 1;
}

#sidebar ul li.active a svg,
#sidebar ul li.active a span {
    color: var(--text-dark) !important;
    font-weight: 500 !important;
}

#sidebar ul li:hover a svg,
#sidebar ul li:hover a span {
    color: var(--text-dark) !important;
    font-weight: 500 !important;
}

#sidebar ul li a svg {
    width: 20px;
}

/* ==========================================================================
   4. SIDEBAR — Refined, clean, Apple-style navigation
   ========================================================================== */
#sidebar {
    background: var(--apple-bg-secondary) !important;
    border-right: 2px solid #f3f3f3 !important;
    box-shadow: none !important;
}

/* Sidebar menu items */
#sidebar ul li {
    background-color: transparent !important;
    transition: background-color var(--apple-duration-fast) var(--apple-ease),
                transform var(--apple-duration-fast) var(--apple-ease) !important;
}

#sidebar ul li a svg,
#sidebar ul li a span {
    color: var(--apple-text-secondary) !important;
    font-weight: 400 !important;
    transition: color var(--apple-duration-fast) var(--apple-ease),
                font-weight var(--apple-duration-fast) var(--apple-ease) !important;
}

#sidebar ul li:hover {
    background-color: var(--apple-separator) !important;
}

#sidebar ul li:hover a svg,
#sidebar ul li:hover a span {
    color: var(--apple-text-primary) !important;
    font-weight: 400;
}

/* Active item — subtle accent indicator */
#sidebar ul li.active {
    background-color: var(--apple-accent-light) !important;
}

#sidebar ul li.active a svg,
#sidebar ul li.active a span {
    color: var(--apple-accent) !important;
    font-weight: 600 !important;
}

/* Refine the active bar indicator */
#sidebar ul li.active a::before {
    background-color: var(--apple-accent) !important;
    border-radius: var(--apple-radius-full) !important;
    width: 3px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    height: 18px !important;
    left: -8px !important;
    opacity: 1 !important;
}

a.menu-commissioned-active::before {
    background-color: var(--apple-accent) !important;
    border-radius: var(--apple-radius-full) !important;
    width: 3px !important;
    height: 18px !important;
}

/* Sidebar footer — refined grid */
#sidebar footer.footer {
    border-top: 1px solid var(--apple-border) !important;
}

#sidebar footer .grid > div {
    border-color: var(--apple-border) !important;
}

#sidebar footer a {
    transition: color var(--apple-duration-fast) var(--apple-ease),
                background-color var(--apple-duration-fast) var(--apple-ease) !important;
    border-radius: var(--apple-radius-sm) !important;
}

#sidebar footer a:hover {
    color: var(--apple-accent) !important;
    background-color: var(--apple-accent-light) !important;
}

/* Sidebar header company selector */
#sidebar .border-b {
    border-color: var(--apple-border) !important;
}
