/* =============================================================================
 * Zone Populate Sheet — shown after creating a new zone so Colton can
 * immediately add plants and seed batches without any wizard steps.
 * Consumes only --v2-* tokens per CLAUDE.md Canopy v2 hard rule #1.
 * ============================================================================= */

/* The sheet uses the existing .modal-overlay + .modal-sheet skeleton from
   style.css. Only zone-populate-specific elements are defined here. */

/* Full-height bottom sheet like the other modals — fills most of viewport
   so long plant lists are usable without inner scroll-trap. */
#zone-populate-overlay .modal-sheet {
  max-height: 92vh;
  height: 92vh;
  display: flex;
  flex-direction: column;
}
#zone-populate-overlay .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--v2-space-md) calc(var(--v2-space-xl) + env(safe-area-inset-bottom, 0));
  overscroll-behavior: contain;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.zone-populate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--v2-space-md) var(--v2-space-md) var(--v2-space-sm);
  position: sticky;
  top: 0;
  background: var(--v2-bg-panel);
  z-index: 1;
}

.zone-populate-title {
  font-family: var(--v2-font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--v2-text-primary);
  margin: 0;
}

.zone-populate-done {
  min-height: var(--v2-space-touch);
  padding: 0 var(--v2-space-md);
  background: transparent;
  color: var(--v2-accent-botanical-dark);
  border: 0;
  font-family: var(--v2-font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Sections ────────────────────────────────────────────────────────────── */

.zone-populate-section {
  margin-bottom: var(--v2-space-lg);
}

.zone-populate-section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--v2-text-stone);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--v2-space-sm);
  padding-top: var(--v2-space-sm);
}

.zone-populate-empty {
  font-size: 13px;
  color: var(--v2-text-tertiary);
  text-align: center;
  padding: var(--v2-space-lg) 0;
  margin: 0;
}

/* ── Plant species section ───────────────────────────────────────────────── */

.zone-populate-search {
  width: 100%;
  min-height: var(--v2-space-touch);
  padding: 0 var(--v2-space-md);
  background: var(--v2-bg-secondary);
  border: 1px solid var(--v2-border-soft);
  border-radius: var(--v2-radius-sm);
  font-family: var(--v2-font-body);
  font-size: 14px;
  color: var(--v2-text-primary);
  box-sizing: border-box;
  margin-bottom: var(--v2-space-sm);
}
.zone-populate-search:focus {
  outline: 2px solid var(--v2-accent-botanical);
  outline-offset: 2px;
  border-color: var(--v2-accent-botanical);
}

/* Secondary CTA under the search input — opens the new-plant form prefilled
   with this zone, so a plant that isn't in the catalog yet can be created
   and placed in one motion. (Cairn idea #425.) */
.zone-populate-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: var(--v2-space-touch);
  margin-bottom: var(--v2-space-sm);
  padding: 0 var(--v2-space-md);
  background: transparent;
  border: 1px dashed var(--v2-border-soft);
  border-radius: var(--v2-radius-sm);
  font-family: var(--v2-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--v2-accent-botanical-dark);
  cursor: pointer;
}
.zone-populate-create:active {
  background: var(--v2-bg-secondary);
}
.zone-populate-create svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.zone-populate-plant-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* #436 — bounded height gives the list its own scroll context so search
     matches stay visible without the user having to scroll the outer
     sheet body past the seed-batches section underneath. */
  max-height: 42vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.zone-populate-plant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--v2-space-sm);
  min-height: var(--v2-space-touch);
  padding: var(--v2-space-xs) var(--v2-space-md);
  background: var(--v2-bg-card);
  border-radius: var(--v2-radius-sm);
  border: 1px solid var(--v2-border-soft);
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}
.zone-populate-plant-row:active {
  background: var(--v2-bg-card-hover);
}
.zone-populate-plant-row.added,
.zone-populate-plant-row[disabled] {
  background: var(--v2-bg-secondary);
  opacity: 0.65;
  cursor: default;
}
.zone-populate-plant-chev {
  flex-shrink: 0;
  color: var(--v2-text-tertiary);
}

