/*
 * tray-bar.css — TrayBar (#798): the whole-tray bar on the Greenhouse list plus its sheets.
 * Mockup: docs/design/mockups/tray-bar-798.html. Tokens: --v2-* only.
 * Extends bulk-action-bar.css (selection state on rows, bar slide-in).
 */

/* ── Bar: count row, then one sideways-scrolling row of icon-over-label actions ── */

.bulk-action-bar.tray-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  /* Covers the tab bar and "+" (glass.css, z-index 100, later in the page) while
     picking, like the iOS selection toolbar; sheets stay above (modal base 1000). */
  z-index: 110;
}

.tray-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.tray-top .bulk-bar-count { flex: 1; }

.tray-hint-line {
  font: 500 0.75rem/1.3 var(--v2-font-body);
  color: var(--v2-text-secondary);
}

.tray-close {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--v2-text-secondary);
  -webkit-tap-highlight-color: transparent;
}

.tray-close span {
  width: 36px;
  height: 36px;
  border-radius: var(--v2-radius-full);
  background: var(--v2-bg-secondary);
  display: grid;
  place-items: center;
}

.tray-acts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tray-acts::-webkit-scrollbar { display: none; }

.tray-act {
  flex: 1 0 76px;
  min-height: 60px;
  padding: 6px 4px;
  border: 0;
  border-radius: 14px;
  background: var(--v2-bg-secondary);
  color: var(--v2-text-primary);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  font: 600 0.75rem/1 var(--v2-font-body);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--v2-transition-fast) var(--v2-ease-out);
}

.tray-act:active:not(:disabled) { transform: scale(0.96); }
.tray-act:disabled { opacity: 0.38; }
.tray-act svg, .tray-close svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tray-act--heat svg { color: var(--v2-heat-warmth); }
.tray-act--harden svg { color: var(--v2-accent-botanical); }

/* ── Lot rows while picking ── */

#seed-grid.bulk-mode .plant-card-row { padding-left: 48px; min-height: 64px; }

.tray-heat-on {
  display: none;
  position: absolute;
  bottom: 4px;
  right: 8px;
  align-items: center;
  gap: 3px;
  font: 600 0.75rem/1 var(--v2-font-body);
  color: var(--v2-heat-warmth);
}

.tray-heat-on svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#seed-grid.bulk-mode .tray-heat-on { display: inline-flex; }

/* ── Sheet ── */

.tray-sheet svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.tray-body { display: grid; gap: 10px; padding: 0 16px 20px; align-content: start; }

.tray-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0 12px;
  border-bottom: 1px solid var(--v2-border-soft);
}

.tray-head > div { flex: 1; min-width: 0; }
.tray-head h3 { margin: 0; font: 700 1.1875rem/1.2 var(--v2-font-display); color: var(--v2-text-primary); }
.tray-sub { display: block; margin-top: 2px; font: 500 0.8125rem/1.35 var(--v2-font-body); color: var(--v2-text-secondary); }

.tray-x {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -6px -8px -6px 0;
  border: 0;
  background: none;
  color: var(--v2-text-secondary);
  display: grid;
  place-items: center;
}

.tray-list { display: grid; gap: 10px; }

.tray-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--v2-border-soft);
  border-radius: 14px;
  background: var(--v2-bg-card);
}

.tray-nm { font: 600 0.875rem/1.3 var(--v2-font-body); color: var(--v2-text-primary); overflow-wrap: anywhere; }
.tray-st { grid-column: 1; font: 500 0.75rem/1.3 var(--v2-font-body); color: var(--v2-text-secondary); }
.tray-st--heat { color: var(--v2-heat-warmth); }
.tray-row--skip { background: var(--v2-pop-ochre-bg); border-color: transparent; grid-template-columns: 1fr; }

.tray-why {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font: 600 0.75rem/1.35 var(--v2-font-body);
  color: var(--v2-pop-ochre);
}

/* Stepper: 44px buttons, number in the middle, "was N" under it */
.tray-step { display: flex; align-items: center; gap: 2px; grid-column: 2; grid-row: 1 / span 2; }

