/* assets/css/afx-dialog.css — Ventana emergente ÚNICA de AnacoPay
 *
 * Sustituye a alert() / confirm() / prompt() del navegador en TODA la web:
 * mismo diseño en portada, panel de admin y área de cliente. Solo cambia el
 * mensaje y el icono (éxito ✓ verde, error ✕ rojo, aviso !, información i,
 * confirmación ?).
 *
 * Reglas del proyecto respetadas:
 *  - Sin style="" ni <style>: la portada tiene CSP style-src 'self'.
 *  - Sin backdrop-filter (ver trampa 4): el velo es un color sólido.
 *  - Colores propios con valores de reserva: la portada no incluye tokens.php.
 */
.afxd-root{
  --afxd-fondo:#0f172a;
  --afxd-borde:rgba(148,163,184,.28);
  --afxd-texto:#e5e7eb;
  --afxd-suave:#94a3b8;
  --afxd-color:#0ea5e9;
  position:fixed;inset:0;z-index:2147483000;
  display:flex;align-items:center;justify-content:center;
  padding:16px;box-sizing:border-box;
  background:rgba(2,6,23,.78);
  opacity:0;transition:opacity .18s ease;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}
.afxd-root *{box-sizing:border-box}
.afxd-root.afxd-vis{opacity:1}
.afxd-root.afxd-out{opacity:0;pointer-events:none}

