/* Base styles */
body {
    min-height: 100vh;
    background-color: #f8f9fa;
    color: #212529;
}

/* Layout */
.wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 100px;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sidebar */
.sidebar {
    width: 250px;
    position: fixed;
    top: 100px;
    left: 0;
    height: calc(100vh - 100px);
    z-index: 999;
    background: #ffffff;
    border-right: 1px solid #dee2e6;
    transition: all 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
}

.sidebar.active {
    transform: translateX(0);
}

/* Mobile-specific sidebar styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
        z-index: 1050;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    /* Content area adjustments for mobile */
    #content {
        margin-left: 0 !important;
    }
    
    #content.active {
        margin-left: 0 !important;
    }
    
    /* Overlay for mobile */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 250px;
        width: calc(100vw - 250px);
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    /* Auto Ordering Mobile Optimizations */
    .auto-order-card {
        margin-bottom: 1rem;
    }
    
    .auto-order-product-card {
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 10px;
        background: #f8f9fa;
    }
    
    .auto-order-product-header {
        font-weight: bold;
        font-size: 14px;
        color: #495057;
        margin-bottom: 8px;
        border-bottom: 1px solid #dee2e6;
        padding-bottom: 4px;
    }
    
    .auto-order-product-details {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
    }
    
    .auto-order-detail-item {
        background: white;
        padding: 4px 8px;
        border-radius: 4px;
        border: 1px solid #e9ecef;
        min-width: fit-content;
    }
    
    .auto-order-quantity-input {
        max-width: 80px;
        margin: 8px 0;
    }
    
    /* Mobile-friendly table alternatives */
    .mobile-table-card {
        display: none !important;
    }
    
    .desktop-table {
        display: block !important;
    }
    
    /* Auto order product cards should be hidden */
    .auto-order-product-card {
        display: none !important;
    }
    
    /* Mobile form improvements */
    .mobile-form-row {
        margin-bottom: 8px;
    }
    
    .mobile-label {
        font-weight: 600;
        font-size: 11px;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
    }
    
    /* Compact button styles for mobile */
    .btn-mobile-compact {
        padding: 4px 8px;
        font-size: 12px;
        line-height: 1.2;
    }
    
    /* Auto-order specific mobile styles */
    .auto-order-summary-mobile {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 2px solid #007bff;
        padding: 10px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }
    
    .auto-order-summary-mobile .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    /* Mobile date button improvements */
    .btn-group-vertical .btn {
        border-radius: 0;
    }
    
    .btn-group-vertical .btn:first-child {
        border-top-left-radius: 0.375rem;
        border-top-right-radius: 0.375rem;
    }
    
    .btn-group-vertical .btn:last-child {
        border-bottom-left-radius: 0.375rem;
        border-bottom-right-radius: 0.375rem;
    }
    
    /* Auto-order mobile pagination */
    .pagination-sm .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Fix for theme font colors on mobile auto ordering */
@media (max-width: 576px) {
    .auto-order-product-card {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .auto-order-product-header {
        font-size: 16px;
        line-height: 1.3;
    }
    
    .auto-order-detail-item {
        flex: 1 1 45%;
        min-width: 120px;
    }
    
    /* Better button spacing on mobile auto-order pages */
    .btn-group-vertical .btn + .btn {
        margin-top: -1px;
        border-top: 1px solid rgba(0,0,0,0.125);
    }
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-content {
    flex-grow: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
}

/* Sidebar Navigation */
.sidebar .nav-link {
    padding: 0.8rem 1.5rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .nav-link:hover {
    color: #212529;
    background: rgba(13, 110, 253, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background: #0d6efd;
}

/* User Info in Sidebar */
.user-info {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
}

.user-info small {
    opacity: 0.7;
}

/* Main Content */
#content {
    width: calc(100% - 250px);
    margin-left: 250px;
    margin-top: 100px;
    transition: all 0.3s;
    min-height: calc(100vh - 100px);
    background-color: #f8f9fa;
}

#content.active {
    width: 100%;
    margin-left: 0;
}

/* Navbar */
.navbar {
    padding: 1rem;
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
}

#sidebarCollapse {
    padding: 0.5rem;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -250px;
    }
    .sidebar.active {
        margin-left: 0;
    }
    #content {
        width: 100%;
        margin-left: 0;
        margin-top: 140px;
    }
    #content.active {
        width: calc(100% - 250px);
        margin-left: 250px;
        margin-top: 140px;
    }
}

/* Cards and other components */
.card {
    margin-bottom: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}

/* Analytics Dashboard Card Styling */
.border-left-primary {
    border-left: 4px solid #4e73df;
}

.border-left-success {
    border-left: 4px solid #1cc88a;
}

.border-left-info {
    border-left: 4px solid #36b9cc;
}

.border-left-warning {
    border-left: 4px solid #f6c23e;
}

.border-left-danger {
    border-left: 4px solid #e74a3b;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700;
}

.text-gray-300 {
    color: #dddfeb!important;
}

