* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    /* Background color changed to a softer gradient */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Enhanced Layout Components */
.main-wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
    position: relative;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
    min-height: 0; /* Allow proper scrolling */
    width: 100%;
    /* Enhanced Sidebar Integration with Content */
    margin-left: 260px;
    transition: margin-left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper.expanded {
    margin-left: 70px;
}

/* Header adjustments to ensure full width */
.header {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar.collapsed + .content-wrapper {
    margin-left: 80px;
}

/* Sidebar Styles - Enhanced design */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    /* Updated background gradient for better contrast */
    background: linear-gradient(135deg, #1e2a38 0%, #12151e 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
    transition: all 0.3s ease;
    border-radius: 0 24px 24px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    width: 60px;
    height: 60px;
    /* Enhanced logo styling with 3D effect */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 
                inset 0 2px 3px rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(30deg); }
    20%, 100% { transform: translateX(100%) rotate(30deg); }
}

.nav-section {
    margin-bottom: 1rem; /* Reduced spacing for tablets */
    flex-grow: 0; /* Changed from 1 to 0 - no equal distribution */
    flex-shrink: 0; /* Don't shrink sections */
    display: block; /* Changed from flex to block for top-to-bottom flow */
}

/* Ensure first nav-section starts at top without margin */
.nav-container > .nav-item:first-child,
.nav-container > .nav-section:first-child {
    margin-top: 0;
    padding-top: 0;
}

.nav-section-title {
    font-size: 0.65rem; /* Reduced for tablets */
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.8px; /* Slightly reduced letter spacing */
    margin-bottom: 0.3rem; /* Reduced margin for tablets */
    padding: 0 0.4rem; /* Reduced padding for tablets */
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Fix sidebar navigation list item display */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
    position: relative;
    border-radius: 10px;
    transition: all 0.3s ease;
    /* Better hover transitions for nav items */
    position: relative;
    transition: all 0.3s ease;
}

/* Improved animations for sidebar elements */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Add fade-in animation to elements when sidebar expands from collapsed state */
.sidebar.collapsed:hover .nav-text,
.sidebar.collapsed:hover .nav-section-title,
.sidebar.collapsed:hover .user-info {
    animation: fadeIn 0.3s ease forwards;
}

/* Smooth transition for menu elements on hover */
.nav-link {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

/* Improved hover and active states */
.nav-item:hover {
    background: rgba(102, 126, 234, 0.15);
}

.nav-item:hover .nav-link {
    color: white;
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.nav-item.active .nav-link {
    color: white;
}

/* Remove the previous active state styling that was directly on .nav-link */
.nav-link:hover,
.nav-item.active .nav-link {
    background: transparent; /* Remove background that was causing overlap */
    box-shadow: none;
    transform: translateX(5px);
}

.nav-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.2);
}

