/* ==========================================================================
   MZ-WMS — SCANNER / HANDHELD stylesheet
   Loaded ONLY for scanner users (userright 4), AFTER theme.css, so it can
   freely override the desktop layout for a ~360px handheld without ever
   affecting the desktop UI. Mobile-first: full width, big tap targets,
   no sideways scrolling (wide tables become stacked cards).
   ========================================================================== */

body.scanner { font-size: 15px; }
body.scanner #content-wrap { padding: 6px 8px 18px; }
body.scanner .container,
body.scanner .container-fluid { padding-left: 8px; padding-right: 8px; }

/* every desktop wrapper becomes a full-width lean card on the handheld */
body.scanner .contmin,
body.scanner .contwide,
body.scanner .card-surface,
body.scanner .well {
  max-width: 100%;
  margin: 6px 0;
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* compact headings */
body.scanner .headerline { font-size: 1.05rem; margin: 2px 0 10px; padding-bottom: 6px; }
body.scanner h1 { font-size: 1.25rem; }
body.scanner h2 { font-size: 1.15rem; }
body.scanner h3 { font-size: 1.05rem; }

/* thumb-friendly controls; 16px input font prevents mobile auto-zoom */
body.scanner .form-control { min-height: 46px; font-size: 16px; padding: 10px 12px; }
body.scanner .input-lg { min-height: 52px; }
body.scanner .form-group { margin-bottom: 12px; }
body.scanner .btn { padding: 11px 16px; }
body.scanner .btn-lg { padding: 14px 18px; font-size: 1.05rem; }
body.scanner .sc-data { font-size: 1.1rem; }
body.scanner .alert { padding: 10px 12px; }

/* scanner home top bar + menu grid */
body.scanner .scan-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
body.scanner .scan-brand { color: var(--brand); font-size: 1.2rem; line-height: 1; }
body.scanner .scan-user { color: var(--ink-soft); font-size: .9rem; }
body.scanner .scan-topbar > a:last-child { margin-left: auto; }
body.scanner .scan-grid { margin: 0 -4px; }
body.scanner .scan-grid > [class^="col-"] { padding: 0 4px; }
body.scanner .scannerbutton { min-height: 92px; padding: 10px 6px; margin-bottom: 8px; }
body.scanner .scannerbutton img { max-height: 38px; }
body.scanner .scannerbutton small { font-size: 11px; line-height: 1.2; }

/* --------------------------------------------------------------------------
   Stacked tables — one card per row (label: value), so the user NEVER scrolls
   sideways. The .stacktable class + data-label attrs are added by the JS in
   index.php for scanner users. (Not media-gated: this file = scanner only.)
   -------------------------------------------------------------------------- */
body.scanner table.stacktable { width: 100%; }
body.scanner table.stacktable thead { display: none; }
body.scanner table.stacktable,
body.scanner table.stacktable tbody { display: block; width: 100%; }
body.scanner table.stacktable tr {
  display: block; width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 7px;
  padding: 1px 10px;
}
body.scanner table.stacktable > tbody > tr > td {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  width: 100%;
  text-align: right;
  padding: 4px 0 !important;
  line-height: 1.3;
  border: 0 !important;
  border-top: 1px solid var(--line-soft) !important;
  white-space: normal;
  word-break: break-word;
}
body.scanner table.stacktable > tbody > tr > td:first-child {
  border-top: 0 !important; font-weight: 600;
}
body.scanner table.stacktable > tbody > tr > td::before {
  content: attr(data-label);
  flex: 0 0 40%;
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .03em;
  padding-top: 2px;
}
/* cells with no header label (e.g. the delete-button column) */
body.scanner table.stacktable > tbody > tr > td:not([data-label]) { justify-content: flex-end; }
body.scanner table.stacktable > tbody > tr > td:not([data-label])::before { content: none; }
/* hide truly empty cells (e.g. a blank To Bin) to keep cards compact */
body.scanner table.stacktable > tbody > tr > td.stack-empty { display: none; }

/* status colours (Bootstrap .danger/.success/.warning/.info on a <tr>): in a
   stacked card a full red/green fill looks patchy against the card border, so
   use a clean coloured LEFT-accent stripe + a very light tint instead, and stop
   the cells carrying their own heavier fill. */
body.scanner table.stacktable > tbody > tr {
  border-left: 4px solid var(--line);
}
body.scanner table.stacktable > tbody > tr > td { background: transparent !important; }
body.scanner table.stacktable > tbody > tr.danger  { background: #fef2f2 !important; border-left-color: var(--danger); }
body.scanner table.stacktable > tbody > tr.success { background: #f0fdf4 !important; border-left-color: var(--success); }
body.scanner table.stacktable > tbody > tr.warning { background: #fffbeb !important; border-left-color: var(--warning); }
body.scanner table.stacktable > tbody > tr.info    { background: #eff6ff !important; border-left-color: var(--info); }

/* long values (e.g. item names) use the FULL card width: label on top,
   value below, left-aligned — instead of cramming into a narrow right column */
body.scanner table.stacktable > tbody > tr > td.stack-wide {
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 1px;
}
body.scanner table.stacktable > tbody > tr > td.stack-wide::before { flex: none; }
body.scanner table.stacktable > tbody > tr > td.stack-wide { font-weight: 500; }
