/* ============================================================
   Food Dealer — Premium Design System
   ============================================================ */

:root {
  /* Warm food-inspired palette */
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-sunken: #f3f2ef;
  --text: #1c1917;
  --text-muted: #78716c;
  --text-dim: #8a8279;
  --border: #e7e5e4;
  --border-subtle: #f0eeec;

  /* Brand colors — warm coral/red */
  --primary: #e63946;
  --primary-hover: #c1121f;
  --primary-light: #fff1f2;
  --primary-glow: rgba(230, 57, 70, 0.15);

  /* Semantic colors */
  --green: #16a34a;
  --green-bg: #dcfce7;
  --green-light: #f0fdf4;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --gold: #f59e0b;
  --gold-bg: #fffbeb;

  /* Badge variants */
  --badge-none-bg: #dcfce7;
  --badge-none-text: #166534;
  --badge-app-bg: #dbeafe;
  --badge-app-text: #1e40af;
  --badge-online-bg: #fef3c7;
  --badge-online-text: #92400e;
  --badge-instore-bg: #fce7f3;
  --badge-instore-text: #9d174d;

  /* Savings */
  --savings-bg: #16a34a;
  --savings-text: #ffffff;
  --live-bg: #e63946;
  --live-text: #ffffff;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);

  /* Layout */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-full: 100px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Interaction */
  --focus-ring: 0 0 0 3px rgba(230, 57, 70, 0.3);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Toast */
  --toast-bg: #292524;
  --toast-text: #fafaf9;
}

/* ============================================================
   Dark Mode
   ============================================================ */
[data-theme="dark"],
.dark-mode {
  --bg: #0c0a09;
  --bg-card: #1c1917;
  --bg-elevated: #292524;
  --bg-sunken: #0c0a09;
  --text: #fafaf9;
  --text-muted: #a8a29e;
  --text-dim: #78716c;
  --border: #292524;
  --border-subtle: #1c1917;
  --primary-light: #2a1215;
  --primary-glow: rgba(230, 57, 70, 0.25);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.6);
  --green-bg: #052e16;
  --green-light: #052e16;
  --green: #4ade80;
  --blue-bg: #172554;
  --amber-bg: #451a03;
  --red-bg: #450a0a;
  --gold-bg: #422006;
  --badge-none-bg: #052e16;
  --badge-none-text: #86efac;
  --badge-app-bg: #172554;
  --badge-app-text: #93c5fd;
  --badge-online-bg: #451a03;
  --badge-online-text: #fcd34d;
  --badge-instore-bg: #4a1d42;
  --badge-instore-text: #f9a8d4;
  --toast-bg: #f5f5f4;
  --toast-text: #1c1917;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a09;
    --bg-card: #1c1917;
    --bg-elevated: #292524;
    --bg-sunken: #0c0a09;
    --text: #fafaf9;
    --text-muted: #a8a29e;
    --text-dim: #78716c;
    --border: #292524;
    --border-subtle: #1c1917;
    --primary-light: #2a1215;
    --primary-glow: rgba(230, 57, 70, 0.25);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.6);
    --green-bg: #052e16;
    --green-light: #052e16;
    --green: #4ade80;
    --blue-bg: #172554;
    --amber-bg: #451a03;
    --red-bg: #450a0a;
    --gold-bg: #422006;
    --badge-none-bg: #052e16;
    --badge-none-text: #86efac;
    --badge-app-bg: #172554;
    --badge-app-text: #93c5fd;
    --badge-online-bg: #451a03;
    --badge-online-text: #fcd34d;
    --badge-instore-bg: #4a1d42;
    --badge-instore-text: #f9a8d4;
    --toast-bg: #f5f5f4;
    --toast-text: #1c1917;
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Accessibility
   ============================================================ */
.skip-nav {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  z-index: 1000;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s;
}
.skip-nav:focus { top: 0; }

*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ============================================================
   Header — Gradient with floating orbs
   ============================================================ */
header {
  background: linear-gradient(135deg, #e63946 0%, #c1121f 50%, #9b2335 100%);
  color: #fff;
  padding: 2.5rem 1rem 2.75rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header-bg-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,180,50,0.5), transparent 70%);
  top: -30%;
  left: -10%;
  animation: orbFloat 15s ease-in-out infinite alternate;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.2), transparent 70%);
  bottom: -20%;
  right: -5%;
  animation: orbFloat 18s ease-in-out infinite alternate-reverse;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.1); }
  100% { transform: translate(-20px, 10px) scale(0.95); }
}

