/* =========================================================
   WeedSeg AI — Core Stylesheet
   Palette: clean white background, agricultural green accents
   ========================================================= */

:root {
  /* Colors */
  --color-bg: #ffffff;
  --color-bg-alt: #f6faf7;
  --color-surface: #ffffff;
  --color-border: #e3ece5;
  --color-text: #16241a;
  --color-text-muted: #5b6b60;
  --color-primary: #1f8a4c;
  --color-primary-dark: #146538;
  --color-primary-light: #e6f5ec;
  --color-accent: #7fd858;
  --color-danger: #c0392b;
  --color-warning: #b8860b;

  /* Typography */
  --font-display: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Consolas", "Menlo", monospace;

  /* Radius / Shadow */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(20, 60, 30, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 60, 30, 0.10);
  --shadow-lg: 0 16px 40px rgba(20, 60, 30, 0.14);

  /* Layout */
  --container-width: 1160px;
  --nav-height: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 0.5em 0;
  font-weight: 700;
}

p { margin: 0 0 1em 0; color: var(--color-text-muted); }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 88px 0; }
.section-alt { background: var(--color-bg-alt); }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.section-heading { max-width: 640px; margin-bottom: 48px; }
.section-heading h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.section-heading p { font-size: 1.05rem; }
.section-heading.center { margin-left: auto; margin-right: auto; text-align: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: transparent;
  color: var(--color-primary-dark);
  border-color: var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-primary); background: var(--color-primary-light); }

.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------- Navigation ---------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.nav-inner {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.35rem;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--color-text);
}
.nav-links a:hover,
.nav-links a.active { background: var(--color-primary-light); color: var(--color-primary-dark); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--color-text); border-radius: 2px; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 96px 0 72px;
  background: radial-gradient(circle at 85% 10%, var(--color-primary-light) 0%, transparent 55%);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 4.2vw, 3.4rem);
  margin-bottom: 20px;
}
.hero-desc { font-size: 1.12rem; max-width: 520px; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-visual {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  display: block;
  transition: transform 0.4s ease;
}

.hero-visual:hover .hero-image {
  transform: scale(1.02);
}

.hero-visual svg { width: 100%; height: 100%; }

/* ---------------- Feature Cards ---------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--color-primary);
}
.card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.card p { margin: 0; font-size: 0.96rem; }

/* ---------------- How It Works ---------------- */
.workflow {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 20px 10px 30px;
}
.workflow-step {
  position: relative;
  flex: 1 1 0;
  min-width: 170px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(31, 138, 76, 0.07);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}
.workflow-step:hover {
  transform: translateY(-6px);
  border-color: var(--color-primary);
  box-shadow: 0 14px 30px rgba(31, 138, 76, 0.14);
}
.workflow-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #e6f5ec;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid #cde8d6;
}
.workflow-step h4 {
  font-size: 1rem;
  line-height: 1.3;
  margin-bottom: 8px;
  color: var(--color-text);
}
.workflow-step p {
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 0;
  color: var(--color-text-muted);
}
.workflow-arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  color: var(--color-primary);
  font-size: 1.5rem;
  font-weight: 600;
}

/* ---------------- Detection Preview ---------------- */
.detect-preview {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}
.preview-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.preview-panel .panel-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.preview-img-box {
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-warning);
  background: #fff6e0;
  padding: 4px 10px;
  border-radius: 999px;
}
.detect-arrow { font-size: 1.6rem; color: var(--color-primary); text-align: center; }
.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}

/* ---------------- Weed Library Preview ---------------- */
.weed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.weed-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.weed-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.weed-thumb {
  aspect-ratio: 1/1;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-bg-alt));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 2rem;
}
.weed-card-body { padding: 14px 16px; }
.weed-card-body h4 { font-size: 0.92rem; margin-bottom: 2px; }
.weed-card-body span { font-size: 0.78rem; color: var(--color-text-muted); font-style: italic; }

