/* ==========================================================================
   BodegaFlex POS — Pantalla de Pago y Franja de Avisos (pago.css)
   Aislado bajo #bf-pago-overlay y #bf-franja-plan.
   Mobile-first, probado a 390x844 sin scroll horizontal.
   ========================================================================== */

#bf-pago-overlay,
#bf-pago-overlay *,
#bf-pago-overlay *::before,
#bf-pago-overlay *::after {
  box-sizing: border-box;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#bf-pago-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147482900;
  background-color: #f8fafc;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Contenedor central de la pantalla */
#bf-pago-overlay .bf-pago-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  background-color: #ffffff;
  overflow: hidden;
}

/* Encabezado */
#bf-pago-overlay .bf-pago-header {
  padding: 16px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#bf-pago-overlay .bf-pago-header-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #1a3a6b;
  line-height: 1.3;
}

#bf-pago-overlay .bf-pago-header-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 9999px;
  background-color: #f1f5f9;
  color: #64748b;
}

/* Área scrollable */
#bf-pago-overlay .bf-pago-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  background-color: #ffffff;
}

/* Textos introductorios */
#bf-pago-overlay .bf-pago-intro {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

/* Alerta de rechazo */
#bf-pago-overlay .bf-pago-alerta-rechazo {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Tarjeta de monto a pagar */
#bf-pago-overlay .bf-pago-monto-card {
  background: linear-gradient(135deg, #f0f7ff 0%, #e0effe 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
}

#bf-pago-overlay .bf-pago-monto-concepto {
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 4px 0;
}

#bf-pago-overlay .bf-pago-monto-valor {
  font-size: 28px;
  font-weight: 800;
  color: #1a3a6b;
  margin: 0 0 4px 0;
}

#bf-pago-overlay .bf-pago-monto-bs {
  font-size: 14px;
  font-weight: 600;
  color: #0284c7;
  margin: 0 0 6px 0;
}

#bf-pago-overlay .bf-pago-monto-detalle {
  font-size: 13px;
  color: #475569;
  margin: 4px 0 0 0;
  line-height: 1.4;
}

/* Selección de plan */
#bf-pago-overlay .bf-pago-planes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

#bf-pago-overlay .bf-pago-plan-card {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  background-color: #ffffff;
}

#bf-pago-overlay .bf-pago-plan-card:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
}

#bf-pago-overlay .bf-pago-plan-card.bf-pago-plan-activo {
  border-color: #1a3a6b;
  background-color: #eff6ff;
}

#bf-pago-overlay .bf-pago-plan-nombre {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px 0;
}

#bf-pago-overlay .bf-pago-plan-precio {
  font-size: 14px;
  font-weight: 600;
  color: #1a3a6b;
  margin: 0;
}

/* Selección de métodos de pago */
#bf-pago-overlay .bf-pago-seccion-titulo {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 18px 0 10px 0;
}

#bf-pago-overlay .bf-pago-metodos-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

#bf-pago-overlay .bf-pago-chip {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#bf-pago-overlay .bf-pago-chip:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

#bf-pago-overlay .bf-pago-chip.bf-pago-chip-activo {
  background-color: #1a3a6b;
  color: #ffffff;
  border-color: #1a3a6b;
}

/* Datos del método seleccionado */
#bf-pago-overlay .bf-pago-datos-metodo {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

#bf-pago-overlay .bf-pago-dato-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 14px;
}

#bf-pago-overlay .bf-pago-dato-fila:last-child {
  border-bottom: none;
}

#bf-pago-overlay .bf-pago-dato-etiqueta {
  color: #64748b;
  font-weight: 500;
}

#bf-pago-overlay .bf-pago-dato-valor-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

#bf-pago-overlay .bf-pago-dato-valor {
  font-weight: 700;
  color: #0f172a;
}

#bf-pago-overlay .bf-pago-btn-copiar {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #1a3a6b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

#bf-pago-overlay .bf-pago-btn-copiar:hover {
  background-color: #f1f5f9;
}

#bf-pago-overlay .bf-pago-btn-copiar.bf-pago-copiado {
  background-color: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

/* Campos del formulario */
#bf-pago-overlay .bf-pago-campo {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

#bf-pago-overlay .bf-pago-label {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}

#bf-pago-overlay .bf-pago-input,
#bf-pago-overlay .bf-pago-select {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 16px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#bf-pago-overlay .bf-pago-input:focus,
#bf-pago-overlay .bf-pago-select:focus {
  border-color: #1a3a6b;
  box-shadow: 0 0 0 3px rgba(26, 58, 107, 0.12);
}