.header-inner {
  position: relative;
  z-index: 1;
}

.header-inner h1 {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.2;
}

.logo-icon {
  font-size: 1.8rem;
  margin-right: 0.15rem;
}

.tagline {
  font-size: 0.95rem;
  margin-top: 0.4rem;
  font-weight: 400;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.88);
}

.header-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.header-stat {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.9;
  background: rgba(255,255,255,0.15);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.header-stat-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
}

/* ============================================================
   Main Layout
   ============================================================ */
main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  width: 100%;
}

/* ============================================================
   Zip Input — Floating card design
   ============================================================ */
.zip-section {
  margin-bottom: 2rem;
  margin-top: -1.5rem;
}

.zip-input-group {
  display: flex;
  gap: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  padding: 0.4rem;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  align-items: center;
}

.zip-icon {
  padding: 0 0.5rem 0 0.75rem;
  font-size: 1.1rem;
  flex-shrink: 0;
}

#zip-input {
  flex: 1;
  padding: 0.9rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  background: transparent;
  color: var(--text);
  text-align: center;
  letter-spacing: 3px;
  font-weight: 600;
  font-family: var(--font);
}
#zip-input:focus { outline: none; }
.zip-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
#zip-input::placeholder {
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text-dim);
}

#zip-btn {
  padding: 0.9rem 1.8rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background 0.2s, transform 0.1s;
}
#zip-btn:hover { background: var(--primary-hover); }
#zip-btn:active { transform: scale(0.97); }
#zip-btn:disabled {
  background: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.7;
}
#zip-btn.loading {
  position: relative;
  color: transparent;
}
#zip-btn.loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  top: 50%; left: 50%;
  margin: -9px 0 0 -9px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.zip-helper {
  text-align: center;
  margin-top: 0.65rem;
}

.geo-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: color 0.2s;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-xs);
}
.geo-btn:hover { color: var(--primary); }

.zip-error {
  text-align: center;
  color: var(--red);
  background: var(--red-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  margin-top: 0.5rem;
  font-size: 0.88rem;
  font-weight: 500;
}
.geo-btn:focus-visible { background: var(--primary-light); }

.location-info {
  text-align: center;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.88rem;
}

/* ============================================================
   Deal of the Day — Premium hero card
   ============================================================ */
.deal-of-day {
  background: linear-gradient(135deg, #e63946 0%, #9b2335 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(230, 57, 70, 0.3);
  position: relative;
  overflow: hidden;
}
.deal-of-day::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 50%;
  height: 180%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.dotd-badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 800;
  background: rgba(255,255,255,0.2);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
}

.dotd-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  position: relative;
}

.dotd-chain-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.dotd-chain {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.dotd-title {
  font-size: 1.05rem;
  flex: 1;
  min-width: 200px;
  line-height: 1.4;
  opacity: 0.95;
}

.dotd-savings {
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(8px);
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 1.15rem;
  border: 1px solid rgba(255,255,255,0.18);
  letter-spacing: -0.3px;
}

/* ============================================================
   Savings Tracker
   ============================================================ */
.savings-tracker {
  margin-bottom: 1.5rem;
}

.savings-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--green-light);
  border: 1px solid var(--green-bg);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.1rem;
  font-size: 0.88rem;
  color: var(--green);
  font-weight: 500;
}

.savings-icon { font-size: 1.1rem; }
.savings-inner strong { font-weight: 800; }

/* ============================================================
   Category Tabs
   ============================================================ */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  padding: 0.3rem;
  background: var(--bg-sunken);
  border-radius: 14px;
}

.cat-tab {
  padding: 0.55rem 1rem;
  min-height: 38px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}
.cat-tab:hover {
  color: var(--text);
  background: var(--bg-card);
}
.cat-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow);
  font-weight: 700;
}

/* ============================================================
   Controls
   ============================================================ */
.controls {
  margin-bottom: 1.5rem;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.control-group label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 700;
}