.tray-step button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--v2-radius-full);
  background: var(--v2-bg-secondary);
  color: var(--v2-text-primary);
  display: grid;
  place-items: center;
}

.tray-step button:disabled { opacity: 0.38; }
.tray-num { display: grid; justify-items: center; min-width: 44px; }

.tray-count {
  width: 52px;
  min-height: 32px;
  border: 0;
  background: none;
  text-align: center;
  font: 700 1.125rem/1 var(--v2-font-display);
  font-variant-numeric: tabular-nums;
  color: var(--v2-text-primary);
}

.tray-was { min-height: 14px; font: 500 0.6875rem/1.2 var(--v2-font-body); color: var(--v2-text-secondary); }

/* Result rows: colour plus an icon, never colour alone */
.tray-res { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; }
.tray-res--done { background: var(--v2-pop-sage-bg); }
.tray-res--skip { background: var(--v2-pop-ochre-bg); }
.tray-res--fail { background: var(--v2-pop-coral-bg); }
.tray-tx { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tray-rs { font: 500 0.8125rem/1.35 var(--v2-font-body); color: var(--v2-text-secondary); }
.tray-ic { flex: none; width: 24px; height: 24px; display: grid; place-items: center; margin-top: 1px; }
.tray-res--done .tray-ic { color: var(--v2-pop-sage); }
.tray-res--skip .tray-ic { color: var(--v2-pop-ochre); }
.tray-res--fail .tray-ic { color: var(--v2-pop-coral-text); }

.tray-retry {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--v2-pop-coral);
  background: var(--v2-bg-card);
  color: var(--v2-pop-coral-text);
  font: 700 0.875rem/1 var(--v2-font-body);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tray-retry:disabled { opacity: 0.38; }

/* Whole action failed */
.tray-banner { display: flex; gap: 10px; padding: 12px; border-radius: 14px; background: var(--v2-pop-coral-bg); color: var(--v2-pop-coral-text); }
.tray-banner b { display: block; font: 700 0.9375rem/1.3 var(--v2-font-body); }
.tray-banner span { display: block; margin-top: 2px; font: 500 0.8125rem/1.4 var(--v2-font-body); color: var(--v2-text-primary); }

/* Buttons */
.tray-prim {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--v2-accent-botanical);
  color: var(--v2-text-on-accent);
  font: 700 1rem/1 var(--v2-font-body);
}

.tray-prim--heat { background: var(--v2-heat-warmth); }
.tray-prim:disabled { opacity: 0.38; }

.tray-sec {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--v2-border-soft);
  background: var(--v2-bg-card);
  color: var(--v2-text-secondary);
  font: 600 0.9375rem/1 var(--v2-font-body);
}

.tray-hint { margin: 0; font: 500 0.75rem/1.45 var(--v2-font-body); color: var(--v2-text-secondary); }

/* Photo */
.tray-shot {
  height: 130px;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--v2-border-soft);
  background: linear-gradient(135deg, var(--v2-pop-sage-bg), var(--v2-bg-secondary));
  color: var(--v2-pop-sage);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  font: 600 0.875rem/1 var(--v2-font-body);
}

.tray-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tray-prow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 2px 12px 2px 2px;
  border: 1px solid var(--v2-border-soft);
  border-radius: 14px;
  background: var(--v2-bg-card);
}

.tray-prow .tray-nm { flex: 1; min-width: 0; }
.tray-chk { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; }
.tray-chk input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; }

.tray-chk i {
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border-radius: var(--v2-radius-full);
  border: 2px solid var(--v2-border-strong);
  display: grid;
  place-items: center;
}

.tray-chk i svg { width: 14px; height: 14px; stroke-width: 3; stroke: var(--v2-text-on-accent); display: none; }
.tray-chk input:checked + i { background: var(--v2-accent-botanical); border-color: var(--v2-accent-botanical); }
.tray-chk input:checked + i svg { display: block; }
.tray-chk input:focus-visible + i { outline: 2px solid var(--v2-accent-botanical); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .tray-act { transition: none; }
}
