/* ===========================
   CSS Variables & Light Theme
   Redesign: Gestalt + Marketing Psychology
   Target: Deal-seekers from Instagram (mobile-first)
   =========================== */
:root {
    /* Primary - Savings Green */
    --primary: #059669;
    --primary-light: #10b981;
    --primary-dark: #047857;
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;

    /* Accent - Action Orange */
    --accent: #f97316;
    --accent-light: #fdba74;
    --accent-dark: #ea580c;
    --accent-50: #fff7ed;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-50: #fef2f2;

    /* Supermarket Colors */
    --california: #dc2626;
    --yaguar: #0d9488;
    --hiperlibertad: #ca8a04;
    --multiexpress: #1e40af;
    --changomas: #ea580c;
    --hiperdelpollo: #7c3aed;
    --maxiconsumo: #0891b2;

    /* Neutrals */
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-dark: #0f172a;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.12);
    --shadow-green: 0 4px 14px rgba(5, 150, 105, 0.3);
    --shadow-orange: 0 4px 14px rgba(249, 115, 22, 0.3);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-bounce: 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: var(--text-base);
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-lg); }

/* Skip link */
.skip-link {
    position: absolute; left: -9999px; top: auto; z-index: 999;
    padding: var(--space-sm) var(--space-md);
    background: var(--primary); color: white; border-radius: var(--radius-md);
    font-size: var(--text-sm); text-decoration: none;
}
.skip-link:focus { left: var(--space-md); top: var(--space-md); }

/* ===========================
   Header
   =========================== */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 100;
}

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg); gap: var(--space-lg);
}

.logo { display: flex; align-items: center; gap: var(--space-sm); text-decoration: none; }
.logo-icon { font-size: 1.75rem; }
.logo-text { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.logo-accent { color: var(--primary); }

.nav { display: flex; gap: var(--space-xs); }

.nav-btn {
    display: flex; align-items: center; gap: 6px;
    padding: var(--space-sm) var(--space-md);
    background: transparent; border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted); font-size: var(--text-sm); font-weight: 500;
    cursor: pointer; transition: all var(--transition-normal);
}
.nav-btn:hover { background: var(--bg-muted); color: var(--text); }
.nav-btn:active { transform: scale(0.96); }
.nav-btn.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}
.nav-icon { font-size: 1rem; }
.nav-label { white-space: nowrap; }

/* ===========================
   Main Content
   =========================== */
.main { padding: var(--space-xl) 0 var(--space-2xl); min-height: calc(100vh - 200px); }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
.view-title { font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--space-xl); color: var(--text); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===========================
   Hero Section
   =========================== */
.hero {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg) 0 var(--space-md);
}

.hero-title {
    font-size: clamp(1.75rem, 5vw, var(--text-3xl));
    font-weight: 800; margin-bottom: var(--space-sm);
    color: var(--text);
    line-height: 1.2;
}

.gradient-text {
    color: var(--primary);
    position: relative;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    margin-bottom: var(--space-lg);
}

/* Hero Stats */
.hero-stats {
    display: flex; justify-content: center; gap: var(--space-xl);
    flex-wrap: wrap; margin-top: var(--space-md);
}

.stat-item {
    text-align: center; min-width: 80px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.stat-number {
    display: block; font-size: var(--text-2xl); font-weight: 800;
    color: var(--primary); line-height: 1.2;
}
.stat-number small { font-size: 0.6em; }
.stat-label {
    font-size: var(--text-xs); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500;
}

/* ===========================
   Search Container
   =========================== */
.search-container {
    max-width: 680px; margin: 0 auto var(--space-lg); position: relative;
}

.search-form { margin-bottom: var(--space-md); }

.search-input-wrapper {
    display: flex; align-items: center;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-sm);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}
.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--primary-50);
}

.search-icon { padding: 0 var(--space-sm); font-size: 1.2rem; color: var(--text-muted); }

#search-input {
    flex: 1; background: transparent; border: none;
    color: var(--text); font-size: var(--text-base);
    padding: var(--space-md) var(--space-sm); outline: none; font-family: inherit;
}
#search-input::placeholder { color: var(--text-muted); }

