/* Reset and Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

html {
    height: 100%;
    width: 100%;
}

* {
    box-sizing: border-box;
}

/* Layout */
.app-layout {
    display: flow-root;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 2rem;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.sidebar-header p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.sidebar-nav {
    padding: 0 1rem;
}

.sidebar-nav-item {
    display: block;
    padding: 1rem 1rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-nav-item:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar-nav-item.active {
    background-color: rgba(255,255,255,0.2);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-nav-item i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav-divider {
    height: 1px;
    background-color: rgba(255,255,255,0.2);
    margin: 1rem 0;
    border: none;
}

.logout-btn {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: rgba(255,255,255,0.9);
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
}

.content-wrapper {
    padding: 2rem;
    max-width: none;
    width: 100%;
}

/* Responsive content padding */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }
}

.table-header {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 20px;
}

/* Mobile Layout */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
        background: #667eea;
        color: white;
        border: none;
        padding: 0.75rem;
        border-radius: 8px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        font-size: 1.2rem;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.open {
        display: block;
    }
}

/* Desktop sidebar toggle */
@media (min-width: 1025px) {
    .sidebar {
        transition: transform 0.3s ease;
    }

    .sidebar.collapsed {
        transform: translateX(-280px);
    }

    .main-content {
        transition: margin-left 0.3s ease;
    }

    .main-content.sidebar-collapsed {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
        background: #667eea;
        color: white;
        border: none;
        padding: 0.75rem;
        border-radius: 8px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        font-size: 1.2rem;
        transition: left 0.3s ease;
    }

    .mobile-menu-toggle.sidebar-collapsed {
        left: 1rem;
    }
}

.mobile-menu-toggle {
    display: none;
}

/* Header (now used for mobile only) */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none; /* Hidden on desktop, shown on mobile */
}

@media (max-width: 1024px) {
    .header {
        display: block;
    }

    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .header p {
        opacity: 0.9;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .nav {
        display: flex;
        gap: 1rem;
    }

    .nav-link {
        color: rgba(255,255,255,0.9);
        text-decoration: none;
        padding: 0.5rem 1rem;
        border-radius: 6px;
        transition: all 0.3s ease;
        font-weight: 500;
    }

    .nav-link:hover {
        background-color: rgba(255,255,255,0.1);
        color: white;
    }

    .nav-link.active {
        background-color: rgba(255,255,255,0.2);
        color: white;
    }

    .nav-link i {
        margin-right: 0.5rem;
    }
}

/* Container (for backward compatibility) */
.container {
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}
.nav {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Filters Section */
.filters-section {
    background: white;
    margin: 2rem 0;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.filters-section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.filter-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

.filter-item label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #34495e;
    font-size: 0.9rem;
}

.filter-item label i {
    margin-right: 0.5rem;
    color: #667eea;
}

.filter-item input,
.filter-item select {
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-item input:focus,
.filter-item select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-item small {
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.8rem;
}

.filter-actions {
    width: 100%;
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* Warehouse Filters */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.filters h3 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
}

.filters .filter-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
}

.filters .filter-group {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    flex: 1;
    max-width: 200px;
}

.filters .filter-buttons {
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 1rem;
}

.filters .filter-buttons .filter-group {
    flex: none;
    min-width: auto;
}

.filter-group select,
.filter-group input {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    position: relative;
    margin: 0;
    padding: 1rem; /* Add padding here instead */
    border-radius: 12px;
}

/* Ensure the table container has proper spacing */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden; /* Changed from visible to hidden to allow child scrolling */
    margin-bottom: 2rem;
    padding: 0; /* Remove padding to let table-responsive handle spacing */
}

/* Add scroll indicator for tables that need horizontal scrolling */
.table-responsive::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px; /* Increased width for better visibility */
    height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,0.95), rgba(255,255,255,0.8), rgba(255,255,255,0.3), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.table-responsive.has-scroll::before {
    content: '↔ Scroll horizontally • Alt+←/→ to navigate';
}

