/* 
 * Production Management Portal - Custom Styles
 * Light Blue Theme - Updated May 9, 2025
 * Custom styling for enhancing the UI beyond Bootstrap defaults
 */

/* General Styles */
body {
    background-color: #f0f8ff;  /* Very light blue background */
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    color: #2c3e50; /* Darker text for better contrast on light blue */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

:root {
    --primary-light-blue: #1e90ff;
    --secondary-light-blue: #87cefa;
    --accent-light-blue: #add8e6;
    --hover-light-blue: #e3f2fd;
    --card-border-blue: #b3e0ff;
}

/* Enhanced Navbar Styling */
.navbar-enhanced {
    background: linear-gradient(135deg, rgba(30, 144, 255, 0.9) 0%, rgba(100, 181, 246, 0.85) 100%) !important; /* Light blue gradient */
    backdrop-filter: blur(10px); /* Increased blur for depth */
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.1), 0 6px 20px 0 rgba(30, 144, 255, 0.15); /* Enhanced layered shadow */
    transition: all 0.3s ease;
    z-index: 1030; /* Ensure navbar stays above other elements */
    position: fixed; /* Make navbar fixed */
    top: 0; /* Position at the top */
    left: 0;
    right: 0; /* Stretch across full width */
    width: 100%; /* Ensure full width */
}

