/* ==========================================
   CHOCOLATE ORDERING SYSTEM - MAIN STYLES
   Modern, Beautiful, Responsive
   ========================================== */

/* ===== BASE RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, #0a1628 0%, #0d2137 50%, #0f3460 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #050d1a 0%, #081421 50%, #0a1929 100%);
    background-attachment: fixed;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 32px; margin-bottom: var(--space-lg); }
h2 { font-size: 28px; margin-bottom: var(--space-md); }
h3 { font-size: 24px; margin-bottom: var(--space-md); }
h4 { font-size: 20px; margin-bottom: var(--space-sm); }
h5 { font-size: 18px; margin-bottom: var(--space-sm); }
h6 { font-size: 16px; margin-bottom: var(--space-sm); }

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

/* ===== LIGHT PANELS - DARK TEXT OVERRIDE ===== */
[style*="background: white"] h1,
[style*="background: white"] h2,
[style*="background: white"] h3,
[style*="background: white"] h4,
[style*="background: white"] h5,
[style*="background: white"] h6,
[style*="background:#fff"] h1,
[style*="background:#fff"] h2,
[style*="background:#fff"] h3,
[style*="background:#fff"] h4,
[style*="background:#fff"] h5,
[style*="background:#fff"] h6,
[style*="background: #fff"] h1,
[style*="background: #fff"] h2,
[style*="background: #fff"] h3,
[style*="background: #fff"] h4,
[style*="background: #fff"] h5,
[style*="background: #fff"] h6 {
    color: #1a1a1a !important;
}

[style*="background: white"] p,
[style*="background: white"] label,
[style*="background: white"] span,
[style*="background:#fff"] p,
[style*="background:#fff"] label,
[style*="background:#fff"] span,
[style*="background: #fff"] p,
[style*="background: #fff"] label,
[style*="background: #fff"] span {
    color: #333333 !important;
}

[style*="background: #e3f2fd"] h1,
[style*="background: #e3f2fd"] h2,
[style*="background: #e3f2fd"] h3,
[style*="background: #e3f2fd"] h4,
[style*="background: #e3f2fd"] h5,
[style*="background: #e3f2fd"] h6 {
    color: #1a1a1a !important;
}

[style*="background: #e3f2fd"] p,
[style*="background: #e3f2fd"] label,
[style*="background: #e3f2fd"] span,
[style*="background: #e3f2fd"] strong {
    color: #333333 !important;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.login-card h2 {
    color: #7f8c8d;
    margin-bottom: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: 400;
}

.demo-credentials {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
}

.demo-credentials h3 {
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.demo-credentials p {
    margin: 8px 0;
    color: #5a6c7d;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.demo-credentials strong {
    color: #2c3e50;
}

/* ===== CUSTOMER PORTAL STYLING ===== */
.customer-portal {
    background: #f5f7fa !important;
}

.customer-portal .navbar {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid #e8e8e8;
    padding: 8px 0;
}

.customer-portal .nav-container {
    max-width: 1600px;
    padding: 0 15px;
}

.customer-portal .nav-container h1 {
    color: #2c3e50;
    font-size: 16px;
}

.customer-portal .nav-right span {
    color: #5a6c7d;
    font-size: 13px;
}

.customer-portal .container {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    margin: 12px auto;
    padding: 12px;
    max-width: 1600px;
}

.customer-portal h1,
.customer-portal h2,
.customer-portal h3 {
    color: #2c3e50 !important;
}

.customer-portal p {
    color: #5a6c7d;
}

.customer-portal .tabs {
    padding: 8px 12px 0 12px;
    border-bottom: 1px solid #e8e8e8;
}

.customer-portal .tab-btn {
    color: #7f8c8d;
    padding: 8px 16px;
    font-size: 13px;
}

.customer-portal .tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.customer-portal .tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.customer-portal .tab-content {
    padding: 12px;
}

.customer-portal h2 {
    font-size: 16px;
    margin-bottom: 10px;
}

.customer-portal .badge {
    background: #e74c3c;
    color: white;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 11px;
    margin-left: 6px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    display: inline-block;
}

.customer-portal .cart-item {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.customer-portal .cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.customer-portal .cart-item-details h4 {
    color: #2c3e50;
}

.customer-portal .cart-item-details p {
    color: #7f8c8d;
}

.customer-portal .cart-total {
    color: #27ae60;
    border-top: 2px solid #e8e8e8;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg), 0 1px 0 var(--border-medium);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid var(--border-medium);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-container h1 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-right span {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 14px;
}

/* ===== CONTAINER ===== */
.container {
    width: 100%;
    margin: 10px auto;
    padding: 10px;
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-light);
    border: 1px solid var(--border-dark);
    min-height: 500px;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-lg) 0 var(--space-lg);
    border-bottom: 2px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all var(--transition-base);
    position: relative;
    white-space: nowrap;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-btn:hover {
    color: var(--color-accent-primary);
    background: var(--hover-overlay);
}

.tab-btn.active {
    color: var(--color-accent-primary);
    border-bottom-color: var(--color-accent-primary);
    background: var(--hover-overlay);
}

.badge {
    background: var(--gradient-accent);
    color: white;
    border-radius: var(--radius-full);
    padding: 2px 8px;
    font-size: 11px;
    margin-left: 6px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    padding: 10px;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select,
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-primary);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-control:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
    background: var(--bg-elevated);
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: var(--border-medium);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-primary);
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    font-weight: 700;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
    border: 2px solid #bdc3c7;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #d5dbdb;
    border-color: #95a5a6;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-secondary {
    background: #34495e;
    color: #ecf0f1;
    border-color: #4a6278;
}