.text-primary {
    color: #4e73df!important;
}

.text-success {
    color: #1cc88a!important;
}

.text-info {
    color: #36b9cc!important;
}

.text-warning {
    color: #f6c23e!important;
}

.alert {
    margin-bottom: 1rem;
}

/* Form styles */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Icon styles */
.feather {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
}

/* Table styles */
.table {
    color: #212529;
}

/* Bootstrap-select customization */
.bootstrap-select .dropdown-menu {
    max-height: 300px !important;
}

.bootstrap-select .dropdown-menu .inner {
    max-height: 250px !important;
}

.bootstrap-select .dropdown-toggle {
    background-color: #fff;
    border: 1px solid #ced4da;
}

.bootstrap-select .dropdown-toggle:focus,
.bootstrap-select .dropdown-toggle:active {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    outline: none !important;
}

.bootstrap-select .dropdown-menu .bs-searchbox .form-control {
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

.bootstrap-select .dropdown-menu .bs-actionsbox .btn-group button {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.bootstrap-select .dropdown-menu .inner .dropdown-item.active, 
.bootstrap-select .dropdown-menu .inner .dropdown-item:active {
    background-color: #0d6efd;
    color: #fff;
}

.bootstrap-select .dropdown-menu .inner .dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark {
    color: #0d6efd;
}
/* Theme Switcher Styles */
:root {
    /* Define theme transition properties */
    --transition-speed: 0.3s;
    --transition-timing: ease-in-out;
}

/* Theme transition styles */
body {
    transition: background-color var(--transition-speed) var(--transition-timing),
                color var(--transition-speed) var(--transition-timing);
}

.sidebar,
.navbar,
.card,
.dropdown-menu,
.form-control,
.form-select,
.btn,
.alert,
.modal-content,
.table,
.bootstrap-select .dropdown-toggle {
    transition: background-color var(--transition-speed) var(--transition-timing),
                border-color var(--transition-speed) var(--transition-timing),
                color var(--transition-speed) var(--transition-timing),
                box-shadow var(--transition-speed) var(--transition-timing);
}

/* Dark theme adjustments - these will be applied when data-bs-theme="dark" */
[data-bs-theme="dark"] {
    --bs-body-bg: #212529;
    --bs-body-color: #f8f9fa;
}

[data-bs-theme="dark"] .sidebar {
    background: #2c3136;
    border-right: 1px solid #495057;
}

[data-bs-theme="dark"] .sidebar-header,
[data-bs-theme="dark"] .sidebar-footer {
    border-color: #495057;
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: #adb5bd;
}

[data-bs-theme="dark"] .sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .navbar {
    background: #2c3136;
    border-color: #495057;
}

[data-bs-theme="dark"] .card {
    background-color: #2c3136;
    border-color: #495057;
}

[data-bs-theme="dark"] .table {
    color: #f8f9fa;
}

/* Theme toggle button */
#theme-toggle {
    width: 40px;
    height: 40px;
    padding: 8px;
    transition: background-color 0.3s;
    position: relative;
}

#theme-toggle .feather {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s, transform 0.3s;
}

/* Burger menu button improvements */
#sidebarCollapse {
    border: none !important;
    padding: 0.5rem !important;
    color: #495057 !important;
    background: transparent !important;
    transition: all 0.3s ease;
}

#sidebarCollapse:hover {
    color: #0d6efd !important;
    background: rgba(13, 110, 253, 0.1) !important;
}

#sidebarCollapse:focus {
    box-shadow: none !important;
    outline: none !important;
}

/* Improve mobile navigation */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem !important;
    }
    
    #sidebarCollapse {
        font-size: 1.2rem !important;
    }
    
    /* Ensure sidebar is above all content on mobile */
    .sidebar {
        position: fixed !important;
        z-index: 1050 !important;
    }
}

/* Custom column width for 5 tiles per row */
@media (min-width: 1200px) {
    .col-lg-2-4,
    .col-xl-2-4 {
        flex: 0 0 auto;
        width: 20% !important; /* 5 tiles per row on large screens */
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .col-lg-2-4 {
        flex: 0 0 auto;
        width: 20% !important; /* 5 tiles per row on medium-large screens */
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .col-lg-2-4 {
        flex: 0 0 auto;
        width: 33.333333% !important; /* 3 tiles per row on medium screens */
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .col-lg-2-4 {
        flex: 0 0 auto;
        width: 50% !important; /* 2 tiles per row on small screens */
    }
}

@media (max-width: 575px) {
    .col-lg-2-4 {
        flex: 0 0 auto;
        width: 100% !important; /* 1 tile per row on extra small screens */
    }
}
}

#theme-toggle:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

[data-bs-theme="light"] #theme-toggle {
    color: #6c757d;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

[data-bs-theme="dark"] #theme-toggle {
    color: #f8f9fa;
    background: #343a40;
    border: 1px solid #495057;
}

/* Theme toggle button animation */
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rotate-icon {
    animation: rotate 0.5s ease-in-out;
}
