/* ============================================
   VECKANS RECEPT - Scandinavian Design System
   ============================================ */

:root {
    /* Warm Nordic palette */
    --color-cream: #F7F4EF;
    --color-paper: #FFFDF9;
    --color-ink: #1A1915;
    --color-ink-soft: #4A4640;
    --color-ink-muted: #8A857D;

    /* Accent colors */
    --color-amber: #D4A853;
    --color-amber-soft: #E8D4A8;
    --color-terracotta: #C67B5C;
    --color-forest: #4A6741;
    --color-forest-soft: #8BA882;

    /* Store colors */
    --color-ica: #E13205;
    --color-ica-soft: #FFEAE4;
    --color-coop: #00843D;
    --color-coop-soft: #E0F4E9;
    --color-willys: #E30613;
    --color-willys-soft: #FCE4E6;

    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;

    /* Layout */
    --max-width: 1400px;
    --border-radius: 12px;
    --border-radius-sm: 6px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Shadow colors */
    --shadow-color: rgba(0, 0, 0, 0.04);
    --shadow-color-hover: rgba(0, 0, 0, 0.08);
    --shadow-color-strong: rgba(0, 0, 0, 0.1);
    --border-soft: rgba(26, 25, 21, 0.08);
    --border-softer: rgba(26, 25, 21, 0.06);
    --border-medium: rgba(26, 25, 21, 0.1);
    --focus-glow: rgba(212, 168, 83, 0.15);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --color-cream: #1A1915;
        --color-paper: #252320;
        --color-ink: #F7F4EF;
        --color-ink-soft: #C5C0B8;
        --color-ink-muted: #A09A92;
        --color-amber: #E8B85C;
        --color-amber-soft: #3D3525;
        --color-terracotta: #D88B6C;
        --color-forest: #5A7B51;
        --color-forest-soft: #2A3527;
        --color-ica-soft: #3D2220;
        --color-coop: #2ECC71;
        --color-coop-soft: #1A3326;
        --color-willys-soft: #3D2022;
        --shadow-color: rgba(0, 0, 0, 0.2);
        --shadow-color-hover: rgba(0, 0, 0, 0.3);
        --shadow-color-strong: rgba(0, 0, 0, 0.4);
        --border-soft: rgba(255, 255, 255, 0.08);
        --border-softer: rgba(255, 255, 255, 0.06);
        --border-medium: rgba(255, 255, 255, 0.1);
        --focus-glow: rgba(232, 184, 92, 0.3);
    }
}

/* Manual toggle override */
[data-theme="dark"] {
    --color-cream: #1A1915;
    --color-paper: #252320;
    --color-ink: #F7F4EF;
    --color-ink-soft: #C5C0B8;
    --color-ink-muted: #A09A92;
    --color-amber: #E8B85C;
    --color-amber-soft: #3D3525;
    --color-terracotta: #D88B6C;
    --color-forest: #5A7B51;
    --color-forest-soft: #2A3527;
    --color-ica-soft: #3D2220;
    --color-coop: #2ECC71;
    --color-coop-soft: #1A3326;
    --color-willys-soft: #3D2022;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --shadow-color-hover: rgba(0, 0, 0, 0.3);
    --shadow-color-strong: rgba(0, 0, 0, 0.4);
    --border-soft: rgba(255, 255, 255, 0.08);
    --border-softer: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --focus-glow: rgba(232, 184, 92, 0.3);
}

[data-theme="light"] {
    --color-cream: #F7F4EF;
    --color-paper: #FFFDF9;
    --color-ink: #1A1915;
    --color-ink-soft: #4A4640;
    --color-ink-muted: #8A857D;
    --color-amber: #D4A853;
    --color-amber-soft: #E8D4A8;
    --color-terracotta: #C67B5C;
    --color-forest: #4A6741;
    --color-forest-soft: #8BA882;
    --color-ica-soft: #FFEAE4;
    --color-coop-soft: #E0F4E9;
    --color-willys-soft: #FCE4E6;
    --shadow-color: rgba(0, 0, 0, 0.04);
    --shadow-color-hover: rgba(0, 0, 0, 0.08);
    --shadow-color-strong: rgba(0, 0, 0, 0.1);
    --border-soft: rgba(26, 25, 21, 0.08);
    --border-softer: rgba(26, 25, 21, 0.06);
    --border-medium: rgba(26, 25, 21, 0.1);
    --focus-glow: rgba(212, 168, 83, 0.15);
}

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

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

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

html.theme-transition,
html.theme-transition *:not(.recipe-card):not(.recipe-card *),
html.theme-transition *:not(.recipe-card):not(.recipe-card *)::before,
html.theme-transition *:not(.recipe-card):not(.recipe-card *)::after {
    transition: background-color 0.4s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Instant theme switch for recipe cards (performance) */
html.theme-transition .recipe-card,
html.theme-transition .recipe-card * {
    transition: none !important;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-cream);
    color: var(--color-ink);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}


