/* =========================
   SIDEBAR
========================= */

.dashboard-sidebar {
    width: var(--sidebar-width);
    background: var(--app-sidebar-bg);
    border-right: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: all 0.3s ease;
    overflow: hidden;
}

.dashboard-sidebar.collapsed {
    width: 80px;
    transition: width 0.3s ease;
}

.dashboard-sidebar.collapsed:hover {
    width: var(--sidebar-width);
}

.dashboard-sidebar.collapsed .brand-text,
.dashboard-sidebar.collapsed .nav-link-label,
.dashboard-sidebar.collapsed .nav-section-title,
.dashboard-sidebar.collapsed .badge-pill,
.dashboard-sidebar.collapsed .quick-access-title,
.dashboard-sidebar.collapsed .quick-btn span,
.dashboard-sidebar.collapsed .dropdown-icon {
    display: none;
}

.dashboard-sidebar.collapsed:hover .brand-text,
.dashboard-sidebar.collapsed:hover .nav-link-label,
.dashboard-sidebar.collapsed:hover .nav-section-title,
.dashboard-sidebar.collapsed:hover .badge-pill,
.dashboard-sidebar.collapsed:hover .quick-access-title,
.dashboard-sidebar.collapsed:hover .quick-btn span,
.dashboard-sidebar.collapsed:hover .dropdown-icon {
    display: grid;
}

.dashboard-sidebar.collapsed .nav-link,
.dashboard-sidebar.collapsed .nav-dropdown-toggle,
.dashboard-sidebar.collapsed .dropdown-link {
    justify-content: center;
}

.dashboard-sidebar.collapsed:hover .nav-link,
.dashboard-sidebar.collapsed:hover .nav-dropdown-toggle,
.dashboard-sidebar.collapsed:hover .dropdown-link {
    justify-content: flex-start;
}

.dashboard-sidebar.collapsed .nav-link-main {
    justify-content: center;
    width: auto;
}

.dashboard-sidebar.collapsed .nav-dropdown-menu {
    display: none;
}

.dashboard-sidebar.collapsed:hover .nav-dropdown-menu {
    display: grid;
}

.dashboard-sidebar.collapsed .nav-link-icon {
    margin-right: 0;
}

.dashboard-sidebar.collapsed .brand-box {
    justify-content: center;
}

.dashboard-sidebar.collapsed .brand-logo {
    width: 40px;
    height: 40px;
}

.dashboard-sidebar.collapsed .nav-dropdown-toggle {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.dashboard-sidebar.collapsed .nav-link-end {
    display: none;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

#dashboardMain {
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
}

#dashboardMain.expanded {
    margin-left: 80px;
}
/* =========================
   HEADER
========================= */

.sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid var(--app-border);
    flex-shrink: 0;
}

.brand-box {
    display: flex;
    gap: 10px;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--app-primary);
    line-height: 1.1;
}

.brand-subtitle {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--app-text-muted);
    line-height: 1.15;
}

/* =========================
   BODY (SCROLL AREA)
========================= */

.sidebar-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.sidebar-nav {
    padding: 16px 10px 18px;
}

/* =========================
   SECTION
========================= */

.nav-section {
    margin-bottom: 18px;
}

.nav-section-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--app-sidebar-heading);
    margin: 0 0 9px;
    padding: 0 12px;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* =========================
   NAV ITEMS
========================= */

.nav-link,
.nav-dropdown-toggle {
    min-height: 42px;
    width: 100%;
    border: 0;
    background: transparent;
    text-decoration: none;
    color: var(--app-sidebar-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nav-link-label {
    display: block;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ICON SYSTEM */
.nav-link-icon,
.dropdown-link-icon {
    width: 20px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-link-icon i,
.dropdown-link-icon i {
    font-size: 15px;
    line-height: 1;
}

/* RIGHT ICON (CHEVRON) */
.nav-link-end {
    width: 18px;
    min-width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================
   STATES
========================= */

.nav-link:hover,
.nav-dropdown-toggle:hover {
    background: #f8fafc;
    color: var(--app-primary);
}

.nav-link.active {
    background: var(--app-primary);
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(37, 68, 150, 0.18);
}

.nav-link.active i,
.nav-link.active .nav-link-label {
    color: #fff;
}

.nav-dropdown.active > .nav-dropdown-toggle {
    background: #eff6ff;
    color: var(--app-primary);
    font-weight: 600;
    border-radius: 10px;
}

.nav-dropdown.active > .nav-dropdown-toggle .nav-link-label,
.nav-dropdown.active > .nav-dropdown-toggle i {
    color: var(--app-primary);
}

/* =========================
   BADGE
========================= */

.badge-pill {
    background: var(--app-badge-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 7px;
    flex-shrink: 0;
    line-height: 1;
}

/* =========================
   DROPDOWN
========================= */

.nav-dropdown {
    margin-bottom: 4px;
}

.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        max-height 0.35s ease,
        opacity 0.25s ease,
        transform 0.25s ease;
    padding-left: 14px;
    margin-top: 4px;
    margin-left: 18px;
    border-left: 1px solid #e2e8f0;
}

.nav-dropdown.open .nav-dropdown-menu {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
}

/* CHEVRON ROTATION */
.dropdown-icon {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

.nav-dropdown.open > .nav-dropdown-toggle .dropdown-icon {
    transform: rotate(90deg);
}

/* =========================
   DROPDOWN ITEM
========================= */

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: #64748b;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13.25px;
    margin-bottom: 3px;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1.25;
    min-height: 36px;
}

.dropdown-link span:last-child {
    line-height: 1.25;
}

.dropdown-link.active {
    background: #eff6ff;
    color: var(--app-primary);
    font-weight: 600;
}

.dropdown-link:hover {
    background: #eff6ff;
    color: var(--app-primary);
}

/* =========================
   FOOTER
========================= */

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--app-border);
    background: #fff;
    flex-shrink: 0;
}

.sidebar-footer-card {
    background: linear-gradient(135deg, #eff6ff, #ffffff);
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 12px;
}

.quick-access-title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--app-primary);
    margin: 0 0 8px;
    line-height: 1.2;
}

.quick-btn {
    width: 100%;
    border: 1px solid var(--app-primary);
    color: var(--app-primary);
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 12.75px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1.2;
    min-height: 36px;
}

.quick-btn:hover {
    background: var(--app-primary);
    color: #fff;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 991.98px) {
    .dashboard-sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
    }

    .dashboard-sidebar.mobile-open {
        margin-left: 0;
    }
}