/* ERP Elitse — sidebar.css */

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: width 0.2s ease, flex-basis 0.2s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    flex-basis: var(--sidebar-collapsed);
}

/* ---------- Top / logo area ---------- */
.sidebar-top {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--border);
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    overflow: hidden;
    min-width: 0;
    flex: 1 1 auto;
}

.logo-wrap .logo-full {
    width: 100%;
    max-width: 160px;
    height: auto;
    display: block;
}

.logo-wrap .logo-text {
    font-weight: var(--fw-bold);
    font-size: var(--fs-md);
    color: var(--primary);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Compact mark shown only when collapsed */
.logo-wrap .logo-mark {
    display: none;
    font-weight: var(--fw-bold);
    font-size: var(--fs-lg);
    color: var(--primary);
}

.sidebar.collapsed .logo-full,
.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar.collapsed .logo-mark {
    display: block;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    color: var(--text-muted);
    flex: 0 0 auto;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.sidebar-toggle i { font-size: 18px; }

.sidebar.collapsed .sidebar-top {
    justify-content: center;
}

/* ---------- Navigation ---------- */
.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--sp-3) 0;
}

.nav-section {
    padding: var(--sp-4) var(--sp-4) var(--sp-1);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar.collapsed .nav-section {
    visibility: hidden;
    height: var(--sp-4);
    padding-top: var(--sp-2);
    padding-bottom: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-4);
    margin: 1px var(--sp-2);
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    color: var(--text);
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
    background: var(--primary-bg);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
    background: rgba(78, 128, 114, 0.08);
    color: var(--primary);
    font-weight: var(--fw-medium);
}

.nav-item i {
    font-size: 18px;
    flex: 0 0 auto;
    width: 18px;
    text-align: center;
}

.nav-label {
    font-size: var(--fs-base);
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    gap: 0;
    margin: 1px var(--sp-1);
    padding: var(--sp-2);
    border-left-width: 0;
}

.sidebar.collapsed .nav-item.active {
    border-left-width: 0;
}

/* ---------- Bottom / user area ---------- */
.sidebar-bottom {
    flex: 0 0 auto;
    border-top: 1px solid var(--border);
    padding: var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
}

.sidebar-bottom .user-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
}

.sidebar-bottom .user-meta {
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-logout:hover {
    background: var(--primary-bg);
    color: var(--danger);
}

.sidebar-logout i { font-size: 18px; }

.sidebar.collapsed .sidebar-logout,
.sidebar.collapsed .sidebar-logout-form {
    display: none;
}

.sidebar-bottom .user-name {
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-bottom .user-role {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-bottom {
    justify-content: center;
    padding: var(--sp-3) var(--sp-1);
}

.sidebar.collapsed .sidebar-bottom .user-meta {
    display: none;
}