/* Header */
.header {
    background: var(--color-paper);
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
}

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

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--color-terracotta);
    animation: logoReveal 0.8s var(--ease-out) both;
}

@keyframes logoReveal {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    animation: textSlide 0.6s var(--ease-out) 0.1s both;
}

.tagline {
    font-size: 0.875rem;
    color: var(--color-ink-muted);
    animation: textSlide 0.6s var(--ease-out) 0.2s both;
}

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

.update-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-cream);
    border-radius: 100px;
    font-size: 0.8125rem;
    color: var(--color-ink-soft);
    animation: fadeIn 0.6s var(--ease-out) 0.3s both;
}

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

/* Desktop Navigation Tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    animation: fadeIn 0.6s var(--ease-out) 0.25s both;
}

.nav-tab {
    position: relative;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-ink-muted);
    text-decoration: none;
    transition: color 0.25s var(--ease-out);
    border-radius: var(--border-radius-sm);
}

.nav-tab:hover {
    color: var(--color-ink-soft);
}

.nav-tab.active {
    color: var(--color-ink);
}

.nav-tab-text {
    position: relative;
    z-index: 1;
}

.nav-tab-indicator {
    position: absolute;
    bottom: 0;
    left: var(--space-md);
    right: var(--space-md);
    height: 2px;
    background: var(--color-terracotta);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s var(--ease-out);
}

.nav-tab:hover .nav-tab-indicator {
    transform: scaleX(0.6);
    opacity: 0.4;
}

.nav-tab.active .nav-tab-indicator {
    transform: scaleX(1);
    opacity: 1;
}

/* Hide desktop nav on mobile */
@media (max-width: 768px) {
    .nav-tabs {
        display: none;
    }
}

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

.update-dot {
    width: 8px;
    height: 8px;
    background: var(--color-forest);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* Main */
.main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-xl);
}

/* Page Containers */
.page {
    animation: pageEnter 0.4s var(--ease-out) both;
}

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

/* Placeholder Pages */
.page-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    padding: var(--space-2xl);
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    color: var(--color-ink-muted);
    opacity: 0.4;
    margin-bottom: var(--space-lg);
}

.placeholder-icon svg {
    width: 100%;
    height: 100%;
}

.placeholder-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--color-ink-soft);
    margin-bottom: var(--space-sm);
}

.placeholder-text {
    font-size: 1rem;
    color: var(--color-ink-muted);
}

/* Controls */
.controls {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
    animation: slideUp 0.6s var(--ease-out) 0.2s both;
}

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

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-ink-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) calc(var(--space-md) * 3);
    font-family: var(--font-body);
    font-size: 1rem;
    background: var(--color-paper);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    outline: none;
    transition: all 0.3s var(--ease-out);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.search-input:focus {
    border-color: var(--color-amber);
    box-shadow: 0 4px 20px var(--focus-glow);
}

.search-input::placeholder {
    color: var(--color-ink-muted);
}

.filter-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    align-items: center;
}

/* Store Select Dropdown */
.store-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.store-select {
    padding: var(--space-md) var(--space-xl) var(--space-md) var(--space-lg);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    background: var(--color-paper);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    box-shadow: 0 2px 8px var(--shadow-color);
    appearance: none;
    color: var(--color-ink);
    min-width: 180px;
}

.store-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-color-hover);
}

.store-select:focus {
    outline: none;
    border-color: var(--color-amber);
    box-shadow: 0 4px 20px var(--focus-glow);
}

.store-select optgroup {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
    background: var(--color-cream);
    padding: var(--space-sm) 0;
}

.store-select option {
    font-weight: 400;
    padding: var(--space-sm);
    background: var(--color-paper);
    color: var(--color-ink);
}

.store-select-icon {
    position: absolute;
    right: var(--space-md);
    width: 16px;
    height: 16px;
    color: var(--color-ink-muted);
    pointer-events: none;
    transition: transform 0.2s var(--ease-out);
}

.store-select:focus + .store-select-icon {
    color: var(--color-amber);
}

@media (prefers-color-scheme: dark) {
    .store-select {
        border-color: var(--border-medium);
    }
}

[data-theme="dark"] .store-select {
    border-color: var(--border-medium);
}

[data-theme="light"] .store-select {
    border-color: transparent;
}

.filter-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.filter-dot.ica {
    background: var(--color-ica);
}

.filter-dot.coop {
    background: var(--color-coop);
}

.filter-dot.willys {
    background: var(--color-willys);
}

/* Sort Select */
.sort-select {
    padding: var(--space-md) var(--space-lg);
    padding-right: calc(var(--space-lg) + 20px);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    background: var(--color-paper);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    box-shadow: 0 2px 8px var(--shadow-color);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A4640' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    color: var(--color-ink);
}

@media (prefers-color-scheme: dark) {
    .sort-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C5C0B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    }
}

[data-theme="dark"] .sort-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C5C0B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="light"] .sort-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A4640' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.sort-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-color-hover);
}

