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

:root {
  --coles-red: #e01a22;
  --woolworths-green: #00802b;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --border: #d2d2d7;
  --accent: #0071e3;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}
.logo { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.tagline { color: var(--text-muted); font-size: 15px; margin-top: 4px; }

/* Intro / SEO content */
.intro {
  margin: 20px 0 0;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}
.intro strong { color: var(--text); }
.last-updated {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 12px;
  margin: 24px 0;
}
.stat-card {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-card.active { border-color: var(--accent); background: #f0f7ff; }
.stat-card--coles.active { border-color: var(--coles-red); background: #fef2f2; }
.stat-card--woolworths.active { border-color: var(--woolworths-green); background: #f0fdf4; }
.stat-count { display: block; font-size: 32px; font-weight: 700; }
.stat-card--coles .stat-count { color: var(--coles-red); }
.stat-card--woolworths .stat-count { color: var(--woolworths-green); }
.stat-label { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Controls */
.controls { margin-bottom: 24px; }
.search-box { margin-bottom: 12px; }
.search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--surface);
  transition: border-color 0.2s;
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,0.15); }
.filter-row { display: flex; gap: 12px; }
.filter-row select {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Section Title */
.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Best Deals */
.best-deals { margin-bottom: 32px; }

/* Results Info */
.results-info {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Product Card */
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.product-card a { text-decoration: none; color: inherit; display: flex; flex-direction: column; height: 100%; }

.card-image {
  position: relative;
  aspect-ratio: 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-image img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}
.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
}
.badge-coles { background: var(--coles-red); }
.badge-woolworths { background: var(--woolworths-green); }

.card-discount {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff3b30;
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.card-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; }
.card-brand { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.card-name { font-size: 14px; font-weight: 600; margin: 4px 0 6px; line-height: 1.3; flex: 1; }
.card-size { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.card-pricing { display: flex; align-items: baseline; gap: 8px; }
.price-sale { font-size: 22px; font-weight: 700; color: #ff3b30; }
.price-original { font-size: 14px; color: var(--text-muted); text-decoration: line-through; }
.price-save { font-size: 12px; color: #34c759; font-weight: 600; margin-top: 4px; }
.card-unit-price { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.card-category {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
}

/* Load More */
.load-more-wrap { text-align: center; margin: 32px 0; }
.btn-load-more {
  padding: 12px 40px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-load-more:hover { background: var(--accent); color: white; }

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 16px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 0;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .stats-bar { flex-direction: row; gap: 8px; }
  .stat-card { padding: 12px 8px; }
  .stat-count { font-size: 24px; }
  .filter-row { flex-direction: column; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .card-body { padding: 10px 12px; }
  .card-name { font-size: 13px; }
  .price-sale { font-size: 18px; }
  .logo { font-size: 22px; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