.search-btn {
    background: var(--primary);
    border: none; border-radius: var(--radius-xl);
    color: white; font-size: var(--text-base); font-weight: 600;
    padding: var(--space-md) var(--space-xl);
    cursor: pointer; transition: all var(--transition-normal);
    display: flex; align-items: center; gap: var(--space-sm); white-space: nowrap;
}
.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-green);
}
.search-btn:active { transform: scale(0.97); }
.search-btn.loading { opacity: 0.7; pointer-events: none; }
.search-btn-icon { font-size: 1.2em; transition: transform var(--transition-normal); }
.search-btn:hover .search-btn-icon { transform: translateX(3px); }

/* Search Suggestions */
.search-suggestions {
    position: absolute; top: calc(100% - var(--space-xs)); left: 0; right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 320px; overflow-y: auto; z-index: 50;
}
.suggestion-header {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted); font-size: var(--text-xs);
    text-transform: uppercase; letter-spacing: 0.05em;
    background: var(--bg-muted);
    font-weight: 600;
}
.suggestion-item {
    padding: var(--space-sm) var(--space-md); cursor: pointer;
    display: flex; align-items: center; gap: var(--space-sm);
    transition: background var(--transition-fast);
    font-size: var(--text-sm); color: var(--text);
}
.suggestion-item:hover, .suggestion-item.active { background: var(--primary-50); }
.suggestion-icon { opacity: 0.7; font-size: var(--text-sm); }

/* ===========================
   Filter Chips
   =========================== */
.filter-chips {
    display: flex; flex-wrap: wrap; gap: var(--space-sm);
    margin-bottom: var(--space-xl); justify-content: center;
}

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary); font-size: var(--text-sm);
    cursor: pointer; transition: all var(--transition-fast);
    white-space: nowrap; font-family: inherit; font-weight: 500;
    box-shadow: var(--shadow-xs);
}
.chip:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.chip:active { transform: scale(0.96); }
.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-green);
}
.chip.active[data-supermarket="california"] { background: var(--california); border-color: var(--california); }
.chip.active[data-supermarket="yaguar"] { background: var(--yaguar); border-color: var(--yaguar); }
.chip.active[data-supermarket="hiperlibertad"] { background: var(--hiperlibertad); border-color: var(--hiperlibertad); }
.chip.active[data-supermarket="multiexpress"] { background: var(--multiexpress); border-color: var(--multiexpress); }
.chip.active[data-supermarket="changomas"] { background: var(--changomas); border-color: var(--changomas); }
.chip.active[data-supermarket="hiperdelpollo"] { background: var(--hiperdelpollo); border-color: var(--hiperdelpollo); }
.chip.active[data-supermarket="maxiconsumo"] { background: var(--maxiconsumo); border-color: var(--maxiconsumo); }
.chip.active .store-dot { background: white; }

.store-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.store-dot.california { background: var(--california); }
.store-dot.yaguar { background: var(--yaguar); }
.store-dot.hiperlibertad { background: var(--hiperlibertad); }
.store-dot.multiexpress { background: var(--multiexpress); }
.store-dot.changomas { background: var(--changomas); }
.store-dot.hiperdelpollo { background: var(--hiperdelpollo); }
.store-dot.maxiconsumo { background: var(--maxiconsumo); }

.chip-suggestion {
    background: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary);
}
.chip-suggestion:hover {
    background: var(--primary);
    color: white;
}

/* ===========================
   Section Header
   =========================== */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-lg); gap: var(--space-md);
}
.section-title { font-size: var(--text-xl); font-weight: 700; color: var(--text); }
.section-header-actions { display: flex; align-items: center; gap: var(--space-sm); }

.cache-indicator { font-size: var(--text-xs); color: var(--text-muted); }
.refresh-btn {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-full); width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all var(--transition-normal);
    font-size: 1rem; color: var(--text-muted);
}
.refresh-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.refresh-btn:active { transform: scale(0.9); }
.refresh-btn.spinning { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================
   Deals Section (horizontal scroll)
   =========================== */
.deals-section { margin-bottom: var(--space-2xl); }

.deals-scroll {
    display: flex; gap: var(--space-md);
    overflow-x: auto; scroll-snap-type: x mandatory;
    padding-bottom: var(--space-sm);
    scrollbar-width: none; -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}
.deals-scroll::-webkit-scrollbar { display: none; }

.deal-card {
    min-width: 200px; max-width: 240px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl); overflow: hidden;
    scroll-snap-align: start; flex-shrink: 0;
    cursor: pointer; transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}