.sort-select:focus {
    outline: none;
    border-color: var(--color-amber);
    box-shadow: 0 4px 20px var(--focus-glow);
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
    animation: slideUp 0.6s var(--ease-out) 0.25s both;
}

.category-pill {
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--color-paper);
    border: 1px solid var(--border-medium);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.category-pill:hover {
    background: var(--color-cream);
    border-color: var(--color-amber);
}

.category-pill.active {
    background: var(--color-ink);
    color: var(--color-paper);
    border-color: var(--color-ink);
}

/* Nutrition Pills */
.nutrition-pills {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
    animation: slideUp 0.6s var(--ease-out) 0.28s both;
}

.nutrition-pill {
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--color-paper);
    border: 1px solid var(--color-forest-soft);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    color: var(--color-forest);
}

.nutrition-pill:hover {
    background: color-mix(in srgb, var(--color-forest-soft) 30%, var(--color-paper));
    border-color: var(--color-forest);
}

.nutrition-pill.active {
    background: var(--color-forest);
    color: var(--color-paper);
    border-color: var(--color-forest);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-md) 0;
    margin-bottom: var(--space-xl);
    animation: slideUp 0.6s var(--ease-out) 0.3s both;
}

.stat {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-terracotta);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-ink-muted);
}

.stat-divider {
    width: 4px;
    height: 4px;
    background: var(--color-ink-muted);
    border-radius: 50%;
    opacity: 0.4;
}

/* Recipe Grid */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-lg);
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--color-ink-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-paper);
    border-top-color: var(--color-terracotta);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-md);
}

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

/* Recipe Card */
.recipe-card {
    background: var(--color-paper);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.4s var(--ease-out);
    box-shadow: 0 2px 12px var(--shadow-color);
    animation: cardReveal 0.6s var(--ease-out) both;
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: auto 350px;
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.recipe-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    pointer-events: none;
    transition: border-color 0.3s var(--ease-out);
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px var(--shadow-color-strong);
}

.recipe-card:hover::before {
    border-color: var(--color-amber);
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card-header {
    padding: var(--space-lg);
    padding-bottom: var(--space-md);
}

.card-category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-ink-muted);
    margin-bottom: var(--space-sm);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: var(--space-md);
    transition: color 0.2s;
}

.recipe-card:hover .card-title {
    color: var(--color-terracotta);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 0.8125rem;
    color: var(--color-ink-soft);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-icon {
    opacity: 0.6;
}

/* Match Score */
.match-score {
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--color-amber-soft) 0%, var(--color-cream) 100%);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.score-ring {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.score-ring svg {
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--color-paper);
    stroke-width: 4;
}

.score-ring-progress {
    fill: none;
    stroke: var(--color-terracotta);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 138.23;
    stroke-dashoffset: 138.23;
    transition: stroke-dashoffset 1s var(--ease-out);
}

.score-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
}

.score-details {
    flex: 1;
}

.score-label {
    font-size: 0.75rem;
    color: var(--color-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.score-fraction {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
}

/* Ingredients */
.ingredients-section {
    padding: var(--space-sm) var(--space-lg);
}

/* Ingredients Accordion */
.ingredients-accordion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-sm) 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-ink-soft);
    transition: color 0.2s var(--ease-out);
}

.ingredients-accordion:hover {
    color: var(--color-ink);
}

.ingredients-accordion:focus-visible {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

.accordion-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s var(--ease-out);
    flex-shrink: 0;
}

.ingredients-accordion.open .accordion-icon {
    transform: rotate(180deg);
}

.ingredients-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease-out);
}

.ingredients-accordion-content.open {
    max-height: 500px;
}

/* Ingredient Rows */
.ingredient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-softer);
}

.ingredient-row:last-child {
    border-bottom: none;
}

.ingredient-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-ink);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ingredient-deal {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.store-badge {
    padding: 2px 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 4px;
    background: var(--color-cream);
    color: var(--color-ink-muted);
}

.store-badge.ica {
    background: var(--color-ica-soft);
    color: var(--color-ica);
}

.store-badge.coop {
    background: var(--color-coop-soft);
    color: var(--color-coop);
}

.store-badge.willys {
    background: var(--color-willys-soft);
    color: var(--color-willys);
}

.ingredient-deal .deal-price {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-terracotta);
}

.ingredient-deal .price-original {
    font-size: 0.75rem;
    color: var(--color-ink-muted);
    text-decoration: line-through;
}

/* Legacy ingredient tags (keep for backwards compat) */
.ingredients-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-ink-muted);
    margin-bottom: var(--space-sm);
}

.ingredient-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.ingredient-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.8125rem;
    border-radius: 100px;
    background: var(--color-cream);
    color: var(--color-ink-soft);
}

.ingredient-tag.matched {
    background: var(--color-forest-soft);
    color: var(--color-forest);
    font-weight: 500;
}

