/* ─────────────────────────────────────────────────────────────────────────────
   AlexxaFarms — Modern Clean Agriculture UI Design
   Matching AlexxaFarms Mobile & Web Dashboard Visual Style
───────────────────────────────────────────────────────────────────────────── */

:root {
  /* AlexxaFarms Palette */
  --bg-page:        #F5F7F5;
  --bg-card:        #FFFFFF;
  --bg-subtle:      #F0F4F1;
  --bg-pill:        #E8EFE9;

  --color-primary:  #0F542A; /* Alexxa Forest Green */
  --color-primary-h:#0A3B1D;
  --color-light-green:#E6F4EA;
  --color-accent-green:#22C55E;

  --color-text-main:#1A202C;
  --color-text-sub: #64748B;
  --color-text-muted:#94A3B8;

  --border-light:   #E2E8F0;
  --border-green:   #C8E6C9;

  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;

  --font-family:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-card:    0 4px 20px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
}

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

body {
  background-color: var(--bg-page);
  color: var(--color-text-main);
  font-family: var(--font-family);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ──────────────────────────────────────────────────────────────── */
.header {
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.875rem 1.5rem;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background-color: var(--color-light-green);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo svg {
  width: 22px;
  height: 22px;
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.name-main {
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: 0.05em;
  color: var(--color-primary);
}

.name-sub {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--color-text-sub);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--color-text-sub);
}

.status-pill.online {
  background: var(--color-light-green);
  color: var(--color-primary);
}

.status-pill.offline {
  background: #FEE2E2;
  color: #DC2626;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
}

/* ── MAIN CONTAINER ─────────────────────────────────────────────────────── */
.main-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
  flex: 1;
}

/* ── OVERVIEW BANNER ─────────────────────────────────────────────────────── */
.overview-banner {
  background-color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
}

.banner-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  background-color: var(--color-light-green);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.overview-banner h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: 0.375rem;
}

.overview-banner p {
  color: var(--color-text-sub);
  font-size: 0.9375rem;
  max-width: 700px;
}

/* ── NAVIGATION TABS ─────────────────────────────────────────────────────── */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.625rem 1.25rem;
  border-radius: 99px;
  border: 1px solid var(--border-light);
  background: #FFFFFF;
  color: var(--color-text-sub);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--color-primary);
}

.tab-btn.active {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}

/* ── TAB PANELS ──────────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── GRID LAYOUT ─────────────────────────────────────────────────────────── */
.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

/* ── UI CARD ─────────────────────────────────────────────────────────────── */
.ui-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card-head {
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border-light);
}

.card-head h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.card-head .sub-text {
  font-size: 0.8125rem;
  color: var(--color-text-sub);
  display: block;
  margin-top: 2px;
}

/* ── DROPZONE ────────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  background: var(--bg-page);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-primary);
  background: var(--color-light-green);
}

.upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.drop-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-main);
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.preview-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-md) - 2px);
  overflow: hidden;
  background: #000;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #FFF;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 0.875rem 0;
  font-size: 0.8125rem;
  color: var(--color-text-main);
  font-weight: 500;
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-h);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  color: var(--color-text-main);
}

.btn-outline:hover {
  background: var(--bg-subtle);
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
}

/* ── FORM CONTROL ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.input-label {
  display: block;
  font-size: 0.78125rem;
  font-weight: 700;
  color: var(--color-text-sub);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.input-label .unit {
  font-weight: 500;
  text-transform: none;
  color: var(--color-text-muted);
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-text-main);
  background: #FFFFFF;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-light-green);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 540px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ── CATEGORY PILLS ──────────────────────────────────────────────────────── */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.5rem;
}

.pill {
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-light);
  background: #FFFFFF;
  color: var(--color-text-sub);
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.pill:hover {
  background: var(--bg-subtle);
}

.pill.active {
  background: var(--color-light-green);
  color: var(--color-primary);
  border-color: var(--border-green);
}

/* ── PLACEHOLDER STATE ───────────────────────────────────────────────────── */
.placeholder-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--color-text-sub);
  font-size: 0.875rem;
}

.placeholder-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* ── RESULTS DISPLAY ─────────────────────────────────────────────────────── */
.report-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-header-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-header-card.healthy {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
}

.result-header-card.diseased {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
}

.result-header-card .status-icon {
  font-size: 1.5rem;
}

.result-header-card .title {
  font-weight: 800;
  font-size: 1rem;
}

.result-header-card .sub {
  font-size: 0.8125rem;
  opacity: 0.85;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.stat-box {
  background: var(--bg-subtle);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.stat-box .lbl {
  font-size: 0.6875rem;
  color: var(--color-text-sub);
  font-weight: 700;
  text-transform: uppercase;
}

.stat-box .val {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-top: 2px;
}

.detection-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detection-card .name {
  font-weight: 700;
  font-size: 0.875rem;
}

.detection-card .badge {
  background: #FEE2E2;
  color: #991B1B;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

/* Crop list styling */
.crop-item {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;

}

.crop-item.rank-1 {
  border-color: var(--border-green);
  background: #F4FBF6;
}

.crop-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-light-green);
  color: var(--color-primary);
  font-weight: 800;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crop-details {
  flex: 1;
}

.crop-name {
  font-weight: 800;
  font-size: 0.9375rem;
  color: var(--color-text-main);
  text-transform: capitalize;
}

.crop-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-text-sub);
  text-transform: uppercase;
  background: var(--bg-pill);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.crop-confidence {
  text-align: right;
}

.crop-confidence .pct {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--color-primary);
}

.crop-confidence .lbl {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

/* ── SPINNER ──────────────────────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── TOAST ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1A202C;
  color: #FFFFFF;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toastIn 0.2s ease;
}

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

/* ── FOOTER ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--border-light);
  background: #FFFFFF;
  margin-top: auto;
}

.hidden {
  display: none !important;
}

.treatment-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
}

.treatment-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}

.treatment-card .lbl {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.treatment-card .val {
  font-size: 0.95rem;
  color: #1e293b;
}

.treatment-card ul {
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ── VIDEO SUPPORT ───────────────────────────────────────────────────────── */
.preview-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.remove-btn {
  z-index: 2;
}

.video-options {
  margin-bottom: 0.875rem;
}

.video-options select {
  width: 100%;
  margin-top: 4px;
}

.warning-box {
  margin-top: 0.75rem;
  padding: 10px 12px;
  background: #FFF7ED;
  border: 1px solid #FDBA74;
  border-radius: var(--radius-sm);
  color: #9A3412;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.dist-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.8125rem;
}

.dist-label {
  color: var(--color-text-main);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-bar {
  height: 8px;
  background: var(--bg-pill);
  border-radius: 99px;
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 99px;
}

.dist-pct {
  text-align: right;
  color: var(--color-text-sub);
  font-weight: 700;
}

.result-header-card.unknown {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-left: 4px solid #64748b;
}

.result-header-card.unknown .status-icon {
  background: #64748b;
  color: white;
}

.result-header-card.unknown .title {
  color: #334155;
}