/* Lubbock Meat Deals — clean, mobile-first, no framework */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2a2e3d;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --accent: #ef4444;
  --accent-soft: #991b1b;
  --green: #22c55e;
  --green-soft: #14532d;
  --blue: #3b82f6;
  --yellow: #eab308;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
header {
  background: linear-gradient(135deg, var(--accent-soft), #1a1d27);
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 1.75rem; font-weight: 700; }
header .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding-top: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); font-weight: 600; }

/* Views */
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.view-header h2 { font-size: 1.1rem; }

.filters select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

/* Card grid (best prices) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.deal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.deal-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.deal-card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
}
.deal-card .price .unit { font-size: 0.85rem; font-weight: 400; color: var(--text-muted); }
.deal-card .item-name { font-size: 0.95rem; margin-top: 4px; }
.deal-card .store-name { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.deal-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.category-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}
.category-badge.beef { background: var(--accent-soft); color: #fca5a5; }
.category-badge.pork { background: #713f12; color: #fde68a; }
.category-badge.chicken { background: #365314; color: #bef264; }
.category-badge.turkey { background: #1e3a5f; color: #93c5fd; }
.category-badge.seafood { background: #164e63; color: #67e8f9; }
.category-badge.deli { background: #4a1d96; color: #c4b5fd; }
.category-badge.lamb { background: #581c87; color: #e9d5ff; }

.stores-count { font-size: 0.75rem; color: var(--text-muted); }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tr:hover td { background: var(--surface-hover); }
tr { cursor: pointer; }

.price-cell {
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
}

/* Store chips */
.store-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.store-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.store-chip:hover { border-color: var(--blue); }
.store-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.store-chip .count { font-size: 0.75rem; color: var(--text-muted); margin-left: 4px; }
.store-chip.active .count { color: rgba(255,255,255,0.7); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
#modal-item-name { font-size: 1.25rem; margin-bottom: 8px; }
#modal-current-prices { margin: 16px 0; }
#modal-current-prices table { font-size: 0.85rem; }
#modal-chart-container { margin-top: 16px; }
#modal-chart-container h4 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.chart-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* Footer */
footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
footer a { color: var(--blue); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.stats { margin-top: 8px; font-size: 0.75rem; }

/* Loading */
.loading { text-align: center; padding: 32px; color: var(--text-muted); }

/* Mobile */
@media (max-width: 600px) {
  header h1 { font-size: 1.35rem; }
  .card-grid { grid-template-columns: 1fr; }
  .deal-card .price { font-size: 1.3rem; }
  th, td { padding: 8px 6px; font-size: 0.8rem; }
}