.deal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--danger);
}

.deal-card-image {
    height: 130px; background: var(--bg-muted);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
.deal-card-image img { max-width: 90%; max-height: 90%; object-fit: contain; }
.deal-discount-badge {
    position: absolute; top: var(--space-sm); right: var(--space-sm);
    background: var(--danger); color: white;
    padding: 3px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 700;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.deal-card-info { padding: var(--space-md); }
.deal-card-name {
    font-size: var(--text-sm); font-weight: 600; line-height: 1.3;
    margin-bottom: var(--space-sm); color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.deal-card-prices { display: flex; align-items: baseline; gap: var(--space-sm); }
.deal-price-current { font-size: var(--text-lg); font-weight: 800; color: var(--primary); }
.deal-price-original { font-size: var(--text-xs); color: var(--danger); text-decoration: line-through; }

/* ===========================
   Results Grid
   =========================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* ===========================
   Product Card
   =========================== */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden; transition: all var(--transition-normal);
    position: relative;
    box-shadow: var(--shadow-sm);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}
.product-card.cheapest {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary-light), var(--shadow-md);
}

/* Card animation */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.product-card.animate-in { opacity: 0; animation: cardFadeIn 0.4s ease forwards; }

.product-image-wrapper {
    position: relative; height: 180px;
    background: var(--bg-muted); display: flex;
    align-items: center; justify-content: center; overflow: hidden;
}
.product-image-wrapper.image-fallback::after {
    content: 'Sin imagen'; position: absolute; bottom: var(--space-sm);
    left: 50%; transform: translateX(-50%);
    font-size: var(--text-xs); color: var(--text-muted); opacity: 0.6;
}

.product-image {
    max-width: 90%; max-height: 90%; object-fit: contain;
    transition: transform var(--transition-slow);
}
.product-card:hover .product-image { transform: scale(1.05); }

.product-badges {
    position: absolute; top: var(--space-sm); left: var(--space-sm);
    display: flex; flex-direction: column; gap: var(--space-xs);
}

.badge {
    padding: 3px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.badge-cheapest { background: var(--primary); color: white; }
.badge-offer { background: var(--danger); color: white; }
.badge-savings { background: var(--warning); color: white; }
.badge-stores { background: var(--primary); color: white; }

.supermarket-tag {
    position: absolute; top: var(--space-sm); right: var(--space-sm);
    padding: 4px var(--space-sm); border-radius: var(--radius-sm);
    font-size: 0.7rem; font-weight: 700; color: white;
    box-shadow: var(--shadow-sm);
}
.supermarket-tag.california { background: var(--california); }
.supermarket-tag.yaguar { background: var(--yaguar); }
.supermarket-tag.hiperlibertad { background: var(--hiperlibertad); }
.supermarket-tag.multiexpress { background: var(--multiexpress); }
.supermarket-tag.changomas { background: var(--changomas); }
.supermarket-tag.hiperdelpollo { background: var(--hiperdelpollo); }
.supermarket-tag.maxiconsumo { background: var(--maxiconsumo); }

.product-info { padding: var(--space-md); }

.product-name {
    font-size: var(--text-base); font-weight: 600; line-height: 1.4;
    margin-bottom: var(--space-sm); color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.product-prices {
    display: flex; align-items: baseline; gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.price-current { font-size: var(--text-2xl); font-weight: 800; color: var(--primary); }
.price-original { font-size: var(--text-sm); color: var(--danger); text-decoration: line-through; }

.product-actions { display: flex; gap: var(--space-sm); }

.action-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md); background: var(--bg-white);
    color: var(--text-secondary); font-size: var(--text-sm);
    cursor: pointer; transition: all var(--transition-fast); font-family: inherit;
}
.action-btn:hover { background: var(--bg-muted); color: var(--text); border-color: var(--border-hover); }
.action-btn:active { transform: scale(0.96); }
.action-btn.favorite.active {
    background: var(--danger-50);
    border-color: var(--danger);
    color: var(--danger);
}
@keyframes heartPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.action-btn.favorite.pulse { animation: heartPulse 0.3s ease; }
.action-btn.view-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.action-btn.view-link:hover { background: var(--primary-50); border-color: var(--primary-light); }

/* ===========================
   Inline Price History Chart
   =========================== */
.product-card.chart-expanded {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary-light), var(--shadow-lg);
}

.inline-chart-section {
    border-top: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}
.inline-chart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-muted);
}
.inline-chart-title {
    font-size: var(--text-xs); font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.05em;
}
.inline-chart-body {
    padding: var(--space-sm) var(--space-md) var(--space-md);
    min-height: 100px;
}
.inline-chart-body canvas { max-height: 200px; }
.inline-chart-loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: var(--space-lg) 0;
}
.inline-chart-empty {
    text-align: center; color: var(--text-muted);
    font-size: var(--text-sm); padding: var(--space-lg) 0;
}
.inline-chart-legend {
    text-align: center; color: var(--text-muted);
    font-size: var(--text-xs); margin-top: var(--space-sm);
}

