/* Mobile-first responsive CSS for Dutch grocery scanner */

/* Variables */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #C8E6C9;
    --background: #f5f5f5;
    --white: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border: #e0e0e0;
    --error: #f44336;
    --success: #4CAF50;
    --warning: #FF9800;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --max-width: 1200px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    font-size: 16px;
}

/* Layout */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem;
}

.main-content {
    min-height: calc(100vh - 140px);
    padding-top: 80px;
}

/* Navigation */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

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

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* Cards and containers */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
    padding: 1rem;
}

.auth-card,
.onboarding-card,
.settings-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.onboarding-card,
.settings-card {
    max-width: 800px;
}

.shopping-header {
    text-align: center;
    margin-bottom: 2rem;
}

.shopping-form-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Typography */
h1 {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.textarea-large {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-help {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

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

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

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn-full {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Store selection */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.store-option {
    cursor: pointer;
}

.store-checkbox {
    display: none;
}

.store-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.store-checkbox:checked + .store-card {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.store-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Results */
.results-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.tier-breakdown {
    margin-bottom: 2rem;
}

.tier-section {
    margin-bottom: 1.5rem;
}

.tier-title {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    margin-bottom: 1rem;
}

.tier-item {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.item-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.item-matches {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.match-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.match-info:last-child {
    border-bottom: none;
}

.store {
    font-weight: 600;
    color: var(--primary-color);
    flex: 0 0 100px;
}

.product {
    flex: 1;
    color: var(--text-secondary);
    padding: 0 0.5rem;
    font-size: 0.9rem;
}

.price {
    font-weight: 600;
    color: var(--text-primary);
    flex: 0 0 auto;
}

.no-matches {
    color: var(--text-light);
    font-style: italic;
}

.optimized-plan {
    border-top: 2px solid var(--border);
    padding-top: 1.5rem;
}

.plan-summary {
    background: var(--primary-light);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-cost,
.total-savings {
    font-size: 1.1rem;
}

.store-plans {
    display: grid;
    gap: 1rem;
}

.store-plan {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.store-name {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    margin: -1rem -1rem 1rem -1rem;
    font-weight: 600;
}

.store-total {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.plan-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

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

.item-price {
    font-weight: 600;
    color: var(--primary-color);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background-color: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #c3e6c3;
}

.alert-error {
    background-color: #ffeaea;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Settings specific */
.setting-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.setting-section:last-of-type {
    border-bottom: none;
}

.danger-zone {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 2rem;
}

.danger-zone h3 {
    color: var(--error);
    margin-bottom: 1rem;
}

/* Help text */
.help-text {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 0.25rem 0.5rem;
    }
    
    .store-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .store-card {
        height: 70px;
        font-size: 0.85rem;
    }
    
    .plan-summary {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .match-info {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .store {
        flex: 0 0 80px;
        font-size: 0.85rem;
    }
    
    .product {
        font-size: 0.8rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    .auth-card,
    .onboarding-card,
    .settings-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .store-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-brand {
        font-size: 1.1rem;
    }
    
    .main-content {
        padding-top: 70px;
    }
}
/* Tier options within item */
.tier-options {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.tier-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    flex-wrap: wrap;
}

.tier-row.tier-empty {
    opacity: 0.4;
}

.tier-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 60px;
    text-align: center;
    background: var(--border);
    color: var(--text-secondary);
}

.tier-badge-sm {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    min-width: 45px;
}

.tier-budget .tier-badge { background: #e8f5e9; color: #2e7d32; }
.tier-mid .tier-badge { background: #e3f2fd; color: #1565c0; }
.tier-premium .tier-badge { background: #fff3e0; color: #e65100; }

.was-price {
    color: var(--text-light);
    font-size: 0.85rem;
    text-decoration: line-through;
}

.fire-deal {
    color: #e65100;
    font-weight: 600;
    font-size: 0.85rem;
}

.product-name {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-left: 70px;
}

.no-option {
    color: var(--text-light);
}

/* Shopping plan */
.plan-meta {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.store-plan {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

.store-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.store-total {
    font-size: 1.1rem;
}

.store-items {
    padding: 0.5rem;
}

.plan-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

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

.plan-item-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-query {
    flex: 1;
    font-weight: 500;
}

.item-price {
    font-weight: 600;
    color: var(--primary-dark);
}

.plan-item-product {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-left: 55px;
}

.plan-item-size {
    font-size: 0.75rem;
    color: var(--text-light);
    padding-left: 55px;
}

.plan-tip {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-style: italic;
}

/* Exceptional deals */
.exceptional-deals {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--warning);
}

.deal-card {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.deal-store {
    font-weight: 600;
    color: var(--primary-dark);
}

.deal-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.deal-price {
    font-weight: 600;
    margin-top: 0.25rem;
}

.deal-type {
    background: var(--warning);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.deal-savings {
    color: var(--success);
    font-size: 0.85rem;
}

/* Legal pages */
.legal-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
    line-height: 1.7;
}
.legal-page h1 { color: #4CAF50; margin-bottom: 0.5rem; }
.legal-page h2 { color: #333; margin-top: 1.5rem; font-size: 1.1rem; }
.legal-page ul { padding-left: 1.5rem; }
.legal-updated { color: #666; font-style: italic; margin-bottom: 1.5rem; }
.footer a { color: #4CAF50; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