.center-action { text-align: center; margin-top: 36px; }

/* ---------------- Technology Preview ---------------- */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.tech-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.tech-item .tech-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tech-item h4 { font-size: 1rem; margin-bottom: 4px; }
.tech-item p { margin: 0; font-size: 0.9rem; }

.cbam-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
}
.cbam-node {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}
.cbam-arrow { color: var(--color-primary); font-size: 1.3rem; }

/* ---------------- Research Section ---------------- */
.research-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.research-list li {
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 0.94rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.research-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex: 0 0 auto;
}

/* ---------------- Final CTA ---------------- */
.final-cta {
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
  border-radius: var(--radius-lg);
  padding: 64px 40px;
  text-align: center;
  color: #fff;
}
.final-cta h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.final-cta p { color: rgba(255,255,255,0.88); max-width: 520px; margin: 0 auto 28px; }
.final-cta .btn-primary { background: #fff; color: var(--color-primary-dark); }
.final-cta .btn-primary:hover { background: #eafbf1; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 48px 0 28px;
  background: var(--color-bg-alt);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-brand p { font-size: 0.9rem; max-width: 280px; }
.footer-col h5 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  color: var(--color-text);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 0.9rem; color: var(--color-text-muted); }
.footer-col a:hover { color: var(--color-primary-dark); }
.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ---------------- Page Header (inner pages) ---------------- */
.page-header {
  padding: 56px 0 40px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
}
.page-header h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.page-header p { max-width: 600px; }
.breadcrumb { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--color-primary-dark); font-weight: 600; }

/* ---------------- Detect Page ---------------- */
.detect-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}
.upload-card {
  width: min(100%, 680px);
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.upload-card.dragover { border-color: var(--color-primary); background: var(--color-primary-light); }
.upload-icon { color: var(--color-primary); margin-bottom: 14px; }
.upload-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.upload-card p { font-size: 0.9rem; margin-bottom: 20px; }
.upload-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.file-hint { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 14px; }

.preview-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.preview-box .preview-img-frame {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-alt);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.preview-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-primary);
  margin-bottom: 12px;
  text-align: center;
}
.preview-box .preview-img-frame img { width: 100%; height: 100%; object-fit: contain; }
.preview-actions { display: flex; gap: 10px; }

