/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:        #16a34a;
  --green-dark:   #15803d;
  --green-light:  #f0fdf4;
  --green-mid:    #dcfce7;
  --blue-card:    #eff6ff;
  --orange-card:  #fff7ed;
  --text:         #111827;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --white:        #ffffff;
  --red:          #dc2626;
  --red-light:    #fef2f2;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
}

body {
  font-family: 'Segoe UI', 'Inter', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ===== NAVBAR ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.navbar-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px;
}

.brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}

.navbar-nav {
  display: flex; align-items: center; gap: 2px;
  list-style: none;
}

.navbar-nav a,
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  font-size: 14px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.navbar-nav a:hover, .nav-btn:hover { background: var(--green-light); color: var(--green); }
.navbar-nav a.active, .nav-btn.active { background: var(--green); color: white; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border-radius: 10px;
  font-size: 15px; font-weight: 500; cursor: pointer;
  border: none; transition: all .15s; white-space: nowrap;
  min-width: 120px;
}

.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-outline {
  background: white; color: var(--green);
  border: 2px solid var(--green);
}
.btn-outline:hover { background: var(--green-light); }

/* ===== HERO ===== */
.hero-wrap { background: var(--green-light); }

.hero {
  max-width: 1100px; margin: 0 auto;
  padding: 64px 32px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 56px; align-items: center;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; border: 1px solid var(--border);
  padding: 5px 14px; border-radius: 20px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 20px;
}

.hero-title {
  font-size: 46px; font-weight: 800; line-height: 1.15;
  margin-bottom: 16px;
}
.hero-title span { color: var(--green); }

.hero-desc {
  font-size: 16px; color: var(--muted);
  margin-bottom: 32px; max-width: 400px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-img-wrap {
  position: relative;
}

.hero-img-wrap img {
  width: 100%; border-radius: var(--radius-lg);
  object-fit: cover; aspect-ratio: 4/3;
  display: block;
}

.accuracy-float {
  position: absolute; bottom: -10px; right: -10px;
  background: white; border-radius: var(--radius);
  padding: 12px 18px; box-shadow: var(--shadow-md);
  text-align: center;
}
.accuracy-float .pct { font-size: 26px; font-weight: 700; color: var(--green); }
.accuracy-float .lbl { font-size: 12px; color: var(--muted); }

/* ===== SECTIONS ===== */
.section { padding: 72px 32px; }
.section-center { text-align: center; }
.section-title { font-size: 30px; font-weight: 700; margin-bottom: 10px; }
.section-sub { font-size: 15px; color: var(--muted); max-width: 460px; margin: 0 auto 48px; }

/* ===== FEATURE CARDS ===== */
.features-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 24px; max-width: 960px; margin: 0 auto;
}

.feature-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 24px;
}
.feature-card:nth-child(1) { background: #f0fdf4; }
.feature-card:nth-child(2) { background: var(--blue-card); }
.feature-card:nth-child(3) { background: var(--orange-card); }

.feat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 18px;
}
.feat-icon.green  { background: var(--green); }
.feat-icon.blue   { background: #3b82f6; }
.feat-icon.orange { background: #f97316; }

.feature-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.feature-card p  { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ===== HOW TO ===== */
.how-wrap { background: var(--green-light); }

.steps-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 32px; max-width: 760px; margin: 0 auto;
  text-align: center;
}

.step-num {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--green); color: white;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.step h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.step p  { font-size: 14px; color: var(--muted); }

/* ===== FOOTER ===== */
footer {
  background: var(--green); color: white;
  text-align: center; padding: 20px;
  font-size: 14px;
}

/* ===== IDENTIFY PAGE ===== */
.id-hero {
  background: var(--green-light);
  padding: 48px 32px 32px;
  text-align: center;
}
.id-hero h1 { font-size: 30px; font-weight: 700; margin-bottom: 8px; }
.id-hero p  { font-size: 15px; color: var(--muted); }

.id-body {
  max-width: 660px; margin: 32px auto 64px;
  padding: 0 24px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius-lg);
  padding: 52px 28px;
  text-align: center;
  background: white;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone.drag { border-color: var(--green); background: var(--green-light); }

.upload-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--green-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--green);
  margin: 0 auto 14px;
}

.upload-zone h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.upload-zone p  { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

.upload-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
#fileInput { display: none; }

/* Preview */
.preview-wrap { display: none; position: relative; margin-bottom: 16px; }
.preview-wrap img {
  width: 100%; max-height: 340px;
  object-fit: cover; border-radius: var(--radius-lg);
}
.btn-remove {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.5); color: white;
  border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
}

/* Tips */
.tips-box {
  background: #eff6ff; border-radius: var(--radius);
  padding: 18px 22px; margin-top: 24px;
}
.tips-box h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.tips-box li { font-size: 14px; color: var(--muted); list-style: none; padding: 2px 0; }
.tips-box li::before { content: '✓ '; color: var(--green); font-weight: 700; }