.ingredient-tag.matched.ica {
    background: var(--color-ica-soft);
    color: var(--color-ica);
}

.ingredient-tag.matched.coop {
    background: var(--color-coop-soft);
    color: var(--color-coop);
}

.ingredient-tag.matched.willys {
    background: var(--color-willys-soft);
    color: var(--color-willys);
}

.tag-price {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    font-weight: 600;
    opacity: 0.9;
}

.price-current {
    color: inherit;
}

.price-unit {
    font-weight: 400;
    font-size: 0.85em;
    opacity: 0.7;
}

.price-original {
    text-decoration: line-through;
    opacity: 0.5;
    font-size: 0.85em;
    font-weight: 400;
}

/* Nutrition Section */
.nutrition-section {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-softer);
    background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
    .nutrition-section {
        background: rgba(255, 255, 255, 0.02);
    }
}

[data-theme="dark"] .nutrition-section {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .nutrition-section {
    background: rgba(0, 0, 0, 0.02);
}

.nutrition-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-ink-muted);
    margin-bottom: var(--space-sm);
}

.nutrition-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.nutrition-label {
    color: var(--color-ink-muted);
}

.nutrition-value {
    font-weight: 500;
}

/* Card Footer */
.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-softer);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-terracotta);
    text-decoration: none;
    transition: all 0.2s;
}

.recipe-link:hover {
    gap: var(--space-md);
}

.recipe-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s var(--ease-out);
}

.recipe-link:hover svg {
    transform: translateX(4px);
}

.rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
}

.rating-star {
    color: var(--color-amber);
}

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

.empty-state h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--color-ink-soft);
}

/* ============================================
   DEALS PAGE
   ============================================ */


.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--color-paper);
    border: 1px solid var(--border-medium);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.filter-chip:hover {
    background: var(--color-cream);
    border-color: var(--color-amber);
}

.filter-chip.active {
    background: var(--color-ink);
    color: var(--color-paper);
    border-color: var(--color-ink);
}

.filter-chip:focus-visible {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
}

.filter-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.filter-chip .chip-dot.ica { background: var(--color-ica); }
.filter-chip .chip-dot.coop { background: var(--color-coop); }
.filter-chip .chip-dot.willys { background: var(--color-willys); }

/* Deals Container */
.deals-container {
    min-height: 300px;
}

/* Selection Bar - Floating Paper Card */
.selection-bar {
    position: fixed;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-paper);
    color: var(--color-ink);
    border-radius: var(--border-radius);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.06),
        0 16px 48px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-soft);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s, transform 0.4s var(--ease-bounce);
    z-index: 150;
}

.selection-bar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

@media (min-width: 769px) {
    .selection-bar {
        bottom: var(--space-xl);
    }
}

/* Terracotta badge with count */
.selection-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 var(--space-sm);
    background: var(--color-terracotta);
    color: var(--color-paper);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
}

.selection-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-ink-soft);
}

/* Vertical divider */
.selection-divider {
    width: 1px;
    height: 1.5rem;
    background: var(--border-soft);
    margin: 0 var(--space-xs);
}

/* Mobile: hide label, compact layout */
@media (max-width: 768px) {
    .selection-bar {
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
    }

    .selection-label {
        display: none;
    }

    .selection-divider {
        margin: 0;
    }

    .selection-btn {
        padding: var(--space-sm);
    }

    /* Hide button text, show only icons */
    .selection-btn span {
        display: none;
    }
}

.selection-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    color: var(--color-ink);
    border: 1px solid var(--border-soft);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.selection-btn:hover:not(:disabled) {
    background: var(--color-cream);
    border-color: var(--border-medium);
}

.selection-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forest green primary button */
.selection-btn.primary {
    background: var(--color-forest);
    color: var(--color-paper);
    border-color: var(--color-forest);
}

.selection-btn.primary:hover:not(:disabled) {
    background: var(--color-forest-soft);
    border-color: var(--color-forest-soft);
    color: var(--color-ink);
}

/* Ghost secondary button */
.selection-btn.secondary {
    background: transparent;
    color: var(--color-ink-muted);
    border-color: transparent;
}

.selection-btn.secondary:hover:not(:disabled) {
    background: var(--color-cream);
    color: var(--color-ink);
}

.selection-btn svg {
    width: 16px;
    height: 16px;
}

.selection-btn:focus-visible {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
}

/* Deals Table (Desktop) */
.deals-table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    background: var(--color-paper);
    box-shadow: 0 2px 12px var(--shadow-color);
}

.deals-table {
    width: 100%;
    min-width: 800px;
}

.deals-thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-paper);
    border-bottom: 2px solid var(--border-medium);
}

.deals-tr {
    display: grid;
    grid-template-columns: 48px 56px 1fr 100px 100px 120px 1.2fr;
    align-items: center;
    gap: var(--space-sm);
    padding: 0 var(--space-md);
    transition: background 0.15s ease;
}

.deals-header-row {
    height: 48px;
}

