/*
 * Manufacturing order type (templates/cart-mfg.html.twig): React
 * ManufacturingWorkspace.js (package rows are read-only history), MoveLocationForm's
 * location tiles and ManufacturingComplete.js. Colors and sizes come from
 * their sx props, themes/darkPanel.js (DARK) and the theme overrides.
 */

/* Drawer paper while a manufacturing cart is shown. */
.drawer--cart .drawer__paper.cart-paper.cart-paper--mfg { background: #1a2332; }

:where(.mfg) p { margin: 0; }
.mfg-camera-host { margin-bottom: 16px; }

/* ---------- Outlined fields ---------- */

.mf--gap16 { margin-bottom: 16px; }

/* fieldSx / selectSx (orange focus) on the light theme's OutlinedInput and InputLabel. */
.mfg-field:not(.mfg-field--dark) .mf__root { background-color: transparent; }
.mfg-field:not(.mfg-field--dark) .mf__input { color: white; }
.mfg-field:not(.mfg-field--dark) .mf__input::placeholder { color: #888; opacity: 0.42; }
.mfg-field:not(.mfg-field--dark) .mf__label { color: #888; }
.mfg-field:not(.mfg-field--dark):focus-within .mf__label { color: #ff9800; }
.mfg-field:not(.mfg-field--dark):focus-within .mf__label,
.mfg-field:not(.mfg-field--dark).is-filled .mf__label { background: #ffffff; }
.mfg-field:not(.mfg-field--dark) .mf__outline { border-color: #555; }
.mfg-field:not(.mfg-field--dark) .mf__root:hover .mf__outline { border-color: #ff9800; }
.mfg-field:not(.mfg-field--dark):focus-within .mf__root { box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2); }
.mfg-field:not(.mfg-field--dark):focus-within .mf__outline { border: 1px solid #ff9800; }

/* ---------- Package-history indicator ---------- */

.mfg-binding {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 12px;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background-color: #2a2a2a;
}
.mfg-binding[hidden] { display: none; }
.mfg-binding[data-status="found"] { background-color: #1e3a2a; }
.mfg-binding[data-status="offline"] { border-color: #6a2e2e; background-color: #3a1e1e; }
.mfg-binding__spinner { flex-shrink: 0; width: 14px; height: 14px; color: #ff9800; }
.mfg-binding[data-status="offline"] .mfg-binding__spinner { color: #f44336; }
.mfg-binding__spinner[hidden], .mfg-binding__check[hidden] { display: none; }
.mfg-binding__check { flex-shrink: 0; width: 16px; height: 16px; color: #4caf50; }
.mfg-binding__text { color: #ccc; font-size: 0.8rem; line-height: 1.57; }
.mfg-binding[data-status="found"] .mfg-binding__text { color: #4caf50; }
.mfg-binding[data-status="none"] .mfg-binding__text { color: #999; }
.mfg-binding[data-status="offline"] .mfg-binding__text { color: #f44336; }

/* ---------- Search and results ---------- */

.mfg-search { position: relative; margin-bottom: 16px; }
.mfg-results {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  z-index: 1000;
  max-height: 300px;
  margin-top: 4px;
  overflow-y: auto;
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #2a2a2a;
  box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12);
}
.mfg-results[hidden] { display: none; }
.mfg-result {
  padding: 8px 16px;
  border-bottom: 1px solid #3a3a3a;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mfg-result:hover { background-color: #3a3a3a; }
.mfg-result__name { color: white; font-size: 0.9rem; line-height: 1.57; }
.mfg-result__line { display: block; color: #ff9800; font-size: 0.75rem; line-height: 1.57; }
.mfg-result__line--meta { color: #999; }

/* ---------- Scanned package: move-location tiles ---------- */

.mfg-scanned { margin-bottom: 16px; }
.mfg-scanned[hidden] { display: none; }
.mfg-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mfg-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  min-width: 0;
  height: 56px;
  padding: 6px 4px;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  background-color: #1f1f1f;
  color: #ffffff;
  font-family: var(--mui-font);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.75;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mfg-tile .icon { width: 22px; height: 22px; color: #32beb9; }
.mfg-tile .icon[hidden], .mfg-tile .cart-progress[hidden] { display: none; }
.mfg-tile .cart-progress { width: 20px; height: 20px; color: #32beb9; }
.mfg-tile:hover { border-color: #32beb9; background-color: #2b2b2b; }
.mfg-tile:active { background-color: #32beb9; color: #0b0b0b; }
.mfg-tile:active .icon { color: #0b0b0b; }
.mfg-tile.is-current, .mfg-tile.is-current:hover, .mfg-tile.is-current:active { border-color: #32beb9; background-color: #32beb9; color: #0b0b0b; }
.mfg-tile.is-current .icon { color: #0b0b0b; }
.mfg-tile.is-inert { cursor: default; }
.mfg-tile.is-dim { opacity: 0.55; }
.mfg-tile__name {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.55rem;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mfg-tile.is-current .mfg-tile__name { font-weight: 700; }
.mfg-tiles__empty { color: #9aa0a0; font-size: 0.85rem; line-height: 1.57; }
.mfg-move__toggle {
  display: flex;
  align-items: center;
  color: #9aa0a0;
  font-size: 0.85rem;
  line-height: 1.57;
  cursor: pointer;
  user-select: none;
}
.mfg-move__toggle.is-open { margin-bottom: 12px; }
.mfg-move__toggle .icon { width: 20px; height: 20px; margin-right: 4px; transition: transform 0.2s; }
.mfg-move__toggle.is-open .icon { transform: rotate(180deg); }
.mfg-move__details[hidden] { display: none; }

/* ---------- Package rows ---------- */

.mfg-package {
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background-color: #2a2a2a;
}
.mfg-package__head { display: flex; align-items: center; padding: 10px 12px; }
.mfg-package__text { flex: 1; min-width: 0; }
.mfg-package__name {
  overflow: hidden;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.57;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mfg-package__meta { color: #999; font-size: 0.7rem; line-height: 1.57; }
.mfg-package__location { display: flex; align-items: center; gap: 3px; color: #9aa0a0; font-size: 0.7rem; line-height: 1.57; }
.mfg-package__location.is-missing { color: #b0883a; }
.mfg-package__location .icon { width: 12px; height: 12px; }
.mfg-package__body { padding: 0 12px 12px; }

/* MUI Chip, size small, theme radius 4. */
.mfg-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
  font-family: var(--mui-font);
  white-space: nowrap;
}
.mfg-chip[hidden] { display: none; }
.mfg-chip--count { height: 24px; margin-right: 4px; background-color: #1e3a2a; color: #4caf50; font-size: 0.8125rem; }
.mfg-chip--count .icon { width: 14px; height: 14px; margin-right: -4px; margin-left: 4px; color: #4caf50; }
.mfg-chip--count span { padding: 0 6px; }
.mfg-chip--status { height: 20px; padding: 0 6px; font-size: 0.65rem; }

/* Action history */
.mfg-actions { margin-bottom: 12px; }
.mfg-actions[hidden] { display: none; }
.mfg-action {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  background-color: #1a1a2e;
}
.mfg-action__icon { display: flex; }
.mfg-action__icon .icon { width: 16px; height: 16px; }
.mfg-action__text { flex: 1; min-width: 0; }
.mfg-action__label { color: white; font-size: 0.8rem; font-weight: 700; line-height: 1.57; }
.mfg-action__summary, .mfg-action__time, .mfg-action__error {
  overflow: hidden;
  color: #999;
  font-size: 0.7rem;
  line-height: 1.57;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mfg-action__error { color: #f44336; font-size: 0.65rem; }
.mfg-action__error[hidden] { display: none; }

/* MUI IconButton, size small (theme: 30px, radius 4). */
.mfg-pager__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mfg-pager__button:hover:not(:disabled) { background-color: rgba(0, 0, 0, 0.04); }
.mfg-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }
.mfg-pager[hidden] { display: none; }
.mfg-pager__button { color: #9aa0a0; }
.mfg-pager__button:disabled { color: #444; cursor: default; }
.mfg-pager__button .icon { width: 20px; height: 20px; }
.mfg-pager__label { color: #9aa0a0; font-size: 0.75rem; line-height: 1.57; }

/* ---------- ManufacturingComplete ---------- */

.mfg-complete { padding: 20px 0; text-align: center; }
.mfg-complete[hidden] { display: none; }
.mfg-complete__icon { width: 64px; height: 64px; margin-bottom: 16px; color: #4caf50; }
.mfg-complete__title { margin: 0 0 8px; color: white; font-size: 1rem; font-weight: 600; line-height: 1.5; }
.mfg-complete__sub { margin-bottom: 24px; color: #999; font-size: 0.875rem; line-height: 1.57; }
.mfg-complete__outputs { margin-bottom: 24px; padding: 16px; border-radius: 8px; background-color: #2a2a2a; text-align: left; }
.mfg-complete__outputs[hidden] { display: none; }
.mfg-complete__outputs-title { margin-bottom: 8px; color: #32beb9; font-size: 0.9rem; font-weight: 700; line-height: 1.57; }
.mfg-complete__output { margin-bottom: 6px; color: white; font-size: 0.85rem; line-height: 1.57; }
.mfg-complete__output:last-child { margin-bottom: 0; }
.mfg-complete__button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 64px;
  padding: 12px 16px;
  border: 0;
  border-radius: 4px;
  background-color: #32beb9;
  color: #fff;
  font-family: var(--mui-font);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.75;
  text-transform: capitalize;
  cursor: pointer;
}
.mfg-complete__button:hover { background-color: #2aa5a0; }