.table-responsive.scrolling {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.table-responsive.scrolling::before {
    content: '← Alt+← | Alt+→ →';
    background: #28a745;
}

/* Enhanced scrollbar styling */
.table-responsive::-webkit-scrollbar {
    height: 16px; /* Made even taller for better visibility */
    background: #f8f9fa;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 8px;
    border: 3px solid #f8f9fa;
    min-width: 40px; /* Ensure minimum thumb size */
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

.table-responsive::-webkit-scrollbar-corner {
    background: #f8f9fa;
}

/* Force scrollbar to be visible when scrolling is needed */
.table-responsive.has-scroll {
    scrollbar-width: auto; /* Firefox */
    scrollbar-color: #667eea #f8f9fa; /* Firefox */
    border-bottom: 2px solid #e9ecef; /* Add visual indicator that scrolling is available */
}

/* Fallback for older browsers */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: #667eea #f8f9fa;
}

#warehouse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 2000px; /* Increased significantly to ensure scrolling on all screens */
}

#warehouse-table th,
#warehouse-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    min-width: 60px; /* Reduced minimum width */
}

/* Optimize column widths for better space usage */
#warehouse-table th:nth-child(1), #warehouse-table td:nth-child(1) { /* Order # */
    min-width: 80px;
    max-width: 100px;
}
#warehouse-table th:nth-child(2), #warehouse-table td:nth-child(2) { /* Customer */
    min-width: 120px;
    max-width: 150px;
}
#warehouse-table th:nth-child(3), #warehouse-table td:nth-child(3) { /* SKU */
    min-width: 80px;
    max-width: 140px;
}
#warehouse-table th:nth-child(4), #warehouse-table td:nth-child(4) { /* Product */
    min-width: 80px;
    max-width: 200px;
    width: 45px;
}
#warehouse-table th:nth-child(5), #warehouse-table td:nth-child(5) { /* Type */
    min-width: 80px;
    max-width: 100px;
}
#warehouse-table th:nth-child(6), #warehouse-table td:nth-child(6) { /* Stock Date */
    min-width: 50px;
    max-width: 120px;
}
#warehouse-table th:nth-child(7), #warehouse-table td:nth-child(7) { /* Booked */
    min-width: 95px;
    max-width: 80px;
}
#warehouse-table th:nth-child(8), #warehouse-table td:nth-child(8) { /* Collected */
    min-width: 145px;
    max-width: 80px;
}
#warehouse-table th:nth-child(9), #warehouse-table td:nth-child(9) { /* Collected Date */
    min-width: 100px;
    max-width: 120px;
}
#warehouse-table th:nth-child(10), #warehouse-table td:nth-child(10) { /* Notes */
    min-width: 120px;
    max-width: 180px;
}
#warehouse-table th:nth-child(11), #warehouse-table td:nth-child(11) { /* Parts */
    min-width: 100px;
    max-width: 150px;
}
#warehouse-table th:nth-child(12), #warehouse-table td:nth-child(12) { /* Collection Info */
    min-width: 120px;
    max-width: 180px;
}
#warehouse-table th:nth-child(13), #warehouse-table td:nth-child(13) { /* Notified */
    min-width: 80px;
    max-width: 100px;
}
#warehouse-table th:nth-child(14), #warehouse-table td:nth-child(14) { /* Actions */
    min-width: 150px;
    max-width: 200px;
}
#warehouse-table th:nth-child(18), #warehouse-table td:nth-child(18) { /* Actions */
    min-width: 50px;
    max-width: 200px;
}

#warehouse-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap; /* Prevent header text wrapping */
    border-top: 2px solid #e9ecef;
    border-bottom: 2px solid #dee2e6;
}

#warehouse-table tbody tr:hover {
    background: #f8f9fa;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-booked {
    background: #cce5ff;
    color: #004085;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-collected {
    background: #d1ecf1;
    color: #0c5460;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 3px;
}

.actions-column {
    white-space: nowrap;
}

/* Table cell specific styles */
.checkbox-cell {
    width: 120px;
    text-align: center;
}
.checkbox-cell [type="checkbox"]{
    display:block;
    margin:0 auto;
} 

.action-cell {
    width: 100px;
    text-align: center;
}

.notes-cell {
    min-width: 200px;
    max-width: 300px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.btn-info {
    background: #3498db;
    color: white;
}

.btn-info:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-outline-primary {
    background: transparent;
    color: #3498db;
    border: 1px solid #3498db;
}

.btn-outline-primary:hover {
    background: #3498db;
    color: white;
}

.pdf-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Orders Section */
.orders-section {
    background: white;
    margin: 2rem 0;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    overflow: hidden;
}

.orders-header {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.orders-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
}

.orders-stats {
    display: flex;
    gap: 2rem;
    font-weight: 600;
    color: #34495e;
}

.orders-stats span {
    font-size: 0.9rem;
}

/* Loading & Empty States */
.loading,
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
}