[data-theme="dark"] .btn-secondary:hover {
    background: #4a6278;
    border-color: #5a7a98;
}

.btn-success {
    background: var(--color-success);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #0d9668;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--color-error);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.button-group {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

/* ===== PRODUCT GRID ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.product-card {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .product-card {
    background: #2a2a2a;
    border-color: #404040;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f5f5f5;
}

.product-card-body {
    padding: 8px;
}

.product-card h3 {
    margin: 3px 0 2px 0;
    color: #2c3e50 !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    min-height: 28px;
}

.product-card p {
    color: #7f8c8d !important;
    margin-bottom: 4px;
    font-size: 10px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 26px;
}

[data-theme="dark"] .product-card h3 {
    color: #ecf0f1 !important;
}

[data-theme="dark"] .product-card p {
    color: #95a5a6 !important;
}

.product-card .price {
    font-size: 16px;
    color: #27ae60;
    font-weight: 700;
    margin: 4px 0 4px 0;
    letter-spacing: -0.2px;
}

.product-card .quantity-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
}

.product-card .quantity-selector label {
    font-size: 9px;
    font-weight: 500;
    color: #7f8c8d;
}

.product-card .quantity-selector input {
    width: 45px;
    text-align: center;
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.product-card .quantity-selector input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.product-code {
    display: inline-block;
    font-size: 7px;
    color: #95a5a6;
    font-weight: 700;
    padding: 2px 5px;
    background: #f0f0f0;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.product-code-large {
    display: inline-block;
    font-size: 11px;
    color: #2c3e50;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.product-title-large {
    margin: 0 0 4px 0;
    color: #2c3e50 !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.badge-small {
    display: inline-block;
    padding: 1px 4px;
    font-size: 7px;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.product-meta {
    margin: 2px 0 0 0;
}

.order-increment {
    font-size: 8px;
    color: #7f8c8d;
    font-weight: 500;
    margin: 3px 0;
    padding: 3px 6px;
    background: #f8f9fa;
    border-radius: 3px;
    border-left: 1px solid #3498db;
}

.product-card .btn {
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 7px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    background: white;
}

.search-bar input::placeholder {
    color: #95a5a6;
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle .btn {
    padding: 7px 12px;
    font-size: 16px;
    font-weight: 600;
    min-width: 40px;
}

.view-toggle .btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ===== LIST VIEW ===== */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 15px;
}

.product-list-item {
    display: flex;
    gap: 12px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 10px;
    transition: all 0.25s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    align-items: center;
}

.product-list-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.product-list-item img {
    width: 60px;
    height: auto;
    max-height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f5f5f5;
}

.product-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.product-list-info h3 {
    margin-bottom: 2px;
    color: #2c3e50;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.product-list-info p {
    color: #7f8c8d;
    font-size: 9px;
    margin-bottom: 2px;
    line-height: 1.3;
}