.deals-tr:not(.deals-header-row):hover {
    background: var(--color-cream);
}

.deals-tr.selected {
    background: var(--color-amber-soft);
}

.deals-th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-ink-muted);
    padding: var(--space-sm) 0;
}

.deals-th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.deals-th[data-sort]:hover {
    color: var(--color-ink);
}

.deals-th[data-sort]:focus-visible {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

.deals-td {
    font-size: 0.875rem;
    padding: var(--space-sm) 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Checkbox styling */
.deal-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.deal-checkbox-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.deal-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    background: var(--color-paper);
    transition: all 0.2s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.deal-checkbox-label input:checked + .deal-checkbox-custom {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
}

.deal-checkbox-label input:checked + .deal-checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid var(--color-paper);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.deal-checkbox-label:hover .deal-checkbox-custom {
    border-color: var(--color-terracotta);
}

.deal-checkbox-label input:focus-visible + .deal-checkbox-custom {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
}

.deal-checkbox-label input:indeterminate + .deal-checkbox-custom {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
}

.deal-checkbox-label input:indeterminate + .deal-checkbox-custom::after {
    content: '';
    width: 10px;
    height: 2px;
    background: var(--color-paper);
}

/* Thumbnail */
.deal-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-cream);
}

.deal-thumb.ica { background: var(--color-ica-soft); color: var(--color-ica); }
.deal-thumb.coop { background: var(--color-coop-soft); color: var(--color-coop); }
.deal-thumb.willys { background: var(--color-willys-soft); color: var(--color-willys); }

.deal-thumb-img {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    object-fit: cover;
}

.deal-store-icon {
    width: 24px;
    height: 24px;
}

/* Name cell */
.deal-name {
    font-weight: 500;
    color: var(--color-ink);
}

.deal-unit {
    font-size: 0.75rem;
    color: var(--color-ink-muted);
    margin-left: var(--space-xs);
}

/* Price */
.deal-price {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-terracotta);
}

.deal-original-price {
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
    text-decoration: line-through;
}

/* Store badge */
.deal-store-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 100px;
    background: var(--color-cream);
    color: var(--color-ink-muted);
}

.deal-store-badge.ica { background: var(--color-ica-soft); color: var(--color-ica); }
.deal-store-badge.coop { background: var(--color-coop-soft); color: var(--color-coop); }
.deal-store-badge.willys { background: var(--color-willys-soft); color: var(--color-willys); }

/* Description */
.deal-desc {
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
}

/* ===========================================
   DEALS CARDS (Mobile) - ICA-inspired design
   =========================================== */

.deals-virtual-scroll {
    padding: var(--space-sm);
}

/* Card container - horizontal layout */
.deal-card {
    background: var(--color-paper);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px var(--shadow-color);
    display: grid;
    grid-template-columns: 130px 1fr;
    grid-template-rows: 1fr auto;
    margin: var(--space-sm) 0;
    transition: box-shadow 0.2s var(--ease-out), transform 0.15s var(--ease-out);
}

.deal-card:active {
    transform: scale(0.99);
}

.deal-card.selected {
    box-shadow: 0 0 0 2px var(--color-forest), 0 4px 12px var(--shadow-color-hover);
}

/* Left side - Product image area */
.deal-card-media {
    grid-row: 1 / 3;
    position: relative;
    background: #f8f7f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.deal-card.ica .deal-card-media { background: #fef7f5; }
.deal-card.coop .deal-card-media { background: #f5faf7; }
.deal-card.willys .deal-card-media { background: #fef5f5; }

.deal-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    transition: transform 0.3s var(--ease-out);
}

.deal-card:hover .deal-card-img {
    transform: scale(1.03);
}

.deal-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
}

.deal-card-placeholder .deal-store-icon {
    width: 48px;
    height: 48px;
}

/* Price tag - positioned over image */
.deal-card-price-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--color-ica);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    min-width: 48px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.deal-card-price-tag.coop { background: var(--color-coop); }
.deal-card-price-tag.willys { background: var(--color-willys); }

.deal-card-price-tag .price-value {
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.deal-card-price-tag .price-unit {
    font-size: 0.625rem;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 1px;
}

/* Right side - Content area */
.deal-card-content {
    display: flex;
    flex-direction: column;
    padding: 14px 14px 0 14px;
}

.deal-card-info {
    flex: 1;
    min-height: 0;
}

.deal-card-title {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-ink);
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.deal-card-meta {
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CTA Button - Full width, ICA red style */
.deal-card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% + 28px);
    margin: 12px -14px 0 -14px;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: white;
    background: var(--color-ica);
    border: none;
    border-radius: 0 0 16px 0;
    cursor: pointer;
    transition: background 0.15s var(--ease-out), transform 0.1s;
}

.deal-card.coop .deal-card-cta { background: var(--color-coop); }
.deal-card.willys .deal-card-cta { background: var(--color-willys); }

.deal-card-cta:hover {
    filter: brightness(1.08);
}