.afxd-success{--afxd-color:#22c55e}
.afxd-error,.afxd-danger{--afxd-color:#ef4444}
.afxd-warn{--afxd-color:#f59e0b}
.afxd-info{--afxd-color:#0ea5e9}

.afxd-card{
  position:relative;overflow:hidden;
  width:100%;max-width:400px;
  padding:30px 24px 22px;
  text-align:center;color:var(--afxd-texto);
  background:linear-gradient(180deg,rgba(30,41,59,.55),rgba(15,23,42,0) 55%),var(--afxd-fondo);
  border:1px solid var(--afxd-borde);
  border-radius:16px;
  box-shadow:0 18px 50px rgba(0,0,0,.65);
  transform:translateY(14px) scale(.94);opacity:0;
}
.afxd-vis .afxd-card{animation:afxd-in .32s cubic-bezier(.2,.9,.3,1.2) forwards}

/* ---------- Icono ---------- */
.afxd-icowrap{position:relative;width:84px;height:84px;margin:0 auto 14px}
.afxd-icowrap::after{
  content:"";position:absolute;inset:6px;border-radius:50%;
  border:2px solid var(--afxd-color);opacity:0;
}
.afxd-vis .afxd-icowrap::after{animation:afxd-ring .9s .45s ease-out 1 both}
.afxd-ico{display:block;width:84px;height:84px;overflow:visible}
.afxd-vis .afxd-ico{animation:afxd-pop .5s .05s cubic-bezier(.2,.9,.3,1.3) both}
.afxd-ico .afxd-c{
  fill:var(--afxd-color);fill-opacity:0;
  stroke:var(--afxd-color);stroke-width:2.4;
  stroke-dasharray:151;stroke-dashoffset:151;
}
.afxd-vis .afxd-ico .afxd-c{animation:afxd-draw .55s .1s ease-out forwards,afxd-fill .35s .5s ease-out forwards}
.afxd-ico .afxd-p{
  fill:none;stroke:var(--afxd-color);stroke-width:3.4;
  stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:40;stroke-dashoffset:40;
}
.afxd-vis .afxd-ico .afxd-p{animation:afxd-draw .38s .55s ease-out forwards}
.afxd-vis .afxd-ico .afxd-p2{animation-delay:.72s}
/* Icono con punto (i, !, ?): se dibuja entero, sin trazo animado. */
.afxd-ico .afxd-q{
  fill:none;stroke:var(--afxd-color);stroke-width:3.6;
  stroke-linecap:round;stroke-linejoin:round;opacity:0;
}
.afxd-vis .afxd-ico .afxd-q{animation:afxd-aparece .3s .5s ease-out forwards}
/* El error tiembla al terminar de dibujarse la equis. */
.afxd-error.afxd-vis .afxd-icowrap{animation:afxd-shake .5s 1.05s ease-in-out 1 both}

/* ---------- Texto ---------- */
.afxd-titulo{margin:0 0 8px;font-size:1.18rem;font-weight:700;line-height:1.3;color:#f8fafc}
.afxd-msg{
  margin:0;font-size:.95rem;line-height:1.55;color:var(--afxd-texto);
  white-space:pre-line;overflow-wrap:anywhere;
  max-height:42vh;overflow:auto;
}
.afxd-campo{
  display:block;width:100%;margin:14px 0 0;padding:11px 12px;
  font:inherit;font-size:.88rem;color:#f8fafc;text-align:center;
  background:rgba(2,6,23,.7);border:1px solid var(--afxd-borde);border-radius:10px;
}
.afxd-campo:focus{outline:2px solid var(--afxd-color);outline-offset:1px}

/* ---------- Botones ---------- */
.afxd-btns{display:flex;gap:10px;justify-content:center;margin-top:22px;flex-wrap:wrap}
.afxd-btn{
  flex:1 1 130px;min-height:44px;padding:11px 20px;cursor:pointer;
  font:inherit;font-size:.95rem;font-weight:700;line-height:1.2;
  border-radius:999px;border:1px solid transparent;
  transition:transform .12s ease,filter .12s ease,background .12s ease;
}
.afxd-btn:hover{filter:brightness(1.1);transform:translateY(-1px)}
.afxd-btn:active{transform:none}
.afxd-btn:focus-visible{outline:2px solid rgba(248,250,252,.55);outline-offset:3px}
.afxd-ok{background:var(--afxd-color);color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.35)}
.afxd-warn .afxd-ok{color:#1f1300;text-shadow:none}
.afxd-no{background:transparent;color:var(--afxd-texto);border-color:var(--afxd-borde)}
.afxd-no:hover{background:rgba(148,163,184,.12)}

/* Barra que se vacía mientras el aviso de éxito se cierra solo. */
.afxd-barra{
  position:absolute;left:0;right:0;bottom:0;height:3px;
  background:var(--afxd-color);transform-origin:left center;opacity:.85;
}
.afxd-vis .afxd-barra{animation:afxd-barra 3.2s linear forwards}

/* Banners del servidor que ya salieron como ventana: se esconden. */
.afxd-flash-hide{display:none !important}
html.afxd-lock,html.afxd-lock body{overflow:hidden}

@keyframes afxd-in{to{transform:none;opacity:1}}
@keyframes afxd-draw{to{stroke-dashoffset:0}}
@keyframes afxd-fill{to{fill-opacity:.14}}
@keyframes afxd-aparece{to{opacity:1}}
@keyframes afxd-pop{0%{transform:scale(.55)}60%{transform:scale(1.1)}100%{transform:scale(1)}}
@keyframes afxd-ring{0%{transform:scale(.9);opacity:.6}100%{transform:scale(1.65);opacity:0}}
@keyframes afxd-shake{
  10%,90%{transform:translateX(-2px)}20%,80%{transform:translateX(4px)}
  30%,50%,70%{transform:translateX(-6px)}40%,60%{transform:translateX(6px)}
}
@keyframes afxd-barra{to{transform:scaleX(0)}}

@media (max-width:480px){
  .afxd-root{padding:12px}   /* sigue centrado: en móvil la ventana va en el medio, no abajo */
  .afxd-card{padding:26px 18px 18px}
  .afxd-btn{flex-basis:100%}
}
@media (prefers-reduced-motion:reduce){
  .afxd-root{transition:none}
  .afxd-vis .afxd-card,.afxd-vis .afxd-ico,.afxd-vis .afxd-icowrap::after,
  .afxd-error.afxd-vis .afxd-icowrap,.afxd-vis .afxd-barra{animation:none}
  .afxd-card{transform:none;opacity:1}
  .afxd-ico .afxd-c,.afxd-ico .afxd-p{stroke-dashoffset:0;animation:none !important}
  .afxd-ico .afxd-c{fill-opacity:.14}
  .afxd-ico .afxd-q{opacity:1;animation:none !important}
}