/* Spinner */
.spinner-wrap { display: none; text-align: center; padding: 32px; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--green-mid);
  border-top-color: var(--green);
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-wrap p { color: var(--muted); font-size: 14px; }

/* Result */
.result-box {
  display: none;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  margin-top: 20px;
}

.toxic-banner {
  background: var(--red-light); border: 1px solid #fca5a5;
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 20px; color: var(--red);
  font-size: 14px; font-weight: 600;
}

.result-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px; margin-bottom: 20px;
}
.result-name h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.result-name .sci { font-size: 13px; color: var(--muted); font-style: italic; }

.acc-badge {
  background: var(--green-light); color: var(--green);
  border-radius: 10px; padding: 8px 14px;
  text-align: center; flex-shrink: 0;
}
.acc-badge .num { font-size: 22px; font-weight: 700; }
.acc-badge .lbl { font-size: 11px; }

.info-grid { display: grid; gap: 10px; }
.info-row { display: flex; gap: 8px; font-size: 14px; }
.info-label { font-weight: 600; min-width: 130px; }
.info-value { color: var(--muted); }

.result-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* Camera modal */
.cam-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 200;
  align-items: center; justify-content: center;
}
.cam-modal.open { display: flex; }
.cam-box {
  background: white; border-radius: var(--radius-lg);
  padding: 20px; width: 90%; max-width: 500px;
}
.cam-box video { width: 100%; border-radius: var(--radius); background: #000; }
.cam-actions { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; color: white; z-index: 500;
  transform: translateY(60px); opacity: 0;
  transition: all .3s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: #374151; }

/* ===== LOGIN / REGISTER ===== */
.auth-page {
  min-height: calc(100vh - 60px);
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
}

.auth-card {
  background: white; border-radius: var(--radius-lg);
  padding: 40px 36px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: 0 auto 16px;
}

.auth-card h1 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-card .sub { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.input-wrap {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 0 14px; background: #f9fafb;
  transition: border-color .15s;
}
.input-wrap:focus-within { border-color: var(--green); background: white; }
.input-wrap span { font-size: 16px; color: var(--muted); flex-shrink: 0; }
.input-wrap input {
  flex: 1; border: none; background: none;
  padding: 13px 0; font-size: 15px; outline: none;
  color: var(--text);
}
.input-wrap button {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px; padding: 0;
}

.form-footer {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
  font-size: 13px;
}
.form-footer label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.form-footer a { color: var(--green); font-weight: 500; }

.btn-full { width: 100%; }

.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--green); font-weight: 600; }

.error-msg {
  background: var(--red-light); color: var(--red);
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 16px; display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; padding: 40px 20px; gap: 32px; }
  .hero-title { font-size: 32px; }
  .features-grid { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 16px; }
  .navbar-nav a, .nav-btn { padding: 7px 10px; font-size: 13px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 26px; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; }
  .upload-btns { flex-direction: column; }
  .result-actions { flex-direction: column; }
}

/* ===== SEARCH AUTOCOMPLETE ===== */
.search-wrap { position: relative; display: flex; align-items: center; gap: 8px; max-width: 600px; margin: 0 auto 24px; }
.search-input { flex: 1; padding: 12px 16px; font-size: 16px; border: 2px solid var(--border); border-radius: var(--radius); outline: none; transition: border-color .2s; }
.search-input:focus { border-color: var(--green); }
.btn-mic { background: var(--green-light); border: 2px solid var(--green); border-radius: var(--radius); padding: 10px 14px; font-size: 18px; cursor: pointer; transition: background .2s; }
.btn-mic:hover, .btn-mic.listening { background: var(--green); }
.search-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 48px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 100; display: none; max-height: 360px; overflow-y: auto; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; transition: background .15s; }
.search-item:hover { background: var(--green-light); }
.search-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.search-item-name { font-size: 15px; font-weight: 600; }
.search-item-sci { font-size: 13px; color: var(--muted); font-style: italic; }
.search-no-result { padding: 14px; color: var(--muted); text-align: center; font-size: 14px; }
.toxic-tag { background: #fef2f2; color: var(--red); font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }

/* ===== HISTORY GRID ===== */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.history-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--white); box-shadow: var(--shadow); position: relative; transition: box-shadow .2s; }
.history-card:hover { box-shadow: var(--shadow-md); }
.history-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.card-body { padding: 12px; }
.card-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.card-sci { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.card-note { font-size: 12px; color: var(--green-dark); background: var(--green-light); padding: 4px 8px; border-radius: 6px; margin-bottom: 8px; }
.card-actions { display: flex; gap: 6px; }
.btn-sm { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; background: var(--white); transition: background .15s; }
.btn-sm:hover { background: var(--green-light); }
.btn-delete:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }
.toxic-tag-card { position: absolute; top: 8px; right: 8px; background: var(--red); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.empty-garden { text-align: center; padding: 60px 20px; grid-column: 1/-1; }
.empty-garden p { font-size: 18px; color: var(--muted); margin: 12px 0 20px; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; font-size: 15px; }

/* ===== REF IMAGES ===== */
.ref-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ref-images img { width: 100px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
