/* ============================================================
   WMS PDA — Estilos
   ============================================================ */

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.15);
  --text: #e8eaf0;
  --text2: #8b91a8;
  --text3: #5a6080;
  --accent: #4f7fff;
  --accent2: #3a6aff;
  --green: #22c97a;
  --yellow: #f5c842;
  --red: #f54242;
  --purple: #a259ff;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  margin: 0;
}

.device {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header .back-btn {
  width: 36px; height: 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--text2);
  flex-shrink: 0;
}
.header .back-btn:active { opacity: 0.6; }
.header-title { flex: 1; }
.header-title h1 { font-size: 16px; font-weight: 600; color: var(--text); }
.header-title p  { font-size: 12px; color: var(--text2); margin-top: 1px; }
.header .badge {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.badge-green  { background: rgba(34,201,122,0.15);  color: var(--green); }
.badge-yellow { background: rgba(245,200,66,0.15);  color: var(--yellow); }
.badge-red    { background: rgba(245,66,66,0.15);   color: var(--red); }
.badge-blue   { background: rgba(79,127,255,0.15);  color: var(--accent); }

/* ── Content ─────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.content::-webkit-scrollbar { display: none; }
/* El menú principal ocupa toda la pantalla sin padding */
.content:has(#screen-menu.active) {
  padding: 0;
  gap: 0;
}
/* El mapa ocupa toda la pantalla sin padding y sin scroll propio */
.content:has(#screen-mapa.active) {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

/* ── Screens ─────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; width: 100%; gap: 12px; }
#screen-menu.active { gap: 0; flex: 1; }
#screen-mapa.active { gap: 0; flex: 1; overflow: hidden; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s, opacity 0.1s;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-success   { background: var(--green); color: #0a1f14; }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm { padding: 10px 14px; font-size: 13px; border-radius: var(--radius-sm); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Menu tiles (pantalla completa) ──────────────────────────── */
.menu-tile {
  background: var(--bg2);
  padding: 20px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
  min-height: 110px;
  transition: background 0.12s;
}
.menu-tile:active { background: var(--bg3); }
.menu-tile-icon  { font-size: 26px; line-height: 1; margin-bottom: 4px; }
.menu-tile-label { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.2; }
.menu-tile-sub   { font-size: 11px; color: var(--text3); line-height: 1.3; }
.menu-tile-danger:active { background: rgba(245,66,66,0.08); }

/* ── Menu grid antiguo (mantener compatibilidad) ─────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.menu-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.menu-item:active { background: var(--bg3); border-color: var(--accent); }
.menu-icon  { font-size: 24px; }
.menu-label { font-size: 14px; font-weight: 600; color: var(--text); }
.menu-sub   { font-size: 11px; color: var(--text3); }

/* ── List items ──────────────────────────────────────────────── */
.list-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s;
}
.list-item:active { border-color: var(--accent); }
.list-item.selected { border-color: var(--accent); background: rgba(79,127,255,0.08); }
.list-item .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }
.list-content { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; }
.list-sub   { font-size: 12px; color: var(--text2); margin-top: 2px; }
.list-right { text-align: right; flex-shrink: 0; }
.list-qty   { font-size: 16px; font-weight: 700; color: var(--accent); }
.list-unit  { font-size: 11px; color: var(--text3); }

/* ── Scanner result ──────────────────────────────────────────── */
.scanner-result {
  background: var(--bg3);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* ── Inputs ──────────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 12px; color: var(--text2); font-weight: 500; }
.input-field {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  width: 100%;
  text-align: center;
  font-weight: 700;
  outline: none;
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { font-weight: 400; color: var(--text3); }

/* ── Stepper ─────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.stepper-btn {
  width: 52px; height: 52px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 22px;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
}
.stepper-btn:active { background: rgba(79,127,255,0.1); }
.stepper-val {
  flex: 1;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  /* cuando es input */
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  font-family: var(--font);
  width: 100%;
  min-width: 0;
}
/* Ocultar flechas nativas del input number */
.stepper-val::-webkit-outer-spin-button,
.stepper-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-val[type=number] { -moz-appearance: textfield; }