.control-group select,
.search-group input {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.88rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.control-group select:hover,
.search-group input:hover {
  border-color: var(--text-dim);
}
.control-group select:focus,
.search-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.toggle-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-weight: 400;
  padding-bottom: 0.5rem;
}
.toggle-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  background: var(--bg-card);
  flex-shrink: 0;
}
.toggle-group input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.toggle-group input[type="checkbox"]:checked::after {
  content: '\2713';
  color: #fff;
  font-size: 12px;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.search-group { flex: 1; min-width: 200px; }
.search-group input { width: 100%; }

/* Compare toggle */
.compare-toggle {
  padding: 0.55rem 1rem;
  border: 2px solid var(--blue);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: all 0.2s var(--ease-out);
}
.compare-toggle:hover { background: var(--blue-bg); }
.compare-toggle.has-items {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Action buttons */
.action-btn {
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: all 0.2s var(--ease-out);
}
.action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Theme toggle */
.theme-toggle-wrap { margin-left: auto; }
.theme-toggle {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
}
.theme-toggle:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.updated-badge {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding-bottom: 0.5rem;
  white-space: nowrap;
}

/* Deal summary */
.deal-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.5rem;
}

/* Chain stats */
.chain-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0;
}

.chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  min-height: 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  transition: all 0.2s var(--ease-out);
}
.chain-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}
.chain-chip .chip-emoji { font-size: 0.9rem; }
.chain-chip .chip-count {
  font-weight: 700;
  color: var(--text-dim);
  font-size: 0.72rem;
}

/* ============================================================
   Recently Viewed
   ============================================================ */
.recent-section { margin-bottom: 1.5rem; }

.recent-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.recent-deals {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}
.recent-deals::-webkit-scrollbar { display: none; }

.recent-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  min-height: 34px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  transition: all 0.2s var(--ease-out);
}
.recent-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.recent-chip .rc-emoji { font-size: 0.85rem; }

/* ============================================================
   Compare Panel
   ============================================================ */
.compare-panel {
  background: var(--bg-card);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  box-shadow: var(--shadow-lg);
}
.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.compare-header h3 { font-size: 1rem; font-weight: 700; }
.compare-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  font-size: 0.85rem;
  transition: all 0.2s;
}
.compare-close:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.compare-content { display: flex; gap: 1rem; min-width: 0; }
.compare-col {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.compare-col h4 { font-size: 0.88rem; margin-bottom: 0.5rem; }
.compare-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.compare-row:last-child { border-bottom: none; }
.compare-label { color: var(--text-muted); }
.compare-value { font-weight: 600; text-align: right; }

/* ============================================================
   View Toggle + Map
   ============================================================ */
.view-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  width: fit-content;
}
.view-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  border-radius: 8px;
  transition: all 0.2s var(--ease-out);
}
.view-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.map-container { margin-bottom: 1rem; }
.map-canvas {
  width: 100%;
  height: 350px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow: auto;
}
.map-list {
  list-style: none;
  padding: 1rem;
  width: 100%;
}
.map-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.map-list li:last-child { border-bottom: none; }
.map-chain { font-weight: 600; }
.map-dist { color: var(--text-muted); }

/* ============================================================
   Deals Grid
   ============================================================ */
.deals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .deals-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .deals-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   Deal Card — Premium design with micro-interactions
   ============================================================ */
.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  position: relative;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s;
  opacity: 0;
  animation: cardEntrance 0.5s var(--ease-out) forwards;
}

.deal-card:nth-child(1) { animation-delay: 0ms; }
.deal-card:nth-child(2) { animation-delay: 60ms; }
.deal-card:nth-child(3) { animation-delay: 120ms; }
.deal-card:nth-child(4) { animation-delay: 180ms; }
.deal-card:nth-child(5) { animation-delay: 240ms; }
.deal-card:nth-child(6) { animation-delay: 300ms; }
.deal-card:nth-child(7) { animation-delay: 360ms; }
.deal-card:nth-child(8) { animation-delay: 420ms; }
.deal-card:nth-child(9) { animation-delay: 480ms; }
.deal-card:nth-child(n+10) { animation-delay: 500ms; }
.deal-card.no-entrance { animation: none; opacity: 1; }

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

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

.deal-card.expired {
  opacity: 0.6;
  background: var(--bg-sunken);
  border-style: dashed;
}
.deal-card.expired:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.deal-card.compare-selected {
  border-color: var(--blue);
  outline: 2px solid var(--blue);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px var(--blue-bg);
}

/* Card header with chain icon */
.deal-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chain-badge {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  background: var(--bg-sunken);
}

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

.chain-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.deal-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: -0.2px;
  color: var(--text);
}

/* Floating discount badge */
.deal-discount-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #c1121f 100%);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 10px rgba(230, 57, 70, 0.35);
  z-index: 2;
  letter-spacing: -0.3px;
}

