/* =====================================================
   Popup "5 % en tu primera compra" (tienda/bienvenida_popup.php + js/bienvenida.js)
   Móvil: hoja que sube desde abajo. Escritorio: tarjeta centrada con foto a la izquierda.
   ===================================================== */
.nb { position: fixed; inset: 0; z-index: 220; display: flex; align-items: flex-end; justify-content: center; }
.nb__fondo { position: absolute; inset: 0; background: rgba(20, 28, 24, .45); opacity: 0; transition: opacity .35s ease; }
.nb__caja {
  position: relative; width: 100%; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sup); color: var(--tinta); border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  transform: translateY(100%); transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.nb.abierto .nb__fondo { opacity: 1; }
.nb.abierto .nb__caja { transform: none; }

.nb__x {
  position: absolute; top: 10px; right: 10px; z-index: 3; width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: var(--tinta); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12); transition: transform var(--t), background var(--t);
}
.nb__x svg { width: 20px; height: 20px; }
.nb__x:hover { background: #fff; transform: rotate(90deg); }

/* Foto: franja arriba en el celular, columna a la izquierda en escritorio */
.nb__foto { position: relative; height: 150px; background: var(--foto); }   /* sin overflow: el sello sobresale */
.nb__foto img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; display: block; }
.nb__sello {
  position: absolute; left: 16px; bottom: -26px; width: 86px; height: 86px; border-radius: 50%;
  display: grid; place-content: center; text-align: center; line-height: 1;
  background: var(--verde-marca); color: #fff; border: 4px solid #fff; box-shadow: 0 8px 20px rgba(47, 122, 36, .3);
  transform: rotate(-10deg) scale(.4); opacity: 0;
  transition: transform .55s cubic-bezier(.3, 1.6, .5, 1) .25s, opacity .3s ease .25s;
}
.nb.abierto .nb__sello { transform: rotate(-10deg) scale(1); opacity: 1; }
.nb__sello b { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; }
.nb__sello small { font-size: .78rem; font-weight: 800; letter-spacing: .14em; margin-top: 2px; }