.deal-card-cta:active {
    transform: scale(0.98);
}

.deal-card-cta.added {
    background: var(--color-forest);
}

.deal-card-cta .cta-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2.5;
}

.deal-card-cta .cta-text {
    letter-spacing: 0.01em;
}

.deal-card-cta:focus-visible {
    outline: 3px solid var(--color-amber);
    outline-offset: -3px;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .deal-card-media {
        background: rgba(255, 255, 255, 0.03);
    }
    .deal-card.ica .deal-card-media { background: rgba(225, 50, 5, 0.08); }
    .deal-card.coop .deal-card-media { background: rgba(0, 132, 61, 0.08); }
    .deal-card.willys .deal-card-media { background: rgba(227, 6, 19, 0.08); }
}

[data-theme="dark"] .deal-card-media {
    background: rgba(255, 255, 255, 0.03);
}
[data-theme="dark"] .deal-card.ica .deal-card-media { background: rgba(225, 50, 5, 0.08); }
[data-theme="dark"] .deal-card.coop .deal-card-media { background: rgba(0, 132, 61, 0.08); }
[data-theme="dark"] .deal-card.willys .deal-card-media { background: rgba(227, 6, 19, 0.08); }


/* Hide table on mobile, show cards */
@media (max-width: 768px) {
    .deals-table-wrapper {
        display: none;
    }
}

@media (min-width: 769px) {
    .deals-virtual-scroll {
        display: none;
    }
}

/* Footer */
.footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-xl);
    padding-top: var(--space-2xl);
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-ink-muted);
}

.footer strong {
    color: var(--color-ink-soft);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-md);
    }

    .main {
        padding: var(--space-md);
    }

    .controls {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        overflow-x: auto;
        padding-bottom: var(--space-sm);
    }

    .filter-btn {
        flex-shrink: 0;
    }

    .recipe-grid {
        grid-template-columns: 1fr;
    }

    .logo-text h1 {
        font-size: 1.5rem;
    }
}

/* Stagger animation delays */
.recipe-card:nth-child(1) { animation-delay: 0.1s; }
.recipe-card:nth-child(2) { animation-delay: 0.15s; }
.recipe-card:nth-child(3) { animation-delay: 0.2s; }
.recipe-card:nth-child(4) { animation-delay: 0.25s; }
.recipe-card:nth-child(5) { animation-delay: 0.3s; }
.recipe-card:nth-child(6) { animation-delay: 0.35s; }
.recipe-card:nth-child(7) { animation-delay: 0.4s; }
.recipe-card:nth-child(8) { animation-delay: 0.45s; }
.recipe-card:nth-child(9) { animation-delay: 0.5s; }
.recipe-card:nth-child(n+10) { animation-delay: 0.55s; }

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-cream);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    color: var(--color-ink-soft);
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--color-amber) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s var(--ease-out);
    border-radius: 50%;
}

.theme-toggle:hover {
    background: var(--color-amber-soft);
    color: var(--color-amber);
    transform: scale(1.1);
    box-shadow: 0 4px 20px var(--focus-glow);
}

.theme-toggle:hover::before {
    opacity: 0.15;
    transform: scale(1.5);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    position: absolute;
    transition: opacity 0.3s, transform 0.4s var(--ease-bounce);
}

.theme-toggle:hover svg {
    transform: rotate(20deg);
}

/* Default: light mode - show moon, hide sun */
.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* System dark mode preference */
@media (prefers-color-scheme: dark) {
    .theme-toggle .icon-moon {
        opacity: 0;
        transform: rotate(90deg) scale(0.5);
    }
    .theme-toggle .icon-sun {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Explicit dark theme */
[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Explicit light theme */
[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* Mobile Bottom Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--color-paper);
    border-top: 1px solid var(--border-soft);
    padding: var(--space-sm) var(--space-md);
    padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px var(--shadow-color);
}

@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    /* Add bottom padding to main content to prevent overlap */
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }

    .footer {
        padding-bottom: calc(var(--space-xl) + 70px + env(safe-area-inset-bottom, 0px));
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    color: var(--color-ink-muted);
    border-radius: var(--border-radius);
    transition: all 0.25s var(--ease-out);
    position: relative;
    min-width: 64px;
}

.mobile-nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-terracotta);
    opacity: 0;
    border-radius: var(--border-radius);
    transform: scale(0.8);
    transition: all 0.25s var(--ease-out);
}

.mobile-nav-item:active::before {
    opacity: 0.08;
    transform: scale(1);
}

.mobile-nav-item.active {
    color: var(--color-terracotta);
}

.mobile-nav-item.active::before {
    opacity: 0.1;
    transform: scale(1);
}

.mobile-nav-icon {
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 1;
    transition: transform 0.25s var(--ease-bounce);
}

.mobile-nav-item:active .mobile-nav-icon {
    transform: scale(0.9);
}

.mobile-nav-item.active .mobile-nav-icon {
    stroke-width: 2;
}