.loading i {
    font-size: 2rem;
    margin-right: 0.5rem;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #bdc3c7;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #34495e;
}

/* Orders Container */
.orders-container {
    padding: 1rem;
}

/* Order Card */
.order-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.3s ease;
    overflow: hidden;
}

.order-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.order-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.order-number {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.order-meta {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: #7f8c8d;
    flex-wrap: wrap;
}

.order-total {
    font-weight: 600;
    font-size: 1.1rem;
    color: #27ae60;
}

.order-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-paid { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-cancelled { background: #f8d7da; color: #721c24; }
.status-fulfilled { background: #d1ecf1; color: #0c5460; }
.status-unfulfilled { background: #f8d7da; color: #721c24; }

.order-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Line Items */
.line-items {
    padding: 1.5rem;
}

.line-items h4 {
    margin-bottom: 1rem;
    color: #34495e;
    font-size: 1rem;
}

.line-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f3f4;
    align-items: flex-start;
}

.line-item:last-child {
    border-bottom: none;
}

.item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
}

.item-image.placeholder {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 1.5rem;
}

.item-details {
    flex: 1;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #2c3e50;
}

.item-variant {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #34495e;
    flex-wrap: wrap;
}

.item-price {
    font-weight: 600;
    color: #27ae60;
    text-align: right;
    flex-shrink: 0;
}

/* Warehouse Booking Styles */
.line-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.line-items-header h4 {
    margin: 0;
}

.btn-warehouse {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-warehouse:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.btn-warehouse:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.item-checkbox {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.warehouse-checkbox {
    display: none;
}

.checkbox-label {
    width: 40px;
    height: 40px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #adb5bd;
    font-size: 1.2rem;
}

.checkbox-label:hover {
    border-color: #3498db;
    color: #3498db;
    transform: scale(1.05);
}

.warehouse-checkbox:checked + .checkbox-label {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #3498db;
    color: white;
}

.warehouse-checkbox:disabled + .checkbox-label {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
    cursor: not-allowed;
    transform: none;
}

.item-status {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 1rem;
}

.booked-status {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.available-status {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none; /* Hidden by default, shown via JavaScript */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    margin: 2rem;
    padding: 2rem;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #adb5bd;
}

.close:hover {
    color: #dc3545;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
        min-height: calc(100vh - 120px); /* Account for header */
    }

    .header {
        padding: 1.5rem 0;
    }

    .header h1 {
        font-size: 2rem;
    }

    .nav {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .nav-link {
        padding: 0.75rem 1.5rem;
        width: 100%;
        text-align: center;
        max-width: 200px;
    }

    .filters-section {
        padding: 1.5rem;
        margin: 1rem 0;
    }

    .filter-group {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .filter-item {
        margin-bottom: 1rem;
    }

    .filter-item input,
    .filter-item select {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }

    .orders-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .order-card {
        padding: 1rem;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .order-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .line-items-header {
        flex-direction: column;
        gap: 1rem;
    }

    .line-item {
        padding: 1rem 0.5rem;
    }

    .item-details {
        flex: 1;
        min-width: 0;
    }

    .item-title {
        font-size: 0.9rem;
        word-break: break-word;
    }

    .item-variant {
        font-size: 0.8rem;
    }

    .item-price {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .btn-warehouse {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .warehouse-controls {
        padding: 1rem;
        margin: 1rem 0;
    }

    .btn-warehouse-main {
        min-width: unset;
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .header {
        padding: 1rem 0;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .header p {
        font-size: 0.9rem;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .filters-section {
        padding: 1rem;
    }

    .filters-section h2 {
        font-size: 1.25rem;
    }

    .order-card {
        padding: 0.75rem;
    }

    .line-item {
        padding: 0.75rem 0.25rem;
    }

    .warehouse-controls {
        padding: 0.75rem;
    }
}

/* Global Warehouse Controls */
.warehouse-controls {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e0f0ff 100%);
    border-radius: 10px;
    border: 2px solid #2563eb;
    text-align: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.btn-warehouse-main {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    margin-bottom: 10px;
    min-width: 300px;
}

.btn-warehouse-main:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.btn-warehouse-main:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.warehouse-info {
    color: #374151;
    font-style: italic;
}

.warehouse-info small {
    font-size: 14px;
}

/* Booked items styling */
.line-item.booked-item {
    opacity: 0.6;
    background: #f8f9fa;
}

.line-item.booked-item .item-checkbox input {
    cursor: not-allowed;
}

.line-item.booked-item .item-details {
    color: #6c757d;
}

/* Utility Classes */
.hidden {
    display: none !important;
}
@media (max-width: 768px) {
    .filters {
        padding: 1rem;
    }

    .filter-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-buttons {
        justify-content: center;
        margin-top: 0.75rem;
    }

    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    #warehouse-table {
        font-size: 0.8rem;
    }

    #warehouse-table th,
    #warehouse-table td {
        padding: 0.5rem;
    }

    .btn-small {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* Large screen optimizations (1920x1080 and similar) */
@media (min-width: 1800px) {
    #warehouse-table {
        min-width: 1600px; /* Allow full width on very large screens */
        font-size: 0.9rem;
    }

    #warehouse-table th,
    #warehouse-table td {
        padding: 0.875rem;
    }
}

/* Medium desktop screens (1440p and similar) */
@media (min-width: 1400px) and (max-width: 1799px) {
    #warehouse-table {
        min-width: 1300px;
        font-size: 0.8rem;
    }

    #warehouse-table th,
    #warehouse-table td {
        padding: 0.625rem;
    }
}

/* Standard desktop screens (1080p) */
@media (min-width: 1200px) and (max-width: 1399px) {
    #warehouse-table {
        min-width: 1200px;
        font-size: 0.75rem;
    }

    #warehouse-table th,
    #warehouse-table td {
        padding: 0.5rem;
        min-width: 50px;
    }

    /* Compress some columns further */
    #warehouse-table th:nth-child(7), #warehouse-table td:nth-child(7), /* Booked */
    #warehouse-table th:nth-child(8), #warehouse-table td:nth-child(8), /* Collected */
    #warehouse-table th:nth-child(13), #warehouse-table td:nth-child(13) { /* Notified */
        min-width: 60px;
        max-width: 70px;
    }

    .table-responsive {
        margin: 0 -0.5rem; /* Reduce negative margin on smaller screens */
        padding: 0 0.5rem;
    }
}

/* Small desktop screens */
@media (min-width: 1025px) and (max-width: 1199px) {
    #warehouse-table {
        min-width: 1100px;
        font-size: 0.7rem;
    }

    #warehouse-table th,
    #warehouse-table td {
        padding: 0.4rem;
        min-width: 45px;
    }

    .table-responsive {
        margin: 0 -0.25rem;
        padding: 0 0.25rem;
    }

    /* Further compress columns */
    #warehouse-table th:nth-child(1), #warehouse-table td:nth-child(1) { /* Order # */
        min-width: 70px;
        max-width: 80px;
    }
    #warehouse-table th:nth-child(2), #warehouse-table td:nth-child(2) { /* Customer */
        min-width: 100px;
        max-width: 120px;
    }
    #warehouse-table th:nth-child(3), #warehouse-table td:nth-child(3) { /* SKU */
        min-width: 75px;
        max-width: 110px;
    }
    #warehouse-table th:nth-child(4), #warehouse-table td:nth-child(4) { /* Product */
        min-width: 80px;
        max-width: 150px;
    }
}

