﻿/* Prevent horizontal scrollbar and fix body padding */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
    height: 100vh;
}

body {
    padding-top: 76px; /* Minimum height of navbar */
}

/* ADDED: Dynamic padding for mobile when navbar expands */
@media (max-width: 575.98px) {
    body {
        padding-top: 60px; /* Reduced for mobile */
    }
}

/* UPDATED: Desktop Sidebar Toggle Button with higher z-index and better positioning */
.sidebar-toggle-btn {
    position: fixed;
    top: 85px; /* Moved down to avoid navbar overlap */
    left: 15px; /* Moved right for better visibility */
    width: 45px; /* Slightly larger */
    height: 45px;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 1060; /* Higher than navbar (1055) */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    pointer-events: auto !important; /* Ensure it's always clickable */
}

.sidebar-toggle-btn:hover {
    background: #2d3748;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.sidebar-toggle-btn.sidebar-collapsed {
    left: 15px;
    background: #48bb78; /* Green when collapsed */
}

.sidebar-toggle-btn.sidebar-collapsed:hover {
    background: #38a169;
}

/* Mobile Sidebar Toggle Button - SEPARATE */
.mobile-sidebar-toggle {
    position: fixed;
    top: 85px;
    left: 15px;
    width: 45px;
    height: 45px;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 1060; /* Higher than navbar */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    pointer-events: auto !important;
}

.mobile-sidebar-toggle:hover {
    background: #2d3748;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Mobile Sidebar - Off-canvas style */
.mobile-sidebar {
    position: fixed;
    top: 76px;
    left: 0;
    width: 280px;
    height: calc(100vh - 76px);
    background: linear-gradient(135deg, #0f1419 0%, #1a202c 100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
    z-index: 1045; /* Lower than toggle buttons */
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-sidebar.open {
    transform: translateX(0);
}

.mobile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-sidebar-header h6 {
    color: white;
    margin: 0;
    font-weight: 600;
}

.mobile-sidebar-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-sidebar-close:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.mobile-sidebar-menu {
    padding: 1rem 0;
}

.mobile-sidebar-link {
    display: block;
    color: rgba(255,255,255,0.85) !important;
    padding: 0.875rem 1.5rem;
    text-decoration: none !important;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: white !important;
    border-left-color: #68d391;
}

.mobile-sidebar-link.active {
    background: rgba(255,255,255,0.15);
    color: white !important;
    border-left-color: #48bb78;
    font-weight: 600;
}

.mobile-sidebar-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    position: fixed;
    top: 76px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 76px);
    background: rgba(0,0,0,0.5);
    z-index: 1040; /* Lower than sidebar and toggle buttons */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Desktop Sidebar Styles */
.sidebar {
    position: fixed;
    top: 76px;
    left: 0;
    height: calc(100vh - 76px);
    width: 250px;
    background: linear-gradient(135deg, #0f1419 0%, #1a202c 100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
    z-index: 1045; /* Lower than toggle button */
    overflow-y: auto;
    transition: transform 0.3s ease;
    transform: translateX(0);
}

/* Collapsed sidebar state */
.sidebar.collapsed {
    transform: translateX(-250px);
}

.sidebar-header {
    background: rgba(0,0,0,0.3);
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h5 {
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
    padding: 1rem 0;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-link {
    display: block;
    color: rgba(255,255,255,0.85) !important;
    padding: 0.75rem 1.5rem;
    text-decoration: none !important;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: white !important;
    border-left-color: #68d391;
    transform: translateX(5px);
}

.sidebar-link.active {
    background: rgba(255,255,255,0.15);
    color: white !important;
    border-left-color: #48bb78;
    font-weight: 600;
}

.sidebar-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* UPDATED: Light mode sidebar styles using Bootstrap data-bs-theme approach */
[data-bs-theme="light"] .sidebar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
}

[data-bs-theme="light"] .mobile-sidebar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
}

[data-bs-theme="light"] .sidebar-toggle-btn {
    background: #667eea;
    color: white;
}

[data-bs-theme="light"] .sidebar-toggle-btn:hover {
    background: #5a67d8;
}

[data-bs-theme="light"] .sidebar-toggle-btn.sidebar-collapsed {
    background: #48bb78;
}

[data-bs-theme="light"] .sidebar-toggle-btn.sidebar-collapsed:hover {
    background: #38a169;
}

[data-bs-theme="light"] .mobile-sidebar-toggle {
    background: #667eea;
    color: white;
}

[data-bs-theme="light"] .mobile-sidebar-toggle:hover {
    background: #5a67d8;
}



 /* FIXED Content area when sidebar is collapsed */
 .user-content.sidebar-collapsed {
    margin-left: 0;
    width: 100vw;
  }

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .sidebar-toggle-btn {
        display: none !important;
    }
    
    .sidebar {
        display: none !important;
    }
    
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar,
.mobile-sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.mobile-sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.sidebar::-webkit-scrollbar-thumb,
.mobile-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.mobile-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Content scrollbar styling */
.user-content::-webkit-scrollbar {
    width: 8px;
}

.user-content::-webkit-scrollbar-track {
    background: transparent;
}

.user-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.user-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Fix Bootstrap container issues */
.container-fluid {
    padding: 0 !important;
    max-width: 100% !important;
    overflow: hidden;
}

.container-fluid > main {
    padding: 0 !important;
}

/* Disable transitions for initial load */
.sidebar-transition-disabled {
    transition: none !important;
}



.card, .row, .col-12 {
    max-width: 100%;
    box-sizing: border-box;
}

