:root {
    --navy-900: #0f172a;
    --navy-800: #1e3a5f;
    --navy-700: #1e3c72;
    --accent:   #2563eb;
    --accent-hover: #1d4ed8;
    --green:    #16a34a;
    --green-hover: #15803d;
    --red:      #dc2626;
    --text-primary:   #0f172a;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;
    --surface:  #ffffff;
    --bg:       #f1f5f9;
    --border:   #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 24px rgba(0,0,0,0.10);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
}

/* ── HEADER ─────────────────────────────────────────── */
header {
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 100%);
    color: white;
    padding: 2rem 1rem 1.75rem;
    text-align: center;
    position: relative;
}

.menu-btn {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.menu-btn:hover { background: rgba(255,255,255,0.2); }

.header-container {
    max-width: 700px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

header h1 span {
    color: #60a5fa;
}

header p {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 1.25rem;
}

/* Stats bar */
.stats-container {
    display: inline-flex;
    gap: 20px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 7px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1.25rem;
}

.stat-item strong {
    color: #4ade80;
}

/* Search box */
.search-box {
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

#searchInput {
    width: 100%;
    padding: 0.9rem 3rem 0.9rem 1.4rem;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    background: rgba(255,255,255,0.97);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    outline: none;
    color: var(--text-primary);
    transition: box-shadow 0.2s;
}

.search-clear {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: rgba(0,0,0,0.35);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.search-clear:hover {
    background: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.6);
}

#searchInput:focus {
    box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 3px rgba(96,165,250,0.4);
}

.result-count {
    display: block;
    margin-top: 8px;
    font-size: 0.82rem;
    color: #64748b;
}

/* Store filter pills */
.store-filters {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    color: #cbd5e1;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.16);
    color: white;
}

.filter-btn.active {
    background: white;
    color: var(--navy-900);
    border-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Category bar — now lives in main content */
.category-bar {
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.cat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.cat-tile:hover,
.cat-tile.active {
    border-color: var(--accent);
    color: var(--accent);
    background: #eff6ff;
}

.cat-tile.active {
    border-width: 2px;
    font-weight: 700;
}

.cat-tile-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

[data-theme="dark"] .cat-tile:hover,
[data-theme="dark"] .cat-tile.active {
    background: #1e2f4a;
    color: #93c5fd;
}

/* Sort pills */
.sort-filters {
    margin-top: 10px;
    gap: 7px;
    justify-content: center;
    flex-wrap: wrap;
}

.sort-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    color: #cbd5e1;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover { background: rgba(255,255,255,0.16); color: white; }

.sort-btn.active {
    background: #f59e0b;
    color: #1c1400;
    border-color: #f59e0b;
}

/* ── MAIN CONTENT ────────────────────────────────────── */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    padding-left: 12px;
    border-left: 4px solid var(--accent);
    letter-spacing: -0.2px;
}

.featured-section,
.trending-section {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 1.25rem 1.5rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-top-width: 3px;
}

.featured-section {
    background: #f0f6ff;
    border-top-color: var(--accent);
}

.trending-section {
    background: #fffbf0;
    border-top-color: #f59e0b;
}

.trending-title {
    border-left-color: #f59e0b;
    color: #78350f;
}

/* Hidden on desktop, shown on mobile via media query */
.view-toggle-btn { display: none; }

/* ── PRODUCT GRID ────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

/* ── PRODUCT CARD ────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.22s ease,
                border-color 0.22s ease;
}

.hit-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f97316, #ef4444);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 50px;
    pointer-events: none;
    z-index: 1;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #c7d7f9;
}

/* Card image — always white so product photos blend naturally */
.card-img {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid #f1f5f9;
}

.card-img img {
    max-height: 130px;
    max-width: 100%;
    object-fit: contain;
}

/* Store badge — soft tinted pill */
.store-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.store-kaufland {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.store-lidl {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

.store-billa {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde047;
}

.store-tmarket {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.store-fantastico {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fdba74;
}

/* Product name */
.product-name {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
    flex-grow: 1;
    margin-bottom: 0.9rem;
}

/* Price area */
.price-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-top: 1px solid var(--border);
    padding-top: 0.9rem;
}

.price-main {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.new-price {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--red);
    line-height: 1;
}

.old-price {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.discount-tag {
    background: var(--red);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: auto;
    align-self: center;
}

.price-sub {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.price-sub s {
    opacity: 0.65;
    margin-left: 5px;
}

.valid-until {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.45rem;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ── SHOPPING LIST PANEL ─────────────────────────────── */
.floating-list-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 13px 22px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.floating-list-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(37,99,235,0.5);
}

.list-badge {
    background: white;
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 800;
    min-width: 24px;
    text-align: center;
}

.shopping-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 380px;
    height: 100dvh;
    background: var(--surface);
    box-shadow: -4px 0 30px rgba(0,0,0,0.12);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.shopping-panel.open {
    right: 0;
}

/* ── LEFT MENU PANEL ─────────────────────────────────── */
.menu-panel {
    position: fixed;
    top: 0;
    left: -360px;
    width: 320px;
    height: 100dvh;
    background: var(--surface);
    box-shadow: 4px 0 30px rgba(0,0,0,0.15);
    z-index: 1001;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.menu-panel.open { left: 0; }

.menu-section {
    padding: 1rem 1.25rem;
}

.menu-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

/* ── MENU ACCORDION ──────────────────────────────────── */
.menu-toggle-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    justify-content: space-between;
    padding: 0;
    margin-bottom: 0;
}

.menu-toggle-btn:hover { opacity: 0.82; }

.menu-section-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-chevron {
    flex-shrink: 0;
    transition: transform 0.22s ease;
}

.menu-toggle-btn.open .menu-chevron { transform: rotate(180deg); }

.menu-collapsible {
    overflow: hidden;
    max-height: 800px;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    opacity: 1;
}

.menu-collapsible.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ── MENU NAV LINK (За Нас etc.) ────────────────────── */
.menu-nav-link-wrap {
    padding: 0.5rem 1.25rem 1.25rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
}

.menu-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.6rem 0;
    transition: color 0.2s;
}

.menu-nav-link:hover { color: var(--text-primary); }

/* ── BROCHURES ───────────────────────────────────────── */
.brochures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    padding: 0.5rem 0 0.25rem;
}

.brochure-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 0.5rem;
    border-radius: 10px;
    text-decoration: none;
    border-width: 1px;
    border-style: solid;
    transition: transform 0.15s, box-shadow 0.15s;
    gap: 3px;
    text-align: center;
    /* button reset */
    cursor: pointer;
    font-family: inherit;
}

/* ── BROCHURE VIEWER ─────────────────────────────────── */
.brochure-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    transform: translateY(100%);
    transition: transform 0.32s ease;
}
.brochure-modal.open { transform: translateY(0); }
#brochureFrame {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

.brochure-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }

.brochure-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

.brochure-store {
    font-size: 0.85rem;
    font-weight: 700;
    display: block;
}

.brochure-link {
    font-size: 0.7rem;
    opacity: 0.7;
    display: block;
}

.meal-planner { padding-top: 0.25rem; }

/* ── MEAL PLANNER ────────────────────────────────────── */
.meal-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.budget-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.budget-btn {
    padding: 7px 0;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
}

.budget-btn:hover, .budget-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.budget-custom-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.budget-custom-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.88rem;
}

