/* ==========================================================================
   Reviewer · Sistema de Diseño Estándar de Categoría (Referente: Google Business Profile / Maps)
   Tokens base derivados de .impeccable/mocks/decision/canon.html y docs/06-BRIEF-DISENO-PWA-OPERADOR.md
   Tema claro obligatorio para máxima legibilidad bajo luz solar directa (contraste >= 4.5:1)
   ========================================================================== */

:root {
  --bg: #F8F9FA;
  --card: #FFFFFF;
  --ink: #202124;
  --mute: #5F6368;
  --blue: #1A73E8;
  --blue-hover: #1557B0;
  --blue-tint: #E8F0FE;
  --hair: #DADCE0;
  --ok: #137333;
  --ok-bg: #E6F4EA;
  --warn: #B06000;
  --warn-bg: #FEF7E0;
  --err: #C5221F;
  --err-bg: #FCE8E6;
  --radius-card: 8px;
  --radius-input: 4px;
  --radius-pill: 22px;
  --shadow-bar: 0 1px 3px rgba(0, 0, 0, 0.18);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-fab: 0 3px 6px rgba(0, 0, 0, 0.25);
  --shadow-sheet: 0 -4px 16px rgba(0, 0, 0, 0.18);
  --transition-fast: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* En escritorio el contenido se centra en una columna de ancho acotado (docs/06 sección 6) */
.app-shell {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 96px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. Barra Superior (Top App Bar)
   -------------------------------------------------------------------------- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  min-height: 56px;
  box-shadow: var(--shadow-bar);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.top-bar-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 48px;
  height: 48px;
  margin: -6px 0 -6px -8px;
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(32, 33, 36, 0.08);
  outline: none;
}

/* --------------------------------------------------------------------------
   2. Banner de Estado de Red / Cola de Sincronización
   -------------------------------------------------------------------------- */
.net-banner {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--hair);
}

.net-banner.synced {
  background: var(--ok-bg);
  color: var(--ok);
}

/* --------------------------------------------------------------------------
   3. Stepper Horizontal de 5 Pasos (canon.html)
   -------------------------------------------------------------------------- */
.stepper-wrap {
  background: var(--bg);
  padding: 14px 20px 6px;
  border-bottom: 1px solid var(--hair);
}

.stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stepper-node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hair);
  color: #3C4043;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.stepper-node.active {
  background: var(--blue);
  color: #FFFFFF;
}

.stepper-node.done {
  background: var(--ok-bg);
  color: var(--ok);
  cursor: pointer;
}

.stepper-line {
  flex: 1;
  height: 2px;
  background: var(--hair);
  margin: 0 6px;
}

.stepper-line.done {
  background: var(--ok);
}

