/* ============================================
   SIDEBAR CSS VARIABLES (Role-based themes)
   ============================================ */

:root {
    /* Default theme (fallback) */
    --sidebar-bg: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --sidebar-text: #ecf0f1;
    --sidebar-primary: #3498db;
    --sidebar-secondary: #2ecc71;
    --sidebar-accent: #9b59b6;
    --sidebar-hover: rgba(52, 73, 94, 0.8);
    --sidebar-active: linear-gradient(90deg, #1abc9c 0%, #16a085 100%);
    --sidebar-border: rgba(52, 152, 219, 0.3);
    --sidebar-shadow: rgba(0, 0, 0, 0.25);
    --sidebar-divider: rgba(255, 255, 255, 0.1);
    
    /* Dynamic sidebar width that shrinks automatically */
    --sidebar-width: calc(230px + (100vw - 230px) * 0.1); /* Auto-shrink formula */
    --sidebar-min-width: 230px;
    --sidebar-max-width: 260px;
    --sidebar-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Beautiful shadow variables */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.2);
    --shadow-strong: 0 15px 40px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(52, 152, 219, 0.3);
}

/* ============================================
   AUTO-SHRINKING SIDEBAR WIDTH CALCULATION
   ============================================ */

/* Automatically shrink sidebar from 260px to 230px as screen gets smaller */
.sidebar_container {
    /* Dynamic width calculation: 
       Starts at 260px, reduces to 230px as screen shrinks */
    width: clamp(230px, calc(230px + (100vw - 320px) * 0.075), 260px);
    min-width: 230px;
    max-width: 260px;
}

/* ============================================
   SIDEBAR CONTAINER WITH BEAUTIFUL SHADOWS
   ============================================ */

.sidebar_container {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: var(--sidebar-transition);
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    
    /* Multi-layered beautiful shadow */
    box-shadow: 
        var(--shadow-strong),
        var(--shadow-glow),
        inset 1px 0 0 rgba(255, 255, 255, 0.05);
    
    /* Glass morphism effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   GRADIENT ENTITIES (NOT SAME COLOR)
   ============================================ */

.sidebar_nav_item {
    margin-bottom: 2px;
    position: relative;
    transition: all 0.3s ease;
}

/* Each link has a unique subtle gradient background */
.sidebar_link {
    color: var(--sidebar-text) !important;
    border-radius: 10px !important;
    padding: 12px 16px !important;
    margin: 3px 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid transparent !important;
    position: relative;
    overflow: hidden;
    
    /* Initial gradient background */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%);
    
    /* Beautiful box shadow */
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Hover effect with enhanced gradient */
.sidebar_link:hover {
    background: linear-gradient(135deg, 
        rgba(52, 152, 219, 0.15) 0%,
        rgba(41, 128, 185, 0.1) 100%);
    
    /* Enhanced shadow on hover */
    box-shadow: 
        0 4px 15px rgba(52, 152, 219, 0.2),
        0 0 0 1px rgba(52, 152, 219, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    transform: translateX(4px) translateY(-1px);
    border-color: rgba(52, 152, 219, 0.4) !important;
}

/* Active link with beautiful gradient */
.sidebar_link_active {
    background: var(--sidebar-active) !important;
    
    /* Glowing shadow for active item */
    box-shadow: 
        0 5px 20px rgba(26, 188, 156, 0.4),
        0 0 0 1px rgba(26, 188, 156, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    
    color: white !important;
    font-weight: 600 !important;
    border-color: rgba(26, 188, 156, 0.8) !important;
    transform: translateX(6px);
}

/* Each odd item gets slightly different gradient */
.sidebar_nav_item:nth-child(odd) .sidebar_link {
    background: linear-gradient(135deg, 
        rgba(155, 89, 182, 0.05) 0%,
        rgba(142, 68, 173, 0.02) 100%);
}

.sidebar_nav_item:nth-child(odd) .sidebar_link:hover {
    background: linear-gradient(135deg, 
        rgba(155, 89, 182, 0.15) 0%,
        rgba(142, 68, 173, 0.1) 100%);
    border-color: rgba(155, 89, 182, 0.4) !important;
}

/* Each even item gets different gradient */
.sidebar_nav_item:nth-child(even) .sidebar_link {
    background: linear-gradient(135deg, 
        rgba(46, 204, 113, 0.05) 0%,
        rgba(39, 174, 96, 0.02) 100%);
}

.sidebar_nav_item:nth-child(even) .sidebar_link:hover {
    background: linear-gradient(135deg, 
        rgba(46, 204, 113, 0.15) 0%,
        rgba(39, 174, 96, 0.1) 100%);
    border-color: rgba(46, 204, 113, 0.4) !important;
}

/* ============================================
   SHADED DIVIDER WITH GLOW EFFECT
   ============================================ */

.sidebar_nav_item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    
    /* Beautiful gradient divider */
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(52, 152, 219, 0.3) 20%, 
        rgba(155, 89, 182, 0.3) 50%,
        rgba(52, 152, 219, 0.3) 80%,
        transparent 100%);
    
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.2);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.sidebar_nav_item:hover::after {
    opacity: 0.8;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(52, 152, 219, 0.6) 20%, 
        rgba(155, 89, 182, 0.6) 50%,
        rgba(52, 152, 219, 0.6) 80%,
        transparent 100%);
}

.sidebar_nav_item:last-child::after {
    display: none;
}