/* ===========================
   Vote Button
   =========================== */
.action-btn.vote-btn {
    gap: 4px; font-weight: 600;
}
.action-btn.vote-btn .vote-icon { font-size: 0.9rem; }
.action-btn.vote-btn .vote-count {
    font-size: var(--text-xs); color: var(--text-muted);
    min-width: 12px; text-align: center;
}
.action-btn.vote-btn.voted {
    background: var(--primary-50);
    border-color: var(--primary-light);
    color: var(--primary);
}
.action-btn.vote-btn.voted .vote-count { color: var(--primary); font-weight: 700; }
.action-btn.vote-btn:hover { background: var(--primary-50); border-color: var(--primary-light); color: var(--primary); }

/* ===========================
   Offers Section
   =========================== */
.offers-section { margin-bottom: var(--space-2xl); }

.offer-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-sm); }

.offer-tab {
    padding: 4px var(--space-sm); border: none;
    border-radius: var(--radius-sm); color: white;
    font-size: 0.7rem; font-weight: 700; font-family: inherit;
    cursor: pointer; opacity: 0.5; transition: all var(--transition-fast);
}
.offer-tab.active { opacity: 1; transform: scale(1.05); box-shadow: var(--shadow-sm); }
.offer-tab:hover { opacity: 0.8; }

.offer-price-display {
    display: flex; align-items: baseline; gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

/* Price Bars */
.price-bars { margin-bottom: var(--space-sm); }
.price-bar-row {
    display: flex; align-items: center; gap: var(--space-sm);
    margin-bottom: 5px; font-size: var(--text-xs);
}
.price-bar-label {
    width: 75px; text-align: right; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
    font-weight: 500;
}
.price-bar-track {
    flex: 1; height: 8px; background: var(--bg-muted);
    border-radius: 4px; overflow: hidden;
}
.price-bar-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.6s ease;
}
.price-bar-fill.cheapest { background: var(--primary) !important; }
.price-bar-value {
    width: 70px; color: var(--text-secondary);
    font-weight: 700; font-size: var(--text-xs);
}

/* Savings Indicator */
.savings-indicator {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-md); margin-top: var(--space-sm);
    font-size: var(--text-sm); color: var(--primary-dark);
}
.savings-indicator strong { font-weight: 800; }

.offer-store-info { display: flex; align-items: center; gap: var(--space-sm); }

.supermarket-tag-inline {
    padding: 3px var(--space-sm); border-radius: var(--radius-sm);
    font-size: 0.7rem; font-weight: 700; color: white;
}
.supermarket-tag-inline.california { background: var(--california); }
.supermarket-tag-inline.yaguar { background: var(--yaguar); }
.supermarket-tag-inline.hiperlibertad { background: var(--hiperlibertad); }
.supermarket-tag-inline.multiexpress { background: var(--multiexpress); }
.supermarket-tag-inline.changomas { background: var(--changomas); }
.supermarket-tag-inline.hiperdelpollo { background: var(--hiperdelpollo); }
.supermarket-tag-inline.maxiconsumo { background: var(--maxiconsumo); }

.offer-cheapest-label { font-size: var(--text-xs); font-weight: 700; color: var(--primary); }

/* ===========================
   Results Info & Sort
   =========================== */
.results-info {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-lg); flex-wrap: wrap; gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
#results-count { color: var(--text-secondary); font-size: var(--text-base); }

.sort-select {
    background: var(--bg-muted); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm); cursor: pointer; font-family: inherit;
}