.budget-custom-row input:focus {
    outline: none;
    border-color: var(--accent);
}

.budget-custom-row button {
    padding: 8px 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.18s;
}

.budget-custom-row button:hover { opacity: 0.88; }

.meal-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.meal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.meal-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}

.meal-items { display: flex; flex-direction: column; gap: 0.6rem; }

.meal-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    padding: 4px;
    margin: -4px;
    transition: background 0.15s;
}

.meal-item:hover { background: var(--border); }

.meal-item-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.meal-item-info {
    flex: 1;
    min-width: 0;
}

.meal-item-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.meal-item-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.meal-total {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-align: right;
}

.meal-total strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.meal-retry-btn {
    width: 100%;
    padding: 9px;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    margin-bottom: 0.5rem;
}

.meal-retry-btn:hover {
    background: var(--accent);
    color: white;
}

.meal-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 0;
    line-height: 1.5;
}

.meal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meal-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: meal-spin 0.75s linear infinite;
}

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

.panel-header {
    background: var(--navy-900);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

.panel-controls {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

/* Smart mode toggle */
.smart-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.smart-toggle-container span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

#smartModeDesc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.add-item-box {
    display: flex;
    gap: 8px;
}

.add-item-box input {
    flex: 1;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.add-item-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.add-item-box button {
    background: var(--green);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.add-item-box button:hover {
    background: var(--green-hover);
}

/* List items */
.list-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    background: var(--surface);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    border-left: 4px solid #cbd5e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.list-item.smart {
    border-left-color: var(--accent);
}

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

.item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

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

.del-btn {
    background: #fee2e2;
    border: none;
    color: var(--red);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.2s;
    flex-shrink: 0;
}

.del-btn:hover {
    background: #fecaca;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 21px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 15px;
    width: 15px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(17px);
}

.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* ── SMART SUGGESTIONS ───────────────────────────────── */
.smart-suggestions {
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}

.suggestion-item {
    background: #f8faff;
    border: 1px solid #c7d7f9;
    border-radius: var(--radius-md);
    padding: 9px 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.suggestion-item:hover {
    background: #eff6ff;
    border-color: var(--accent);
}

.suggestion-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-price {
    font-size: 0.88rem;
    color: var(--red);
    font-weight: 700;
    white-space: nowrap;
}

/* ── MOBILE ──────────────────────────────────────────── */
@media (max-width: 640px) {
    header h1 { font-size: 1.9rem; }
    header p  { font-size: 0.85rem; }

    .category-bar {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 1rem;
        gap: 0.6rem;
    }

    .cat-tile { padding: 0.85rem 0.5rem; }
    .cat-tile-label { font-size: 0.75rem; }

    .store-filters { gap: 6px; }
    .filter-btn    { padding: 5px 12px; font-size: 0.8rem; }

    /* ── Compact view (default mobile) — 2 columns, smaller cards ── */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
    }

    .card { padding: 0.75rem; }

    .card-img {
        height: 90px;
        margin-bottom: 0.6rem;
    }

    .card-img img { max-height: 90px; }

    .product-name {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        /* stylelint-disable-next-line */
    }

    .new-price  { font-size: 1.15rem; }
    .old-price  { font-size: 0.78rem; }
    .price-sub  { font-size: 0.75rem; }
    .discount-tag { font-size: 0.7rem; padding: 1px 5px; }
    .store-badge  { font-size: 0.66rem; padding: 2px 7px; margin-bottom: 0.5rem; }

    /* ── 1-column view: same card design, single column ── */
    body.classic-view .products-grid {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    /* ── View toggle button — inline in the result count row ── */
    .view-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: var(--surface);
        border: 1.5px solid var(--border);
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        cursor: pointer;
        transition: border-color 0.2s, color 0.2s;
        flex-shrink: 0;
    }

    .view-toggle-btn:hover,
    .view-toggle-btn:active {
        border-color: var(--accent);
        color: var(--accent);
    }

    .floating-list-btn {
        bottom: 16px;
        right: 16px;
        padding: 11px 18px;
        font-size: 0.9rem;
    }

    .shopping-panel {
        width: 100%;
        right: -105%;
    }

    .shopping-panel.open { right: 0; }

    .menu-panel {
        width: 100%;
        left: -105%;
    }

    .menu-panel.open { left: 0; }
}

@media (max-width: 380px) {
    /* Do NOT force 1 column here — let the toggle control it on small phones too.
       Only 1-column mode (classic-view) forces single column. */
    body.classic-view .products-grid {
        grid-template-columns: 1fr;
    }

    /* Tighter card sizing for 2-col layout on ~360px phones */
    .card            { padding: 0.5rem; }
    .card-img        { height: 72px; margin-bottom: 0.35rem; }
    .card-img img    { max-height: 72px; }
    .store-badge     { font-size: 0.58rem; padding: 1px 5px; margin-bottom: 0.3rem; }
    .product-name    { font-size: 0.72rem; margin-bottom: 0.3rem; -webkit-line-clamp: 2; line-clamp: 2; }
    .price-container { padding-top: 0.45rem; gap: 1px; }
    .new-price       { font-size: 1rem; }
    .old-price       { font-size: 0.68rem; }
    .price-sub       { font-size: 0.65rem; }
    .discount-tag    { font-size: 0.6rem; padding: 1px 4px; }
    .valid-until     { font-size: 0.6rem; margin-top: 0.2rem; }

    .section-title { font-size: 1rem; }
}

/* ── RECENTLY VIEWED SECTION ─────────────────────────── */
.recent-section {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0;
}

.recent-title {
    border-left-color: #8b5cf6;
    color: #5b21b6;
}

/* ── LOAD MORE BUTTON ────────────────────────────────── */
.load-more-btn {
    display: block;
    margin: 1.75rem auto 0;
    padding: 11px 36px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #eff6ff;
}

/* ── DARK MODE TOGGLE ────────────────────────────────── */
.dark-toggle {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s, transform 0.35s, background 0.2s;
    opacity: 1;
}

.dark-toggle:hover { background: rgba(255,255,255,0.2); }

/* Fade out when user has scrolled past the header */
.dark-toggle.scrolled-away {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

/* ── SKELETON LOADING ────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.skel {
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, #f8fafc 50%, var(--border) 75%);
    background-size: 1200px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skel-badge  { width: 64px;  height: 22px; margin-bottom: 12px; }
.skel-img    { width: 100%;  height: 130px; border-radius: var(--radius-md); margin-bottom: 12px; }
.skel-line   { width: 100%;  height: 13px; margin-bottom: 7px; }
.skel-line.short { width: 65%; }
.skel-price  { width: 90px;  height: 26px; margin-top: 14px; }

/* ── DARK MODE ───────────────────────────────────────── */
[data-theme="dark"] {
    --bg:             #0f172a;
    --surface:        #1e293b;
    --border:         #334155;
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] #searchInput {
    background: rgba(255,255,255,0.07);
    color: var(--text-primary);
}

[data-theme="dark"] .featured-section { background: #162032; border-color: #1e3a5f; }
[data-theme="dark"] .trending-section  { background: #1c1500; border-color: #4a3800; }
[data-theme="dark"] .recent-title      { color: #a78bfa; }

[data-theme="dark"] .card:hover { border-color: #4a5568; }

[data-theme="dark"] .panel-controls { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .list-items     { background: var(--bg); }
[data-theme="dark"] .list-item      { background: var(--surface); }

[data-theme="dark"] .add-item-box input {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .suggestion-item { background: #162032; border-color: #2d4a7a; }
[data-theme="dark"] .suggestion-item:hover { background: #1e3a5f; }

[data-theme="dark"] .load-more-btn:hover { background: #1e2f4a; }

[data-theme="dark"] .skel {
    background: linear-gradient(90deg, #1e293b 25%, #2d3f55 50%, #1e293b 75%);
    background-size: 1200px 100%;
}

[data-theme="dark"] .store-kaufland   { background: #3d1515; color: #fca5a5; border-color: #5a2020; }
[data-theme="dark"] .store-lidl       { background: #0f2040; color: #93c5fd; border-color: #1e3a6e; }
[data-theme="dark"] .store-billa      { background: #2d2500; color: #fde047; border-color: #4a3d00; }
[data-theme="dark"] .store-tmarket    { background: #0d2a14; color: #86efac; border-color: #1a4a20; }
[data-theme="dark"] .store-fantastico { background: #2d1500; color: #fdba74; border-color: #4a2500; }

/* product detail page dark overrides */
[data-theme="dark"] .product-img-col  { background: #ffffff; border-color: #e2e8f0; }
[data-theme="dark"] .similar-card:hover { border-color: #4a5568; }
[data-theme="dark"] .btn-store { background: var(--surface); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .btn-store:hover { background: #1e2f4a; }
[data-theme="dark"] .btn-share { border-color: var(--border); color: var(--text-secondary); }
[data-theme="dark"] .btn-share:hover { border-color: var(--accent); color: #93c5fd; }

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
    background: var(--navy-900);
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}
.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}
.footer-logo {
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.3px;
    margin-bottom: 0.2rem;
}
.footer-logo span { color: #60a5fa; }
.footer-tagline {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}
.footer-fresh {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #34d399;
    font-weight: 600;
}
.footer-fresh svg { flex-shrink: 0; }
.footer-nav {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: center;
}
.footer-nav a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-nav a:hover { color: white; }
.footer-bottom {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 0.9rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
