/* Nanotap Loyalty — estilos compartidos.
   --marca y --marca-texto se reemplazan con los colores de cada negocio. */
:root {
  --marca: #1a1a2e;
  --marca-texto: #ffffff;
  --fondo: #f5f4f0;
  --superficie: #ffffff;
  --texto: #1c1c1e;
  --texto-suave: #6b6b70;
  --borde: #e3e1db;
  --exito: #1f8a4c;
  --exito-fondo: #e6f4ec;
  --error: #b42318;
  --error-fondo: #fdecea;
  --aviso-fondo: #fff6db;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 20px rgba(0, 0, 0, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fondo);
}

[hidden] { display: none !important; }

a { color: inherit; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }

.contenedor { max-width: 34rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.contenedor-ancho { max-width: 68rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* Encabezado con la marca del negocio */
.marca {
  background: var(--marca);
  color: var(--marca-texto);
  padding: 2rem 1rem 3.5rem;
  text-align: center;
}
.marca img.logo {
  max-height: 72px;
  max-width: 200px;
  object-fit: contain;
  margin-bottom: 0.75rem;
}
.marca h1 { margin: 0; }
.marca p { margin: 0.4rem 0 0; opacity: 0.85; }
.marca + .contenedor { margin-top: -2.25rem; }

.tarjeta {
  background: var(--superficie);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1rem;
}

.suave { color: var(--texto-suave); font-size: 0.92rem; }
.centro { text-align: center; }

/* Formularios */
.campo { margin-bottom: 1rem; }
.campo label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.3rem; }
.campo .opcional { font-weight: 400; color: var(--texto-suave); }
.fila { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.fila > .campo { flex: 1 1 12rem; }

input[type="text"], input[type="tel"], input[type="email"], input[type="date"],
input[type="password"], input[type="url"], input[type="number"], input[type="search"], select {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: #fff;
  color: var(--texto);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--marca) 35%, transparent);
  outline-offset: 1px;
}
input[type="color"] { width: 3.5rem; height: 2.6rem; border: 1px solid var(--borde); border-radius: 10px; padding: 0.2rem; background: #fff; }

.casilla { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.92rem; }
.casilla input { margin-top: 0.25rem; width: 1.15rem; height: 1.15rem; flex: none; }

/* Botones */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--marca);
  color: var(--marca-texto);
  cursor: pointer;
  min-height: 3rem;
}
.boton:disabled { opacity: 0.55; cursor: default; }
.boton.bloque { width: 100%; }
.boton.grande { font-size: 1.15rem; min-height: 3.75rem; }
.boton.secundario { background: #fff; color: var(--texto); border-color: var(--borde); }
.boton.peligro { background: var(--error); color: #fff; }
.boton.exito { background: var(--exito); color: #fff; }
.boton.negro { background: #000; color: #fff; }
/* Insignias oficiales de Apple y Google: se muestran tal cual, a 52 px de alto
   (Google pide 48 px como mínimo) y centradas, una por fila. */
.insignia-wallet { display: block; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; border-radius: 12px; }
.insignia-wallet img { display: block; height: 52px; width: auto; }
.insignia-wallet:disabled { cursor: progress; opacity: 0.5; }
.boton.chico { min-height: 2.2rem; padding: 0.35rem 0.75rem; font-size: 0.88rem; border-radius: 9px; }
.botones { display: grid; gap: 0.75rem; }

/* Mensajes */
.mensaje { border-radius: 10px; padding: 0.75rem 0.9rem; margin-bottom: 1rem; font-size: 0.95rem; }
.mensaje.error { background: var(--error-fondo); color: var(--error); }
.mensaje.exito { background: var(--exito-fondo); color: var(--exito); }
.mensaje.aviso { background: var(--aviso-fondo); color: #6b4e00; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: #1c1c1e;
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--sombra);
  z-index: 50;
  max-width: calc(100% - 2rem);
  text-align: center;
}
.toast.error { background: var(--error); }
.toast.exito { background: var(--exito); }

/* Sellos (círculos) */
.sellos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem auto;
  max-width: 20rem;
}
.sellos span {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 2px dashed color-mix(in srgb, var(--marca) 45%, transparent);
}
.sellos span.lleno {
  border: 0;
  background: radial-gradient(circle, var(--marca-texto) 0 28%, var(--marca) 30%);
  box-shadow: 0 0 0 2px var(--marca) inset;
}
.contador { font-size: 2.4rem; font-weight: 700; text-align: center; line-height: 1; }
.contador small { font-size: 1rem; color: var(--texto-suave); font-weight: 500; }

.qr { display: block; width: 12rem; max-width: 100%; margin: 0.5rem auto; image-rendering: pixelated; }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; }

.insignia {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--fondo);
  color: var(--texto-suave);
}
.insignia.si { background: var(--exito-fondo); color: var(--exito); }
.insignia.no { background: var(--error-fondo); color: var(--error); }

/* Barra superior de paneles */
.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--marca);
  color: var(--marca-texto);
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1rem 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.barra .titulo { font-weight: 700; }
.barra .boton { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--marca-texto) 40%, transparent); }

/* Tablas del operador */
.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texto-suave); }
td .boton + .boton { margin-left: 0.35rem; }

