/* ─────────────────────────────────────────────────────────────────────────────
   css/fertiliser.css  |  pH Lens  |  aSpace
   Depends on css/style.css for --green, --brown, --gold, --sky, --muted,
   --bg, --surface, --border, --radius, --text-dark, --text-body, --font
───────────────────────────────────────────────────────────────────────────── */

/* ── Section wrapper ─────────────────────────────────────────────────────── */
.fert-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px 20px;
  margin-bottom: 20px;
}

/* ── Header row ──────────────────────────────────────────────────────────── */
.fert-section-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 4px;
}
.fert-section-title {
  font-size: 1rem; font-weight: 700;
  color: var(--text-dark);
}
.fert-section-sub {
  font-size: .78rem; color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.55;
}

/* ── Years selector ──────────────────────────────────────────────────────── */
.years-row {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; color: var(--muted);
  flex-wrap: wrap;
}
.years-select {
  font-size: .78rem; font-weight: 600;
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text-dark);
  cursor: pointer;
}
.years-select:focus { outline: 2px solid var(--green); outline-offset: 1px; }

/* ── 3-slot grid ─────────────────────────────────────────────────────────── */
.fert-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 700px) {
  .fert-slots { grid-template-columns: 1fr; }
}

/* ── Individual slot ─────────────────────────────────────────────────────── */
.fert-slot {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 12px 10px;
  transition: border-color .2s;
}
.fert-slot:focus-within { border-color: var(--brown); }

.fert-slot-label {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--brown);
  margin-bottom: 7px;
}

/* ── Shared select styles ────────────────────────────────────────────────── */
.fert-select,
.liming-select {
  width: 100%; font-size: .78rem;
  padding: 7px 28px 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--text-dark);
  cursor: pointer;
  margin-bottom: 9px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23808080' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.fert-select:focus,
.liming-select:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.fert-select option:disabled { color: #ccc; }

/* ── Rate row inside each slot ───────────────────────────────────────────── */
.fert-rate-wrap {
  display: flex; align-items: center; gap: 6px;
}
.fert-rate-label {
  font-size: .7rem; color: var(--muted);
  white-space: nowrap; flex: 1;
}
.fert-rate-input,
.liming-rate-input {
  font-size: .8rem; font-weight: 600;
  padding: 5px 7px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text-dark);
  text-align: right;
  width: 78px;
  transition: border-color .2s;
}
.fert-rate-input:focus,
.liming-rate-input:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.fert-rate-input:disabled,
.liming-rate-input:disabled { opacity: .4; cursor: not-allowed; }

/* ── Liming row ──────────────────────────────────────────────────────────── */
.liming-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: #f0fdf5;
  border: 1px solid rgba(32, 215, 96, .3);
  border-radius: 8px;
  margin-bottom: 16px;
}
.liming-label {
  font-size: .78rem; font-weight: 700;
  color: var(--green); white-space: nowrap;
}
.liming-select { flex: 1; min-width: 150px; margin-bottom: 0; }
.liming-note {
  font-size: .7rem; color: var(--muted);
  width: 100%; margin-top: 2px;
  line-height: 1.4;
}

/* ── Projected marker ────────────────────────────────────────────────────── */
.proj-marker {
  position: absolute;
  top: 6px;
  width: 22px; height: 22px;
  background: var(--gold);
  border: 3px solid #7a5200;
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  transition: left .45s cubic-bezier(.22,.61,.36,1);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: .52rem; font-weight: 800;
  color: #7a5200;
}
.proj-marker::after { content: 'P'; }

.proj-line {
  position: absolute;
  top: 14px; height: 4px;
  background: rgba(218,165,32,.3);
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
  transition: left .45s cubic-bezier(.22,.61,.36,1),
              width .45s cubic-bezier(.22,.61,.36,1);
}

/* ── Projected badge ─────────────────────────────────────────────────────── */
.proj-badge {
  font-size: .8rem; font-weight: 600;
  letter-spacing: -.01em;
  min-height: 18px;
  transition: color .3s;
}

/* ── Insight card ────────────────────────────────────────────────────────── */
.fert-insight {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.fi-empty, .fi-loading {
  font-size: .8rem; color: var(--muted);
  font-style: italic; margin: 0;
}

.fi-summary {
  font-size: .84rem; color: var(--text-body);
  line-height: 1.7; margin-bottom: 14px;
}

/* Breakdown table */
.fi-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-bottom: 12px;
}
.fi-row {
  display: flex; align-items: baseline;
  gap: 8px; padding: 5px 0;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.fi-row--lime {
  background: #f0fdf5;
  border-radius: 4px;
  padding: 6px 8px;
  border-bottom: none;
  margin-top: 4px;
}
.fi-label  { flex: 1; font-size: .77rem; color: var(--text-dark); font-weight: 500; min-width: 100px; }
.fi-rate   { font-size: .71rem; color: var(--muted); white-space: nowrap; }
.fi-acid   { font-size: .74rem; font-weight: 600; white-space: nowrap; }
.fi-nv     { font-size: .67rem; color: var(--muted); font-weight: 400; margin-left: 3px; }
.fi-total  {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; color: var(--text-dark);
  padding: 8px 0 2px;
}

/* Stats row */
.fi-stats { display: flex; flex-direction: column; gap: 0; }
.fi-stat  {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .77rem; color: var(--text-body);
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.fi-stat strong { color: var(--text-dark); }

@media (max-width: 480px) {
  .fert-section { padding: 16px 14px 14px; }
  .liming-row   { flex-direction: column; align-items: flex-start; gap: 8px; }
  .liming-select { width: 100%; }
}