.stepper-caption {
  text-align: center;
  font-size: 13px;
  color: var(--mute);
  padding: 8px 0 4px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   4. Superficies y Tarjetas (Cards)
   -------------------------------------------------------------------------- */
.surface-main {
  flex: 1;
  padding: 8px 16px 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-top: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card h2 {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.card p.sub {
  font-size: 14px;
  color: var(--mute);
  margin-top: 4px;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

/* --------------------------------------------------------------------------
   5. Chips de Estado (GBP, Precisión GPS, Autollenado, Instalado)
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.chip-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.chip-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.chip-err {
  background: var(--err-bg);
  color: var(--err);
}

.chip-blue {
  background: var(--blue-tint);
  color: var(--blue);
}

.chip-neutral {
  background: #F1F3F4;
  color: var(--mute);
}

.chip-auto {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--blue-tint);
  color: var(--blue);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   6. Botones Estándar (Objetivos Táctiles >= 48px)
   -------------------------------------------------------------------------- */
.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 24px;
  border: 1px solid var(--hair);
  background: var(--card);
  color: var(--blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  width: 100%;
  margin-top: 12px;
}

.btn:hover:not(:disabled) {
  background: rgba(26, 115, 232, 0.06);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-fill {
  background: var(--blue);
  color: #FFFFFF;
  border-color: var(--blue);
}

.btn-fill:hover:not(:disabled) {
  background: var(--blue-hover);
}

.btn-text {
  min-height: 48px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border-radius: var(--radius-input);
}

.btn-text:hover {
  background: rgba(26, 115, 232, 0.08);
}

.btn-danger-text {
  color: var(--err);
}

/* Barra de acción primaria fija al pie en la zona del pulgar (docs/06 sección 6) */
.bottom-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: var(--card);
  border-top: 1px solid var(--hair);
  padding: 12px 16px;
}

.bottom-action-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bottom-action-inner .btn {
  margin-top: 0;
}

/* Botón Flotante (FAB) para Lista de Negocios */
.fab {
  position: fixed;
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: 24px;
  z-index: 26;
  height: 56px;
  padding: 0 22px;
  border-radius: 16px;
  border: none;
  background: var(--blue);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-fab);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.fab:hover {
  background: var(--blue-hover);
}

/* --------------------------------------------------------------------------
   7. Campos de Formulario con Etiqueta, Ayuda y Error en Línea
   -------------------------------------------------------------------------- */
.field-group {
  margin-top: 14px;
}

.field-box {
  border: 1px solid var(--hair);
  border-radius: var(--radius-input);
  padding: 8px 12px;
  background: var(--card);
  transition: border-color var(--transition-fast);
}

.field-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.field-box.has-error {
  border-color: var(--err);
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--mute);
  font-weight: 500;
}

.field-input,
.field-select {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  padding: 4px 0 2px;
  outline: none;
}

.field-help {
  font-size: 12px;
  color: var(--mute);
  margin-top: 4px;
  padding-left: 2px;
}

.field-error {
  font-size: 12px;
  color: var(--err);
  font-weight: 500;
  margin-top: 4px;
  padding-left: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Buscador en lista de negocios y selector de categorías */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 24px;
  padding: 0 16px;
  min-height: 48px;
  margin-top: 8px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: none;
}

/* Dropdown de categorías con buscador */
.category-results {
  margin-top: 6px;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--hair);
  border-radius: var(--radius-input);
  background: var(--card);
}

.category-option {
  width: 100%;
  text-align: left;
  padding: 12px;
  min-height: 48px;
  border: none;
  border-bottom: 1px solid #F1F3F4;
  background: var(--card);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.category-option:hover,
.category-option.selected {
  background: var(--blue-tint);
  color: var(--blue);
  font-weight: 500;
}

.category-option small {
  font-size: 12px;
  color: var(--mute);
}

/* --------------------------------------------------------------------------
   8. Lista de Negocios (Superficie 1)
   -------------------------------------------------------------------------- */
.business-list {
  list-style: none;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.business-row {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.business-row:hover {
  border-color: var(--blue);
}

.business-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.business-row-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}

.business-row-addr {
  font-size: 13px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.business-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* --------------------------------------------------------------------------
   9. Mini-Mapa Interactivo de Pin Ajustable y Vista Previa de Fachada (Paso 1)
   -------------------------------------------------------------------------- */
.pin-adjuster {
  margin-top: 12px;
  height: 148px;
  background: #E8EAED;
  border: 1px solid var(--hair);
  border-radius: var(--radius-input);
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background-image:
    linear-gradient(to right, rgba(95, 99, 104, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(95, 99, 104, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
}

.pin-adjuster:active {
  cursor: grabbing;
}

.pin-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -100%);
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.pin-hint {
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--mute);
  text-align: center;
}

.facade-preview {
  margin-top: 12px;
  border-radius: var(--radius-input);
  border: 1px solid var(--hair);
  overflow: hidden;
  background: #F1F3F4;
}

.facade-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.facade-meta {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ok);
  background: var(--ok-bg);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   10. Selector de Presets de Horario y Modo de Redirección (Paso 2 y 3)
   -------------------------------------------------------------------------- */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preset-btn {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--hair);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.preset-btn.active {
  background: var(--blue-tint);
  border-color: var(--blue);
  color: var(--blue);
}

.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.mode-option {
  border: 1px solid var(--hair);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  background: var(--card);
}

.mode-option.selected {
  border-color: var(--blue);
  background: #F8FAFF;
}

.mode-option input[type="radio"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

/* --------------------------------------------------------------------------
   11. Vista Previa de Tarjeta QR (Paso 3) y Radar NFC (Paso 4)
   -------------------------------------------------------------------------- */
.qr-preview-wrap {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qr-print-canvas {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--hair);
  background: #FFFFFF;
}

.nfc-radar-box {
  margin-top: 14px;
  padding: 24px 16px;
  border-radius: var(--radius-card);
  border: 2px dashed var(--blue);
  background: var(--blue-tint);
  text-align: center;
}

.nfc-radar-ring {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--blue);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(26, 115, 232, 0.2);
}

/* Checkboxes de Prueba en Vivo (Paso 5) */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 12px;
  border: 1px solid var(--hair);
  border-radius: var(--radius-card);
  margin-top: 10px;
  min-height: 56px;
  cursor: pointer;
  background: var(--card);
}

.check-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--ok);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   12. Hoja Inferior (Bottom Sheet) y Diálogo de Confirmación
   -------------------------------------------------------------------------- */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(32, 33, 36, 0.48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 82dvh;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 16px;
  overflow-y: auto;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--hair);
  border-radius: 2px;
  margin: 0 auto 12px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(32, 33, 36, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dialog-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-sheet);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* --------------------------------------------------------------------------
   13. Snackbar de Feedback Silencioso
   -------------------------------------------------------------------------- */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 70;
  background: #323232;
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: 4px;
  font-size: 14px;
  max-width: 92vw;
  box-shadow: var(--shadow-fab);
}

/* --------------------------------------------------------------------------
   14. Hoja de Estilo de Impresión (@media print) — Imprime SOLO la Tarjeta QR
   -------------------------------------------------------------------------- */
@media print {
  body * {
    visibility: hidden !important;
  }
  #print-area,
  #print-area * {
    visibility: visible !important;
  }
  #print-area {
    position: fixed;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
  }
  #print-area img {
    max-width: 100mm;
    max-height: 135mm;
    width: auto;
    height: auto;
  }
}