.lector { border-radius: var(--radio); overflow: hidden; background: #000; min-height: 16rem; }
.lector video { width: 100% !important; display: block; }

.separador { display: flex; align-items: center; gap: 0.75rem; color: var(--texto-suave); font-size: 0.85rem; margin: 1rem 0; }
.separador::before, .separador::after { content: ""; flex: 1; border-top: 1px solid var(--borde); }

.legal { font-size: 0.95rem; }
.legal h2 { margin-top: 1.5rem; }

/* Imágenes de marca en el panel del operador */
.miniatura { display: block; width: 3.5rem; height: 3.5rem; object-fit: contain; border: 1px solid var(--borde); border-radius: 10px; background: #fff; margin-bottom: 0.4rem; }
.vista-previa { display: block; width: 100%; max-width: 30rem; border-radius: 12px; border: 1px solid var(--borde); }

/* Editor de negocio con vista previa de la tarjeta */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 21rem); gap: 1.75rem; align-items: start; }
@media (max-width: 52rem) { .editor { grid-template-columns: minmax(0, 1fr); } }
.editor-campos { min-width: 0; }
.ayuda { font-size: 0.85rem; color: var(--texto-suave); margin: 0 0 0.5rem; }
.subida { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.subida .miniatura { margin: 0; }
fieldset.campo { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.4rem; }
fieldset.campo legend { font-weight: 600; font-size: 0.92rem; padding: 0; margin-bottom: 0.3rem; }
fieldset.campo legend .opcional { font-weight: 400; color: var(--texto-suave); }
fieldset.campo .ayuda { margin: 0; }
.estampas-propias { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: 0.6rem; }
.estampa-propia { display: grid; justify-items: center; gap: 0.25rem; font-size: 0.8rem; color: var(--texto-suave); }
.estampa-propia > button:first-child {
  width: 4rem; height: 4rem; padding: 0.2rem; border: 1px dashed var(--borde); border-radius: 10px;
  background: #fff; color: var(--texto-suave); font-size: 1.4rem; cursor: pointer;
}
.estampa-propia.con-imagen > button:first-child { border-style: solid; }
.estampa-propia img { width: 100%; height: 100%; object-fit: contain; }
.estampa-propia .quitar { border: 0; background: none; color: var(--texto-suave); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.aviso-imagen { font-size: 0.85rem; background: var(--aviso-fondo); color: #6b4e00; border-radius: 8px; padding: 0.5rem 0.7rem; margin: 0.5rem 0 0; }

.vista-tarjeta { position: sticky; top: calc(4.5rem + env(safe-area-inset-top, 0px)); display: grid; gap: 0.75rem; }
.selector-plataforma { display: grid; grid-template-columns: 1fr 1fr; background: var(--fondo); border-radius: 10px; padding: 3px; }
.selector-plataforma button { font: inherit; font-weight: 600; font-size: 0.9rem; border: 0; border-radius: 8px; padding: 0.45rem; background: transparent; color: var(--texto-suave); cursor: pointer; }
.selector-plataforma button[aria-pressed="true"] { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.vista-tarjeta input[type="range"] { width: 100%; }
.nota-previa { font-size: 0.8rem; margin: 0; }

.tira-previa { display: block; width: 100%; aspect-ratio: 375 / 123; object-fit: cover; }
.qr-previa { display: grid; justify-items: center; padding: 0.9rem; }
.qr-previa img { width: 6.5rem; height: 6.5rem; background: #fff; padding: 0.35rem; border-radius: 6px; image-rendering: pixelated; }

.wallet-ios { border-radius: 14px; overflow: hidden; box-shadow: var(--sombra); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
.ios-cabeza { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.8rem; min-height: 3.1rem; }
.ios-logo { max-height: 1.9rem; max-width: 5rem; object-fit: contain; }
.ios-nombre { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-campo { text-align: right; }
.wallet-ios small { display: block; font-size: 0.6rem; letter-spacing: 0.06em; font-weight: 600; opacity: 0.75; }
.wallet-ios b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ios-campos { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 0.8rem 0; }
.ios-campos .der, .and-filas .der { text-align: right; }

.wallet-android { border-radius: 22px; overflow: hidden; box-shadow: var(--sombra); font-family: Roboto, system-ui, sans-serif; }
.and-cabeza { display: flex; align-items: center; gap: 0.55rem; padding: 0.9rem 1rem 0.3rem; font-size: 0.88rem; }
.and-logo { width: 1.9rem; height: 1.9rem; border-radius: 50%; object-fit: cover; }
.and-titulo { font-size: 1.25rem; padding: 0.3rem 1rem 0.7rem; }
.and-filas { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0 1rem; }
.and-filas small { display: block; font-size: 0.7rem; opacity: 0.75; }
.and-filas b { font-weight: 500; font-variant-numeric: tabular-nums; }

textarea { width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 1px solid var(--borde); border-radius: 10px; background: #fff; color: var(--texto); resize: vertical; margin-bottom: 0.5rem; }

/* Reglas del programa en la inscripción */
.reglas { border: 1px solid var(--borde); border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.9rem; }
.reglas summary { cursor: pointer; font-weight: 600; }
.reglas ul { margin: 0.6rem 0 0.2rem; padding-left: 1.1rem; display: grid; gap: 0.35rem; color: var(--texto-suave); }