/* ============================================
   TEXT AND ICON STYLING
   ============================================ */

.sidebar_link_text {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sidebar_icon {
    font-size: 1.1rem;
    color: inherit;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.sidebar_link:hover .sidebar_icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px rgba(52, 152, 219, 0.5));
}

.sidebar_link_active .sidebar_icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

/* ============================================
   RESPONSIVE AUTO-SHRINKING
   ============================================ */

/* Extra Small Screens (230px - 300px) */
@media (max-width: 300px) {
    .sidebar_container {
        width: 230px; /* Minimum width */
    }
    
    .sidebar_link {
        padding: 10px 12px !important;
        margin: 2px 6px !important;
    }
    
    .sidebar_link_text {
        font-size: 0.85rem;
    }
    
    .sidebar_nav_item::after {
        left: 12px;
        right: 12px;
    }
}

/* Small Screens (301px - 400px) */
@media (min-width: 301px) and (max-width: 400px) {
    .sidebar_container {
        width: calc(230px + (100vw - 300px) * 0.2); /* Smooth shrink */
    }
}

/* Medium Screens (401px - 600px) */
@media (min-width: 401px) and (max-width: 600px) {
    .sidebar_container {
        width: calc(240px + (100vw - 400px) * 0.1);
    }
}

/* Large Screens (601px - 900px) */
@media (min-width: 601px) and (max-width: 900px) {
    .sidebar_container {
        width: calc(245px + (100vw - 600px) * 0.05);
    }
}

/* Extra Large Screens (901px and above) */
@media (min-width: 901px) {
    .sidebar_container {
        width: 260px; /* Maximum width */
    }
}

/* ============================================
   SIDEBAR HEADER WITH SHADOW
   ============================================ */

.sidebar_header {
    padding: 15px 0;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 10px;
    
    /* Header shadow */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, 
        rgba(44, 62, 80, 0.9) 0%,
        rgba(52, 73, 94, 0.7) 100%);
}

.sidebar_brand_link {
    margin-top: 33px;
    padding: 8px 16px;
    border-radius: 8px;
    width: 100%;
    color:  #3498db;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.sidebar_brand_link:hover {
    background: rgba(52, 152, 219, 0.15);
    box-shadow: 
        0 4px 15px rgba(52, 152, 219, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* ============================================
   SIDEBAR FOOTER WITH SHADOW
   ============================================ */

.sidebar_footer {
    border-top: 1px solid var(--sidebar-border) !important;
    margin-top: auto;
    padding: 15px 0;
    
    /* Footer shadow */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, 
        rgba(44, 62, 80, 0.9) 0%,
        rgba(52, 73, 94, 0.7) 100%);
}

.sidebar_avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-radius: 50%;
    font-size: 1rem;
    box-shadow: 
        0 3px 10px rgba(52, 152, 219, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sidebar_role_text {
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar_logout_btn {
    background: linear-gradient(135deg, 
        rgba(231, 76, 60, 0.9) 0%,
        rgba(192, 57, 43, 0.8) 100%) !important;
    border: none !important;
    color: white !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    box-shadow: 
        0 3px 10px rgba(231, 76, 60, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s ease !important;
}

.sidebar_logout_btn:hover {
    background: linear-gradient(135deg, 
        #e74c3c 0%,
        #c0392b 100%) !important;
    box-shadow: 
        0 5px 15px rgba(231, 76, 60, 0.4),
        0 2px 0 rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

/* ============================================
   SCROLLBAR STYLING WITH SHADOW
   ============================================ */

.sidebar_container::-webkit-scrollbar {
    width: 6px;
}

.sidebar_container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.sidebar_container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3498db 0%, #9b59b6 100%);
    border-radius: 3px;
    box-shadow: 
        0 0 10px rgba(52, 152, 219, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sidebar_container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2980b9 0%, #8e44ad 100%);
    box-shadow: 
        0 0 15px rgba(52, 152, 219, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */

@media (max-width: 767.98px) {
    .sidebar_container {
        transform: translateX(-100%);
        width: 85vw;
        max-width: 280px;
        min-width: 230px;
        box-shadow: 
            var(--shadow-strong),
            5px 0 30px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar_show {
        transform: translateX(0);
    }
    
    .sidebar_backdrop {
        display: block !important;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(3px);
    }
}

/* ============================================
   ANIMATIONS FOR BEAUTIFUL APPEAL
   ============================================ */

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 
            0 4px 20px rgba(0, 0, 0, 0.15),
            var(--shadow-glow);
    }
    50% {
        box-shadow: 
            0 6px 25px rgba(0, 0, 0, 0.2),
            0 0 25px rgba(52, 152, 219, 0.4);
    }
}

.sidebar_container {
    animation: glowPulse 6s ease-in-out infinite;
}

/* Subtle animation for active link */
@keyframes activeGlow {
    0%, 100% {
        box-shadow: 
            0 5px 20px rgba(26, 188, 156, 0.4),
            0 0 0 1px rgba(26, 188, 156, 0.6);
    }
    50% {
        box-shadow: 
            0 7px 25px rgba(26, 188, 156, 0.6),
            0 0 0 1px rgba(26, 188, 156, 0.8),
            0 0 15px rgba(26, 188, 156, 0.4);
    }
}

.sidebar_link_active {
    animation: activeGlow 3s ease-in-out infinite;
}