.navbar-enhanced .navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    padding: 0.5rem 0;
    letter-spacing: 0.5px;
    transition: all 0.3s ease-in-out;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.navbar-enhanced .navbar-brand:hover {
    transform: scale(1.05);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.navbar-enhanced .navbar-brand i {
    color: #ffe600;
}

.navbar-enhanced .nav-item {
    position: relative;
    margin: 0 0.25rem;
}

.navbar-enhanced .nav-link {
    position: relative;
    padding: 0.7rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.navbar-enhanced .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Updated navbar toggler for better mobile experience */
.navbar-enhanced .navbar-toggler {
    border: none;
    padding: 0.5rem;
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.navbar-enhanced .navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

.navbar-enhanced .navbar-toggler:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar-enhanced .dropdown-menu {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
    padding: 0.7rem 0;
    transition: all 0.3s ease;
}

.navbar-enhanced .dropdown-item {
    padding: 0.7rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar-enhanced .dropdown-item:hover {
    background-color: rgba(78, 115, 223, 0.1);
    color: #4e73df;
}

.navbar-enhanced .dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

/* Animated User Avatar */
.navbar-enhanced .user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-enhanced .user-avatar:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Left Sidebar Layout Styles */
.wrapper {
    min-height: calc(100vh - 56px);
    display: flex;
    position: relative;
    margin-top: 56px; /* Add margin to account for fixed navbar */
    padding-top: 1rem; /* Add some breathing room */
}

.sidebar {
    width: 250px;
    min-height: calc(100vh - 56px);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    position: fixed;
    top: 56px;
    left: 0;
    padding-top: 1.5rem;
    z-index: 1000; /* Increased z-index for proper stacking */
    background-color: #e3f2fd !important; /* Light blue sidebar background */
    border-right: 1px solid #b3e0ff;
    transition: all 0.3s ease; /* Smooth transition for sidebar collapse/expand */
    overflow-y: auto; /* Allow scrolling for tall sidebars */
}

.sidebar .nav-item {
    position: relative;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link {
    padding: 0.85rem 1.5rem;
    color: #333;
    font-weight: 600;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background-color: rgba(30, 144, 255, 0.1);
    border-left-color: rgba(30, 144, 255, 0.5);
}

.sidebar .nav-link.active {
    background-color: rgba(30, 144, 255, 0.15);
    border-left-color: #1e90ff;
    color: #1e90ff;
}

.sidebar .nav-link i {
    opacity: 0.75;
    width: 1.5rem;
    text-align: center;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.content-area {
    margin-left: 250px;
    flex: 1;
    padding: 1.5rem;
    transition: margin-left 0.3s ease; /* Smooth transition when sidebar is toggled */
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: fixed;
    left: 250px; /* Positioned at edge of expanded sidebar */
    top: 70px;
    background: #1e90ff;
    color: white;
    border-radius: 0 4px 4px 0;
    width: 24px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 999;
    border: none;
}

.sidebar-collapsed .sidebar-toggle {
    left: 0;
}

/* Collapsed sidebar state */
.sidebar-collapsed .sidebar {
    left: -250px;
}

.sidebar-collapsed .content-area {
    margin-left: 0;
}

/* Mobile overlay backdrop when sidebar is open */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Improved Responsive adjustments for small screens */
@media (max-width: 991px) {
    .sidebar {
        left: -280px; /* Start with hidden sidebar on mobile - slightly wider for better content display */
        width: 280px; /* Wider sidebar on mobile for better readability */
        top: 0; /* Full height sidebar */
        height: 100vh;
        padding-top: 60px; /* Space for navbar */
        z-index: 1050; /* Above navbar on mobile */
        box-shadow: 0 0 15px rgba(0, 0, 0, 2);
    }
    
    .sidebar.mobile-open {
        left: 0;
        animation: slideInLeft 0.3s forwards;
    }
    
    .content-area {
        margin-left: 0;
        width: 100%;
        transition: filter 0.3s ease;
    }
    
    body.sidebar-open .content-area {
        filter: blur(3px);
        pointer-events: none;
    }
    
    .sidebar-toggle {
        left: 0; /* Position toggle button at edge of screen */
        top: 70px;
        z-index: 1040; /* Below sidebar but above content */
    }
    
    /* Show backdrop when sidebar is open on mobile */
    .sidebar-backdrop.show {
        display: block;
        opacity: 1;
        visibility: visible;
    }
    
    /* Ensure navbar stays on top */
    .navbar-enhanced {
        z-index: 1050;
    }
    
    /* Improved dropdown menu for mobile */
    .navbar-enhanced .dropdown-menu {
        border-radius: 0.25rem;
        margin-top: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
    }
    
    /* Better touch targets for nav items */
    .navbar-enhanced .nav-link {
        padding: 0.75rem 1rem;
    }
    
    /* Enhance sidebar header for mobile */
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #b3e0ff;
    }
    
    .sidebar-header h5 {
        margin-bottom: 0;
        color: var(--primary-light-blue);
    }
    
    .sidebar-close {
        background: transparent;
        border: none;
        color: #666;
        font-size: 1.25rem;
    }
    
    /* Larger touch targets for sidebar items on mobile */
    .sidebar .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* Animation for mobile sidebar */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Touch-friendly sidebar adjustments */
@media (hover: none) and (pointer: coarse) {
    .sidebar .nav-link {
        padding: 0.875rem 1.5rem; /* Larger touch targets */
    }
    
    .sidebar .nav-item {
        margin-bottom: 0.5rem;
    }
}

/* Responsive Font Sizes */
@media (max-width: 768px) {
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    .navbar-enhanced .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Hide text labels on very small screens */
    @media (max-width: 360px) {
        .navbar-enhanced .d-sm-none {
            display: none !important;
        }
    }
    
    /* Better navbar spacing on very small screens */
    .navbar-enhanced {
        padding: 0.6rem 1rem;
    }
}

/* Additional mobile enhancements */
@media (max-width: 576px) {
    .content-area {
        padding: 1rem 0.75rem;
    }
    
    /* Stack buttons on small mobile screens */
    .btn-group-responsive {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group-responsive .btn {
        margin-bottom: 0.5rem;
        border-radius: 0.25rem !important;
    }
}

/* Rest of the CSS file remains the same */

/* Enhanced Navbar Styling */
.navbar-enhanced .dropdown-menu {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
    padding: 0.7rem 0;
    transition: all 0.3s ease;
}

.navbar-enhanced .dropdown-item {
    padding: 0.7rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar-enhanced .dropdown-item:hover {
    background-color: rgba(78, 115, 223, 0.1);
    color: #4e73df;
}

.navbar-enhanced .dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

/* Animated User Avatar */
.navbar-enhanced .user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-enhanced .user-avatar:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Left Sidebar Layout Styles */
.wrapper {
    min-height: calc(100vh - 56px);
    display: flex;
    position: relative;
    margin-top: 56px; /* Add margin to account for fixed navbar */
    padding-top: 1rem; /* Add some breathing room */
}

.sidebar {
    width: 250px;
    min-height: calc(100vh - 56px);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    position: fixed;
    top: 56px;
    left: 0;
    padding-top: 1.5rem;
    z-index: 1000; /* Increased z-index for proper stacking */
    background-color: #e3f2fd !important; /* Light blue sidebar background */
    border-right: 1px solid #b3e0ff;
    transition: all 0.3s ease; /* Smooth transition for sidebar collapse/expand */
    overflow-y: auto; /* Allow scrolling for tall sidebars */
}

.sidebar .nav-item {
    position: relative;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link {
    padding: 0.85rem 1.5rem;
    color: #333;
    font-weight: 600;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background-color: rgba(30, 144, 255, 0.1);
    border-left-color: rgba(30, 144, 255, 0.5);
}

.sidebar .nav-link.active {
    background-color: rgba(30, 144, 255, 0.15);
    border-left-color: #1e90ff;
    color: #1e90ff;
}

.sidebar .nav-link i {
    opacity: 0.75;
    width: 1.5rem;
    text-align: center;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.content-area {
    margin-left: 250px;
    flex: 1;
    padding: 1.5rem;
    transition: margin-left 0.3s ease; /* Smooth transition when sidebar is toggled */
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: fixed;
    left: 250px; /* Positioned at edge of expanded sidebar */
    top: 70px;
    background: #1e90ff;
    color: white;
    border-radius: 0 4px 4px 0;
    width: 24px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 999;
    border: none;
}

.sidebar-collapsed .sidebar-toggle {
    left: 0;
}

/* Collapsed sidebar state */
.sidebar-collapsed .sidebar {
    left: -250px;
}

.sidebar-collapsed .content-area {
    margin-left: 0;
}

/* Mobile overlay backdrop when sidebar is open */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive adjustments for small screens */
@media (max-width: 991px) {
    .sidebar {
        left: -250px; /* Start with hidden sidebar on mobile */
    }
    
    .sidebar.mobile-open {
        left: 0; /* Show sidebar when mobile-open class is present */
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }
    
    .content-area {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-toggle {
        left: 0; /* Position toggle button at edge of screen */
        top: 70px;
    }
    
    /* Show backdrop when sidebar is open on mobile */
    .sidebar-backdrop.show {
        display: block;
    }
    
    /* Ensure navbar stays on top */
    .navbar-enhanced {
        z-index: 1050;
    }
}

/* Animation for mobile sidebar */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@media (max-width: 991px) {
    .sidebar.mobile-open {
        animation: slideInLeft 0.3s forwards;
    }
}

/* Responsive adjustments for small screens */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
        min-height: auto;
        margin-bottom: 1rem;
    }

    .content-area {
        margin-left: 0;
    }

    .wrapper {
        flex-direction: column;
    }
}

/* Card Enhancements */
.card {
    border: none;
    border-radius: 0.35rem;
    border-top: 3px solid var(--card-border-blue);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    background-color: white;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 2rem 0 rgba(30, 144, 255, 0.2);
}

.card-header {
    background-color: #e3f2fd;
    border-bottom: 1px solid #b3e0ff;
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: #1e90ff;
}

.card-footer {
    background-color: #f8fcff;
    border-top: 1px solid #b3e0ff;
}

/* Border Left Cards for Dashboard Stats */
.border-left-primary {
    border-left: 0.25rem solid #1e90ff !important; /* Light blue */
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-danger {
    border-left: 0.25rem solid #e74a3b !important;
}

/* Text Colors */
.text-primary {
    color: #1e90ff !important; /* Light blue */
}

.text-success {
    color: #1cc88a !important;
}

.text-info {
    color: #36b9cc !important;
}

.text-warning {
    color: #f6c23e !important;
}

.text-danger {
    color: #e74a3b !important;
}

/* Navbar Customization */
.navbar-dark.bg-primary {
    background: linear-gradient(135deg, #1e90ff 0%, #64b5f6 100%) !important; /* Light blue gradient */
}

/* Login Page Enhancements */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* Table Enhancements */
.table-hover tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.05);
}

/* Form Control Focus */
.form-control:focus {
    border-color: #87cefa;
    box-shadow: 0 0 0 0.2rem rgba(30, 144, 255, 0.25);
}

.input-group-text {
    background-color: #e3f2fd;
    border-color: #b3e0ff;
    color: #2c3e50;
}

.btn-primary {
    background-color: #1e90ff;
    border-color: #1e90ff;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #187bcd;
    border-color: #187bcd;
    box-shadow: 0 0 0 0.2rem rgba(30, 144, 255, 0.25);
}

.btn-outline-primary {
    color: #1e90ff;
    border-color: #1e90ff;
}

.btn-outline-primary:hover {
    background-color: #1e90ff;
    color: white;
}

/* Responsive Font Sizes */
@media (max-width: 768px) {
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
}

/* Footer Styling */
.footer {
    position: relative;
    margin-top: 2rem;
    background-color: #e3f2fd !important; /* Light blue footer */
}

/* Progress Bar Animations */
.progress-bar {
    transition: width 1s ease-in-out;
    background-color: #1e90ff; /* Light blue progress bar */
}

/* Custom Badge Styles */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

.badge-primary {
    background-color: #1e90ff;
}

.badge-secondary {
    background-color: #87cefa;
    color: #2c3e50;
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 0.5rem;
}

.modal-header {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    background-color: #f8f9fc;
}

/* Dashboard Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Add Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background-color: #1a1a1a;
        color: #e1e1e1;
    }
    
    body.dark-mode .card {
        background-color: #2a2a2a;
        box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.3);
    }
    
    body.dark-mode .card-header {
        background-color: #333;
        border-bottom-color: #444;
    }
    
    body.dark-mode .table {
        color: #e1e1e1;
    }
    
    body.dark-mode .table-hover tbody tr:hover {
        background-color: rgba(78, 115, 223, 0.1);
    }
    
    body.dark-mode .modal-content {
        background-color: #2a2a2a;
        color: #e1e1e1;
    }
    
    body.dark-mode .modal-header {
        background-color: #333;
        border-bottom-color: #444;
    }
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #333;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: background-color 0.3s;
}

.dark-mode-toggle:hover {
    background-color: #555;
}

/* Custom Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(78, 115, 223, 0.25);
    border-top-color: #4e73df;
    border-radius: 50%;
    animation: spinner 0.75s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Tables with Light Blue Theme */
.table thead th {
    background-color: #e3f2fd;
    border-bottom: 2px solid #b3e0ff;
    color: #2c3e50;
}

.table-hover tbody tr:hover {
    background-color: #f0f8ff;
}

.table-bordered {
    border: 1px solid #b3e0ff;
}

.table-bordered td, .table-bordered th {
    border: 1px solid #b3e0ff;
}

/* Badges and Alerts with Light Blue Theme */
.alert-primary {
    color: #004085;
    background-color: #cce5ff;
    border-color: #b8daff;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Pagination with Light Blue Theme */
.page-item.active .page-link {
    background-color: #1e90ff;
    border-color: #1e90ff;
}

.page-link {
    color: #1e90ff;
}

.page-link:hover {
    color: #0056b3;
    background-color: #e3f2fd;
}

/* Dashboard Stats Cards */
.stat-card {
    border-left: 4px solid #1e90ff;
    background: linear-gradient(135deg, white 0%, #f8fcff 100%);
}

.stat-card .stat-icon {
    color: #1e90ff;
    opacity: 0.8;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(30, 144, 255, 0.15);
}

/* Custom Scrollbar for Light Blue Theme */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f0f8ff;
}

::-webkit-scrollbar-thumb {
    background: #87cefa;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1e90ff;
}

/* Mobile sidebar improvements */
.sidebar {
    transition: all 0.3s ease-in-out;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        overflow-y: auto;
        padding-top: 60px;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        background-color: #fff;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .content-area {
        transition: margin-left 0.3s ease-in-out;
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1049;
        display: none;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
    
    .sidebar-toggle {
        position: fixed;
        top: 70px;
        left: 0;
        width: 40px;
        height: 40px;
        background-color: #1e90ff;
        color: white;
        border: none;
        border-radius: 0 4px 4px 0;
        z-index: 1040;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
        transition: all 0.2s ease-in-out;
    }
    
    .sidebar-toggle:hover {
        background-color: #0066cc;
    }
    
    /* Adjust main content when sidebar is open */
    body.sidebar-open .content-area {
        filter: blur(2px);
        pointer-events: none;
    }
}

/* Dark mode adjustments for sidebar */
.dark-mode .sidebar {
    background-color: #2c3e50;
    color: #ecf0f1;
}

.dark-mode .sidebar .nav-link {
    color: #ecf0f1;
}

.dark-mode .sidebar .nav-link:hover,
.dark-mode .sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .sidebar-toggle {
    background-color: #3498db;
}

.dark-mode .sidebar-toggle:hover {
    background-color: #2980b9;
}

/* Touch-friendly sidebar adjustments */
@media (hover: none) and (pointer: coarse) {
    .sidebar .nav-link {
        padding: 0.75rem 1rem;  /* Larger touch targets */
    }
    
    .sidebar .nav-item {
        margin-bottom: 0.5rem;
    }
}

/* Mobile Sidebar Enhancement */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -280px; /* Slightly wider to avoid text cutoff */
        top: 0;
        height: 100%;
        width: 280px;
        z-index: 1050;
        background-color: #fff;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
    }
    
    .sidebar.mobile-open {
        transform: translateX(280px);
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    
    .sidebar-toggle {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1030;
        width: 40px;
        height: 40px;
        border-radius: 4px;
        background: #007bff;
        color: white;
        border: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 18px;
    }

    /* Add padding to main content when using fixed sidebar button */
    .main-content {
        padding-top: 55px !important;
    }
    
    body.sidebar-open {
        overflow: hidden; /* Prevent scrolling when sidebar is open */
    }
    
    /* Enhance sidebar menu items for touch targets */
    .sidebar .nav-link {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    /* Add close button inside sidebar */
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px;
        border-bottom: 1px solid #eee;
    }
    
    .sidebar-close {
        font-size: 20px;
        background: transparent;
        border: none;
        color: #333;
        cursor: pointer;
    }
}