/* Tarjeta de sellos de La Florería: misma paleta y letras que el sitio (lino, bosque, rosa, sol). */

:root {
  --rosa: #d84a7e;
  --rosa-tinta: #c23a6c;
  --rosa-suave: #fdf1f5;
  --bosque: #1d4a38;
  --bosque-hondo: #013323;
  --salvia: #7fa088;
  --lino: #faf7f2;
  --papel: #fffaf1;
  --sol: #ffd36e;
  --texto: #151d1a;
  --texto-suave: #414944;
  --borde: #e8e2d7;
  --error: #ba1a1a;
  --error-fondo: #ffdad6;
  --exito-fondo: #e3f2e8;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radio: 0.9rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--lino);
  color: var(--texto);
  font: 400 15px/1.5 'Plus Jakarta Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--bosque-hondo);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}
h1 { font-size: clamp(28px, 7vw, 38px); }
h2 { font-size: clamp(22px, 5vw, 28px); }
h3 { font-size: 19px; }
p { margin: 0 0 0.75rem; }
a { color: var(--rosa-tinta); }

[hidden] { display: none !important; }

.franja-prueba {
  background: var(--sol);
  color: #3b2a00;
  font: 700 12px/1.3 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.45rem 1rem;
}

/* ---------- Barra superior ---------- */
.barra {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borde);
}
.marca { display: flex; flex-direction: column; text-decoration: none; color: var(--bosque-hondo); }
.marca b { font: 600 19px/1 'Playfair Display', serif; }
.marca span { font: 700 10px/1.4 'Plus Jakarta Sans', sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rosa-tinta); margin-top: 3px; }
.barra-acciones { display: flex; align-items: center; gap: 0.5rem; }

.pagina {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem 1rem calc(2.5rem + env(safe-area-inset-bottom));
}
.pagina-ancha { max-width: 1100px; }