/* Warehouse Card View Styles */
@media (max-width: 480px) {
    .mobile-toggle {
        display: block;
        background: #667eea;
        color: white;
        padding: 0.75rem;
        border-radius: 8px;
        margin-bottom: 1rem;
        text-align: center;
        cursor: pointer;
        font-size: 0.9rem;
    }

    .table-view {
        display: none;
    }

    .card-view {
        display: block;
    }

    .warehouse-card {
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid #e9ecef;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .warehouse-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    }

    .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
    }

    .card-order-number {
        font-weight: bold;
        color: #667eea;
    }

    .card-sku {
        color: #666;
        font-size: 0.9rem;
    }

    .card-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    .card-field {
        display: flex;
        justify-content: space-between;
        padding: 0.25rem 0;
    }

    .card-field-label {
        font-weight: 500;
        color: #555;
    }

    .card-field-value {
        text-align: right;
        word-break: break-word;
    }

    .card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.75rem;
        padding-top: 0.5rem;
        border-top: 1px solid #eee;
    }

    .card-checkboxes {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
        margin: 0.5rem 0;
    }

    .checkbox-group {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .checkbox-group input[type="checkbox"] {
        transform: scale(1.2);
    }

    /* Additional mobile enhancements */
    .warehouse-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions button {
        width: 100%;
        padding: 10px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .mobile-toggle {
        padding: 12px;
        font-size: 16px;
    }
}

/* Desktop styles */
@media (min-width: 481px) {
    .mobile-toggle {
        display: none;
    }

    .table-view {
        display: block;
    }

    .card-view {
        display: none;
    }
}

/* Editable Elements */
.editable-cell {
    cursor: pointer;
    position: relative;
}

.editable-cell:hover {
    background-color: #f0f8ff;
}

.cell-content {
    display: flex;
    align-items: center;
    min-height: 24px;
}

.cell-value {
    flex: 1;
}

.cell-value em {
    color: #6c757d;
    font-style: italic;
}

.cell-editor {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.cell-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.cell-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Message System */
#message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

.message-success {
    border-left-color: #28a745;
    color: #155724;
}

.message-error {
    border-left-color: #dc3545;
    color: #721c24;
}

.message-info {
    border-left-color: #007bff;
    color: #004085;
}

.message i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    line-height: 1;
}

.message-close:hover {
    color: #495057;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile adjustments for messages */
@media (max-width: 768px) {
    #message-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* Order Header Row Styles */
.order-header-row {
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
}

.order-header-row.expandable {
    cursor: pointer;
}

.order-header-row.expandable:hover {
    background-color: #000000;
}

.order-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.order-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: #495057;
}

.order-meta {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: normal;
}

.order-header-info {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.order-header-info span {
    font-size: 0.875rem;
    color: #6c757d;
}

.order-header-info span strong {
    color: #495057;
}

.order-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Item Row Styles */
.item-row {
    background-color: white;
    border-bottom: 1px solid #dee2e6;
}

.item-row:hover {
    background-color: #f8f9fa;
}

.order-item {
    border-left: 3px solid #007bff;
}

/* Card view expandable styles */
.order-card.expandable {
    cursor: pointer;
}

.order-card.expandable:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.order-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.item-count {
    font-size: 0.875rem;
    color: #6c757d;
    margin-left: 0.5rem;
}

.card-body .order-summary {
    margin-bottom: 1rem;
}

.card-body .order-items {
    margin-top: 1rem;
}

.item-card {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.item-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #495057;
}

.item-sku {
    font-size: 0.875rem;
    color: #6c757d;
}

.item-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-row span:first-child {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.item-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dee2e6;
}

/* Status badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.booked {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

/* Reports Page Styles */
#reports-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#reports-table th,
#reports-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

#reports-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

#reports-table th:nth-child(1), #reports-table td:nth-child(1) { /* Collected Date */
    min-width: 100px;
    max-width: 120px;
}

#reports-table th:nth-child(2), #reports-table td:nth-child(2) { /* Order number */
    min-width: 80px;
    max-width: 100px;
}

#reports-table th:nth-child(3), #reports-table td:nth-child(3) { /* Product Title */
    min-width: 150px;
    max-width: 250px;
}

#reports-table th:nth-child(4), #reports-table td:nth-child(4) { /* SKU */
    min-width: 80px;
    max-width: 120px;
}

#reports-table th:nth-child(5), #reports-table td:nth-child(5) { /* Price */
    min-width: 70px;
    max-width: 90px;
}

#reports-table th:nth-child(6), #reports-table td:nth-child(6) { /* Product Type */
    min-width: 100px;
    max-width: 140px;
}

#reports-table th:nth-child(7), #reports-table td:nth-child(7) { /* Weight KG */
    min-width: 80px;
    max-width: 100px;
}

#reports-table th:nth-child(8), #reports-table td:nth-child(8) { /* Customer Name */
    min-width: 120px;
    max-width: 180px;
}

#reports-table th:nth-child(9), #reports-table td:nth-child(9) { /* Collected */
    min-width: 70px;
    max-width: 90px;
}

#reports-table tbody tr:hover {
    background-color: #f8f9fa;
}

#reports-table .loading {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px;
}