/* ===================================================================
   UNIVERSAL SIDEBAR SCROLLBAR SYSTEM - Applied to ALL Pages/Views
   ================================================================= */

/* CORE SIDEBAR STRUCTURE - Works on every page */
.sidebar {
    /* Fixed positioning and dimensions */
    width: 250px !important;
    height: 100vh !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 999 !important;
    
    /* Visual styling */
    background-color: #800000 !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1) !important;
    
    /* Layout */
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 20px 0 !important;
    
    /* SCROLLBAR BEHAVIOR - KEY FEATURE */
    overflow-y: auto !important; /* Always enable vertical scrolling */
    overflow-x: hidden !important; /* Hide horizontal scrollbar */
    
    /* Smooth transitions */
    transition: width 0.3s !important;
    
    /* Firefox scrollbar styling */
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(128, 0, 0, 0.1) !important;
}

/* WEBKIT SCROLLBAR STYLING - Chrome, Safari, Edge */
.sidebar::-webkit-scrollbar {
    width: 8px !important;
    background-color: transparent !important;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 4px !important;
    margin: 10px 0 !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: scaleY(1.1) !important;
}

.sidebar::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* SIDEBAR CONTENT WRAPPER - Essential for scrolling */
.sidebar-content {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-height: calc(100vh - 40px) !important;
    justify-content: flex-start !important;
    padding: 0 10px !important;
}

