.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background-color: var(--bs-custom-bg-white-fill);
    transition: width 0.4s ease;

    /* Always reserve scrollbar space */
    overflow-y: scroll !important;
    scrollbar-gutter: stable;

    z-index: 1050;
    box-sizing: border-box;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

/* =========================
   CHROME / EDGE / SAFARI
========================= */

.sidebar::-webkit-scrollbar {
    width: 2px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 10px;
    transition: background-color 0.2s ease;
}

.sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.18);
}

.sidebar:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.30);
}

/* =========================
   FIREFOX
========================= */

.sidebar:hover {
    scrollbar-color: rgba(0,0,0,0.18) transparent;
}

.sidebar__section {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-toggle-btn {
    margin-left: 230px;
    transition: margin-left 0.3s ease;
}

.sidebar__link:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.main-menu--TOGGLE {
    margin-left: 60px !important;
    transition: margin-left 0.4s ease, width 0.4s ease;
}

/* Sidebar Navigation Wrapper */
.sidebar__nav {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

/* General Sidebar Item */
.sidebar__item {
    width: 100%;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
}

.sidebar__item:first-child {
    padding-top: 10px;
    margin-top: 0;
}

/* Link inside Items */
.sidebar__link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: inherit;
    width: 100%;
    text-decoration: none;
    color: var(--bs-custom-sidebar-text);
    font-size: 14px;
    border-radius: 0.375rem;
    box-sizing: border-box;
}

.sidebar__link:hover {
    background-color: var(--bs-custom-stroke-weak);
    color: var(--bs-custom-sidenav-hover-dark-white);
}

    /* Active State Styling */
    .sidebar__item--active > .sidebar__link {
    background-color: var(--bs-primary) !important;
    color: var(--bs-custom-white-dark) !important;
    }

    .sidebar__item--active > .sidebar__link svg {
    color: var(--bs-custom-stroke-weak) !important;
    }

    /* Icon Styling */
    .sidebar__icon {
    margin-right: 0.5rem;
    flex-shrink: 0;
    }

    /* Text Transitioning */
    .sidebar__text {
    transition: opacity 0.3s ease, transform 0.3s ease;
    }

    /* Profile Section at Bottom */
    .sidebar__profile {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: auto;
    }

    /* Styling for Profile-Link items */
    .sidebar__link--profile {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: inherit;
    width: 100%;
    }

    /* Hover effect for the entire usage module */
    .module-usage {
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer; /* indicate hoverable */
    }

    .module-usage:hover {
    background-color: var(--bs-custom-stroke-weak);
    color: var(--bs-custom-sidenav-hover-dark-white);
    }

#usage-text{
    font-size:11px;
    white-space:nowrap;
    text-align:right;
}


    /* --- Collapsed Sidebar Styles (Ensuring Icons Centered) --- */

    .sidebar--collapsed {
    width: 60px;
    left: 8px;    /* <-- small distance from screen edge */
    }


    .sidebar-collapsed .navbar__sidebar-toggle-btn {
    margin-left: 60px; /* same as collapsed sidebar width */
    transition: margin-left 0.3s ease;
    }

    /* Tighter vertical spacing for collapsed sidebar links */
    .sidebar--collapsed .sidebar__item {
    padding: 0;       /* remove inner padding */
    margin: 1px 0;    /* minimal vertical gap */
    }

    .sidebar--collapsed .sidebar__link:hover {
    background-color: var(--bs-custom-stroke-weak); /* subtle highlight */
    cursor: pointer;
    }

   .sidebar--collapsed .sidebar__item:not(.sidebar__item--logo) .sidebar__link {
       display: inline-flex;
       justify-content: center;
       align-items: center;
       width: 50px;
       height: 50px;
       margin: 5px auto;
       padding: 0;
       box-sizing: border-box;
       border-radius: 12px;
       background: transparent;
   }

    .sidebar--collapsed .sidebar__icon {
    margin: 0 !important;
    }

    /* Hide text & profile info so only icons remain */
    .sidebar--collapsed .sidebar__text,
    .sidebar--collapsed .sidebar__profile-info {
    display: none !important;
    }

    /* Collapsed sidebar icon sizing like Subly */
    .sidebar--collapsed .sidebar__icon svg {
    width: 1em;          /* scalable like text */
    height: 1em;         /* scalable like text */
    font-size: 22px;     /* matches Subly size */
    display: block;
    }

    /* ----------------- Desktop vs Collapsed Module Usage ----------------- */

    /* Hide collapsed by default */
    .module-usage-collapsed,
    .module-usage-upgrade-collapsed {
    display: none;
    }

    /* Collapsed sidebar overrides */
    .sidebar--collapsed .module-usage-desktop,
    .sidebar--collapsed .module-usage-upgrade-desktop,
    .sidebar--collapsed .module-usage .alert,
    .sidebar--collapsed .module-usage .text-muted {
    display: none !important;
    }

    .sidebar--collapsed .module-usage-collapsed,
    .sidebar--collapsed .module-usage-upgrade-collapsed {
    display: flex !important;
    justify-content: center;
    align-items: center;
    }

    /* ----------------- Collapsed Usage Bar Styling ----------------- */
    .sidebar--collapsed .module-usage {
    padding: 0.25rem !important;
    font-size: 0.85rem !important;
    }

    .sidebar--collapsed .module-usage .progress {
    height: 6px !important;
    }

    .sidebar--collapsed .module-usage-upgrade-collapsed {
    display:flex!important;
    }

    .sidebar--collapsed .module-usage-upgrade-collapsed i {
    font-size: 1.2em; /* icon size */
    }

    /* Sidebar Profile (Bottom Section) */
    .sidebar__profile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 0;
    width: 100%;
    margin-top: auto;
    }

    .sidebar__link--profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    width: 100%;
    text-decoration: none;
    }

    .sidebar__profile-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0; /* Required to allow text-overflow inside flex items */
    }

    .sidebar__email {
    max-width: 150px; /* or 100% if inside a constrained container */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    color: var(--bs-light-text); /* optional */
    font-size: 12px; /* optional */
    }

    .sidebar__avatar {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    }

    .sidebar__profile-icon {
    margin-left: auto;
    }

    /* -----------------------------
    Collapsed Sidebar Profile Fix
    ------------------------------ */
    .sidebar--collapsed .sidebar__profile {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.75rem 0;
    text-align: center;
    }

    .sidebar--collapsed .sidebar__link--profile {
    justify-content: center;
    width: 100%;
    padding: 0;
    }

    .sidebar--collapsed .sidebar__avatar {
    width: 38px;
    height: 38px;
    margin: 0 auto;
    display: block;
    }

    .sidebar--collapsed .sidebar__profile-info,
    .sidebar--collapsed .sidebar__profile-icon {
    display: none !important;
    }

    /* Bottom Nav */
    .bottom-nav {
    display: none;
    transition: all 0.3s ease;
    }

    .bottom-nav__icon svg {
    width: 24px;
    height: 24px;
    display: block;
    stroke: currentColor;
    fill: none; /* or currentColor if you want filled icons */
    }

    .sidebar__item--channelinfo .sidebar__text {
    position: relative;
    top: -2px; /* nudge up slightly */
}

/* =========================
   LOGO CONTAINER (ONLY LOGO ITEM)
========================= */
.sidebar__item--logo {
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar__logo {
    width: 180px;
    height: 50px;
    display: block;

    background-image: var(--sidebar-logo);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* collapsed */
.sidebar--collapsed .sidebar__logo {
    width: 100px !important;
    height: 100px !important;

    background-image: var(--sidebar-logo-collapsed);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;

    flex-shrink: 0;
}

.sidebar--collapsed .sidebar__item--logo {
    height: 80px;
    padding: 0;
}

.sidebar__link {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.sidebar__text {
    white-space: nowrap;
    flex-shrink: 0;
}