/* Pills row */
.deal-pills {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.pill-savings {
  background: var(--green);
  color: #fff;
}

.pill-live {
  background: var(--live-bg);
  color: var(--live-text);
  position: relative;
}
.pill-live::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  margin-right: 4px;
  vertical-align: middle;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.pill-loophole {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.pill-new {
  background: #0ea5e9;
  color: #fff;
}
.pill-trending {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
}
.pill-cal {
  background: var(--amber-bg);
  color: #92400e;
  font-weight: 600;
}

/* Description */
.deal-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Cost breakdown */
.cost-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.82rem;
  background: var(--bg-sunken);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
}

.cost-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
}

.cost-value {
  text-align: right;
  font-weight: 700;
}

.cost-value.highlight {
  color: var(--green);
  font-size: 0.95rem;
}

/* Badges */
.deal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-none { background: var(--badge-none-bg); color: var(--badge-none-text); }
.badge-app { background: var(--badge-app-bg); color: var(--badge-app-text); }
.badge-online { background: var(--badge-online-bg); color: var(--badge-online-text); }
.badge-in-store { background: var(--badge-instore-bg); color: var(--badge-instore-text); }

/* Timing */
.deal-timing {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Distance */
.deal-distance {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.deal-distance.too-far { color: var(--amber); }
.deal-distance.nearby { color: var(--green); }

/* Card action buttons */
.deal-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding-top: 0.15rem;
}

.deal-action-btn {
  padding: 0.45rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s var(--ease-out);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.deal-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.deal-action-btn:active {
  transform: scale(0.95);
}

.deal-action-btn.favorited {
  background: var(--gold-bg);
  border-color: var(--gold);
  color: #b45309;
}
.deal-action-btn.reacted {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Reactions row */
.deal-reactions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.reaction-btn {
  padding: 0.3rem 0.6rem;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}
.reaction-btn:hover {
  border-color: var(--border);
  background: var(--bg-card);
  transform: scale(1.1);
}
.reaction-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
}
.reaction-btn .reaction-count {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-left: 0.15rem;
  font-weight: 600;
}

/* Steps */
.deal-steps {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
}
.steps-toggle {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 600;
  padding: 0.3rem 0;
  font-family: var(--font);
  transition: opacity 0.2s;
}
.steps-toggle:hover { opacity: 0.7; }
.steps-list {
  display: none;
  list-style: decimal;
  padding: 0.5rem 0 0 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.steps-list.open { display: block; }
.steps-list li { margin-bottom: 0.25rem; }

/* Source link */
.deal-source {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.4rem;
}
.source-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: var(--font);
}
.source-url {
  display: none;
  font-size: 0.72rem;
  word-break: break-all;
  margin-top: 0.2rem;
}
.source-url.open { display: block; }
.source-url a {
  color: var(--primary);
  text-decoration: none;
}
.source-url a:hover { text-decoration: underline; }

/* Verified timestamp */
.deal-verified {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: right;
}

/* ============================================================
   Skeleton Loading — Shimmer effect
   ============================================================ */
.loading { padding: 1rem 0; }

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .skeleton-grid { grid-template-columns: repeat(3, 1fr); }
}

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skeleton {
  background: var(--bg-sunken);
  border-radius: var(--radius-xs);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
  transform: translateX(-100%);
}
[data-theme="dark"] .skeleton::after,
.dark-mode .skeleton::after {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .skeleton::after {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
  }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.skeleton-badge { width: 50px; height: 50px; border-radius: 14px; }
.skeleton-title { width: 75%; height: 18px; }
.skeleton-text { width: 100%; height: 14px; }
.skeleton-text.short { width: 45%; }
.skeleton-price { width: 35%; height: 24px; border-radius: var(--radius-sm); }

.loading-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-top: 1.5rem;
}

/* ============================================================
   No Deals / Empty State
   ============================================================ */
.no-deals {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.no-deals-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.no-deals p:first-of-type {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.no-deals-sub { font-size: 0.88rem; }

/* ============================================================
   Notification Bar
   ============================================================ */
.notif-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  background: var(--blue-bg);
  border-radius: var(--radius);
  margin-top: 2rem;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid rgba(37, 99, 235, 0.15);
}
.notif-btn {
  padding: 0.5rem 1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  transition: opacity 0.2s;
}
.notif-btn:hover { opacity: 0.9; }
.notif-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font);
}
.notif-dismiss:hover { text-decoration: underline; }