/* COLLAPSED SIDEBAR - Maintains scrolling */
.sidebar.collapsed {
    width: 80px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.sidebar.collapsed .sidebar-content {
    padding: 0 5px !important;
    align-items: center !important;
}

/* HEADER AND LOGO STYLING */
.sidebar h3 {
    width: 100% !important;
    text-align: center !important;
    margin: 0 0 20px !important;
    transition: opacity 0.3s ease !important;
    flex-shrink: 0 !important;
    font-size: 1.5rem !important;
    font-weight: bold !important;
}

.sidebar.collapsed h3 {
    opacity: 0 !important;
    display: none !important;
}

.sidebar img {
    flex-shrink: 0 !important;
    transition: all 0.3s ease !important;
    display: block !important;
    margin: 0 auto 20px !important;
}

.sidebar.collapsed img {
    width: 40px !important;
    height: 40px !important;
    margin: 0 auto 10px !important;
}

/* NAVIGATION LINKS - Universal styling */
.sidebar a {
    color: #fff !important;
    text-decoration: none !important;
    width: 90% !important;
    margin: 0 auto 10px !important;
    padding: 12px 15px !important;
    text-align: left !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    flex-shrink: 0 !important;
    font-weight: 500 !important;
    border: 2px solid transparent !important;
}

.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(5px) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.sidebar a.active,
.sidebar a[style*="background-color: rgba(255, 255, 255, 0.1)"] {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    font-weight: 600 !important;
}

.sidebar a i {
    margin-right: 12px !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    font-size: 1.1rem !important;
}

/* COLLAPSED NAVIGATION */
.sidebar.collapsed a {
    justify-content: center !important;
    width: 60px !important;
    margin: 0 auto 10px !important;
    padding: 12px !important;
}

.sidebar.collapsed a i {
    margin-right: 0 !important;
}

.sidebar.collapsed a span:not(.notification-badge) {
    display: none !important;
}

/* DROPDOWN FUNCTIONALITY */
.dropdown-btn {
    color: #fff !important;
    text-decoration: none !important;
    width: 90% !important;
    margin: 0 auto 10px !important;
    padding: 12px 15px !important;
    text-align: left !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    background: transparent !important;
    border: 2px solid transparent !important;
    font-weight: 500 !important;
    position: relative !important;
}

.dropdown-btn:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(5px) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.dropdown-btn.active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.dropdown-btn .fa-caret-down {
    transition: transform 0.3s ease !important;
    font-size: 0.9rem !important;
}

.dropdown-btn.active .fa-caret-down {
    transform: rotate(180deg) !important;
}

/* DROPDOWN CONTAINER - Enables scrolling when expanded */
.dropdown-container {
    width: 90% !important;
    margin: 0 auto 15px !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px !important;
    padding: 10px 0 !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    display: none !important; /* Hidden by default */
}

.dropdown-container.show {
    display: block !important;
    animation: slideDown 0.3s ease forwards !important;
}

.dropdown-container a {
    width: 85% !important;
    margin: 0 auto 8px !important;
    padding: 10px 12px !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-radius: 6px !important;
    font-size: 0.9rem !important;
    border: 1px solid transparent !important;
}

.dropdown-container a:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(3px) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.dropdown-container a:last-child {
    margin-bottom: 0 !important;
}

/* DROPDOWN ANIMATION */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scaleY(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

/* LOGOUT BUTTON - Always at bottom */
.btn-logout {
    margin-top: auto !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    color: white !important;
    width: 90% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: 15px !important;
    padding: 12px 15px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.btn-logout:hover {
    background-color: rgba(220, 53, 69, 0.8) !important;
    border-color: rgba(220, 53, 69, 1) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
}

/* NOTIFICATION BADGES - Consistent across all pages */
.notification-badge {
    background-color: #dc3545 !important;
    color: white !important;
    border-radius: 50% !important;
    padding: 2px 6px !important;
    font-size: 0.75rem !important;
    font-weight: bold !important;
    margin-left: auto !important;
    min-width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: pulse 2s infinite !important;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* TOGGLE BUTTON - positioned inside sidebar at TOP LEFT */
.toggle-sidebar-btn {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    z-index: 1001 !important;
    background-color: #800000 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.toggle-sidebar-btn:hover {
    background-color: #a00000 !important;
    transform: rotate(90deg) !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4) !important;
}

/* MAIN CONTENT ADJUSTMENT */
.main-content {
    margin-left: 250px !important;
    transition: margin-left 0.3s ease !important;
    padding: 20px !important;
    min-height: 100vh !important;
    background-color: #f8f9fa !important;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 80px !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
    }
    
    .sidebar.show {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .toggle-sidebar-btn {
        left: 20px !important;
    }
}

/* ENSURE COMPATIBILITY - Force application on all page types */
body .sidebar,
.container .sidebar,
.wrapper .sidebar,
div[class*="sidebar"],
#sidebar {
    /* Re-apply all critical scrollbar properties */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(128, 0, 0, 0.1) !important;
}

/* GLOBAL SCROLLBAR STYLING - Apply to any sidebar class or ID */
body .sidebar::-webkit-scrollbar,
.container .sidebar::-webkit-scrollbar,
#sidebar::-webkit-scrollbar,
div[class*="sidebar"]::-webkit-scrollbar {
    width: 8px !important;
}

body .sidebar::-webkit-scrollbar-thumb,
.container .sidebar::-webkit-scrollbar-thumb,
#sidebar::-webkit-scrollbar-thumb,
div[class*="sidebar"]::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 4px !important;
}

body .sidebar::-webkit-scrollbar-thumb:hover,
.container .sidebar::-webkit-scrollbar-thumb:hover,
#sidebar::-webkit-scrollbar-thumb:hover,
div[class*="sidebar"]::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4) !important;
}