.product-list-prices {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.product-list-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.product-list-actions .price {
    font-size: 14px;
    color: #27ae60;
    font-weight: 700;
    min-width: 70px;
    text-align: right;
}

.product-list-actions .quantity-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-list-actions .quantity-selector label {
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
}

.product-list-actions .quantity-selector input {
    width: 80px;
    padding: 8px;
    text-align: center;
    font-size: 14px;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    font-weight: 600;
}

.product-list-actions .btn {
    padding: 10px 18px;
    font-size: 13px;
    white-space: nowrap;
    min-width: 120px;
}

/* Mobile responsive for list view */
@media (max-width: 768px) {
    .product-list-prices {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .product-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-list-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 7px;
    font-weight: 700;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== CART ===== */
.cart-item {
    display: flex;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.cart-item:hover {
    box-shadow: var(--shadow-md);
}

.cart-item img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-right: var(--space-lg);
    background: var(--bg-secondary);
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.cart-item-details p {
    color: var(--text-muted);
    font-size: 14px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.cart-total {
    text-align: right;
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
    margin: var(--space-lg) 0;
    padding: var(--space-lg);
    border-top: 2px solid var(--border-light);
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}

.data-table th,
.data-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
}

.data-table th:last-child,
.data-table td:last-child {
    border-right: none;
}

.data-table th {
    background: #d1f0f5 !important;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    user-select: none;
    border-bottom: 2px solid var(--color-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.data-table th:hover {
    background: #a5e3ed !important;
    color: #000000 !important;
}

[data-theme="dark"] .data-table th {
    background: #1a4b56;
    color: #ffffff;
}

[data-theme="dark"] .data-table th:hover {
    background: #2d6b7a !important;
    color: #ffffff !important;
}

.data-table tr {
    background: var(--bg-elevated);
    transition: all var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--hover-overlay);
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.data-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.data-table tbody tr:nth-child(even):hover {
    background: var(--hover-overlay);
}

/* Resizable columns */
.data-table th .resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    z-index: 11;
    transition: background var(--transition-fast);
}

.data-table th .resize-handle:hover {
    background: var(--color-accent-primary);
}

.data-table th .resize-handle:active {
    background: var(--color-accent-secondary);
}

/* Text wrap toggle */
.data-table.text-wrap td,
.data-table.text-wrap th {
    white-space: normal;
    word-wrap: break-word;
}

.data-table td {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Table containers */
#productsList,
#ordersList,
#batchHistory,
#extractedProductsTable,
#calculatedProductsTable {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

/* Make scrollbar more visible and sticky */
#productsList::-webkit-scrollbar,
#ordersList::-webkit-scrollbar,
#batchHistory::-webkit-scrollbar,
#extractedProductsTable::-webkit-scrollbar,
#calculatedProductsTable::-webkit-scrollbar {
    height: 12px;
}

#productsList::-webkit-scrollbar-track,
#ordersList::-webkit-scrollbar-track,
#batchHistory::-webkit-scrollbar-track,
#extractedProductsTable::-webkit-scrollbar-track,
#calculatedProductsTable::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

#productsList::-webkit-scrollbar-thumb,
#ordersList::-webkit-scrollbar-thumb,
#batchHistory::-webkit-scrollbar-thumb,
#extractedProductsTable::-webkit-scrollbar-thumb,
#calculatedProductsTable::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-md);
}

#productsList::-webkit-scrollbar-thumb:hover,
#ordersList::-webkit-scrollbar-thumb:hover,
#batchHistory::-webkit-scrollbar-thumb:hover,
#extractedProductsTable::-webkit-scrollbar-thumb:hover,
#calculatedProductsTable::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-hover);
}

[data-theme="dark"] #productsList,
[data-theme="dark"] #ordersList,
[data-theme="dark"] #batchHistory,
[data-theme="dark"] #extractedProductsTable,
[data-theme="dark"] #calculatedProductsTable {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border-light);
}

.section-header h2,
.section-header h3 {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 5% auto;
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

[data-theme="dark"] .modal-content {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-base);
}

.close:hover {
    color: var(--color-accent-primary);
}

/* ===== CALCULATOR ===== */
.calculator-form {
    padding: var(--space-lg);
}

.calculator-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.calculator-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent-secondary);
}

.calculator-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.calculator-item-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

/* ===== ORDERS ===== */
.order-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.order-card:hover {
    box-shadow: var(--shadow-lg);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border-light);
}

.order-status {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.order-status.pending {
    background: var(--color-warning);
    color: white;
}

.order-status.processing {
    background: var(--color-primary);
    color: white;
}

.order-status.completed {
    background: var(--color-success);
    color: white;
}

.order-status.cancelled {
    background: var(--color-error);
    color: white;
}

/* ===== STATUS MESSAGES ===== */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #C62828;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
    border-left: 4px solid var(--color-error);
    box-shadow: var(--shadow-sm);
}

.success-message {
    background: rgba(16, 185, 129, 0.1);
    color: #2E7D32;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
    border-left: 4px solid var(--color-success);
    box-shadow: var(--shadow-sm);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: var(--space-sm);
    font-size: 20px;
    color: var(--text-secondary);
}

