/* Estilos exclusivos de /pos: tema oscuro y diseño tipo app de celular
   (inspirado en la app de Loyverse), para que el POS se sienta como una
   app de verdad y no como una página administrativa de escritorio. */

.pos-body {
  --pos-bg: #1c1c1e;
  --pos-bg-elevated: #2c2c2e;
  --pos-bg-elevated-2: #38383a;
  --pos-border: #3a3a3c;
  --pos-text: #f2f2f7;
  --pos-text-dim: #9a9a9e;
  --pos-green: #14B8A6;
  --pos-green-dark: #0E9488;
  --pos-red: #ff453a;

  background: var(--pos-bg);
  color: var(--pos-text);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* --- Reemplaza los estilos claros heredados de style.css dentro de /pos --- */
.pos-body a { color: var(--pos-green); }
.pos-body label { color: var(--pos-text-dim); }
.pos-body input[type="text"], .pos-body input[type="number"], .pos-body input[type="password"],
.pos-body input[type="search"], .pos-body select {
  background: var(--pos-bg-elevated); color: var(--pos-text); border: 1px solid var(--pos-border);
}
.pos-body input::placeholder { color: var(--pos-text-dim); }
.pos-body .card { background: var(--pos-bg-elevated); border-color: var(--pos-border); margin-left: 0.8rem; margin-right: 0.8rem; }
.pos-body .section-title { margin-left: 0.8rem; margin-right: 0.8rem; }
.pos-body .muted { color: var(--pos-text-dim); }
.pos-body .empty { color: var(--pos-text-dim); }
.pos-body h1, .pos-body h3 { color: var(--pos-text); }
.pos-body .btn { background: var(--pos-green); color: #fff; }
.pos-body .btn:hover { background: var(--pos-green-dark); }
.pos-body .btn.secondary { background: var(--pos-bg-elevated-2); color: var(--pos-text); }
.pos-body .btn.danger { background: var(--pos-red); color: #fff; }
.pos-body .flash.success { background: #0f3d24; color: #6fe0a0; }
.pos-body .flash.error { background: #4a1512; color: #ff8a80; }

.pos-topbar {
  background: var(--pos-bg-elevated);
  border-bottom: 1px solid var(--pos-border);
  color: var(--pos-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}
.pos-topbar .brand { color: var(--pos-text); text-decoration: none; font-weight: 700; font-size: 1rem; }
.pos-topbar-links { display: flex; align-items: center; gap: 0.9rem; }
.pos-topbar-links a { color: var(--pos-text-dim); text-decoration: none; font-size: 0.78rem; }
.pos-topbar-links a:hover { color: var(--pos-text); }

.pos-container { max-width: 720px; margin: 0 auto; padding: 0 0 1rem; }
.pos-container > .flash { margin: 0.8rem 0.8rem 0; }

/* --- Barra de acciones (Tickets abiertos/Guardar | Cobrar), fija arriba,
   como la pantalla principal de Loyverse --- */
.pos-actionbar {
  position: sticky;
  top: 49px; /* alto aproximado de .pos-topbar */
  z-index: 25;
  display: flex;
  gap: 1px;
  background: var(--pos-border);
}
.pos-actionbar > a, .pos-actionbar > span {
  flex: 1;
  text-align: center;
  padding: 0.85rem 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  color: #fff;
  background: var(--pos-green);
  letter-spacing: 0.02em;
}
.pos-actionbar > a.secundario { background: var(--pos-bg-elevated-2); }
.pos-actionbar > span.deshabilitado { background: var(--pos-bg-elevated-2); color: var(--pos-text-dim); }

/* --- Búsqueda simple de una sola línea (clientes, etc.) --- */
.pos-search { display: flex; gap: 0.5rem; padding: 0 0.8rem; margin-bottom: 0.6rem; }
.pos-search input { flex: 1; font-size: 1rem; padding: 0.7rem 0.8rem; }

/* --- Búsqueda / categoría --- */
.pos-filterbar { display: flex; gap: 0.5rem; align-items: center; padding: 0.7rem 0.8rem 0.3rem; }
.pos-filterbar select {
  flex: 1; padding: 0.6rem 0.7rem; border-radius: 8px; font-size: 0.92rem;
  background: var(--pos-bg-elevated); color: var(--pos-text); border: 1px solid var(--pos-border);
}
.pos-search-toggle {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 8px;
  background: var(--pos-bg-elevated); border: 1px solid var(--pos-border); color: var(--pos-text);
  font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pos-search-box { padding: 0 0.8rem 0.7rem; display: none; }
.pos-search-box.abierto { display: block; }
.pos-search-box input { width: 100%; padding: 0.65rem 0.8rem; font-size: 0.95rem; }

/* --- Lista de artículos, tipo Loyverse: fila completa, avatar + nombre + precio --- */
.pos-list { padding: 0 0.8rem; margin-bottom: 1rem; }
.pos-item-row {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  padding: 0.65rem 0; border-bottom: 1px solid var(--pos-border);
  background: none; border-left: none; border-right: none; border-top: none;
  text-align: left; color: inherit; font: inherit; cursor: pointer;
}
.pos-avatar {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1rem; text-transform: uppercase;
}
.pos-avatar-0 { background: #5856d6; }
.pos-avatar-1 { background: #ff9500; }
.pos-avatar-2 { background: #af52de; }
.pos-avatar-3 { background: #ff375f; }
.pos-avatar-4 { background: #64d2ff; color: #06304a; }
.pos-avatar-5 { background: #6b7280; }
.pos-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.pos-item-nombre { min-width: 0; font-size: 0.94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-item-stock { min-width: 0; font-size: 0.72rem; color: var(--pos-text-dim); }
.pos-item-precio { flex: 0 0 auto; font-size: 0.94rem; font-weight: 600; }

/* --- Carrito (dentro del ticket) --- */
.pos-cart { padding: 0.2rem 0.8rem 0.6rem; }
.pos-cart-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--pos-border);
}
.pos-cart-item:last-child { border-bottom: none; }
.pos-cart-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.pos-cart-item-nombre { min-width: 0; font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-cart-item-precio { min-width: 0; font-size: 0.76rem; color: var(--pos-text-dim); }
.pos-qty { display: flex; align-items: center; gap: 0.4rem; }
.pos-qty button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--pos-border);
  background: var(--pos-bg-elevated-2); color: var(--pos-text); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.pos-qty input {
  width: 40px; text-align: center; padding: 0.25rem 0.1rem; border: 1px solid var(--pos-border);
  border-radius: 8px; font-size: 0.9rem; background: var(--pos-bg-elevated); color: var(--pos-text);
}
.pos-cart-subtotal { font-size: 0.9rem; font-weight: 700; min-width: 62px; text-align: right; }
.pos-cart-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.8rem 0.8rem; font-size: 1.1rem; font-weight: 700; border-top: 1px solid var(--pos-border);
}

/* --- Métodos de pago: botones grandes con ícono, apilados --- */
.pos-pago-grid { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.pos-pago-grid .btn {
  width: 100%; padding: 0.95rem; font-size: 1rem; text-align: left;
  display: flex; align-items: center; gap: 0.7rem;
}
.pos-pago-grid .btn .icono { font-size: 1.2rem; }

/* --- Tickets abiertos / clientes: tarjetas de lista táctil --- */
.pos-list-card {
  background: var(--pos-bg-elevated); border: 1px solid var(--pos-border); border-radius: 12px;
  padding: 0.8rem 0.9rem; margin: 0 0.8rem 0.6rem; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  color: var(--pos-text); width: 100%; font: inherit; text-align: left; cursor: pointer;
}
.pos-list-card .info { min-width: 0; }
.pos-list-card .titulo { font-weight: 600; font-size: 0.95rem; }
.pos-list-card .detalle { font-size: 0.78rem; color: var(--pos-text-dim); margin-top: 0.15rem; }

/* --- Pantalla de PIN, igual que la de Loyverse --- */
.pin-screen { display: flex; flex-direction: column; align-items: center; padding: 3rem 1.5rem 1rem; }
.pin-logo { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.pin-sub { color: var(--pos-text-dim); margin: 0 0 1.6rem; }
.pin-dots { display: flex; gap: 0.9rem; margin-bottom: 2.2rem; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--pos-green); }
.pin-dot.filled { background: var(--pos-green); }
.pin-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem;
  width: 100%; max-width: 300px;
}
.pin-keypad button {
  aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--pos-border);
  background: var(--pos-bg-elevated); color: var(--pos-text); font-size: 1.4rem; cursor: pointer;
}
.pin-keypad button:active { background: var(--pos-bg-elevated-2); }
.pin-keypad .pin-key-borrar { font-size: 0.85rem; border-radius: 50%; }
.pin-alt { margin-top: 2rem; font-size: 0.88rem; }