/* ===========================
   Skeleton Loading
   =========================== */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.skeleton-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.skeleton-image {
    height: 180px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, #e8edf2 50%, var(--bg-muted) 75%);
    background-size: 800px 100%; animation: shimmer 1.5s infinite;
}
.skeleton-body { padding: var(--space-md); }
.skeleton-text {
    height: 14px; border-radius: 4px; margin-bottom: var(--space-sm);
    background: linear-gradient(90deg, var(--bg-muted) 25%, #e8edf2 50%, var(--bg-muted) 75%);
    background-size: 800px 100%; animation: shimmer 1.5s infinite;
}
.skeleton-text.short { width: 60%; }
.skeleton-price {
    height: 28px; width: 100px; border-radius: 4px; margin-top: var(--space-md);
    background: linear-gradient(90deg, var(--bg-muted) 25%, #e8edf2 50%, var(--bg-muted) 75%);
    background-size: 800px 100%; animation: shimmer 1.5s infinite;
}

/* ===========================
   Pagination
   =========================== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-sm); margin-top: var(--space-xl); flex-wrap: wrap;
}
.pagination-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text);
    cursor: pointer; transition: all var(--transition-fast);
    font-size: var(--text-sm); font-family: inherit;
    box-shadow: var(--shadow-xs);
}
.pagination-btn:hover {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-50);
}
.pagination-btn:active { transform: scale(0.96); }
.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-green);
}

/* ===========================
   Price History Modal
   =========================== */
.price-history-modal { padding: var(--space-xl); }
.modal-title {
    font-size: var(--text-lg); font-weight: 700;
    margin-bottom: var(--space-lg); padding-right: var(--space-2xl);
    line-height: 1.4; color: var(--text);
}
.chart-container { position: relative; height: 350px; width: 100%; }
.chart-legend-info {
    text-align: center; margin-top: var(--space-md);
    color: var(--text-muted); font-size: var(--text-xs);
}

/* ===========================
   Empty State
   =========================== */
.empty-state {
    text-align: center; padding: var(--space-3xl) var(--space-md);
}
.empty-icon { font-size: 3.5rem; display: block; margin-bottom: var(--space-lg); }
.empty-state h3 { font-size: var(--text-xl); margin-bottom: var(--space-sm); color: var(--text); }
.empty-state p { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-md); }
.empty-suggestions { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; }

/* Error State */
.error-state { text-align: center; padding: var(--space-2xl); }
.error-state .error-icon { font-size: 3rem; display: block; margin-bottom: var(--space-md); }
.error-state h3 { color: var(--accent-dark); margin-bottom: var(--space-sm); }
.error-state p { color: var(--text-muted); margin-bottom: var(--space-md); }
.retry-btn {
    background: var(--primary); border: none; border-radius: var(--radius-lg);
    color: white; font-size: var(--text-sm); font-weight: 600;
    padding: var(--space-sm) var(--space-xl); cursor: pointer;
    transition: all var(--transition-normal); font-family: inherit;
}
.retry-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-green); }

/* ===========================
   History
   =========================== */
.history-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.history-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}
.history-item:hover { border-color: var(--primary-light); background: var(--primary-50); box-shadow: var(--shadow-sm); }
.history-item:active { transform: scale(0.99); }
.history-query { font-weight: 600; color: var(--text); }
.history-meta {
    display: flex; align-items: center; gap: var(--space-lg);
    color: var(--text-muted); font-size: var(--text-sm);
}

/* ===========================
   Modal
   =========================== */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-lg);
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    max-width: 700px; width: 100%;
    max-height: 85vh; overflow-y: auto;
    animation: modalSlideUp 0.3s ease;
    box-shadow: var(--shadow-xl);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute; top: var(--space-md); right: var(--space-md);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-muted); border: 1px solid var(--border);
    border-radius: 50%; color: var(--text-secondary); font-size: var(--text-xl);
    cursor: pointer; transition: all var(--transition-fast); z-index: 1;
}
.modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* Keyboard shortcuts modal */
.shortcuts-modal { padding: var(--space-xl); }
.shortcuts-modal h3 { margin-bottom: var(--space-lg); color: var(--text); }
.shortcut-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-sm) 0; border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.shortcut-row:last-child { border-bottom: none; }
kbd {
    display: inline-block; padding: 3px 8px;
    background: var(--bg-muted); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: var(--text-xs);
    font-family: monospace; color: var(--text-secondary);
    min-width: 24px; text-align: center;
}

/* ===========================
   Toast
   =========================== */
