/* ===== DISEASE DETECTION PAGE ===== */

/* Hero */
.disease-hero {
  background: linear-gradient(160deg, #1a3a2a 0%, #1b5e20 50%, #2e7d32 100%);
  color: var(--white);
  padding: 52px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.disease-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 85%, rgba(255,255,255,.04) 0%, transparent 50%),
    radial-gradient(circle at 85% 15%, rgba(249,168,37,.07) 0%, transparent 50%);
}
.disease-hero-content { position: relative; max-width: 680px; margin: 0 auto; }
.disease-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 900; margin-bottom: 14px; }
.disease-hero h1 span { color: var(--amber); }
.disease-hero p { font-size: 1rem; color: rgba(255,255,255,.82); max-width: 540px; margin: 0 auto 20px; line-height: 1.7; }

/* Ollama status bar */
.ollama-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 24px;
  padding: 7px 18px;
  font-size: .82rem;
  color: rgba(255,255,255,.9);
  flex-wrap: wrap;
  justify-content: center;
}
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 1.6s ease infinite;
}
.status-dot.checking  { background: #ffd54f; }
.status-dot.connected { background: #69f0ae; animation: none; }
.status-dot.warn      { background: #ffab40; }
.status-dot.error     { background: #ef5350; animation: none; }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .35; }
}

.model-pill {
  background: rgba(255,255,255,.15);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .3px;
}

/* Loading timer */
.loading-timer-row { margin: 10px 0; }
.loading-timer {
  font-size: .82rem;
  font-weight: 600;
  color: var(--green-mid);
  background: var(--green-pale);
  border-radius: 20px;
  padding: 4px 14px;
}

/* Model used row (above results) */
.model-used-row { margin-bottom: 10px; }
.model-used-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .78rem;
  color: var(--green-dark);
}

/* Main layout */
.disease-main { max-width: 1200px; margin: 0 auto; padding: 40px 24px 56px; }

.disease-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

/* ── LEFT: Upload Panel ── */
.upload-panel { display: flex; flex-direction: column; gap: 18px; }

/* Drop Zone */
.drop-zone {
  border: 2.5px dashed #a5d6a7;
  border-radius: var(--radius-lg);
  background: var(--green-pale);
  cursor: pointer;
  transition: var(--transition);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--green-mid);
  background: #d0eed1;
}
.drop-inner { text-align: center; }
.drop-icon-wrap {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
  filter: grayscale(20%);
}
.drop-inner h3 { font-size: 1.1rem; font-weight: 700; color: var(--green-dark); margin-bottom: 6px; }
.drop-inner p { font-size: .88rem; color: var(--text-light); line-height: 1.5; }
.file-hint {
  display: inline-block;
  margin-top: 12px;
  background: rgba(46,125,50,.1);
  color: var(--green-dark);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .4px;
}

/* Preview box */
.preview-box {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e0f0e0;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.preview-label { font-size: .82rem; font-weight: 700; color: var(--text-mid); }
.btn-change {
  font-size: .75rem;
  font-weight: 600;
  color: var(--green-mid);
  background: none;
  border: 1px solid var(--green-light);
  border-radius: 20px;
  padding: 3px 12px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-change:hover { background: var(--green-pale); }

.preview-img {
  width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
  max-height: 280px;
  display: block;
  margin-bottom: 10px;
}
.file-info { font-size: .76rem; color: var(--text-light); margin-bottom: 14px; }

.btn-analyze {
  width: 100%;
  background: linear-gradient(135deg, var(--green-mid), var(--green-light));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(46,125,50,.3);
}
.btn-analyze:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(46,125,50,.35); }
.btn-analyze:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-icon { font-size: 1.1rem; }

/* Tips box */
.tips-box {
  background: var(--amber-light);
  border: 1px solid #ffe082;
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.tips-title { font-size: .85rem; font-weight: 700; color: #6d4c00; margin-bottom: 10px; }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tips-list li { font-size: .8rem; color: #5d4200; line-height: 1.4; }

/* ── RIGHT: Results Panel ── */
.results-panel {
  min-height: 400px;
}

/* Idle */
.idle-state {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  text-align: center;
  border: 1px solid #e6f0e7;
  box-shadow: var(--shadow-sm);
}
.idle-icon { font-size: 4rem; margin-bottom: 16px; display: block; }
.idle-state h3 { font-size: 1.25rem; font-weight: 800; color: var(--text-mid); margin-bottom: 8px; }
.idle-state p { font-size: .9rem; color: var(--text-light); max-width: 320px; margin: 0 auto 28px; line-height: 1.6; }
.idle-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.idle-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-mid);
}
.idle-step span {
  width: 26px; height: 26px;
  background: var(--green-pale);
  color: var(--green-dark);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
}
.idle-arrow { font-size: 1rem; color: var(--text-light); }

/* Loading */
.loading-state {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  text-align: center;
  border: 1px solid #e6f0e7;
  box-shadow: var(--shadow-sm);
}
.spinner {
  width: 52px; height: 52px;
  border: 4px solid var(--green-pale);
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--green-dark); margin-bottom: 6px; }
.loading-state p { font-size: .85rem; color: var(--text-light); margin-bottom: 24px; }
.loading-steps { display: flex; flex-direction: column; gap: 8px; max-width: 280px; margin: 0 auto; }
.ls-step {
  font-size: .82rem;
  color: var(--text-light);
  padding: 8px 14px;
  border-radius: 8px;
  transition: var(--transition);
}
.ls-step.active { background: var(--green-pale); color: var(--green-dark); font-weight: 600; }
.ls-step.done { color: var(--green-mid); font-weight: 600; }

/* Error */
.error-state {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  text-align: center;
  border: 1px solid #ffcdd2;
  box-shadow: var(--shadow-sm);
}
.error-icon { font-size: 3rem; margin-bottom: 14px; display: block; }
.error-state h3 { font-size: 1.1rem; font-weight: 700; color: #c62828; margin-bottom: 8px; }
.error-state p { font-size: .88rem; color: #555; margin-bottom: 20px; }
.btn-retry {
  background: #c62828;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-retry:hover { background: #b71c1c; }

/* ── Analysis Results ── */
.analysis-results { display: flex; flex-direction: column; gap: 18px; animation: fadeSlideUp .4s ease both; }

/* Summary card */
.summary-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px 24px 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid #e0f0e0;
  position: relative;
  overflow: hidden;
}
.summary-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--green-dark), var(--green-light), var(--amber));
}
.summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.summary-plant {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.summary-badges { display: flex; gap: 8px; flex-wrap: wrap; }

/* Severity badges */
.badge-severity, .badge-urgency {
  border-radius: 20px;
  padding: 4px 13px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.severity-none     { background: #e8f5e9; color: #1b5e20; }
.severity-mild     { background: #fff9c4; color: #f57f17; }
.severity-moderate { background: #ffe0b2; color: #bf360c; }
.severity-severe   { background: #ffcdd2; color: #b71c1c; }

.urgency-immediate  { background: #ffcdd2; color: #b71c1c; }
.urgency-week       { background: #ffe0b2; color: #bf360c; }
.urgency-routine    { background: #e3f2fd; color: #0d47a1; }
.urgency-none       { background: #e8f5e9; color: #1b5e20; }

.disease-name {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--green-dark);
  margin-bottom: 14px;
  line-height: 1.2;
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.conf-label { font-size: .78rem; color: var(--text-light); font-weight: 600; white-space: nowrap; }
.conf-bar-wrap {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}
.conf-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green-mid), var(--green-light));
  transition: width .6s ease;
}
.conf-value { font-size: .78rem; font-weight: 700; color: var(--green-mid); white-space: nowrap; }

/* Result sections */
.result-section {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e6f0e7;
}
.rs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--green-pale);
}
.rs-icon { font-size: 1.2rem; }
.rs-header h4 { font-size: 1rem; font-weight: 800; color: var(--green-dark); }

.symptoms-text { font-size: .88rem; color: var(--text-mid); line-height: 1.7; margin-bottom: 8px; }
.causes-text {
  font-size: .84rem;
  color: var(--text-light);
  line-height: 1.6;
  border-top: 1px dashed #d4e8d5;
  padding-top: 8px;
  margin-top: 4px;
}

/* Fertilizer grid */
.fert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.fert-card {
  background: var(--green-pale);
  border: 1px solid #c8e6c9;
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
}
.fert-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.fert-name { font-size: .9rem; font-weight: 700; color: var(--green-dark); }
.fert-type-tag {
  font-size: .68rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 2px 8px;
  background: var(--green-mid);
  color: var(--white);
}
.fert-type-tag.fungicide  { background: #7b1fa2; }
.fert-type-tag.insecticide{ background: #d32f2f; }
.fert-type-tag.nutrient   { background: #0288d1; }
.fert-type-tag.bio-agent  { background: #388e3c; }
.fert-type-tag.organic    { background: #795548; }

.fert-detail { font-size: .78rem; color: var(--text-mid); line-height: 1.5; }
.fert-detail strong { color: var(--green-dark); }
.fert-purpose { font-size: .76rem; color: var(--text-light); margin-top: 6px; font-style: italic; }

/* Treatment list */
.treatment-list { list-style: none; display: flex; flex-direction: column; gap: 10px; padding: 0; }
.treatment-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: .87rem;
  color: var(--text-mid);
  line-height: 1.5;
}
.treatment-list li .step-num {
  min-width: 26px; height: 26px;
  background: var(--green-mid);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800;
  flex-shrink: 0;
}

/* Prevention list */
.prevention-list { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; }
.prevention-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .87rem;
  color: var(--text-mid);
  line-height: 1.5;
}
.prevention-list li::before {
  content: "✅";
  font-size: .85rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Re-analyze button */
.btn-reanalyze {
  background: none;
  border: 2px solid var(--green-mid);
  color: var(--green-mid);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  align-self: flex-start;
}
.btn-reanalyze:hover { background: var(--green-pale); }

/* Hidden utility */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .disease-layout { grid-template-columns: 1fr; }
  .disease-main { padding: 28px 16px 40px; }
  .fert-grid { grid-template-columns: 1fr; }
}