/* ===== LOADING STATES ===== */
.loading-spinner {
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--color-accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: var(--space-lg) auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.p-1 { padding: var(--space-sm); }
.p-2 { padding: var(--space-md); }
.p-3 { padding: var(--space-lg); }


/* ===== BULK EDITOR LIGHT MODE STYLES ===== */
#bulkEditTable {
    background: #ffffff;
}

#bulkEditTable th {
    background: #f5f5f5 !important;
    color: #1a1a1a !important;
    border-color: #e0e0e0;
}

#bulkEditTable td {
    background: #ffffff !important;
    color: #333333 !important;
    border-color: #e0e0e0;
}

#bulkEditTable tr {
    background: #ffffff;
}

#bulkEditTable tr:nth-child(even) {
    background: #f9f9f9;
}

#bulkEditTable tr:hover {
    background: #f0f0f0 !important;
}

/* Input fields in bulk editor table - light mode */
#bulkEditTable input[type="text"],
#bulkEditTable input[type="number"],
#bulkEditTable select {
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #d0d0d0 !important;
}

#bulkEditTable input[type="text"]:focus,
#bulkEditTable input[type="number"]:focus,
#bulkEditTable select:focus {
    background: #fafafa !important;
    border-color: #4CAF50 !important;
}

/* Editable cells light mode */
#bulkEditTable td[contenteditable="true"] {
    background: #ffffff !important;
    color: #333333 !important;
}

#bulkEditTable td[contenteditable="true"]:focus {
    background: #f5f5f5 !important;
    outline: 1px solid #4CAF50;
}

/* Special colored cells for light mode */
#bulkEditTable td[style*="background: #ffeb3b"],
#bulkEditTable td[style*="background:#ffeb3b"] {
    background: #ffeb3b !important;
    color: #333333 !important;
}

#bulkEditTable td[style*="background: #ffd54f"],
#bulkEditTable td[style*="background:#ffd54f"] {
    background: #ffd54f !important;
    color: #333333 !important;
}

#bulkEditTable td[style*="background: #ffecb3"],
#bulkEditTable td[style*="background:#ffecb3"] {
    background: #ffecb3 !important;
    color: #333333 !important;
}

#bulkEditTable td[style*="background: #fff3e0"],
#bulkEditTable td[style*="background:#fff3e0"] {
    background: #fff3e0 !important;
    color: #333333 !important;
}

#bulkEditTable td[style*="background: #e3f2fd"],
#bulkEditTable td[style*="background:#e3f2fd"] {
    background: #e3f2fd !important;
    color: #1565C0 !important;
}

#bulkEditTable td[style*="background: #e8f5e9"],
#bulkEditTable td[style*="background:#e8f5e9"] {
    background: #e8f5e9 !important;
    color: #2E7D32 !important;
}

/* ===== BULK EDITOR DARK MODE FIXES ===== */
[data-theme="dark"] #bulkEditTable {
    background: var(--bg-secondary);
}

[data-theme="dark"] #bulkEditTable th {
    background: #1a3a4a !important;
    color: #e0e6ed !important;
    border-color: var(--border-medium);
}

[data-theme="dark"] #bulkEditTable td {
    background: #0a1929;
    color: var(--text-secondary);
    border-color: var(--border-light);
}

[data-theme="dark"] #bulkEditTable tr {
    background: #0a1929;
}

[data-theme="dark"] #bulkEditTable tr:nth-child(even) {
    background: #0f1e2e;
}

[data-theme="dark"] #bulkEditTable tr:hover {
    background: #162535 !important;
}

/* Input fields in bulk editor table */
[data-theme="dark"] #bulkEditTable input[type="text"],
[data-theme="dark"] #bulkEditTable input[type="number"],
[data-theme="dark"] #bulkEditTable select {
    background: #1a2332;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

[data-theme="dark"] #bulkEditTable input[type="text"]:focus,
[data-theme="dark"] #bulkEditTable input[type="number"]:focus,
[data-theme="dark"] #bulkEditTable select:focus {
    background: #243142;
    border-color: var(--color-accent-primary);
}

/* Checkbox styling for dark mode */
[data-theme="dark"] #bulkEditTable input[type="checkbox"] {
    background: #1a2332;
    border: 1px solid var(--border-medium);
}

[data-theme="dark"] #bulkEditTable input[type="checkbox"]:checked {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
}

/* Status cells with special backgrounds */
[data-theme="dark"] #bulkEditTable td[style*="background: #ffeb3b"],
[data-theme="dark"] #bulkEditTable td[style*="background:#ffeb3b"] {
    background: #4a4000 !important;
    color: #ffd700 !important;
}

