* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000000;
  --card: #141414;
  --block: #1c1c1c;
  --input-bg: #101010;
  --border: #2c2c2c;
  --accent: #075584;
  --accent-light: #1284c7;
  --accent-text: #4fc3f7;
  --text-primary: #f5f5f5;
  --text-muted: #9a9a9a;
  --danger: #c0524f;
}

html, body {
     height: auto;
     min-height: 100vh;
     overflow-y: auto;
   }

body {
  font-family: "Poppins";
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

main {
  width: 100%;
  max-width: 720px;
  margin: 0;
  padding: 24px 20px;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* ---------- Intro card ---------- */
.intro-card {
  color: white;
  width: 35rem;
  min-width: 80px;
  height: auto;
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 0.625rem;
  background: #151515;
  transition: transform 0.6s ease, box-shadow 0.6s ease;
  animation: riseUp 1s ease-out forwards;

}

@keyframes riseUp {
  from { opacity: 0; transform: translateY(50px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.intro-subtitle {
  font-family: "Poppins";
  font-size: 14px;
  line-height: 1.6;
  color: #FFFFFF;
  margin: 32px 0px 14px;
  width: 548px;
  height: 48px;
}

.intro-subtitle .hl {
  color: var(--accent-text);
  font-weight: 500;
}

/* ---------- Section cards ---------- */
.section-card {
  width: 35rem;
  min-width: 80px;
  background: rgb(21, 21, 21);
  border-radius: 0.625rem;
  overflow: hidden;
  display: none;
  transition: transform 0.6s, box-shadow 0.6s;
}

.section-card.active {
  display: block;
  animation: 1s ease-out 0s 1 normal forwards running riseUp;
}

#resultCard {
  width: 35rem;
  min-width: 80px;
}

.section-header {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 70%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.icon-badge svg {
  width: 15px;
  height: 15px;
}

.header-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  /* Forces the icon to render pure white regardless of its
     original color — needed since agriculture.png and seeds.png
     are black line-art on transparent backgrounds. */
  filter: brightness(0) invert(1);
}

.header-icon-color {
  width: 26px;
  height: 26px;
  object-fit: contain;
  /* Keeps the icon's original colors — do NOT apply the
     brightness/invert filter used on single-color icons above,
     it would flatten this multi-color illustration to white. */
}

.section-header .title {
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
}

.section-body {
  padding: 20px 22px 24px;
}

.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.select-wrap {
  position: relative;
}

.select-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  pointer-events: none;
}

select.styled-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 34px 11px 16px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

select.styled-select:focus {
  outline: none;
  border-color: var(--accent-light);
}

select.styled-select option:disabled {
  color: #6a6a6a;
}

.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 13px;
}

/* ---------- Text input (mobile number, etc.) ---------- */
.text-input {
  width: 100%;
  background-color: var(--input-bg) !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-primary) !important;
  transition: border-color 0.2s ease;
}

.text-input::placeholder {
  color: var(--text-muted);
}

.text-input:focus {
  outline: none;
  border-color: var(--accent-light);
}

.text-input:-webkit-autofill,
.text-input:-webkit-autofill:hover,
.text-input:-webkit-autofill:focus,
.text-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  caret-color: var(--text-primary);
  transition: background-color 5000s ease-in-out 0s;
}

/* ---------- Photo tips card ---------- */
.tips-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 22px;
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  border-bottom: 1px solid var(--border);
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.tips-list li {
  font-size: 11.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
}

.tips-list li:last-child {
  border-bottom: none;
}

.tips-list li svg {
  color: var(--accent-text);
  flex-shrink: 0;
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent-light);
  background: var(--block);
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--block);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  color: var(--text-muted);
}

.dropzone-text {
  font-size: 12px;
  font-weight: 400;
  margin-bottom: 3px;
}

.dropzone-subtext {
  font-size: 10.5px;
  color: var(--text-muted);
}

.preview-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.preview-wrap.active {
  display: flex;
}

.preview-img {
  max-width: 260px;
  max-height: 260px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- CTA button ---------- */
.cta-wrap {
  display: flex;
  justify-content: center;
  width: 35rem;
  min-width: 80px;
  margin-top: 4px;
}

.cta-btn {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 75%);
  border: none;
  border-radius: 8px;
  padding: 13px 0;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.cta-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.cta-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.cta-btn:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ---------- Result ---------- */
.loading-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 0;
}

.loading-wrap.active {
  display: flex;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent-light);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 13.5px;
  color: var(--text-muted);
}

.result-body {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.result-body.active {
  display: flex;
}

.result-img {
  width: 110px;
  height: 110px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.result-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 5px;
}

.result-class {
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

.confidence-track {
  width: 100%;
  max-width: 300px;
  height: 8px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 6px;
  transition: width 0.6s ease;
}

.confidence-value {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.result-meta {
  display: flex;
  gap: 22px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Remedy display ---------- */
.remedy-section {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
  text-align: center;
}

/* ---------- Compact overview header (replaces big gradient banner) ---------- */
.overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--accent-light);
}

.overview-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-badge-sm {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon-img-sm {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.overview-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.overview-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 75%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
  opacity: 0.88;
}

.icon-btn:active {
  transform: scale(0.93);
}

/* ---------- Diagnosis card ---------- */
.diagnosis-card {
  width: 100%;
  background: var(--block);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: left;
}

.diagnosis-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.diagnosis-category {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.severity-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}

.severity-badge.severity-high {
  background: rgba(192, 82, 79, 0.16);
  color: #e08b88;
}

.severity-badge.severity-moderate {
  background: rgba(224, 165, 48, 0.16);
  color: #e0a530;
}

.severity-badge.severity-low {
  background: rgba(76, 175, 109, 0.16);
  color: #6fd08c;
}

.diagnosis-name {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.diagnosis-scientific {
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.diagnosis-description {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-primary);
  padding-left: 14px;
  border-left: 2px solid var(--accent-light);
}

.diagnosis-description strong {
  color: var(--accent-text);
  font-weight: 600;
}

.diagnosis-card.is-healthy .diagnosis-description {
  border-left-color: #4caf6d;
}

.diagnosis-card.is-healthy .diagnosis-description strong {
  color: #6fd08c;
}

/* ---------- Remedies: header row + toggle (replaces stacked big boxes) ---------- */
.remedy-section {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.remedy-section.active {
  display: flex;
}

.remedy-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.remedy-header-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.remedy-header-label svg {
  color: var(--accent-text);
}

.remedy-toggle {
  display: flex;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.remedy-toggle-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.remedy-toggle-btn.active {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 75%);
  color: #ffffff;
}

.remedy-item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  text-align: left;
}

.remedy-item-list li {
  background: var(--block);
  border-radius: 14px;
  padding: 16px 20px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.remedy-item-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.remedy-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.remedy-item-header .bulb-icon {
  flex-shrink: 0;
}

.remedy-item-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-primary);
  padding-left: 14px;
  border-left: 2px solid var(--accent-light);
}

.remedy-item-list:empty::after {
  content: "No recommendation available.";
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 14px;
  display: block;
}

.remedy-generated {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

.error-box {
  display: none;
  background: #2a1414;
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 13.5px;
  color: #f0b4b2;
  text-align: center;
}

.error-box.active {
  display: block;
}

.retry-wrap {
  display: none;
  width: 35rem;
  min-width: 80px;
  margin-top: 20px;
}

.retry-wrap.active {
  display: block;
}

@media (max-width: 600px) {
  .intro-card, .section-card, .cta-wrap {
    width: 100%;
  }
  .section-body { padding: 18px 16px 20px; }
  .intro-card { padding: 1rem; }
}