[data-theme="light"] body,
body:not([data-theme]) {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
}

[data-theme="dark"] body {
    background-color: #0f172a;
    color: #e5e7eb;
}

[data-theme="dark"] header {
    background-color: #020617;
    color: #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

[data-theme="dark"] .tab-btn {
    background: rgba(15,23,42,0.8);
    color: #e5e7eb;
}

[data-theme="dark"] .tab-btn.active {
    background: #e5e7eb;
    color: #020617;
}

[data-theme="dark"] .container {
    background-color: transparent;
}

[data-theme="dark"] .scanner-container {
    background: #1e293b;
}

[data-theme="dark"] .batch-item,
[data-theme="dark"] .product-card,
[data-theme="dark"] .settings-form,
[data-theme="dark"] .login-box,
[data-theme="dark"] .modal-content {
    background: #020617;
    color: #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.7);
}

[data-theme="dark"] .product-card h3 {
    color: #38bdf8;
}

[data-theme="dark"] .price {
    color: #22c55e;
}

[data-theme="dark"] .stock-low {
    color: #f97373;
}

[data-theme="dark"] .stock-ok {
    color: #4ade80;
}

[data-theme="dark"] .history-table th {
    background-color: #0f172a;
}

[data-theme="dark"] .login-screen {
    background-color: #020617;
}

[data-theme="dark"] input,
[data-theme="dark"] #search-input,
[data-theme="dark"] .form-group input,
[data-theme="dark"] #batch-ean-input {
    background-color: #020617;
    color: #e5e7eb;
    border-color: #1e293b;
}

[data-theme="dark"] .stats {
    color: #9ca3af;
}

[data-theme="dark"] #batch-status {
    color: #9ca3af;
}

[data-theme="dark"] .modal {
    background: rgba(15,23,42,0.85);
}

[data-theme="dark"] .error-card {
    background: #1e293b;
    border-color: #4b5563;
}

[data-theme="dark"] .error-tech-btn {
    background: #020617;
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] textarea {
    background-color: #020617;
    color: #e5e7eb;
    border-color: #1e293b;
}

header {
    background-color: #007bff;
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0.5rem 0;
    font-size: 1.2rem;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tab-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.tab-btn.active {
    background: white;
    color: #007bff;
    font-weight: bold;
}

.tab-content {
    display: none;
}

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

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.primary-btn, .secondary-btn, .success-btn, .danger-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    color: white;
}

.primary-btn { background-color: #007bff; }
.secondary-btn { background-color: #6c757d; width: 100%; margin-top: 0.5rem; }
.success-btn { background-color: #28a745; }
.danger-btn { background-color: #dc3545; }

.scanner-container {
    background: #eee;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.batch-header h3 { margin: 0; }

.batch-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.batch-item {
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.batch-item .status {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.status-pending { background: #eee; }
.status-loading { background: #fff3cd; color: #856404; }
.status-done { background: #d4edda; color: #155724; }
.status-error { background: #f8d7da; color: #721c24; }

.container {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.search-container {
    margin-bottom: 1rem;
}

#search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1rem;
}

.product-list {
    display: grid;
    gap: 1rem;
}

.product-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-left: 5px solid #007bff;
    cursor: pointer;
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
}

.product-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #0056b3;
}

.product-card .sku {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.product-image {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 10px;
    background: transparent;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-weight: bold;
    color: #555;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #28a745;
}

.offer {
    color: #dc3545;
}

.old-price {
    text-decoration: line-through;
    font-size: 0.85rem;
    color: #999;
}

.stock-low {
    color: #dc3545;
    font-weight: bold;
}

.stock-ok {
    color: #28a745;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f4f7f6;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #007bff;
    margin-bottom: 0.5rem;
}

.login-box p {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Form settings */
.settings-form {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: bold;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Modal for details */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    background: none;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.history-table th, .history-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.history-table th {
    background-color: #f8f9fa;
}

.error-card {
    background: #fff5f5;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ffcccc;
}

.error-hint {
    font-size: 0.85rem;
    margin-top: 1rem;
}

.error-tech-btn {
    font-size: 0.7rem;
    margin: 5px auto;
    display: block;
    cursor: pointer;
    background: #eee;
    border: 1px solid #ccc;
    padding: 2px 5px;
    border-radius: 4px;
}
