/* CSS Variables - Lidl colors */
:root {
    --lidl-blue: #0050aa;
    --lidl-blue-dark: #003d80;
    --lidl-yellow: #fff000;
    --lidl-red: #e60a14;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --error-color: #dc3545;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.header {
    background: var(--lidl-blue);
    color: white;
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-lg);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.tagline {
    opacity: 0.9;
    font-size: 0.875rem;
}

.back-link {
    color: white;
    text-decoration: none;
    display: inline-block;
    margin-bottom: var(--spacing-sm);
    opacity: 0.9;
}

.back-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Search Section */
.search-section {
    background: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.search-bar {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.search-bar input {
    width: 100%;
    padding: var(--spacing-md);
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--lidl-blue);
}

.btn-clear {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
}

.btn-clear:hover {
    color: var(--text-primary);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
}

.filters select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input {
    cursor: pointer;
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Product Card */
.product-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-image-container {
    position: relative;
    padding-top: 100%;
    background: var(--bg-secondary);
}

.product-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--spacing-sm);
}

.promo-badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    background: var(--lidl-red);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.product-details {
    padding: var(--spacing-md);
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin: var(--spacing-xs) 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.625rem;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--lidl-blue);
}

.price-original {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.product-unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.sparkline {
    display: block;
    margin-top: var(--spacing-sm);
}

/* Loading */
.loading {
    text-align: center;
    padding: var(--spacing-xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--lidl-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Load More */
.load-more-container {
    text-align: center;
    margin: var(--spacing-xl) 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--lidl-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--lidl-blue-dark);
}

.btn-small {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-small:hover {
    background: var(--border-color);
}

.btn-small.active {
    background: var(--lidl-blue);
    color: white;
}

/* Product Detail Page */
.product-detail {
    padding-top: var(--spacing-lg);
}

.product-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    background: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xl);
}

@media (min-width: 768px) {
    .product-header {
        grid-template-columns: 300px 1fr;
    }
}

.product-image-large {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.product-info h1 {
    font-size: 1.5rem;
    margin: var(--spacing-sm) 0;
}

.category-badge {
    display: inline-block;
    background: var(--bg-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
    flex-wrap: wrap;
}

.current-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--lidl-blue);
}

.original-price {
    font-size: 1.25rem;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.discount-badge {
    background: var(--lidl-red);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.unit {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

/* Price History Section */
.price-history-section,
.price-table-section {
    background: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xl);
}

.price-history-section h2,
.price-table-section h2 {
    margin-bottom: var(--spacing-md);
    font-size: 1.25rem;
}

.chart-controls {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.chart-container {
    height: 300px;
    position: relative;
}

.no-data {
    color: var(--text-secondary);
    font-style: italic;
}

/* Price Table */
.price-table {
    width: 100%;
    border-collapse: collapse;
}

.price-table th,
.price-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.price-table th {
    font-weight: 600;
    background: var(--bg-secondary);
}

.price-up {
    color: var(--error-color);
}

.price-down {
    color: var(--success-color);
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
    text-align: center;
    font-size: 0.875rem;
}

/* Error Message */
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--error-color);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}