/* UNIVERSAL APPLICATION - Force on all view types */
.blade-view .sidebar,
.php-view .sidebar,
.laravel-view .sidebar {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* PRINT FRIENDLY */
@media print {
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* DROPDOWN BUTTON STYLING */
.dropdown-btn {
    border: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
    flex-shrink: 0 !important;
}

.dropdown-btn i:first-child {
    margin-right: 10px !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
}

.dropdown-btn i.fa-caret-down {
    margin-left: auto !important;
    transition: transform 0.3s ease !important;
}

.dropdown-btn.active i.fa-caret-down {
    transform: rotate(180deg) !important;
}

.sidebar.collapsed .dropdown-btn {
    justify-content: center !important;
    align-self: center !important;
    margin-left: 0 !important;
    width: 60px !important;
    padding: 10px !important;
}

.sidebar.collapsed .dropdown-btn i:first-child {
    margin-right: 0 !important;
}

.sidebar.collapsed .dropdown-btn i.fa-caret-down {
    display: none !important;
}

.sidebar.collapsed .dropdown-btn span {
    display: none !important;
}

/* Dropdown container styling */
.dropdown-container {
    display: none !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    padding: 8px 0 !important;
    margin: 0 0 10px 0 !important;
    text-align: left !important;
    border-radius: 5px !important;
    width: 90% !important;
    margin-left: 5% !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
}

.dropdown-container.show {
    display: block !important;
}

.dropdown-container a {
    padding: 8px 25px !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-bottom: 5px !important;
    justify-content: flex-start !important;
    background: transparent !important;
}

.dropdown-container a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.sidebar.collapsed .dropdown-container {
    width: 60px !important;
    align-self: center !important;
    margin-left: 0 !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

.sidebar.collapsed .dropdown-container a {
    justify-content: center !important;
    padding: 8px !important;
    width: 60px !important;
}

.sidebar.collapsed .dropdown-container a span {
    display: none !important;
}

.sidebar.collapsed .dropdown-container a i {
    margin-right: 0 !important;
}

/* Logout button - Always keep at bottom and visible */
.btn-logout {
    margin-top: auto !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 5px !important;
    color: white !important;
    border: none !important;
    width: 90% !important;
    margin-left: 5% !important;
    padding: 10px 15px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
    margin-bottom: 10px !important;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    color: white !important;
}

.btn-logout i {
    margin-right: 8px !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
}

.sidebar.collapsed .btn-logout {
    justify-content: center !important;
    align-self: center !important;
    margin-left: 0 !important;
    width: 60px !important;
    padding: 10px !important;
}

.sidebar.collapsed .btn-logout i {
    margin-right: 0 !important;
}

.sidebar.collapsed .btn-logout span {
    display: none !important;
}

/* Notification badges */
.notification-badge {
    background: #dc3545 !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    padding: 4px 8px !important;
    font-size: 0.7rem !important;
    font-weight: 800 !important;
    min-width: 22px !important;
    height: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-shadow: 0 3px 12px rgba(220, 53, 69, 0.5) !important;
    border: 2px solid rgba(255, 255, 255, 1) !important;
    position: absolute !important;
    right: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 15 !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
}

/* Hide empty badges */
.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none !important;
}

/* Ensure badges work in collapsed sidebar too */
.sidebar.collapsed .notification-badge {
    right: 5px !important;
    top: 5px !important;
    transform: none !important;
    position: absolute !important;
}

/* Hover effects */
.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-left: 4px solid white !important;
}

.sidebar.collapsed a:hover {
    border-left: none !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Responsive adjustments for smaller screens */
@media (max-height: 600px) {
    .sidebar {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
    
    .sidebar h3 {
        margin-bottom: 10px !important;
        font-size: 1.2rem !important;
    }
    
    .sidebar a {
        margin-bottom: 5px !important;
        padding: 8px 12px !important;
    }
    
    .dropdown-container a {
        padding: 6px 20px !important;
        margin-bottom: 3px !important;
    }
}

/* Ensure main content adjusts properly */
.main-content {
    margin-left: 250px !important;
    transition: margin-left 0.3s !important;
}

.sidebar.collapsed + .main-content,
.main-content.collapsed {
    margin-left: 80px !important;
}

.content-wrapper {
    margin-left: 250px !important;
    width: calc(100% - 250px) !important;
    transition: margin-left 0.3s, width 0.3s !important;
}

.sidebar.collapsed + .content-wrapper {
    margin-left: 80px !important;
    width: calc(100% - 80px) !important;
}

/* Note: Main toggle button positioning is defined earlier in this file at line 316 */