.nav-indicator {
    position: absolute;
    right: 1rem;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-item.active .nav-indicator {
    opacity: 1;
}

/* Add subtle hover effect for sidebar */
.sidebar:hover .nav-item:not(:hover):not(.active) .nav-link {
    opacity: 0.7;
}

/* Mobile responsive sidebar improvements */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        border-radius: 0;
        width: 240px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Mobile sidebar enhancements */
@media (max-width: 1024px) {
    /* Prevent content scrolling when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
    
    /* Ensure the toggle button is clearly visible and clickable */
    .sidebar-toggle {
        width: 40px;
        height: 40px;
        background: rgba(102, 126, 234, 0.15);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        cursor: pointer;
        z-index: 10;
    }
    
    .sidebar-toggle:hover,
    .sidebar-toggle:focus {
        background: rgba(102, 126, 234, 0.25);
    }
    
    .sidebar-toggle.active {
        background: rgba(102, 126, 234, 0.3);
        color: #5661b3;
    }
    
    .sidebar-toggle i {
        font-size: 1.1rem;
        transition: transform 0.3s ease;
    }
    
    .sidebar-toggle.active i {
        transform: rotate(90deg);
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85%; /* Use percentage for better adaptability */
        max-width: 280px;
    }
    
    .sidebar-toggle {
        width: 36px;
        height: 36px;
    }
}

.sidebar-footer {
    position: relative; /* Changed from sticky to relative */
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 1rem; /* Added margin instead of auto */
}

.user-profile-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-sidebar {
    min-width: 40px; /* Added min-width */
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden; /* Add this to contain the image */
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow text truncation */
    flex: 1;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.user-action-btn {
    flex: 1;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.user-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.user-action-btn.logout:hover {
    background: rgba(255, 71, 87, 0.3);
    color: #ff4757;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* Enhanced Modern Header - More Responsive */
.main-header {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-bottom: none;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
    border-radius: 0 0 16px 16px;
    margin: 0 1rem 1rem 1rem;
    transition: all 0.3s ease;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0; /* Allow text truncation */
}

.sidebar-toggle {
    background: rgba(102, 126, 234, 0.15);
    border: none;
    padding: 0.7rem;
    border-radius: 10px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(102, 126, 234, 0.25);
    transform: rotate(90deg);
}

.sidebar-toggle.active {
    background: rgba(102, 126, 234, 0.3);
    color: #5661b3;
}

.page-title {
    min-width: 0; /* Allow text truncation */
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2b2d42;
    margin: 0;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-title p {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* More Responsive Date & Time Display */
.datetime-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.datetime-display {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    color: #2b2d42;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

#currentDate, #currentTime {
    font-size: 0.85rem;
    color: #555;
}

.datetime-divider {
    margin: 0 0.6rem;
    color: #aaa;
    font-weight: 300;
}

/* Header Right Section - More Compact */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.quick-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    color: #555;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background: #e9ecef;
    color: #2b2d42;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

/* Improved User Profile Button */
.user-profile-dropdown {
    position: relative;
}

.user-profile-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 0.45rem;
    border-radius: 8px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 36px;
}

/* Enhanced Modern Footer - More Compact for Small Screens */
.main-footer {
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    border-top: none;
    padding: 0.75rem 1.5rem;
    margin-top: auto;
    border-radius: 16px 16px 0 0;
    margin: 1rem 1rem 0 1rem;
    transition: all 0.3s ease;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.footer-left p {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}

.footer-version {
    font-size: 0.7rem !important;
    opacity: 0.7;
    color: #999 !important;
}

.footer-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

/* Mobile Responsive Improvements */
@media (max-width: 1024px) {
    .header-container {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .datetime-display {
        width: 100%;
        justify-content: center;
        padding: 0.4rem 0.8rem;
    }
    
    .main-header, .main-footer {
        margin: 0;
        border-radius: 0;
        padding: 0.6rem 1rem;
    }
    
    .page-title h1 {
        font-size: 1.3rem;
    }
    
    .page-title p {
        font-size: 0.8rem;
    }
    
    .status-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        gap: 0.5rem;
    }
    
    .header-left {
        flex: 1;
    }
    
    .page-title h1 {
        font-size: 1.1rem;
    }
    
    .page-title p {
        display: none;
    }
    
    .quick-btn, .user-profile-btn {
        width: 32px;
        height: 32px;
    }
    
    .sidebar-toggle {
        width: 36px;
        height: 36px;
        padding: 0.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .footer-center {
        width: 100%;
        justify-content: center;
    }
    
    .footer-left, .footer-right {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    .footer-version {
        display: none;
    }
    
    .system-status {
        padding: 0.3rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .datetime-container {
        display: none;
    }
    
    .header-container {
        justify-content: space-between;
    }
    
    .quick-actions {
        gap: 0.3rem;
    }
    
    .system-status {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .status-indicator {
        width: 6px;
        height: 6px;
    }
}

/* Make readonly fields have a darker background */
.form-control[readonly],
input[readonly],
textarea[readonly],
select[disabled],
.invoice-table input[readonly] {
    background-color: #e9ecef !important;  /* Darker background */
    color: #495057;                        /* Slightly darker text */
    border-color: #ced4da;
    cursor: not-allowed;
    box-shadow: none;
}

.invoice-table input[readonly] {
    background-color: #e9ecef !important;  /* Ensure table inputs match other readonly inputs */
}

/* Style readonly fields in modal forms */
.modal-content input[readonly],
.modal-content select[disabled],
.modal-content textarea[readonly] {
    background-color: #e9ecef !important;
}

/* Remove lightgrey inline styles if present */
input[style*="background-color: lightgrey"],
select[style*="background-color: lightgrey"],
textarea[style*="background-color: lightgrey"] {
    background-color: #e9ecef !important;
}

/* User Profile in Sidebar Footer - Update for profile images */
.user-avatar-sidebar {
    min-width: 40px; /* Added min-width */
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden; /* Add this to contain the image */
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Professional User Profile Button - Update for profile images */
.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    overflow: hidden; /* Add this to contain the image */
}

/* Improved responsive sidebar handling */
@media (max-width: 1366px) {
    .logo-icon {
        width: 50px;
        height: 50px;
        font-size: 1.75rem;
    }
    
    .nav-link {
        padding: 0.7rem 1rem;
    }
    
    .user-avatar-sidebar {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .sidebar-header {
        padding: 0.75rem 0;
        margin-bottom: 1rem;
    }
    
    .sidebar-footer {
        padding: 0.75rem 1rem;
    }
}

@media (max-height: 768px) {
    .nav-item {
        margin-bottom: 0.3rem;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
    }
    
    .nav-section-title {
        margin-bottom: 0.5rem;
    }
    
    .sidebar-header {
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
    }
    
    .logo-icon {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
}

/* Fix sidebar layout to prevent scrollbar issues */
.sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Add enhanced tablet/mobile responsive adjustments for sidebar */
@media (max-width: 1200px) {
    /* Sidebar layout adjustments for tablets */
    .sidebar .nav-link {
        padding: 0.6rem 1rem;
        gap: 0.8rem; /* Reduce gap between icon and text */
    }
    
    .sidebar .nav-section-title {
        margin-bottom: 0.3rem; /* Further reduced for tablets */
        font-size: 0.6rem; /* Smaller font for tablet screens */
    }
    
    .sidebar .nav-item {
        margin-bottom: 0.2rem;
    }
    
    /* Make sure user profile container doesn't overflow */
    .user-profile-container {
        gap: 0.5rem;
    }
    
    .sidebar-footer {
        padding: 0.8rem;
    }
    
    /* Adjust logo size */
    .logo-icon {
        width: 45px;
        height: 45px;
        font-size: 1.75rem;
    }
    
    /* Prevent text overflow */
    .nav-text-container {
        min-width: 0;
        overflow: hidden;
    }
    
    .nav-text-primary, .nav-text-secondary {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Additional smaller screen adjustments */
@media (max-width: 992px) {
    .sidebar .nav-link {
        padding: 0.5rem 0.8rem;
        gap: 0.6rem;
    }
    
    .nav-icon {
        width: 18px; /* Slightly smaller icons */
    }
    
    .user-avatar-sidebar {
        width: 36px;
        height: 36px;
        min-width: 36px; /* Ensure minimum width */
    }
}

/* Fix content wrapper margins */
@media (max-width: 1024px) {
    .content-wrapper {
        margin-left: 0;
    }
    
    .sidebar.collapsed + .content-wrapper {
        margin-left: 0;
    }
    
    /* Ensure main content areas are properly padded on mobile */
    .main-content {
        padding: 1rem;
    }
    
    .content-container {
        padding: 0 1rem 1rem;
    }
}

/* Smaller screen content adjustments */
@media (max-width: 768px) {
    .main-content {
        padding: 0.75rem;
    }
    
    .content-container {
        padding: 0 0.75rem 0.75rem;
    }
}

/* Very small screen content adjustments */
@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .content-container {
        padding: 0 0.5rem 0.5rem;
    }
}

body.dark-theme .card-header,
body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: #3a3b3c;
    background-color: #18191a;
}

body.dark-theme .card-title,
body.dark-theme .modal-title,
body.dark-theme .page-title h1 {
    color: #e4e6eb;
}

/* Dark theme for inputs and selects */
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .form-control {
    background-color: #3a3b3c;
    border-color: #4e4f50;
    color: #e4e6eb;
}

body.dark-theme input:focus,
body.dark-theme select:focus,
body.dark-theme textarea:focus,
body.dark-theme .form-control:focus {
    background-color: #4e4f50;
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Dark theme for tables */
body.dark-theme table,
body.dark-theme .invoice-table {
    background-color: #242526;
    color: #e4e6eb;
}

body.dark-theme .invoice-table th {
    background-color: #18191a;
    color: #b0b3b8;
    border-color: #3a3b3c;
}

body.dark-theme .invoice-table td {
    border-color: #3a3b3c;
}

body.dark-theme .invoice-table tr:nth-child(even) {
    background-color: #18191a;
}

body.dark-theme .invoice-table tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* Dark theme for header elements */
body.dark-theme .datetime-display {
    background-color: #3a3b3c;
    border-color: #4e4f50;
}

body.dark-theme #currentDate,
body.dark-theme #currentTime,
body.dark-theme .datetime-divider {
    color: #b0b3b8;
}

body.dark-theme .quick-btn,
body.dark-theme .user-profile-btn {
    background-color: #3a3b3c;
    border-color: #4e4f50;
    color: #b0b3b8;
}

body.dark-theme .quick-btn:hover,
body.dark-theme .user-profile-btn:hover {
    background-color: #4e4f50;
    color: #e4e6eb;
}

/* Dark theme for user menu */
body.dark-theme .user-menu {
    background-color: #242526;
    border-color: #3a3b3c;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

body.dark-theme .user-menu-item {
    color: #b0b3b8;
}

body.dark-theme .user-menu-item:hover {
    background-color: #3a3b3c;
    color: #e4e6eb;
}

body.dark-theme .user-menu-divider {
    border-color: #3a3b3c;
}

/* Dark theme readability improvements */
body.dark-theme .page-subtitle,
body.dark-theme .text-muted {
    color: #b0b3b8 !important;
}

body.dark-theme .footer-left p {
    color: #b0b3b8;
}

/* Responsive dark theme adjustments */
@media (max-width: 768px) {
    body.dark-theme .card-body {
        padding: 1rem;
    }
}

/* Fix layout misalignment issues */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
    position: relative;
}

/* Fix content wrapper margins and padding */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
    min-height: 0; /* Allow proper scrolling */
    width: 100%;
}

.content-wrapper.expanded {
    margin-left: 70px;
}

/* Mobile layout fixes */
@media (max-width: 1024px) {
    .content-wrapper {
        margin-left: 0;
    }
    
    .content-wrapper.expanded {
        margin-left: 0;
    }
}

/* Fix main content area */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Fixed footer placement */
.main-footer {
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1.5rem;
    margin-top: auto; /* Push to bottom */
    z-index: 998;
    position: relative;
}

/* Fix header positioning */
.main-header {
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;
}

/* Fix sidebar responsive issues */
@media (max-width: 1024px) {
    body.sidebar-open {
        overflow: hidden;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        visibility: hidden;
        opacity: 0;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        visibility: visible;
        opacity: 1;
    }
}

/* Fix mobile sidebar overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sidebar-overlay.show {
    visibility: visible;
    opacity: 1;
}

/* Enhance toggle button */
.sidebar-toggle {
    /* Improve the clickable area */
    min-width: 40px;
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* Reset any inherited styles that might interfere */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Fixed header settings for mobile */
@media (max-width: 1024px) {
    .main-header {
        position: sticky;
        top: 0;
        z-index: 999;
    }
    
    /* Ensure toggle button is clearly visible and properly sized */
    .sidebar-toggle {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Fix modal display issues */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050; /* Increased z-index */
    display: none;
    overflow: auto;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040; /* Lower z-index than modal content */
}

.modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    padding: 20px;
    width: 90%;
    max-width: 800px;
    margin: 30px auto;
    z-index: 1060; /* Higher z-index than backdrop */
    transition: all 0.3s ease;
}

/* Ensure proper stacking context for nested modals */
.modal-content form,
.modal-content .form-group,
.modal-content input,
.modal-content select,
.modal-content textarea,
.modal-content button {
    position: relative;
    z-index: 1070; /* Higher z-index than modal content */
}

/* Make sure modal content appears properly on top in dark theme */
body.dark-theme .modal-content {
    background-color: #242526;
    border-color: #3a3b3c;
}

/* Fix modal display on mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 15px;
    }
}

/* Fix for GST modal display */
.gst-modal .modal-content {
    position: relative;
    z-index: 1060; /* Ensure it's above backdrop */
}

.gst-modal .modal-content form,
.gst-modal .modal-content .gst-details-content,
.gst-modal .modal-footer {
    position: relative;
    z-index: 1070;
}