.toast-container {
    position: fixed; bottom: var(--space-xl); left: 50%;
    transform: translateX(-50%); z-index: 300;
    display: flex; flex-direction: column; gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: var(--space-sm);
    font-size: var(--text-sm); pointer-events: auto;
    animation: toastIn 0.3s ease;
    border-left: 3px solid var(--primary);
    color: var(--text);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-info { border-left-color: var(--primary); }
.toast.toast-out { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(16px); } }

/* ===========================
   Footer
   =========================== */
.footer {
    border-top: 1px solid var(--border);
    padding: var(--space-xl) 0;
    margin-top: var(--space-3xl);
    background: var(--bg-white);
}
.footer-inner { text-align: center; }
.footer-text { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-xs); }
.footer-meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ===========================
   Utilities
   =========================== */
.hidden { display: none !important; }

/* ===========================
   Responsive - Tablet & Mobile
   =========================== */
@media (max-width: 768px) {
    .header-inner { padding: var(--space-sm) var(--space-md); }
    .logo-text { font-size: var(--text-lg); }

    /* Bottom navigation on mobile */
    .nav {
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--bg-white);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding: var(--space-xs) 0 env(safe-area-inset-bottom, var(--space-xs));
        justify-content: space-around;
    }
    .nav-btn {
        flex-direction: column; gap: 2px; padding: var(--space-sm);
        min-height: 48px; min-width: 48px;
        border-radius: var(--radius-lg);
    }
    .nav-btn.active {
        background: var(--primary-50);
        color: var(--primary);
    }
    .nav-icon { font-size: 1.2rem; }
    .nav-label { font-size: 0.625rem; display: block !important; font-weight: 600; }

    body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    /* Search */
    .search-input-wrapper {
        flex-direction: column;
        padding: var(--space-sm);
        gap: var(--space-sm);
        border-radius: var(--radius-xl);
    }
    .search-icon { display: none; }
    #search-input {
        width: 100%; text-align: center;
        padding: var(--space-md); font-size: var(--text-base);
    }
    .search-btn { width: 100%; justify-content: center; border-radius: var(--radius-lg); }

    /* Filter chips 4x2 grid on mobile */
    .filter-chips {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .chip {
        padding: 6px 4px; font-size: 0.7rem; min-height: 32px;
        justify-content: center;
    }
    .chip .store-dot { width: 6px; height: 6px; }

    .results-info {
        flex-direction: column; align-items: flex-start;
        padding: var(--space-sm) var(--space-md);
    }

    .results-grid, .skeleton-grid { grid-template-columns: 1fr; }

    .chart-container { height: 250px; }
    .inline-chart-body canvas { max-height: 180px; }

    .history-item {
        flex-direction: column; align-items: flex-start;
        gap: var(--space-sm);
    }

    .hero { padding: var(--space-md) 0 var(--space-sm); }
    .hero-title { font-size: var(--text-2xl); }
    .hero-subtitle { font-size: var(--text-base); }
    .hero-stats { gap: var(--space-sm); }
    .stat-item { padding: var(--space-xs) var(--space-sm); }
    .stat-number { font-size: var(--text-xl); }
    .stat-label { font-size: 0.625rem; }

    .modal-content {
        max-height: 90vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin-top: auto;
    }

    /* Touch targets */
    .action-btn { min-height: 44px; min-width: 44px; }
    .pagination-btn { min-height: 44px; min-width: 44px; }

    .toast-container { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: 90%; }

    .footer { margin-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    .section-title { font-size: var(--text-lg); }
}

/* ===========================
   Responsive - Small Mobile
   =========================== */
@media (max-width: 480px) {
    .container { padding: 0 var(--space-md); }
    .hero-title { font-size: 1.4rem; }
    .product-card { border-radius: var(--radius-xl); }
    .hero-stats { gap: var(--space-xs); }
    .stat-item { min-width: 55px; flex: 1; }
    .stat-number { font-size: var(--text-lg); }
    .stat-label { font-size: 0.6rem; }

    .deal-card { min-width: 170px; max-width: 200px; }
    .deal-card-image { height: 110px; }
    .deal-card-name { font-size: var(--text-xs); }
}

/* ===========================
   Responsive - 2 columns for tablets
   =========================== */
@media (min-width: 481px) and (max-width: 768px) {
    .results-grid, .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
