@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,600;1,9..144,300&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --green: #1D9E75;
  --green-dark: #0F6E56;
  --green-light: #E1F5EE;
  --green-mid: #5DCAA5;
  --red-light: #FAECE7;
  --red: #D85A30;
  --gray-50: #F8F7F4;
  --gray-100: #EEECE8;
  --gray-200: #D8D5CF;
  --gray-500: #888580;
  --gray-700: #444240;
  --gray-900: #1C1B19;
  --white: #FFFFFF;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  line-height: 1.2;
}

/* NAV */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248,247,244,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-100);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--green);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 18px; height: 18px; fill: white; }
.logo-text { font-family: 'Fraunces', serif; font-size: 17px; font-weight: 500; color: var(--gray-900); }
.logo-text em { font-style: italic; color: var(--green); }

.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  font-size: 13px;
  color: var(--gray-500);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-links a:hover { color: var(--gray-900); background: var(--gray-100); }
.nav-links a.active { color: var(--green-dark); font-weight: 500; }

.btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; border-radius: var(--radius-md); padding: 9px 18px; transition: all 0.15s; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-outline:hover { background: var(--white); border-color: var(--gray-500); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* HERO */
.hero {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 64px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, rgba(29,158,117,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}
.hero-badge::before { content: '●'; font-size: 8px; color: var(--green); }
.hero h1 { font-size: clamp(32px, 5vw, 52px); color: var(--gray-900); margin-bottom: 14px; max-width: 640px; margin-left: auto; margin-right: auto; }
.hero h1 em { color: var(--green); font-style: italic; }
.hero p { font-size: 16px; color: var(--gray-500); max-width: 480px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* STORE STRIP */
.store-strip {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 14px 24px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.store-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
}
.store-dot { width: 8px; height: 8px; border-radius: 50%; }

/* MAIN LAYOUT */
.main { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-head h2 { font-size: 22px; }
.section-head p { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* FILTERS */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn {
  font-size: 12px; font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.filter-btn:hover { border-color: var(--green); color: var(--green); }
.filter-btn.active { background: var(--green); color: white; border-color: var(--green); }

/* PRICE TABLE */
.price-table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* ── Desktop header ── */
.pt-header {
  display: grid;
  grid-template-columns: 200px repeat(5, 1fr);
  background: var(--gray-50);
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--gray-100);
  gap: 6px;
}
.pt-header .store-col { text-align: center; }

/* ── Desktop row ── */
.pt-row {
  display: grid;
  grid-template-columns: 200px repeat(5, 1fr);
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
  cursor: pointer;
}
.pt-row:last-child { border-bottom: none; }
.pt-row:hover { background: var(--gray-50); }
.pt-row.hidden { display: none; }
/* On desktop, mobile-prices is transparent wrapper — grid handles layout */
.mobile-prices { display: contents; }

/* ── Item info ── */
.item-info { display: flex; flex-direction: column; justify-content: center; }
.item-info .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  line-height: 1.3;
}
.item-info .name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.item-info .meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.save-badge {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Price cells ── */
.price-cell {
  text-align: center;
  font-size: 13px;
  color: var(--gray-700);
}
.price-best {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}
.price-worst { color: var(--red); }
.price-na { color: var(--gray-200); font-size: 11px; }

/* ── Tablet: 768px - show 3 stores ── */
@media (max-width: 900px) {
  .pt-header { grid-template-columns: 180px repeat(5, 1fr); }
  .pt-row     { grid-template-columns: 180px repeat(5, 1fr); }
}

/* ── Mobile: card layout ── */
@media (max-width: 640px) {
  .pt-header { display: none; }

  .pt-row {
    display: block;
    padding: 14px 16px;
  }

  .item-info .name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
  }
  .item-info .meta { margin-bottom: 8px; }

  /* Price pills in a strict 2-column grid — always even */
  .mobile-prices {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 2px;
  }

  .pt-row .price-cell {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 8px;
    padding: 5px 10px;
    min-width: 0;
  }
  .pt-row .price-cell::before {
    content: attr(data-store);
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
  }
  .pt-row .price-cell .price-best {
    padding: 0;
    background: transparent;
    color: var(--green-dark);
    font-weight: 700;
  }
  .pt-row .price-cell.has-best {
    background: var(--green-light);
    border-color: rgba(29,158,117,0.3);
  }
  .pt-row .price-cell.has-worst {
    border-color: rgba(220,50,50,0.15);
  }
}

/* UPLOAD SECTION */
.upload-section {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 32px;
  box-shadow: var(--shadow-sm);
}
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.upload-card {
  border: 1.5px dashed var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-card:hover { border-color: var(--green); background: var(--green-light); }
.upload-card .icon { font-size: 32px; margin-bottom: 12px; }
.upload-card h3 { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; margin-bottom: 6px; }
.upload-card p { font-size: 12px; color: var(--gray-500); }

/* STATS */
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.stat-value { font-family: 'Fraunces', serif; font-size: 32px; font-weight: 500; color: var(--gray-900); }
.stat-value.green { color: var(--green); }
.stat-sub { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* LIST INPUT */
.list-input-wrap { margin-top: 20px; }
.list-textarea {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--gray-900);
  background: var(--gray-50);
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border 0.15s;
}
.list-textarea:focus { border-color: var(--green); background: var(--white); }
.list-textarea::placeholder { color: var(--gray-200); }

/* RESULT CARD */
.result-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  display: none;
}
.result-card.visible { display: block; }
.result-store-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 12px; }
.result-store {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  transition: all 0.15s;
}
.result-store.winner {
  border-color: var(--green);
  background: var(--green-light);
}
.result-store .store-name { font-size: 11px; font-weight: 500; color: var(--gray-500); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.result-store .store-total { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 500; color: var(--gray-900); }
.result-store.winner .store-total { color: var(--green-dark); }
.result-store .store-save { font-size: 11px; color: var(--green-dark); margin-top: 2px; }
.winner-badge {
  display: inline-block;
  background: var(--green);
  color: white;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
}

/* FEATURES TEASER */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-top: 32px; }
.feature-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.feature-icon { font-size: 24px; margin-bottom: 10px; }
.feature-card h3 { font-size: 14px; font-weight: 500; margin-bottom: 5px; }
.feature-card p { font-size: 12px; color: var(--gray-500); line-height: 1.5; }
.coming-soon { font-size: 10px; background: var(--gray-100); color: var(--gray-500); padding: 2px 8px; border-radius: 10px; display: inline-block; margin-top: 6px; }

/* FOOTER */
footer {
  border-top: 1px solid var(--gray-100);
  background: var(--white);
  padding: 24px;
  text-align: center;
  margin-top: 60px;
}
footer p { font-size: 12px; color: var(--gray-500); }
footer a { color: var(--green); text-decoration: none; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28,27,25,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  transform: translateY(10px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h3 { font-family: 'Fraunces', serif; font-size: 20px; margin-bottom: 8px; }
.modal p { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }
.modal-close { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-500); line-height: 1; }

/* RESPONSIVE */
@media (max-width: 700px) {
  .upload-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .result-store-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 28px; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ANIMATIONS */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s ease both; }
.fade-up-2 { animation: fadeUp 0.4s 0.1s ease both; }
.fade-up-3 { animation: fadeUp 0.4s 0.2s ease both; }

/* UPDATED BADGE */
.updated { font-size: 11px; color: var(--gray-500); display: flex; align-items: center; gap: 5px; }
.updated::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; }