.mobile-nav-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
    transition: transform 0.25s var(--ease-out);
}

.mobile-nav-item.active .mobile-nav-label {
    font-weight: 600;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .theme-toggle svg {
        transition: none;
    }
    html.theme-transition,
    html.theme-transition *,
    html.theme-transition *::before,
    html.theme-transition *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   BOTTOM SHEET
   ============================================ */

.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s;
}

.bottom-sheet-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: var(--color-paper);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transform: translateY(100%);
    transition: transform 0.35s var(--ease-out);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bottom-sheet-overlay.visible .bottom-sheet {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-medium);
    border-radius: 2px;
    margin: 12px auto 8px;
    flex-shrink: 0;
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--space-lg) var(--space-lg);
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}

/* Body scroll lock when sheet is open */
body.sheet-open {
    overflow: hidden;
}

/* Sheet header */
.sheet-header {
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: var(--space-lg);
}

.sheet-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
}

.sheet-subtitle {
    font-size: 0.875rem;
    color: var(--color-ink-muted);
    margin: var(--space-xs) 0 0;
}

/* Sheet body */
.sheet-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* List of existing lists in sheet */
.sheet-lists {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sheet-list-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-md);
    background: var(--color-cream);
    border: 1px solid var(--border-soft);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    text-align: left;
}

.sheet-list-btn:hover {
    background: var(--color-paper);
    border-color: var(--color-amber);
}

.sheet-list-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sheet-list-name {
    font-weight: 500;
    color: var(--color-ink);
}

.sheet-list-meta {
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
}

.sheet-list-stores {
    display: flex;
    gap: 4px;
}

.sheet-store-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-ink-muted);
}

.sheet-store-dot.ica { background: var(--color-ica); }
.sheet-store-dot.coop { background: var(--color-coop); }
.sheet-store-dot.willys { background: var(--color-willys); }

/* Create new list button in sheet */
.sheet-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    background: transparent;
    border: 2px dashed var(--border-medium);
    border-radius: var(--border-radius);
    color: var(--color-ink-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.sheet-create-btn:hover {
    border-color: var(--color-amber);
    color: var(--color-ink);
}

.sheet-create-btn svg {
    width: 20px;
    height: 20px;
}

/* Sheet form */
.sheet-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.sheet-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-ink-soft);
}

.sheet-input {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    background: var(--color-cream);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    outline: none;
    transition: all 0.2s var(--ease-out);
}

.sheet-input:focus {
    border-color: var(--color-amber);
    background: var(--color-paper);
}

/* Sheet action buttons */
.sheet-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.sheet-btn {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

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

.sheet-btn.primary:hover {
    filter: brightness(1.1);
}

.sheet-btn.secondary {
    background: var(--color-cream);
    color: var(--color-ink-soft);
}

.sheet-btn.secondary:hover {
    background: var(--border-soft);
}

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

.sheet-btn.danger:hover {
    filter: brightness(1.1);
}

/* Desktop: Modal instead of bottom sheet */
@media (min-width: 769px) {
    .bottom-sheet-overlay {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .bottom-sheet {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        width: 100%;
        max-width: 420px;
        max-height: 80vh;
        border-radius: var(--border-radius);
        transform: scale(0.95);
        opacity: 0;
        transition: transform 0.25s var(--ease-out), opacity 0.25s var(--ease-out);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    }

    .bottom-sheet-overlay.visible .bottom-sheet {
        transform: scale(1);
        opacity: 1;
    }

    .bottom-sheet-handle {
        display: none;
    }

    .bottom-sheet-content {
        padding-top: var(--space-lg);
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

@media (min-width: 769px) {
    .toast-container {
        bottom: calc(var(--space-xl) + 16px);
    }
}

.toast {
    background: var(--color-ink);
    color: var(--color-paper);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s var(--ease-out);
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ============================================
   LISTS PAGE
   ============================================ */

.lists-container {
    min-height: 300px;
}

.lists-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.lists-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 500;
}

.lists-count {
    font-size: 0.875rem;
    color: var(--color-ink-muted);
}

/* Lists grid */
.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* List card */
.list-card {
    background: var(--color-paper);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    box-shadow: 0 2px 12px var(--shadow-color);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    animation: cardReveal 0.4s var(--ease-out) both;
}

.list-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-color-hover);
}

.list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.list-card-name {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
    margin: 0;
    flex: 1;
}

.list-menu-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.list-menu-btn:hover {
    background: var(--color-cream);
    color: var(--color-ink);
}

.list-menu-btn svg {
    width: 18px;
    height: 18px;
}

.list-card-meta {
    display: flex;
    gap: var(--space-md);
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
    margin-bottom: var(--space-md);
}

.list-card-stores {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.list-store-badge {
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 100px;
    background: var(--color-cream);
    color: var(--color-ink-muted);
}

.list-store-badge.ica { background: var(--color-ica-soft); color: var(--color-ica); }
.list-store-badge.coop { background: var(--color-coop-soft); color: var(--color-coop); }
.list-store-badge.willys { background: var(--color-willys-soft); color: var(--color-willys); }

/* List menu dropdown */
.list-menu-dropdown {
    position: fixed;
    background: var(--color-paper);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow-color-strong);
    padding: var(--space-xs);
    z-index: 250;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.15s var(--ease-out);
}

.list-menu-dropdown.visible {
    opacity: 1;
    transform: scale(1);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--color-ink);
    cursor: pointer;
    transition: background 0.15s;
}

.menu-item:hover {
    background: var(--color-cream);
}

.menu-item.delete {
    color: var(--color-ica);
}

.menu-item svg {
    width: 16px;
    height: 16px;
}

/* Empty state for lists */
.lists-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    padding: var(--space-2xl);
}