/* ── Progress bar ────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s;
}

/* ── Stats ───────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.stat-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
.stat-val   { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── Step indicator ──────────────────────────────────────────── */
.step-indicator { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.step-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.step-dot.done    { background: var(--green);  color: #0a1f14; }
.step-dot.active  { background: var(--accent);  color: #fff; }
.step-dot.pending { background: var(--bg3); color: var(--text3); border: 1px solid var(--border2); }
.step-line { flex: 1; height: 1px; background: var(--border2); }

/* ── Map grid ────────────────────────────────────────────────── */
.map-grid { display: grid; gap: 4px; }
.map-cell {
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}
.map-cell:active { transform: scale(0.93); }
.cell-empty      { background: var(--bg3); color: var(--text3); }
.cell-stock-high { background: rgba(34,201,122,0.2);  color: var(--green);  border: 1px solid rgba(34,201,122,0.5); }
.cell-stock-mid  { background: rgba(245,200,66,0.2);  color: var(--yellow); border: 1px solid rgba(245,200,66,0.5); }
.cell-stock-low  { background: rgba(245,66,66,0.2);   color: var(--red);    border: 1px solid rgba(245,66,66,0.5); }
.cell-pick       { background: rgba(79,127,255,0.2);  color: var(--accent); border: 1px solid rgba(79,127,255,0.5); }
.cell-selected   { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
/* compatibilidad con código antiguo */
.cell-stock      { background: rgba(34,201,122,0.15); color: var(--green);  border: 1px solid rgba(34,201,122,0.3); }

/* ── Confirm box ─────────────────────────────────────────────── */
.confirm-box {
  background: var(--bg2);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.confirm-icon  { font-size: 40px; margin-bottom: 8px; }
.confirm-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.confirm-sub   { font-size: 13px; color: var(--text2); }

/* ── Tags ────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.tag-green  { background: rgba(34,201,122,0.15); color: var(--green); }
.tag-yellow { background: rgba(245,200,66,0.15); color: var(--yellow); }
.tag-red    { background: rgba(245,66,66,0.15);  color: var(--red); }
.tag-blue   { background: rgba(79,127,255,0.15); color: var(--accent); }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
}
.alert-warning { background: rgba(245,200,66,0.1);  border: 1px solid rgba(245,200,66,0.3); color: var(--yellow); }
.alert-error   { background: rgba(245,66,66,0.1);   border: 1px solid rgba(245,66,66,0.3);  color: var(--red); }
.alert-success { background: rgba(34,201,122,0.1);  border: 1px solid rgba(34,201,122,0.3); color: var(--green); }

/* ── User bar ────────────────────────────────────────────────── */
.user-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(79,127,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

/* ── Inventario ──────────────────────────────────────────────── */
.inv-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.inv-tab {
  padding: 10px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--border);
}
.inv-tab:last-child { border-right: none; }
.inv-tab.active { background: var(--accent); color: #fff; }
.inv-tab:not(.active):active { background: var(--bg3); }

.inv-filtros {
  display: flex;
  gap: 8px;
}
.inv-filtros input,
.inv-filtros select {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.inv-filtros input:focus,
.inv-filtros select:focus { border-color: var(--accent); }
.inv-filtros input::placeholder { color: var(--text3); }

.inv-resumen {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text2);
}
.inv-resumen strong { color: var(--text); font-weight: 700; }

.inv-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.12s;
}
.inv-item:active { border-color: var(--accent); }
.inv-item-bajo { border-color: rgba(245,66,66,0.4); }
.inv-item-main { flex: 1; min-width: 0; }
.inv-item-desc { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-item-ref  { font-size: 11px; color: var(--text2); margin-top: 2px; }
.inv-item-nums { text-align: right; flex-shrink: 0; }
.inv-num       { font-size: 18px; font-weight: 700; line-height: 1.2; }
.inv-num-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
.inv-badge-bajo {
  font-size: 10px; font-weight: 700;
  color: var(--red);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.dot-empty { background: var(--bg3); border: 1px solid var(--border2); }

