/* PlateEditor (SDK control refresh 7a).
 * Wells are WellPlate's (2b, 3a); this file owns the shell: tabs, toolbar, rail. */

.mint-plate-editor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

/* Focus lands on the root only when a disabled Undo/Redo hands it back; ringed for keyboard users. */
.mint-plate-editor:focus {
  outline: none;
}

.mint-plate-editor:focus-visible {
  box-shadow: var(--focus-ring);
}

/* Tab bar */
.mint-plate-editor__tabbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px 0 4px;
  border-bottom: 1px solid var(--border-color);
}

/* Underline tabs: slot dot + name + bare mono count; the item (tab + ×) carries the underline. */
.mint-plate-editor__tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
}

.mint-plate-editor__tab-item {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  padding-right: 4px;
}

.mint-plate-editor__tab-item--active {
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

.mint-plate-editor__tab {
  display: inline-flex;
  box-sizing: border-box;
  height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 6px 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--mint-transition);
}

.mint-plate-editor__tab:hover,
.mint-plate-editor__tab-item--active .mint-plate-editor__tab {
  color: var(--text-primary);
}

.mint-plate-editor__tab-item--active .mint-plate-editor__tab {
  font-weight: 600;
}

.mint-plate-editor__tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.mint-plate-editor__tab-count {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.mint-plate-editor__tab--dragging {
  opacity: 0.5;
}

.mint-plate-editor__tab--drag-over {
  box-shadow: inset 2px 0 0 var(--color-primary);
}

.mint-plate-editor__tab-close {
  display: grid;
  width: 18px;
  height: 18px;
  align-self: center;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--mint-transition), color var(--mint-transition);
}

.mint-plate-editor__tab-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mint-plate-editor__tab-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

.mint-plate-editor__tabbar-end,
.mint-plate-editor__toolbar-end {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

/* Slot colors: the R/G/B/Y rack positions (--mint-slot-*). */
.mint-plate-editor__slot-dot,
.mint-plate-editor__slot {
  --_slot: var(--mint-slot-r);
}

.mint-plate-editor__slot-dot--g,
.mint-plate-editor__slot--g {
  --_slot: var(--mint-slot-g);
}

.mint-plate-editor__slot-dot--b,
.mint-plate-editor__slot--b {
  --_slot: var(--mint-slot-b);
}

.mint-plate-editor__slot-dot--y,
.mint-plate-editor__slot--y {
  --_slot: var(--mint-slot-y);
}

.mint-plate-editor__slot-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--_slot);
}

/* Toolbar */
.mint-plate-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
}

.mint-plate-editor__field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mint-plate-editor__label {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* Well counts read as data. */
.mint-plate-editor__field--format .mint-segmented-control__label {
  font-family: var(--font-mono);
}

.mint-plate-editor__slots {
  display: inline-flex;
  gap: 2px;
}

/* Rack's slot buttons, kept as they were: tinted outline, filled when active. */
.mint-plate-editor__slot {
  display: grid;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--_slot) 25%, transparent);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--_slot);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--mint-transition), color var(--mint-transition), box-shadow var(--mint-transition);
}

.mint-plate-editor__slot--active {
  border-color: transparent;
  background: var(--_slot);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.mint-plate-editor__slot:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

/* Text actions: Import, Fill Series, Drag, Clear */
.mint-plate-editor__action {
  display: inline-flex;
  box-sizing: border-box;
  height: 28px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary-strong);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background-color var(--mint-transition), color var(--mint-transition), border-color var(--mint-transition);
}

.mint-plate-editor__action:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mint-plate-editor__action:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

/* Drag is a mode toggle: outlined while off, primary while on. */
.mint-plate-editor__action[data-action="drag"] {
  border-color: var(--border-color);
  background: var(--bg-card);
}

.mint-plate-editor__action:disabled {
  opacity: var(--mint-disabled-opacity);
  cursor: not-allowed;
}

.mint-plate-editor__action.mint-plate-editor__action--on {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--_ink-primary);
}

.mint-plate-editor__action--danger {
  color: var(--_ink-error);
}

.mint-plate-editor__action--danger:hover:not(:disabled) {
  background: var(--mint-error-bg);
  color: var(--_ink-error);
}

.mint-plate-editor__file {
  display: none;
}

/* Plate + footer, and the rail beside them when the editor is wide enough */
.mint-plate-editor__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.mint-plate-editor--rail .mint-plate-editor__body {
  grid-template-columns: minmax(0, 1fr) 232px;
}

.mint-plate-editor__main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  min-width: 0;
}

.mint-plate-editor__rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px;
  border-left: 1px solid var(--border-light);
  border-bottom-right-radius: calc(var(--radius-lg) - 1px);
  background: var(--bg-primary);
}

.mint-plate-editor__rail-title {
  padding: 0 6px 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.mint-plate-editor__rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mint-plate-editor__rail-row,
.mint-plate-editor__rail-add {
  display: flex;
  box-sizing: border-box;
  height: 30px;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  font-size: 0.8125rem;
}

.mint-plate-editor__rail-row {
  color: var(--text-primary);
}

/* Group: a color square; sample type: the 3a marker (shape, Q / i glyph). */
.mint-plate-editor__rail-swatch {
  display: grid;
  box-sizing: border-box;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  place-items: center;
  border-radius: var(--radius-sm);
}

.mint-plate-editor__rail-swatch--marker {
  width: 16px;
  height: 16px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
}

.mint-plate-editor__rail-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mint-plate-editor__rail-count {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.mint-plate-editor__rail-add {
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--mint-transition), color var(--mint-transition);
}

.mint-plate-editor__rail-add:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mint-plate-editor__rail-add:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Reserves the selection bar's height so the plate never jumps. */
.mint-plate-editor__footer {
  display: flex;
  min-height: 44px;
  align-items: center;
}

.mint-plate-editor__hint {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.mint-plate-editor__selection {
  display: inline-flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
}

.mint-plate-editor__mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.mint-plate-editor__divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
}

.mint-plate-editor__group {
  display: inline-flex;
  box-sizing: border-box;
  height: 28px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow var(--mint-transition);
}

.mint-plate-editor__group:hover {
  box-shadow: inset 0 0 0 1px var(--border-color);
}

.mint-plate-editor__group:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

.mint-plate-editor__group-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.mint-plate-editor__icon-action {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--mint-transition), color var(--mint-transition);
}

.mint-plate-editor__icon-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mint-plate-editor__icon-action:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

.mint-plate-editor__icon-action--danger,
.mint-plate-editor__icon-action--danger:hover {
  color: var(--_ink-error);
}

.mint-plate-editor__icon-action--danger:hover {
  background: var(--mint-error-bg);
}