/* ---------- Tarjetas y botones ---------- */
.tarjeta {
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1.25rem;
  box-shadow: 0 18px 30px -24px rgba(29, 74, 56, 0.45);
  margin-bottom: 1rem;
}
.centrado { text-align: center; }

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--bosque);
  color: #fff;
  font: 600 15px/1.2 'Plus Jakarta Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.14s var(--ease-out), background-color 0.2s ease, opacity 0.2s ease;
}
.boton:active:not(:disabled) { transform: scale(0.97); }
.boton:disabled { opacity: 0.55; cursor: not-allowed; }
.boton:focus-visible, .enlace:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--sol);
  outline-offset: 2px;
}
.boton-grande { width: 100%; min-height: 60px; font-size: 17px; border-radius: 0.85rem; }
.boton-rosa { background: var(--rosa); box-shadow: 0 10px 22px -10px rgba(216, 74, 126, 0.7); }
.boton-sol { background: var(--sol); color: #3b2a00; }
.boton-claro { background: #fff; color: var(--bosque); border: 1px solid var(--borde); }
.boton-peligro { background: #fff; color: var(--error); border: 1px solid #f0c4be; }
.boton-chico { min-height: 40px; padding: 0.45rem 0.85rem; font-size: 13px; }
@media (hover: hover) and (pointer: fine) {
  .boton:hover:not(:disabled) { background: var(--bosque-hondo); }
  .boton-rosa:hover:not(:disabled) { background: var(--rosa-tinta); }
  .boton-sol:hover:not(:disabled) { background: #ffc94a; }
  .boton-claro:hover:not(:disabled), .boton-peligro:hover:not(:disabled) { background: var(--lino); }
}
.boton[aria-busy='true']::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: girar 0.7s linear infinite;
}
.enlace {
  background: none;
  border: 0;
  padding: 0.6rem 0;
  color: var(--rosa-tinta);
  font: 600 14px/1.3 'Plus Jakarta Sans', sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.fila-botones { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }
.fila-botones > .boton { flex: 1 1 160px; }

/* ---------- Formularios ---------- */
form { display: flex; flex-direction: column; gap: 0.85rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font: 600 13px/1.3 'Plus Jakarta Sans', sans-serif; color: var(--texto-suave); }
input, select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid #d6cfc2;
  border-radius: 0.7rem;
  background: #fff;
  color: var(--texto);
  font: 500 16px/1.3 'Plus Jakarta Sans', sans-serif; /* 16px: iOS no hace zoom */
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--bosque); }
.casilla { flex-direction: row; align-items: flex-start; gap: 0.6rem; font-weight: 500; line-height: 1.45; }
.casilla input { width: 22px; min-height: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--bosque); }
.ayuda { font-size: 13px; color: var(--texto-suave); margin: 0; }
.nota-tecnica { font-size: 13px; color: var(--texto-suave); background: var(--lino); border-radius: 0.6rem; padding: 0.6rem 0.75rem; margin-top: 0.75rem; }

.pestanas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #efe9de; border-radius: 0.8rem; margin-bottom: 1rem; }
.pestanas button {
  min-height: 46px;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--texto-suave);
  font: 600 14px/1.2 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
}
.pestanas button[aria-selected='true'] { background: #fff; color: var(--bosque-hondo); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.2); }

.aviso { border-radius: 0.7rem; padding: 0.75rem 0.9rem; font-size: 14px; font-weight: 500; background: var(--lino); }
.aviso-error { background: var(--error-fondo); color: #6e0b07; }
.aviso-exito { background: var(--exito-fondo); color: #10402b; }
.aviso-alerta { background: #fff3cf; color: #5a4100; }

/* ---------- Tarjeta de sellos ---------- */
.tarjeta-sellos {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 211, 110, 0.35), transparent 38%),
    radial-gradient(circle at 0 100%, rgba(216, 74, 126, 0.12), transparent 40%),
    var(--papel);
}
.tarjeta-sellos::after {
  /* Cinta rosa de florería en la esquina */
  content: '';
  position: absolute;
  top: 18px;
  right: -42px;
  width: 150px;
  height: 18px;
  background: repeating-linear-gradient(90deg, var(--rosa) 0 14px, #e2608f 14px 28px);
  transform: rotate(38deg);
  opacity: 0.85;
}
.saludo { font: 700 11px/1.3 'Plus Jakarta Sans', sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rosa-tinta); margin-bottom: 0.3rem; }

.sellos {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 2.5vw, 14px);
  margin: 1.1rem 0 0.9rem;
}
.sello {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px dashed #cdbfa8;
  background: rgba(255, 255, 255, 0.6);
}
.sello .numero { font: 600 clamp(15px, 4vw, 20px)/1 'Playfair Display', serif; color: #b9ab93; }
.sello.lleno { border: 2px solid rgba(216, 74, 126, 0.35); background: var(--rosa-suave); }
.sello svg { width: 82%; height: 82%; transform: rotate(var(--giro, 0deg)); }
.sello .petalos { fill: var(--rosa); opacity: 0.88; }
.sello .centro { fill: var(--sol); stroke: var(--rosa-tinta); stroke-width: 3; }
/* Recién estampado: cae como un timbre */
.sello.recien svg { animation: estampar 0.55s var(--ease-out) both; }
@keyframes estampar {
  0% { opacity: 0; transform: scale(1.6) rotate(calc(var(--giro) - 30deg)); }
  60% { opacity: 1; transform: scale(0.92) rotate(var(--giro)); }
  100% { transform: scale(1) rotate(var(--giro)); }
}

.progreso { font: 600 17px/1.4 'Plus Jakarta Sans', sans-serif; color: var(--bosque-hondo); margin: 0; }
.regla { font-size: 13px; color: var(--texto-suave); margin: 0.35rem 0 0; }

.premio {
  border-radius: var(--radio);
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #fff1c4, var(--sol));
  color: #3b2a00;
  margin-top: 1rem;
}
.premio h3 { color: #3b2a00; margin-bottom: 0.2rem; }
.premio p { margin: 0; }
.premio-listo { animation: brillar 2.4s ease-in-out infinite; }
@keyframes brillar {
  50% { box-shadow: 0 0 0 6px rgba(255, 211, 110, 0.35); }
}
.etiqueta-provisional {
  display: inline-block;
  font: 700 10px/1.4 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(59, 42, 0, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

/* QR personal */
.qr-caja { display: grid; place-items: center; gap: 0.6rem; }
.qr {
  width: min(260px, 72vw);
  padding: 12px;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid var(--borde);
}
.qr svg { display: block; width: 100%; height: auto; }
.codigo {
  font: 700 22px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: 0.22em;
  color: var(--bosque-hondo);
}

/* Historial */
.historial { list-style: none; margin: 0; padding: 0; }
.historial li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--borde);
}
.historial li:last-child { border-bottom: 0; }
.historial .icono {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--rosa-suave);
  color: var(--rosa-tinta);
}
.historial .icono-canje { background: #fff1c4; color: #7a5600; }
.historial .icono-ajuste { background: #e7f0eb; color: var(--bosque); }
.historial b { display: block; font-weight: 600; }
.historial small { color: var(--texto-suave); font-size: 12px; }
.historial .delta { font-weight: 700; color: var(--bosque); }
.vacio { color: var(--texto-suave); text-align: center; padding: 1rem 0; margin: 0; }

/* ---------- Garzón ---------- */
.cliente-encontrado .nombre { font: 600 26px/1.15 'Playfair Display', serif; color: var(--bosque-hondo); margin: 0; overflow-wrap: anywhere; }
.dato { font-size: 13px; color: var(--texto-suave); margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.verificar { font-size: 13px; background: var(--lino); border-radius: 0.6rem; padding: 0.55rem 0.75rem; margin: 0.75rem 0 0; }

.monto {
  font: 700 34px/1 'Plus Jakarta Sans', sans-serif;
  text-align: center;
  min-height: 72px;
  letter-spacing: 0.02em;
}
.elegible {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  border-radius: 0.7rem;
  font: 600 14px/1.3 'Plus Jakarta Sans', sans-serif;
  text-align: center;
  padding: 0.5rem 0.75rem;
  background: var(--lino);
  color: var(--texto-suave);
}
.elegible.si { background: var(--exito-fondo); color: #10402b; }
.elegible.no { background: #fff3cf; color: #5a4100; }

.camara {
  position: relative;
  overflow: hidden;
  border-radius: var(--radio);
  background: #0e1a15;
  aspect-ratio: 3 / 4;
  max-height: 60dvh;
  width: 100%;
}
.camara video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camara .mira {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 1.2rem;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.camara .estado-camara {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.75rem;
  color: #fff;
  text-align: center;
  font-size: 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}

.resultados { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.resultados button {
  width: 100%;
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--borde);
  border-radius: 0.8rem;
  background: #fff;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.resultados button:active { transform: scale(0.99); }
.resultados b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.resultados small { color: var(--texto-suave); overflow-wrap: anywhere; }
.puntos { display: inline-flex; gap: 3px; flex: none; }
.puntos i { width: 9px; height: 9px; border-radius: 50%; background: #e2d9c8; }
.puntos i.on { background: var(--rosa); }

.resultado-grande { text-align: center; padding: 1.5rem 1rem; }
.resultado-grande .marca-ok {
  width: 72px;
  height: 72px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 36px;
  background: var(--exito-fondo);
  color: var(--bosque);
  animation: aparecer 0.4s var(--ease-out) both;
}
.resultado-grande .marca-ok.premio-ok { background: #fff1c4; color: #7a5600; }
@keyframes aparecer { from { opacity: 0; transform: scale(0.6); } }

/* ---------- Administrador ---------- */
.menu-admin {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  background: #efe9de;
  border-radius: 0.8rem;
  margin-bottom: 1rem;
  scrollbar-width: none;
}
.menu-admin button {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--texto-suave);
  font: 600 14px/1.2 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.menu-admin button[aria-selected='true'] { background: #fff; color: var(--bosque-hondo); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.2); }

.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.cifra { background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; }
.cifra b { display: block; font: 600 32px/1 'Playfair Display', serif; color: var(--bosque-hondo); }
.cifra span { font-size: 13px; color: var(--texto-suave); }

.tabla-caja { overflow-x: auto; border: 1px solid var(--borde); border-radius: var(--radio); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-weight: 700; color: var(--texto-suave); background: var(--lino); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--rosa-suave); color: var(--rosa-tinta); }
.chip-canje { background: #fff1c4; color: #7a5600; }
.chip-ajuste { background: #e7f0eb; color: var(--bosque); }
.chip.inactivo { background: #eee; color: #666; }

.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; align-items: end; margin-bottom: 0.75rem; }
.dos-columnas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 900px) {
  .dos-columnas { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
}

/* ---------- Avisos flotantes y carga ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100% - 2rem);
  padding: 0.85rem 1.1rem;
  border-radius: 0.8rem;
  background: var(--bosque-hondo);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.45);
  animation: subir 0.3s var(--ease-out) both;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast-exito { background: var(--bosque); }
.toast-error { background: var(--error); }
.toast.fuera { opacity: 0; transform: translate(-50%, 8px); }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 12px); } }

.cargando { display: grid; place-items: center; gap: 0.75rem; padding: 3rem 1rem; color: var(--texto-suave); }
.cargando::before {
  content: '';
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #e2d9c8;
  border-top-color: var(--rosa);
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.privacidad { font-size: 13px; color: var(--texto-suave); }
.privacidad summary { cursor: pointer; font-weight: 600; color: var(--bosque); min-height: 44px; display: flex; align-items: center; }
.privacidad ul { padding-left: 1.1rem; margin: 0.25rem 0 0.75rem; }
.pendiente { background: #fff3cf; border-radius: 4px; padding: 0 4px; }

@media (prefers-reduced-motion: reduce) {
  .sello.recien svg, .premio-listo, .resultado-grande .marca-ok, .toast { animation: none; }
  .boton[aria-busy='true']::before, .cargando::before { animation-duration: 2s; }
}