.lists-empty-state .empty-icon {
    width: 80px;
    height: 80px;
    color: var(--color-ink-muted);
    opacity: 0.4;
    margin-bottom: var(--space-lg);
}

.lists-empty-state .empty-icon svg {
    width: 100%;
    height: 100%;
}

.lists-empty-state .empty-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--color-ink-soft);
    margin: 0 0 var(--space-sm);
}

.lists-empty-state .empty-text {
    font-size: 1rem;
    color: var(--color-ink-muted);
    margin: 0 0 var(--space-lg);
}

.create-list-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-forest);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.create-list-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.create-list-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   LIST DETAIL VIEW
   ============================================ */

.list-detail {
    animation: pageEnter 0.3s var(--ease-out) both;
}

.list-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.list-back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-cream);
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--color-ink-soft);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.list-back-btn:hover {
    background: var(--color-paper);
    color: var(--color-ink);
}

.list-back-btn svg {
    width: 20px;
    height: 20px;
}

.list-name-editable {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    margin: 0 calc(-1 * var(--space-sm));
    border-radius: var(--border-radius-sm);
    outline: none;
    transition: background 0.2s;
    flex: 1;
    min-width: 0;
}

.list-name-editable:focus {
    background: var(--color-cream);
}

.list-detail-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Store groups */
.list-store-group {
    background: var(--color-paper);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 12px var(--shadow-color);
}

.list-store-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-cream);
    font-weight: 500;
}

.list-store-header .store-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-ink-muted);
}

.list-store-header .store-dot.ica { background: var(--color-ica); }
.list-store-header .store-dot.coop { background: var(--color-coop); }
.list-store-header .store-dot.willys { background: var(--color-willys); }

.list-store-header.ica { background: var(--color-ica-soft); }
.list-store-header.coop { background: var(--color-coop-soft); }
.list-store-header.willys { background: var(--color-willys-soft); }

.list-store-header .store-name {
    flex: 1;
}

.list-store-header .store-count {
    font-size: 0.875rem;
    color: var(--color-ink-muted);
}

/* List items */
.list-items {
    padding: var(--space-sm);
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--border-radius-sm);
    transition: background 0.15s;
}

.list-item:hover {
    background: var(--color-cream);
}

.list-item.checked {
    opacity: 0.6;
}

.list-item.checked .list-item-name {
    text-decoration: line-through;
}

/* Item checkbox */
.list-item-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.list-item-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.list-item-checkbox .checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-medium);
    border-radius: 50%;
    background: var(--color-paper);
    transition: all 0.2s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-item-checkbox input:checked + .checkbox-custom {
    background: var(--color-forest);
    border-color: var(--color-forest);
}

.list-item-checkbox input:checked + .checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.list-item-checkbox:hover .checkbox-custom {
    border-color: var(--color-forest);
}

/* Item info */
.list-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.list-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-price {
    font-size: 0.8125rem;
    color: var(--color-ink-muted);
}

.list-item-price.ica { color: var(--color-ica); }
.list-item-price.coop { color: var(--color-coop); }
.list-item-price.willys { color: var(--color-willys); }

.list-item-image {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    object-fit: cover;
}

/* Checked section */
.list-checked-section {
    background: var(--color-paper);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 12px var(--shadow-color);
    opacity: 0.7;
}

.list-checked-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-cream);
}

.list-checked-header .checked-title {
    font-weight: 500;
    flex: 1;
}

.list-checked-header .checked-count {
    font-size: 0.875rem;
    color: var(--color-ink-muted);
}

.clear-checked-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius-sm);
    color: var(--color-ink-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-checked-btn:hover {
    background: var(--color-paper);
    border-color: var(--color-ink-muted);
    color: var(--color-ink);
}

.list-items.checked .list-item {
    opacity: 0.6;
}

/* Empty state in detail view */
.list-empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--color-ink-muted);
}

.list-empty-state p {
    margin-bottom: var(--space-md);
}

.list-add-link {
    color: var(--color-terracotta);
    font-weight: 500;
    text-decoration: none;
}

.list-add-link:hover {
    text-decoration: underline;
}