/* ============================================================
   Scroll to Top
   ============================================================ */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: all 0.3s var(--ease-out);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-top:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  text-align: center;
  padding: 2.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
}
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-brand {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}
footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.footer-copyright {
  margin-top: 0.4rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  font-family: var(--font);
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  max-width: 90%;
  text-align: center;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  header, .zip-section, .controls, .category-tabs, .chain-stats,
  .recent-section, .compare-panel, .view-toggle, .map-container,
  .notif-bar, footer, .deal-actions, .skip-nav, .deal-reactions,
  .deal-of-day, #deal-summary, .compare-toggle, .action-btn,
  .updated-badge, .steps-toggle, .source-toggle, .scroll-top,
  .savings-tracker, .theme-toggle-wrap, .geo-btn, .header-stats,
  .deal-discount-badge { display: none !important; }
  body { background: #fff; color: #000; }
  .deal-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
    opacity: 1 !important;
    animation: none !important;
  }
  .deals-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .deals-grid .deal-card { margin-bottom: 0; padding: 1rem; }
  .deal-pills { position: static; }
  .steps-list, .source-url { display: block !important; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 639px) {
  header { padding: 2rem 1rem 2.25rem; }
  .header-inner h1 { font-size: 1.75rem; }
  main { padding: 1.5rem 1rem; }
  .zip-input-group { flex-direction: column; padding: 0.6rem; }
  #zip-btn { width: 100%; }
  .controls-row { flex-direction: column; }
  .control-group { width: 100%; }
  .control-group select, .search-group input { width: 100%; }
  .updated-badge { margin-left: 0; }
  .dotd-content { flex-direction: column; align-items: flex-start; }
  .compare-content { flex-direction: column; }
  .compare-col { min-width: auto; }
  .deal-card { padding: 1.25rem; }
  .header-stats { gap: 0.3rem; }
  .header-stat { font-size: 0.7rem; padding: 0.2rem 0.55rem; }
  .header-stat-dot { display: none; }
  .category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .category-tabs::-webkit-scrollbar { display: none; }
  .cat-tab { min-height: 44px; }
  .chain-chip, .recent-chip { min-height: 44px; }
  .zip-icon { padding: 0.5rem 0; text-align: center; }
  .scroll-top { bottom: 1rem; right: 1rem; }
  .theme-toggle-wrap { margin-left: 0; }
}

@media (max-height: 500px) and (orientation: landscape) {
  header { padding: 1rem 1rem 1.25rem; }
  .header-inner h1 { font-size: 1.5rem; }
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  .pill-live::before { animation: none; }
  .deal-card {
    animation: none;
    opacity: 1;
    transition: none;
  }
  .deal-action-btn { transition: none; }
  .cat-tab { transition: none; }
  .chain-chip { transition: none; }
  .recent-chip { transition: none; }
  #zip-btn { transition: none; }
  .scroll-top { transition: none; }
  .skeleton::after { animation: none; }
  .reaction-btn { transition: none; }
  .marker--loophole { animation: none; }
}

/* ============================================================
   IP Auto-Detect Banner
   ============================================================ */
.auto-detect-banner {
  max-width: 700px;
  margin: 0 auto 0.75rem;
  padding: 0 1rem;
}

.detect-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--primary-light), var(--bg-card));
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 0.875rem 1.25rem;
  box-shadow: 0 2px 8px var(--primary-glow);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.detect-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.detect-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.detect-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.detect-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.detect-confirm {
  background: var(--primary);
  color: #fff;
}

.detect-confirm:hover {
  background: var(--primary-hover);
}

.detect-change {
  background: var(--bg-sunken);
  color: var(--text);
  border: 1px solid var(--border);
}

.detect-change:hover {
  background: var(--border);
}

.detect-dismiss {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
}

.detect-dismiss:hover {
  color: var(--text);
  background: var(--bg-sunken);
}

