/* GroceryGuard — clean food scanner */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark: #1b4332;
  --green-mid: #2d6a4f;
  --green-light: #52b788;
  --cream: #f8f5f0;
  --cream-dark: #ede8e0;
  --text: #1a1a1a;
  --text-muted: #666;
  --red: #e63946;
  --amber: #f4a261;
  --radius: 14px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--green-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-scan-btn {
  background: white;
  color: var(--green-dark);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

/* Hero */
.hero {
  background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-mid) 100%);
  color: white;
  padding: 4rem 1.5rem 5rem;
  text-align: center;
}
.hero-inner { max-width: 540px; margin: 0 auto; }
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: 0.03em;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}
.hero-sub {
  font-size: 1.05rem;
  opacity: 0.85;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.hero-hint { font-size: 0.8rem; opacity: 0.6; margin-top: 0.75rem; }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  color: var(--green-dark);
  font-weight: 700;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.25); }
.btn-large { padding: 1rem 2.5rem; font-size: 1.1rem; }
.btn-icon { font-size: 1.2em; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: white;
  color: var(--text);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  border: 2px solid var(--cream-dark);
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--green-light); }
.full-width { width: 100%; }

/* Features */
.features { padding: 4rem 1.5rem; max-width: 900px; margin: 0 auto; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}
.feature-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-weight: 700; margin-bottom: 0.5rem; font-size: 1rem; }
.feature-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }

/* Verdict explainer */
.verdict-explainer {
  background: white;
  padding: 4rem 1.5rem;
  text-align: center;
}
.verdict-explainer h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 2rem; letter-spacing: -0.02em; }
.verdicts-row {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 700px;
  margin: 0 auto;
}
.verdict-demo {
  flex: 1;
  min-width: 160px;
  max-width: 200px;
  padding: 1.75rem 1rem;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.verdict-clean { background: #d8f3dc; }
.verdict-watch { background: #fff3e4; }
.verdict-avoid { background: #ffe5e7; }
.verdict-emoji { font-size: 2.5rem; }
.verdict-label { font-weight: 800; font-size: 1rem; letter-spacing: 0.05em; }
.verdict-demo p { font-size: 0.82rem; color: var(--text-muted); text-align: center; }

.cta-bottom { padding: 4rem 1.5rem; text-align: center; }

/* Scan page */
.scan-page { max-width: 540px; margin: 0 auto; padding: 1.5rem; }
.scanner-container { }
.scanner-header { text-align: center; margin-bottom: 1.25rem; }
.scanner-header h2 { font-size: 1.4rem; font-weight: 700; }
.scanner-header p { color: var(--text-muted); font-size: 0.9rem; }

.scanner-viewport {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 300px;
}
#reader { width: 100% !important; }
#reader video { width: 100% !important; height: auto !important; }
#reader img { display: none !important; }

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scan-box {
  position: relative;
  width: 220px;
  height: 160px;
}
.scan-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: white;
  border-style: solid;
}
.scan-corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }
.scan-line {
  position: absolute;
  left: 10px; right: 10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #52b788, transparent);
  animation: scanMove 2s ease-in-out infinite;
  top: 10px;
}
@keyframes scanMove {
  0%, 100% { top: 10px; }
  50% { top: calc(100% - 12px); }
}

.manual-entry {
  margin-top: 1.5rem;
  text-align: center;
}
.manual-entry p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.manual-row { display: flex; gap: 0.5rem; }
.manual-row input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 2px solid var(--cream-dark);
  border-radius: 999px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}
.manual-row input:focus { border-color: var(--green-light); }

/* Result panel */
.result-panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 1rem;
}
.result-inner { padding: 1.5rem; }
.result-actions { padding: 1rem 1.5rem; border-top: 1px solid var(--cream-dark); }

.result-verdict-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.result-verdict-emoji { font-size: 3rem; line-height: 1; }
.result-verdict-label {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.result-product-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
.result-brand { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.result-image { width: 80px; height: 80px; object-fit: contain; float: right; margin-left: 1rem; }

.result-nova {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border: 1px solid;
}

.result-flags { margin-top: 1rem; }
.result-flags-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.result-flag-chip {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  margin: 0.2rem 0.15rem;
}
.chip-HIGH { background: #ffe5e7; color: var(--red); }
.chip-MEDIUM { background: #fff3e4; color: #c77a2a; }
.chip-LOW { background: #f0f0f0; color: #555; }
.result-clean-msg { color: var(--green-mid); font-weight: 600; margin-top: 0.75rem; }

/* Loading */
.loading-panel {
  text-align: center;
  padding: 3rem 1.5rem;
  background: white;
  border-radius: var(--radius);
  margin-top: 1rem;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--cream-dark);
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Product page */
.product-page { max-width: 680px; margin: 0 auto; padding: 1.5rem; }
.product-header {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: white;
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.product-header-inner { display: flex; gap: 1.5rem; align-items: flex-start; }
.product-image {
  width: 100px; height: 100px;
  object-fit: contain;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  flex-shrink: 0;
}
.product-brand { font-size: 0.85rem; opacity: 0.7; margin-bottom: 0.25rem; }
.product-name { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin-bottom: 1rem; }
.verdict-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.verdict-badge.verdict-clean { background: #2d6a4f; color: white; }
.verdict-badge.verdict-watch { background: #f4a261; color: white; }
.verdict-badge.verdict-avoid { background: #e63946; color: white; }
.nova-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid;
  margin-left: 0.5rem;
}

/* Flags */
.flags-section { margin-bottom: 1.5rem; }
.flags-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.flags-list { display: flex; flex-direction: column; gap: 0.75rem; }
.flag-card {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border-left: 4px solid;
  box-shadow: var(--shadow);
}
.flag-card.flag-high { border-color: var(--red); }
.flag-card.flag-medium { border-color: var(--amber); }
.flag-card.flag-low { border-color: #aaa; }
.flag-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.flag-name { font-weight: 600; font-size: 0.95rem; text-transform: capitalize; }
.flag-level { font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; }
.flag-level-HIGH { background: #ffe5e7; color: var(--red); }
.flag-level-MEDIUM { background: #fff3e4; color: #c77a2a; }
.flag-level-LOW { background: #f0f0f0; color: #666; }
.flag-concern { font-size: 0.88rem; margin-bottom: 0.25rem; }
.flag-source { font-size: 0.78rem; color: var(--text-muted); }

.flags-clean { background: #d8f3dc; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.flags-clean h2 { color: var(--green-dark); }
.flags-clean p { color: var(--green-mid); font-size: 0.9rem; margin-top: 0.5rem; }

/* NOVA */
.nova-section { margin-bottom: 1.5rem; }
.nova-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.nova-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 5px solid;
}
.nova-score-big { font-size: 3rem; font-weight: 800; line-height: 1; }
.nova-card p { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Ingredients */
.ingredients-section { margin-bottom: 1.5rem; }
.ingredients-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.ingredients-text {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  box-shadow: var(--shadow);
}

.scan-again { text-align: center; padding: 1rem 0 2rem; }

/* Not found */
.not-found {
  max-width: 420px;
  margin: 4rem auto;
  text-align: center;
  padding: 2rem;
}
.not-found h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 1rem; }
.not-found p { color: var(--text-muted); margin-bottom: 1rem; }
.not-found code { background: var(--cream-dark); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.9em; }
.not-found a { color: var(--green-mid); }

@media (max-width: 480px) {
  .product-header-inner { flex-direction: column; }
  .verdict-demo { min-width: 120px; }
}
