/* R & S Services ERP - Shared Sidebar Styles */
:root {
    --sidebar-bg: #a2cffe;
    --sidebar-dark: #8bb8e8;
    --sidebar-darker: #5a9fd4;
    --sidebar-text: #ffffff;
    --sidebar-text-secondary: rgba(255, 255, 255, 0.7);
    --sidebar-accent: #2d5a87;
    --sidebar-active-bg: rgba(255, 255, 255, 0.25);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.15);
    --sidebar-shadow: rgba(0, 0, 0, 0.15);
    --sidebar-font: 'Trebuchet MS', Verdana, Arial, sans-serif;
}

body.has-sidebar { margin: 0; min-height: 100vh; overflow-x: hidden; }

.erp-sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-dark) 100%);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px var(--sidebar-shadow);
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    font-family: var(--sidebar-font);
}

.erp-sidebar.collapsed { width: 80px; }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--sidebar-accent) 0%, #1e3d5c 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(45, 90, 135, 0.3);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-header h2 {
    color: var(--sidebar-text);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin: 0;
    white-space: nowrap;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.erp-sidebar.collapsed .sidebar-logo-icon { transform: scale(0.9); }
.erp-sidebar.collapsed .sidebar-header h2 { opacity: 0; visibility: hidden; width: 0; }

.sidebar-toggle-btn {
    position: absolute;
    right: -16px;
    top: 80px;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--sidebar-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 1001;
    border: 3px solid var(--sidebar-bg);
    color: var(--sidebar-accent);
    font-size: 14px;
}

.sidebar-toggle-btn:hover { transform: scale(1.15); box-shadow: 0 6px 16px var(--sidebar-shadow); }
.erp-sidebar.collapsed .sidebar-toggle-btn i { transform: rotate(180deg); }

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 3px; }

.nav-section { margin-bottom: 8px; }

.nav-section-title {
    padding: 10px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--sidebar-text-secondary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.erp-sidebar.collapsed .nav-section-title { opacity: 0; height: 0; padding: 0; }

.sidebar-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    gap: 12px;
    margin: 2px 8px;
    border-radius: 10px;
}

.sidebar-menu-item:hover { background: var(--sidebar-hover-bg); }

.sidebar-menu-item.active { background: var(--sidebar-active-bg); font-weight: 600; }

.sidebar-menu-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: white;
    border-radius: 0 4px 4px 0;
}

.sidebar-menu-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-menu-item:hover .sidebar-menu-icon { background: rgba(255, 255, 255, 0.2); transform: translateX(2px); }
.sidebar-menu-item.active .sidebar-menu-icon { transform: scale(1.1); }

.sidebar-menu-item span {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.erp-sidebar.collapsed .sidebar-menu-item span { opacity: 0; visibility: hidden; width: 0; }

.sidebar-menu-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    white-space: nowrap;
}

.sidebar-menu-badge.new { background: linear-gradient(135deg, #51cf66 0%, #40c057 100%); }
.erp-sidebar.collapsed .sidebar-menu-badge { opacity: 0; visibility: hidden; width: 0; padding: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.sidebar-user-profile { display: flex; align-items: center; gap: 12px; }

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--sidebar-accent) 0%, #1e3d5c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; transition: opacity 0.2s ease, visibility 0.2s ease; }
.erp-sidebar.collapsed .sidebar-user-info { opacity: 0; visibility: hidden; width: 0; }

.sidebar-user-info h4 {
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info p {
    color: var(--sidebar-text-secondary);
    font-size: 11px;
    margin: 2px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sidebar-text);
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-logout-btn:hover { background: rgba(239, 68, 68, 0.3); color: #fecaca; }
.erp-sidebar.collapsed .sidebar-logout-btn { opacity: 0; visibility: hidden; width: 0; }

.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--sidebar-dark) 100%);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 12px var(--sidebar-shadow);
    border: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active { display: block; }

body.has-sidebar .main-content-wrapper {
    margin-left: 280px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

body.has-sidebar .erp-sidebar.collapsed ~ .main-content-wrapper { margin-left: 80px; }

@media (max-width: 768px) {
    .erp-sidebar { transform: translateX(-100%); width: 280px !important; }
    .erp-sidebar.mobile-open { transform: translateX(0); }
    .mobile-sidebar-toggle { display: flex; }
    body.has-sidebar .main-content-wrapper { margin-left: 0 !important; }
    .sidebar-toggle-btn { display: none; }
}