[data-theme="dark"] #bulkEditTable td[style*="background: #ffd54f"],
[data-theme="dark"] #bulkEditTable td[style*="background:#ffd54f"] {
    background: #5a4d00 !important;
    color: #ffd700 !important;
}

[data-theme="dark"] #bulkEditTable td[style*="background: #ffecb3"],
[data-theme="dark"] #bulkEditTable td[style*="background:#ffecb3"] {
    background: #3a3300 !important;
    color: #ffeb3b !important;
}

[data-theme="dark"] #bulkEditTable td[style*="background: #fff3e0"],
[data-theme="dark"] #bulkEditTable td[style*="background:#fff3e0"] {
    background: #2a2200 !important;
    color: #ffa000 !important;
}

/* Action buttons in bulk editor */
[data-theme="dark"] #bulkEditTable .btn-save {
    background: #2e7d32;
    color: white;
}

[data-theme="dark"] #bulkEditTable .btn-save:hover {
    background: #388e3c;
}

[data-theme="dark"] #bulkEditTable .btn-gallery {
    background: #1976d2;
    color: white;
}

[data-theme="dark"] #bulkEditTable .btn-gallery:hover {
    background: #1e88e5;
}

[data-theme="dark"] #bulkEditTable .btn-delete {
    background: #c62828;
    color: white;
}

[data-theme="dark"] #bulkEditTable .btn-delete:hover {
    background: #d32f2f;
}

/* Fix for any data-table in dark mode (general) */
[data-theme="dark"] .data-table {
    background: var(--bg-secondary);
}

[data-theme="dark"] .data-table td {
    background: transparent;
    color: var(--text-secondary);
}

[data-theme="dark"] .data-table tr {
    background: var(--bg-secondary);
}

[data-theme="dark"] .data-table tr:nth-child(even) {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .data-table tr:hover {
    background: var(--bg-elevated) !important;
}

/* Override inline styles for specific background colors in dark mode */
[data-theme="dark"] td[style*="background: #e3f2fd"],
[data-theme="dark"] td[style*="background:#e3f2fd"] {
    background: #1a3a4a !important;
    color: #a8d4f0 !important;
}

[data-theme="dark"] td[style*="background: #fff3cd"],
[data-theme="dark"] td[style*="background:#fff3cd"] {
    background: #3a3300 !important;
    color: #ffd700 !important;
}

[data-theme="dark"] td[style*="background: #e8f5e9"],
[data-theme="dark"] td[style*="background:#e8f5e9"] {
    background: #1a3a1a !important;
    color: #90ee90 !important;
}

[data-theme="dark"] td[style*="background: white"],
[data-theme="dark"] td[style*="background:#fff"],
[data-theme="dark"] td[style*="background: #fff"],
[data-theme="dark"] td[style*="background:#ffffff"],
[data-theme="dark"] td[style*="background: #ffffff"] {
    background: #0a1929 !important;
    color: var(--text-primary) !important;
}

/* Also fix th elements with inline styles */
[data-theme="dark"] th[style*="background: #e3f2fd"],
[data-theme="dark"] th[style*="background:#e3f2fd"] {
    background: #1a3a4a !important;
    color: #a8d4f0 !important;
}

[data-theme="dark"] th[style*="background: #4caf50"],
[data-theme="dark"] th[style*="background:#4caf50"] {
    background: #1b5e20 !important;
    color: #ffffff !important;
}

/* Fix empty cells that might have white background */
[data-theme="dark"] td:empty {
    background: transparent !important;
}

/* Ensure contenteditable cells also follow dark mode */
[data-theme="dark"] td[contenteditable="true"] {
    background: #0a1929 !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] td[contenteditable="true"]:focus {
    background: #162535 !important;
    outline: 1px solid var(--color-accent-primary);
}

/* ===== FIX TAB TEXT OVERLAP ===== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 10px 10px 0 10px;
    border-bottom: 2px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 12px;
    font-size: 14px;
    min-width: fit-content;
    flex-shrink: 0;
}

/* Responsive tabs for smaller screens */
@media (max-width: 1200px) {
    .tabs {
        gap: 2px;
        padding: 8px 8px 0 8px;
    }
    
    .tab-btn {
        font-size: 13px;
        padding: 6px 10px;
    }
}

@media (max-width: 768px) {
    .tabs {
        overflow-x: scroll;
        flex-wrap: nowrap;
        gap: 1px;
    }
    
    .tab-btn {
        font-size: 12px;
        padding: 6px 8px;
    }
}