#bf-pago-overlay .bf-pago-input-error {
  border-color: #b91c1c;
  background-color: #fef2f2;
}

#bf-pago-overlay .bf-pago-error-campo {
  color: #b91c1c;
  font-size: 13px;
  font-weight: 500;
  margin-top: 5px;
  display: none;
}

#bf-pago-overlay .bf-pago-ayuda {
  font-size: 13px;
  color: #64748b;
  margin: 5px 0 0 0;
  line-height: 1.4;
}

/* Foto del comprobante */
#bf-pago-overlay .bf-pago-foto-box {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#bf-pago-overlay .bf-pago-preview-box {
  display: none;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}

#bf-pago-overlay .bf-pago-preview-img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
}

#bf-pago-overlay .bf-pago-btn-quitar-foto {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #fca5a5;
  background-color: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

/* Errores generales */
#bf-pago-overlay .bf-pago-error-banner {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}

/* Botones principales */
#bf-pago-overlay .bf-pago-btn-primary {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  background-color: #1a3a6b;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  transition: background-color 0.15s ease;
}

#bf-pago-overlay .bf-pago-btn-primary:hover:not(:disabled) {
  background-color: #142d54;
}

#bf-pago-overlay .bf-pago-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #94a3b8;
}

#bf-pago-overlay .bf-pago-btn-secondary {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #334155;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  transition: background-color 0.15s ease;
}

#bf-pago-overlay .bf-pago-btn-secondary:hover:not(:disabled) {
  background-color: #f8fafc;
}

#bf-pago-overlay .bf-pago-btn-whatsapp {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  background-color: #16a34a;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  gap: 8px;
  transition: background-color 0.15s ease;
}

#bf-pago-overlay .bf-pago-btn-whatsapp:hover {
  background-color: #15803d;
}

#bf-pago-overlay .bf-pago-acciones {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#bf-pago-overlay .bf-pago-pie {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin: 16px 0 6px 0;
  line-height: 1.45;
}

/* Pantalla Entrar */
#bf-pago-overlay .bf-pago-pass-box {
  position: relative;
  display: flex;
  align-items: center;
}

#bf-pago-overlay .bf-pago-btn-toggle-pass {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
}

#bf-pago-overlay .bf-pago-btn-toggle-pass:hover {
  color: #0f172a;
}

/* ==========================================================================
   Franja de Aviso de Plan (#bf-franja-plan)
   ========================================================================== */
#bf-franja-plan,
#bf-franja-plan *,
#bf-franja-plan *::before,
#bf-franja-plan *::after {
  box-sizing: border-box;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#bf-franja-plan {
  position: fixed;
  top: 0;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  z-index: 2147482000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 4px 10px;
}

/* Con la franja a la vista, la página baja lo que mide la franja (antes tapaba el encabezado y no se podía salir) */
html.bf-con-franja body {
  padding-top: var(--bf-franja-h, 0px) !important;
}
html.bf-con-franja .app-header {
  top: var(--bf-franja-h, 0px) !important;
}
/* Fondo para que al bajar no se asome el contenido por detrás de la franja (o de la muesca del iPhone) */
html.bf-con-franja #bf-franja-plan {
  background: #f4f6fa;
  padding-top: calc(4px + env(safe-area-inset-top, 0px));
  top: 0;
}

#bf-franja-plan .bf-franja-inner {
  pointer-events: auto;
  width: 100%;
  max-width: 600px;
  min-height: 40px;
  max-height: 56px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

#bf-franja-plan .bf-franja-texto {
  flex: 1 1 auto;
  overflow: hidden;
  /* hasta 2 líneas (antes se cortaba con «…» y no se leía el aviso completo) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  word-break: break-word;
}

#bf-franja-plan .bf-franja-btn {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

#bf-franja-plan .bf-franja-cerrar {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Tipos de Franja */
#bf-franja-plan.bf-franja-info .bf-franja-inner {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
#bf-franja-plan.bf-franja-info .bf-franja-btn {
  background-color: #1d4ed8;
}
#bf-franja-plan.bf-franja-info .bf-franja-cerrar {
  color: #1e40af;
}

#bf-franja-plan.bf-franja-ok .bf-franja-inner {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
#bf-franja-plan.bf-franja-ok .bf-franja-btn {
  background-color: #15803d;
}
#bf-franja-plan.bf-franja-ok .bf-franja-cerrar {
  color: #166534;
}