.nb__cuerpo { position: relative; padding: 36px 20px calc(20px + env(safe-area-inset-bottom)); }
.nb__antetitulo { margin: 0 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--verde); }
.nb__titulo { margin: 0 0 8px; font-size: 1.55rem; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.nb__titulo span { color: var(--verde); white-space: nowrap; }
.nb__bajada { margin: 0 0 16px; color: var(--tinta-2); font-size: 1rem; line-height: 1.45; }

.nb__form { display: grid; gap: 10px; }
.nb__lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nb__input {
  width: 100%; min-height: 54px; padding: 12px 16px; border: 2px solid var(--borde); border-radius: 14px;
  font: inherit; font-size: 16px; color: var(--tinta); background: #fff; transition: border-color var(--t), box-shadow var(--t);
}
.nb__input:focus { outline: none; border-color: var(--verde-marca); box-shadow: 0 0 0 4px rgba(108, 179, 63, .18); }
.nb__input[aria-invalid="true"] { border-color: var(--agotado); }
.nb__trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nb__error { margin: 0; min-height: 0; color: var(--agotado); font-size: .9rem; font-weight: 600; }
.nb__error:empty { display: none; }

.nb__btn { position: relative; }
.nb__giro {
  display: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite;
}
.nb__btn.cargando { pointer-events: none; opacity: .9; }
.nb__btn.cargando .nb__giro { display: inline-block; }

.nb__legal { margin: 12px 0 0; font-size: .78rem; line-height: 1.45; color: var(--tinta-2); }
.nb__legal a { color: inherit; }
.nb__no {
  display: block; margin: 10px auto 0; min-height: 44px; padding: 8px 16px; border: 0; background: none;
  font: inherit; font-size: .92rem; color: var(--tinta-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.nb__no:hover { color: var(--tinta); }

/* ---------- Paso 2: ¡listo! ---------- */
.nb__paso { animation: nb-entra .4s ease both; }
.nb__listo { text-align: center; outline: none; }
.nb__listo .nb__bajada { margin-bottom: 18px; }
.nb__ticket {
  position: relative; margin: 0 0 18px; padding: 14px 16px; border-radius: 14px;
  background: var(--s, #E9F6E5); border: 2px dashed var(--verde-marca);
}
/* Muescas de ticket a los lados */
.nb__ticket::before, .nb__ticket::after {
  content: ""; position: absolute; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%;
  background: var(--sup); border: 2px dashed var(--verde-marca);
}
.nb__ticket::before { left: -11px; clip-path: inset(0 0 0 50%); }
.nb__ticket::after { right: -11px; clip-path: inset(0 50% 0 0); }
.nb__ticket-lbl { display: block; font-size: .8rem; color: var(--tinta-2); margin-bottom: 6px; }
.nb__ticket-fila { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.nb__ticket code { font-family: inherit; font-size: 1.4rem; font-weight: 800; letter-spacing: .12em; color: var(--verde); }
.nb__copiar {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--verde); background: #fff;
  font: inherit; font-size: .88rem; font-weight: 700; color: var(--verde); cursor: pointer; transition: background var(--t), color var(--t);
}
.nb__copiar:hover, .nb__copiar.ok { background: var(--verde); color: #fff; }

/* Confeti del "¡listo!" (12 papelitos que caen una vez) */
.nb__confeti { position: absolute; inset: 0 0 auto; height: 0; pointer-events: none; }
.nb__confeti i {
  position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px; opacity: 0;
  animation: nb-cae 1.6s cubic-bezier(.25, .7, .4, 1) forwards;
}
.nb__confeti i:nth-child(3n) { background: var(--verde-marca); }
.nb__confeti i:nth-child(3n+1) { background: #F2B84B; }
.nb__confeti i:nth-child(3n+2) { background: #E58A6B; width: 6px; height: 6px; border-radius: 50%; }
.nb__confeti i:nth-child(1) { left: 6%; animation-delay: .05s; --x: 14px; }
.nb__confeti i:nth-child(2) { left: 15%; animation-delay: .2s; --x: -10px; }
.nb__confeti i:nth-child(3) { left: 24%; animation-delay: .1s; --x: 18px; }
.nb__confeti i:nth-child(4) { left: 33%; animation-delay: .3s; --x: -16px; }
.nb__confeti i:nth-child(5) { left: 42%; animation-delay: 0s; --x: 8px; }
.nb__confeti i:nth-child(6) { left: 51%; animation-delay: .25s; --x: -12px; }
.nb__confeti i:nth-child(7) { left: 60%; animation-delay: .15s; --x: 20px; }
.nb__confeti i:nth-child(8) { left: 69%; animation-delay: .35s; --x: -8px; }
.nb__confeti i:nth-child(9) { left: 78%; animation-delay: .05s; --x: 12px; }
.nb__confeti i:nth-child(10) { left: 86%; animation-delay: .22s; --x: -18px; }
.nb__confeti i:nth-child(11) { left: 92%; animation-delay: .12s; --x: 6px; }
.nb__confeti i:nth-child(12) { left: 47%; animation-delay: .4s; --x: -4px; }

@keyframes nb-cae {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--x, 0), 190px) rotate(320deg); }
}
@keyframes nb-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

body.nb-abierto { overflow: hidden; }

/* ---------- Escritorio: tarjeta centrada en dos columnas ---------- */
@media (min-width: 760px) {
  .nb { align-items: center; padding: 24px; }
  .nb__caja {
    display: grid; grid-template-columns: 0.9fr 1.1fr; max-width: 760px; border-radius: 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
    transform: translateY(24px) scale(.96); opacity: 0; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
  }
  .nb.abierto .nb__caja { transform: none; opacity: 1; }
  .nb__foto { height: auto; min-height: 100%; }
  .nb__foto img { position: absolute; inset: 0; object-position: 40% 50%; }
  .nb__sello { left: auto; right: -30px; bottom: auto; top: 28px; width: 100px; height: 100px; }
  .nb__sello b { font-size: 2.1rem; }
  .nb__cuerpo { padding: 44px 40px 32px 52px; align-self: center; }
  .nb__titulo { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nb__fondo, .nb__caja, .nb__sello { transition: opacity .2s ease; }
  .nb__caja, .nb.abierto .nb__caja { transform: none; }
  .nb__sello { transform: rotate(-10deg); }
  .nb__confeti { display: none; }
  .nb__paso { animation: none; }
}