/* Count badge — appears to the right of a plant name when the plant is
   already in this zone. Tap of the row opens the count picker in edit mode. */
.zone-populate-count-badge {
  flex-shrink: 0;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--v2-accent-botanical);
  color: var(--v2-text-on-dark);
  font-family: var(--v2-font-display);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-feature-settings: 'tnum';
}
.zone-populate-plant-row.has-count {
  border-color: var(--v2-accent-botanical-light);
}

.zone-populate-plant-name {
  font-size: 14px;
  color: var(--v2-text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-populate-container-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.zone-populate-ct-btn {
  /* Tags-style chip: 24px height, 4px radius, 10px uppercase 500 — canonical per CLAUDE.md §Canopy v2 */
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-family: var(--v2-font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--v2-accent-botanical);
  background: transparent;
  color: var(--v2-accent-botanical-dark);
  cursor: pointer;
  white-space: nowrap;
}
.zone-populate-ct-btn:active {
  background: var(--v2-accent-botanical);
  color: var(--v2-text-on-dark);
}

.zone-populate-added-check {
  font-size: 11px;
  font-weight: 500;
  color: var(--v2-accent-botanical-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ── Seed batch section ──────────────────────────────────────────────────── */

#zone-populate-seed-list {
  display: flex;
  flex-direction: column;
  gap: var(--v2-space-sm);
}

.zone-populate-seed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--v2-space-md);
  min-height: var(--v2-space-touch);
  padding: var(--v2-space-sm) var(--v2-space-sm);
  background: var(--v2-bg-card);
  border-radius: var(--v2-radius-sm);
  border: 1px solid var(--v2-border-soft);
}

.zone-populate-seed-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.zone-populate-seed-name {
  font-size: 14px;
  color: var(--v2-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-populate-seed-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--v2-text-secondary);
}

.zone-populate-stage-chip {
  /* Tags-style chip (canonical variant) */
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--v2-bg-secondary);
  border: 1px solid var(--v2-border-soft);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--v2-text-stone);
}

.zone-populate-seed-controls {
  display: flex;
  align-items: center;
  gap: var(--v2-space-sm);
  flex-shrink: 0;
}

/* Tighten the stepper for seed rows (narrower than the full alloc-move sheet) */
.zone-populate-seed-controls .alloc-stepper-value {
  font-size: 16px;
  min-width: 28px;
}

.zone-populate-add-btn {
  /* Tags-style chip, filled — primary action per card */
  height: 32px;
  padding: 0 var(--v2-space-md);
  background: var(--v2-accent-botanical);
  color: var(--v2-text-on-dark);
  border: 0;
  border-radius: var(--v2-radius-sm);
  font-family: var(--v2-font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.zone-populate-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Inline container chips on plant row (#420) ─────────────────────────── */
/* When a plant already has rows in this zone, replace the single count badge
 * with one chip per container_type so the breakdown is always visible without
 * tapping. Each "edit" chip targets a specific zone_plant.id; the "+" chip
 * opens add-mode for a new container_type. Zero-row case keeps the original
 * chevron button. */

.zone-populate-plant-row.has-chips {
  /* Same visual frame as the button row, but rendered as a non-interactive
   * container — the chips inside carry the tap actions instead of the row. */
  cursor: default;
  border-color: var(--v2-accent-botanical-light);
  flex-wrap: wrap;
  row-gap: 6px;
}
.zone-populate-plant-row.has-chips:active {
  background: var(--v2-bg-card);
}

.zone-populate-chip-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--v2-chip-gap);
  flex-shrink: 0;
}

/* "+" chip — add another container type for this plant */
.po-chip--add {
  min-width: 28px;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  background: var(--v2-bg-secondary);
  color: var(--v2-text-secondary);
  border-style: dashed;
}
.po-chip--add:hover { background: var(--v2-bg-card-hover); }

/* ── Split-batch lineage badge (seed card) ───────────────────────────────── */

.seed-split-badge {
  font-size: 11px;
  color: var(--v2-text-stone);
  margin: 2px 0 4px;
  padding: 0;
}
