 /* ===== Modernized Left Sidebar ===================================================
       Design goals:
         - Light neutral background (#f8f9fb) — calm, professional, not dominant
         - Red (#dc2626) used as accent only: active item bg tint + icon/text color
         - 280px width, 44px item height, 8px rounded corners
         - Compact profile header (replaces the old tall toolbar)
         - Small-caps section labels instead of bold md-subheader
         - Smooth hover / active transitions
    ================================================================================ */

:root {
    --desktop-nav-rail-width: 56px;
    --desktop-nav-expanded-width: 248px;
}

/* ------------------------------------------------------------------
    Persistent desktop navigation
    The same element grows to reveal its labels when expanded.
------------------------------------------------------------------ */
.sidenav-rail {
    display: none;
}

@media (min-width: 960px) {
    .app-shell--with-nav-rail > md-content.main {
        margin-left: var(--desktop-nav-rail-width);
        transition: margin-left 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .app-shell--with-nav-rail.app-shell--with-expanded-nav > md-content.main {
        margin-left: var(--desktop-nav-expanded-width);
    }

    .sidenav-rail {
        position: fixed;
        top: 64px;
        bottom: 0;
        left: 0;
        z-index: 58;
        display: block;
        width: var(--desktop-nav-rail-width);
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 6px 4px;
        border-right: 1px solid #e5e7eb;
        background: #f8f9fb;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
        scrollbar-width: thin;
        scrollbar-color: #d1d5db transparent;
        transition: width 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), padding 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .sidenav-rail--expanded {
        width: var(--desktop-nav-expanded-width);
        padding: 8px;
    }

    .sidenav-rail::-webkit-scrollbar {
        width: 4px;
    }

    .sidenav-rail::-webkit-scrollbar-thumb {
        border-radius: 4px;
        background: #d1d5db;
    }

    .sidenav-rail__item {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 48px;
        margin: 0 0 2px;
        border-radius: 8px;
        box-sizing: border-box;
        color: #6b7280;
        cursor: pointer;
        user-select: none;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .sidenav-rail--expanded .sidenav-rail__item {
        justify-content: flex-start;
        gap: 10px;
        height: 44px;
        padding: 0 10px;
    }

    .sidenav-rail__item:hover {
        background-color: rgba(0, 0, 0, 0.05);
        color: #374151;
    }

    .sidenav-rail__item--active {
        background-color: rgba(47, 111, 237, 0.09) !important;
        color: #2f6fed !important;
    }

    .sidenav-rail__icon {
        width: 24px !important;
        height: 24px !important;
        margin: 0 !important;
        color: currentColor !important;
        font-size: 24px !important;
        line-height: 24px !important;
        flex-shrink: 0;
    }

    .sidenav-rail__img {
        width: 24px;
        height: 22px;
        object-fit: contain;
        opacity: 0.7;
        flex-shrink: 0;
    }

    .sidenav-rail__label {
        display: none;
        min-width: 0;
        overflow: hidden;
        color: inherit;
        font-size: 16px;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidenav-rail--expanded .sidenav-rail__label {
        display: block;
    }

    .sidenav-rail__item--active .sidenav-rail__label {
        font-weight: 600;
    }

    .sidenav-rail__item:hover .sidenav-rail__img,
    .sidenav-rail__item--active .sidenav-rail__img {
        opacity: 1;
    }

    .sidenav-rail__divider {
        height: 1px;
        margin: 8px 5px;
        background-color: #e5e7eb;
    }

    .sidenav-rail__header {
        margin: -8px -8px 8px;
    }

    @media (prefers-reduced-motion: reduce) {
        .app-shell--with-nav-rail > md-content.main,
        .sidenav-rail {
            transition: none;
        }
    }
}

/* Sidebar shell */
.sidenav-modern {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    background-color: #f8f9fb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(0,0,0,0.06) !important;
}

/* ------------------------------------------------------------------
    Profile header — replaces the old md-tall toolbar
    Clean white strip: avatar · name/email · version info icon
------------------------------------------------------------------ */
.sidenav-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 14px 16px;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    min-height: 64px;
    box-sizing: border-box;
}

.sidenav-header__menu {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
}

.sidenav-header__menu md-icon {
    color: #6b7280 !important;
}

/* Initials avatar — smaller (36px) but same color-coded logic */
.sidenav-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    line-height: 36px;
    text-align: center;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0;
}

.sidenav-header__info {
    flex: 1;
    min-width: 0; /* allow ellipsis */
}

.sidenav-header__name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
}

.sidenav-header__email {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
}

/* Version/legal — icon button, subtle */
.sidenav-header__meta {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    line-height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0;
}

.sidenav-header__meta md-icon {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
    color: #d1d5db !important;
    transition: color 0.15s ease;
}

.sidenav-header__meta:hover md-icon {
    color: #9ca3af !important;
}

/* ------------------------------------------------------------------
    Scrollable nav area
------------------------------------------------------------------ */
.sidenav-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    background-color: #f8f9fb !important; /* override md-default-theme gray */
}

/* ------------------------------------------------------------------
    Section labels — replaces md-subheader
    Small-caps, generous top spacing to separate groups visually
------------------------------------------------------------------ */
.sidenav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 16px 10px 4px;
    line-height: 1;
    user-select: none;
}

/* ------------------------------------------------------------------
    Menu item row
    Height: 44px, rounded: 8px, icon + label inline
------------------------------------------------------------------ */
.sidenav-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    color: #374151;
    margin-bottom: 2px;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    /* reset any md-list-item inherited styles */
    min-height: 0 !important;
    text-decoration: none;
    position: relative;
}

/* Hover state: very subtle darkening */
.sidenav-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #111827;
}

.sidenav-item:hover .sidenav-item__icon {
    color: #374151;
}

/* Active state: primary-tinted background + primary icon and label */
.sidenav-item--active {
    background-color: rgba(47, 111, 237, 0.09) !important;
    color: #2f6fed !important;
}

.sidenav-item--active .sidenav-item__icon {
    color: #2f6fed !important;
}

.sidenav-item--active .sidenav-item__label {
    font-weight: 600;
}

/* Icon — 20px, muted gray by default */
.sidenav-item__icon {
    font-size: 22px !important;
    width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    color: #6b7280;
    flex-shrink: 0;
    transition: color 0.15s ease;
    /* keep Angular Material from adding extra margins */
    margin: 0 !important;
}

/* Image-based icon (logo alternative) */
.sidenav-item__img {
    width: 22px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.15s ease;
}

.sidenav-item:hover .sidenav-item__img,
.sidenav-item--active .sidenav-item__img {
    opacity: 1;
}

/* Label text */
.sidenav-item__label {
    font-size: 16px;
    line-height: 1;
    white-space: nowrap;
    /* overflow: hidden; */ /* allow wrapping for long labels */ 
    text-overflow: ellipsis;
    flex: 1;
}

/* Section divider — replaces md-divider */
.sidenav-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 6px 8px;
}