@media (max-width: 600px) {
  .detect-inner {
    flex-wrap: wrap;
  }
  .detect-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================================
   Leaflet Map — Container & Overrides
   ============================================================ */
.map-container {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
}

.map-canvas {
  width: 100%;
  height: 500px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ============================================================
   Chain-Colored Markers
   ============================================================ */
.chain-marker-wrapper {
  background: none !important;
  border: none !important;
}

.chain-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chain-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  z-index: 1000 !important;
}

.chain-marker-emoji {
  font-size: 18px;
  line-height: 1;
}

.marker-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.marker-loophole-icon {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 13px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Loophole marker pulse animation */
.marker--loophole {
  animation: loophole-pulse 2s ease-in-out infinite;
  border-color: #7c3aed;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 3px rgba(124,58,237,0.3);
}

.marker--loophole:hover {
  animation: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35), 0 0 0 4px rgba(124,58,237,0.4);
}

@keyframes loophole-pulse {
  0%   { box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 0 rgba(124,58,237,0.4); }
  70%  { box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 10px rgba(124,58,237,0); }
  100% { box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 0 rgba(124,58,237,0); }
}

/* User location marker */
.user-marker-wrapper {
  background: none !important;
  border: none !important;
}

.user-marker-dot {
  width: 20px;
  height: 20px;
  background: #4285F4;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(66,133,244,0.3), 0 2px 6px rgba(0,0,0,0.3);
}

/* ============================================================
   Custom Leaflet Popups
   ============================================================ */
.deal-popup-container.leaflet-popup {
  margin-bottom: 12px;
}

.deal-popup-container .leaflet-popup-content-wrapper {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.deal-popup-container .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.deal-popup-container .leaflet-popup-tip {
  background: var(--bg-card);
  box-shadow: none;
  border: none;
}

.deal-popup {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.12), 0 4px 10px rgba(0,0,0,0.08);
  width: 300px;
  overflow: hidden;
  animation: popupEnter 0.25s ease-out;
  border-top: 4px solid var(--chain-color, var(--primary));
}

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

.popup-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}

.popup-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.popup-brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.popup-chain-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-distance {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.popup-count-badge {
  padding: 2px 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 99px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.popup-address {
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

/* Popup deal cards */
.popup-deals-carousel {
  padding: 0.75rem 1rem;
}

.popup-deal-card {
  animation: popupEnter 0.2s ease-out;
}

.popup-deal-hidden {
  display: none;
}

.popup-deal-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.popup-loophole-badge {
  display: inline-block;
  padding: 1px 6px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
  white-space: nowrap;
}

.popup-deal-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.popup-pricing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.popup-cost {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.popup-savings {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
}

.popup-pct {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--green-bg);
  color: var(--green);
  padding: 1px 6px;
  border-radius: 4px;
}

.popup-req {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Popup carousel navigation */
.popup-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.25rem 1rem 0.5rem;
}

.popup-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.popup-nav-btn:hover:not(:disabled) {
  background: var(--border);
}

.popup-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.popup-nav-dots {
  display: flex;
  gap: 4px;
}

.popup-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.15s ease, width 0.2s ease;
}

.popup-dot.active {
  background: var(--text);
  width: 16px;
  border-radius: 4px;
}

/* Popup footer */
.popup-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  text-align: center;
}

.popup-directions {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--blue);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.popup-directions:hover {
  background: var(--blue-bg);
  text-decoration: none;
}

/* ============================================================
   MarkerCluster Override (match Food Dealer theme)
   ============================================================ */
.marker-cluster-small {
  background-color: rgba(230, 57, 70, 0.2) !important;
}
.marker-cluster-small div {
  background-color: var(--primary) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

.marker-cluster-medium {
  background-color: rgba(230, 57, 70, 0.3) !important;
}
.marker-cluster-medium div {
  background-color: var(--primary-hover) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.marker-cluster-large {
  background-color: rgba(193, 18, 31, 0.35) !important;
}
.marker-cluster-large div {
  background-color: #991b1b !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
}

/* ============================================================
   Dark Mode — Map Additions
   ============================================================ */
[data-theme="dark"] .map-canvas {
  border-color: var(--border);
  filter: brightness(0.85) contrast(1.1);
}

[data-theme="dark"] .deal-popup {
  background: var(--bg-card);
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
}

[data-theme="dark"] .popup-header {
  background: var(--bg-sunken);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .popup-footer {
  background: var(--bg-sunken);
  border-top-color: var(--border);
}

[data-theme="dark"] .deal-popup-container .leaflet-popup-tip {
  background: var(--bg-card);
}

[data-theme="dark"] .chain-marker {
  border-color: var(--border);
}

[data-theme="dark"] .detect-inner {
  background: linear-gradient(135deg, var(--bg-sunken), var(--bg-card));
  border-color: var(--primary);
}

/* ============================================================
   Mobile — Map Popup Bottom Sheet
   ============================================================ */
@media (max-width: 480px) {
  .map-canvas {
    height: 400px !important;
    border-radius: 12px;
  }

  .deal-popup {
    width: 260px;
  }
}