.camera-view { display: none; margin-top: 16px; }
.camera-view.active { display: block; }
.camera-view video { width: 100%; border-radius: var(--radius-md); background: #000; }

.status-panel {
  margin-top: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: none;
}
.status-panel.active { display: block; }
.status-panel h4 { font-size: 0.98rem; margin-bottom: 12px; }
.status-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.status-steps li {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-steps li.done { color: var(--color-primary-dark); font-weight: 600; }
.status-steps li .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-border);
  flex: 0 0 auto;
}
.status-steps li.done .dot { background: var(--color-primary); }
.progress-bar {
  width: 100%; height: 6px; border-radius: 999px;
  background: var(--color-bg-alt);
  overflow: hidden;
  margin-top: 16px;
}
.progress-bar-fill {
  height: 100%; width: 0%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.results-section { margin-top: 40px; display: none; }
.results-section.active { display: block; }
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.result-item .weed-name { font-weight: 700; font-style: italic; }
.result-item .conf-badge {
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  padding: 4px 12px;
  border-radius: 999px;
}

.weed-scientific-name {
  margin-top: 4px;
  margin-bottom: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

.weed-characteristics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.weed-characteristics div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weed-characteristics strong {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.weed-characteristics span {
  font-size: 0.95rem;
}

.conf-bar { width: 100%; height: 6px; border-radius: 999px; background: var(--color-bg-alt); margin-top: 6px; overflow: hidden; }
.conf-bar-fill { height: 100%; background: var(--color-primary); }

.error-banner {
  display: none;
  background: #fdecea;
  border: 1px solid #f5c6c0;
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.92rem;
  margin-top: 16px;
}
.error-banner.active { display: block; }

.info-banner {
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
  color: var(--color-primary-dark);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

/* ---------------- Library Page ---------------- */
.library-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1 1 260px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  background: var(--color-surface);
}
.search-box input:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.no-results { display: none; text-align: center; padding: 60px 0; color: var(--color-text-muted); }
.no-results.active { display: block; }

/* Species modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 20, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  background: var(--color-bg-alt);
  border: none;
  border-radius: 50%;
  width: 34px; height: 34px;
  cursor: pointer;
  font-size: 1rem;
}
.modal-box .weed-thumb { border-radius: var(--radius-md); margin-bottom: 20px; }
.weed-thumb {
  overflow: hidden;
}

.weed-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal-meta { display: flex; flex-direction: column; gap: 6px; margin: 18px 0; }
.modal-meta div { display: flex; justify-content: space-between; font-size: 0.9rem; border-bottom: 1px dashed var(--color-border); padding: 8px 0; }
.modal-meta span:first-child { color: var(--color-text-muted); }
.placeholder-note { font-size: 0.8rem; color: var(--color-text-muted); font-style: italic; }

/* ---------------- Guide Page ---------------- */
.guide-flow { display: flex; flex-direction: column; gap: 0; max-width: 640px; margin: 0 auto; }
.guide-step {
  display: flex;
  gap: 20px;
  padding: 24px 0;
}
.guide-step .guide-num {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.guide-step-connector { width: 2px; background: var(--color-border); margin-left: 22px; height: 24px; }
.guide-step h3 { font-size: 1.05rem; margin-bottom: 4px; }

/* ---------------- Generic Forms ---------------- */
.simple-note {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  font-size: 0.92rem;
  color: var(--color-text-muted);
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;

  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.team-member {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #ffffff;

  /* Important */
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.team-avatar {
  width: 50px;
  height: 50px;
  min-width: 50px;
  flex-shrink: 0;

  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
  font-weight: 700;
}

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

.team-info h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--color-text);

  overflow-wrap: anywhere;
}

.team-info p {
  margin: 4px 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.5;

  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 700px) {
  .team-grid {
    grid-template-columns: 1fr;
  }
}

.team-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background: var(--color-bg, #f6f8f5);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px;
  background: #ffffff;
  border: 1px solid var(--color-border, #e2e6e1);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header h1 {
  margin: 8px 0;
}

.auth-header p {
  color: var(--color-text-muted);
  margin: 0;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--color-border, #dfe4dc);
  border-radius: 9px;
  font-size: 0.95rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--color-primary, #2e7d32);
}

.auth-submit {
  width: 100%;
  margin-top: 5px;
}

.auth-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 0.9rem;
}

.auth-footer a {
  margin-left: 5px;
  font-weight: 600;
}

.auth-error {
  display: none;
  margin-bottom: 15px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f1;
  color: #b42318;
  font-size: 0.9rem;
}

.auth-error.active {
  display: block;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logged-in-username {
  font-weight: 600;
  color: var(--color-text);
}

.logout-btn {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
}

.logout-btn:hover {
  background: var(--color-bg);
}

/* ================= USER DROPDOWN ================= */

.user-dropdown {
  position: relative;
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;

  border: none;
  background: transparent;

  padding: 10px 4px;
  cursor: pointer;

  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 600;
}

.user-icon {
  font-size: 1.1rem;
}

.dropdown-arrow {
  font-size: 0.65rem;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.user-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}


/* Dropdown box */

.user-dropdown-menu {
  position: absolute;

  top: calc(100% + 10px);
  right: 0;

  width: 210px;

  background: #ffffff;

  border: 1px solid var(--color-border);
  border-radius: 12px;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);

  padding: 8px;

  display: none;

  z-index: 1000;
}

.user-dropdown.open .user-dropdown-menu {
  display: block;
}


/* Dropdown links */

.user-dropdown-menu a,
.logout-option {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 11px 12px;

  border: none;
  border-radius: 8px;

  background: transparent;

  color: var(--color-text);

  text-decoration: none;

  font-size: 0.92rem;

  cursor: pointer;

  box-sizing: border-box;
}

.user-dropdown-menu a:hover,
.logout-option:hover {
  background: #f0f8f3;
}

.user-dropdown-menu a span,
.logout-option span {
  width: 20px;
  text-align: center;
}


/* Divider */

.dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 6px 4px;
}


/* Logout */

.logout-option {
  color: #c62828;
}

.logout-option:hover {
  background: #fff3f3;
}

/* =========================================================
   PREDICTION HISTORY
   ========================================================= */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 36px;
}


/* Individual history card */

.history-card {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 28px;

  padding: 22px;

  background: #ffffff;
  border: 1px solid #dfe9e2;
  border-radius: 16px;

  box-shadow: 0 4px 14px rgba(30, 80, 50, 0.06);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.history-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(30, 80, 50, 0.10);
}


/* Image section */

.history-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.history-images > div {
  min-width: 0;
}

.history-image-label {
  display: block;

  margin-bottom: 8px;

  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: #66756b;
}

.history-images img {
  display: block;

  width: 100%;
  height: 190px;

  object-fit: cover;

  border-radius: 10px;
  border: 1px solid #e2ebe5;

  background: #f4f8f5;
}


/* Information section */

.history-content {
  display: flex;
  flex-direction: column;
  justify-content: center;

  min-width: 0;
}

.history-date {
  margin-bottom: 12px;

  font-size: 0.88rem;
  color: #718077;
}

.history-content h3 {
  margin: 0 0 12px;

  font-size: 1.15rem;
  color: #17251d;
}


/* Detected weed */

.history-detections {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.history-detection {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 11px 14px;

  background: #f4faf6;
  border: 1px solid #e1eee5;
  border-radius: 9px;

  font-size: 0.95rem;
  color: #27372d;
}

.history-detection strong {
  color: #187a43;
  font-weight: 700;
}


/* Buttons */

.history-actions {
  display: flex;
  gap: 10px;

  margin-top: 20px;
}

.history-actions .btn {
  min-width: 130px;
}


/* Empty / loading / error */

#historyLoading,
#historyEmpty,
#historyError {
  margin-top: 30px;
}


/* =========================================================
   HISTORY DETAIL PAGE
   ========================================================= */

.history-detail {
  margin-top: 30px;
}

.history-detail-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.history-detail-images > div {
  padding: 18px;

  background: #ffffff;
  border: 1px solid #dfe9e2;
  border-radius: 16px;

  box-shadow: 0 4px 14px rgba(30, 80, 50, 0.06);
}

.history-detail-images h3 {
  margin: 0 0 14px;

  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: #66756b;
}

.history-detail-images img {
  display: block;

  width: 100%;
  height: 430px;

  object-fit: contain;

  border-radius: 10px;

  background: #f4f8f5;
}

.history-detail-info {
  margin-top: 24px;

  padding: 22px;

  background: #ffffff;
  border: 1px solid #dfe9e2;
  border-radius: 16px;
}

.history-detail-info > p {
  margin-top: 0;
  color: #66756b;
}

.history-detail-info h3 {
  margin-top: 22px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

  .history-card {
    grid-template-columns: 1fr;
  }

  .history-images img {
    height: 220px;
  }

  .history-detail-images {
    grid-template-columns: 1fr;
  }

  .history-detail-images img {
    height: 350px;
  }
}


@media (max-width: 600px) {

  .history-images {
    grid-template-columns: 1fr;
  }

  .history-images img {
    height: 220px;
  }

  .history-card {
    padding: 16px;
  }

  .history-detail-images img {
    height: 260px;
  }
}

.history-delete-btn {
  min-width: 100px;

  color: #b42318;
  background: #ffffff;

  border: 1px solid #e3b8b4;
}

.history-delete-btn:hover {
  background: #fff5f4;
  border-color: #d8948e;
}