#bf-franja-plan.bf-franja-aviso .bf-franja-inner {
  background-color: #fefce8;
  border-color: #fef08a;
  color: #854d0e;
}
#bf-franja-plan.bf-franja-aviso .bf-franja-btn {
  background-color: #a16207;
}
#bf-franja-plan.bf-franja-aviso .bf-franja-cerrar {
  color: #854d0e;
}

#bf-franja-plan.bf-franja-urgente .bf-franja-inner {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
#bf-franja-plan.bf-franja-urgente .bf-franja-btn {
  background-color: #b91c1c;
}
#bf-franja-plan.bf-franja-urgente .bf-franja-cerrar {
  color: #991b1b;
}

/* Historial de pagos y aviso de "Mi plan" (agregado por Claude, 25-oct) */
#bf-pago-overlay .bf-pago-historial-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  font-size: 0.9rem;
  color: #0f172a;
}
#bf-pago-overlay .bf-pago-historial-item small {
  color: #64748b;
}
#bf-pago-overlay .bf-pago-historial-estado {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
}
#bf-pago-overlay .bf-pago-historial-aprobado {
  background: #dcfce7;
  color: #166534;
}
#bf-pago-overlay .bf-pago-historial-rechazado {
  background: #fee2e2;
  color: #991b1b;
}
#bf-pago-overlay .bf-pago-aviso-consulta {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

/* Aviso grande de la instalación y lista de lo que incluye cada plan (agregado por Claude, 25-oct) */
#bf-pago-overlay .bf-pago-aviso-inst {
  margin: 0 0 14px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #16a34a;
  background: #f0fdf4;
  color: #14532d;
}
#bf-pago-overlay .bf-pago-aviso-inst-titulo {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 4px;
}
#bf-pago-overlay .bf-pago-aviso-inst-texto {
  font-size: 0.98rem;
  line-height: 1.4;
  font-weight: 600;
}
#bf-pago-overlay .bf-pago-plan-card {
  text-align: left;
}
#bf-pago-overlay .bf-pago-plan-beneficios {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #334155;
}
#bf-pago-overlay .bf-pago-plan-beneficios li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 4px;
}
#bf-pago-overlay .bf-pago-plan-beneficios li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 800;
}

/* Historial de pagos compacto (Lote 5, 28-oct) */
#bf-pago-overlay .bf-pago-hist-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

#bf-pago-overlay .bf-pago-hist-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background-color: #ffffff;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#bf-pago-overlay .bf-pago-hist-item[data-abierto="true"] {
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#bf-pago-overlay .bf-pago-hist-resumen {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: #0f172a;
  transition: background-color 0.15s ease;
}

#bf-pago-overlay .bf-pago-hist-resumen:hover {
  background-color: #f8fafc;
}

#bf-pago-overlay .bf-pago-hist-resumen:focus-visible {
  outline: 2px solid #1a3a6b;
  outline-offset: -2px;
}

#bf-pago-overlay .bf-pago-hist-fecha {
  flex: 1 1 auto;
  font-weight: 500;
  color: #475569;
  font-size: 13.5px;
}

#bf-pago-overlay .bf-pago-hist-monto {
  flex: 1 1 auto;
  text-align: center;
  font-weight: 700;
  color: #0f172a;
  font-size: 15px;
}

#bf-pago-overlay .bf-pago-hist-estado {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

#bf-pago-overlay .bf-pago-hist-estado-aprobado {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

#bf-pago-overlay .bf-pago-hist-estado-pendiente {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

#bf-pago-overlay .bf-pago-hist-estado-rechazado {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

#bf-pago-overlay .bf-pago-hist-detalle {
  padding: 10px 14px 12px 14px;
  border-top: 1px solid #f1f5f9;
  background-color: #f8fafc;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#bf-pago-overlay .bf-pago-hist-detalle[hidden] {
  display: none;
}

#bf-pago-overlay .bf-pago-hist-fila {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

#bf-pago-overlay .bf-pago-hist-clave {
  color: #64748b;
  font-weight: 500;
  font-size: 12.5px;
  flex-shrink: 0;
}

#bf-pago-overlay .bf-pago-hist-valor {
  color: #0f172a;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

#bf-pago-overlay .bf-pago-hist-btn-mas {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background-color: #ffffff;
  color: #1a3a6b;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#bf-pago-overlay .bf-pago-hist-btn-mas:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

