/* ==========================================================================
   FacturaDigital — modales SweetAlert2 con la dirección artística 2026
   (glass + nebulosa). Archivo estático fuera del build de Vite: se linkea
   DESPUÉS del dist para ganar los overrides de _plugins.scss (que usan
   !important), por eso aquí también se usa !important en esas propiedades.
   ========================================================================== */

/* ---- Backdrop: índigo profundo que difumina lo que hay detrás ---- */
.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-noanimation {
    background: rgba(13, 11, 30, .55) !important;
}
.swal2-container {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* ---- Toast: sin backdrop ni blur (columna oscura de 360x100vh, feedback
   2026-09-01) ----
   SweetAlert2 ya deja el contenedor de un toast transparente y con
   pointer-events:none vía "body.swal2-toast-shown .swal2-container" (su
   propia hoja, sweetalert2.min.css), pero las reglas de arriba usan
   !important y ganaban por especificidad/orden, pintando encima una columna
   fija de 360px x 100% de alto que tapaba el contenido. `backdrop:false` ya
   se agregó en cada Swal.mixin/Swal.fire de toast (app.js y sus gemelos:
   cfdi-crear.js, cfdi/related.js, cfdi/lib/cfdi-enforcer.js, _auth_foot.php,
   noble/layout/scripts.php FD.toast, documentos/listado.php,
   proveedores/recepcion_proveedores.php) — este bloque es el respaldo por si
   algún caller futuro se les escapa.
   No se usa `:has()` (ej. `.swal2-container:has(.swal2-toast)`): el build
   (vite.config.js) targetea chrome87/edge88/firefox78/safari14, ninguno con
   soporte de :has(). En su lugar se reutiliza el hook nativo
   body.swal2-toast-shown que SweetAlert2 ya agrega/quita solo. A diferencia
   del selector alternativo por posición (.swal2-top-end.swal2-backdrop-show),
   este NO choca con el modal bloqueante de "Validando documentos... Espere"
   (crear_facturamanual.php, bitToast=false) que también usa position:top-end
   pero con toast:false — ese modal nunca agrega swal2-toast-shown al body,
   así que conserva su backdrop normal. */
body.swal2-toast-shown .swal2-container.swal2-backdrop-show,
body.swal2-toast-shown .swal2-container.swal2-noanimation,
body.swal2-toast-shown .swal2-container {
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* ---- La tarjeta: vidrio claro, radio generoso, sombra profunda ---- */
div:where(.swal2-container) div:where(.swal2-popup),
.swal2-popup {
    /* El 26em original asfixiaba los textos largos (líneas de ~30 caracteres
       y botones envueltos en tres renglones). Fluido: la tarjeta crece con el
       contenido hasta una medida de lectura cómoda (~36em) y las alertas
       cortas se quedan compactas; en pantallas chicas cede al viewport. */
    width: auto;
    min-width: 24em;
    max-width: min(36em, calc(100vw - 2rem));
    border-radius: 28px !important;
    border: 1px solid rgba(255, 255, 255, .65) !important;
    background: rgba(255, 255, 255, .9) !important;
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    box-shadow: 0 24px 80px rgba(13, 11, 30, .35) !important;
    padding: 2.25rem 2.25rem 2rem !important;
}

/* ---- Tipografía ---- */
.swal2-popup .swal2-title {
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.015em;
    color: #1c1917 !important;
    padding-top: 0;
}
.swal2-popup .swal2-html-container {
    font-size: .95rem !important;
    color: #78716c !important;
    line-height: 1.6 !important;
    margin-top: .35em;
    /* el contenedor de swal trae márgenes laterales de 1.6em que restaban
       aún más medida al texto */
    margin-left: .5em !important;
    margin-right: .5em !important;
    text-wrap: pretty;
}

/* ---- Iconos estilo iOS: disco tintado + glyph, sin anillos gruesos ---- */
.swal2-icon {
    width: 4.25em !important;
    height: 4.25em !important;
    border: 0 !important;
    margin: 0 auto 1.1em !important;
}
.swal2-icon.swal2-error {
    background: #fee2e2 !important;
    box-shadow: 0 0 0 10px rgba(254, 226, 226, .45);
}
.swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
    background-color: #dc2626 !important;
    height: .22em;
    border-radius: 2px;
    top: 2.05em;
    width: 1.9em;
}
.swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='left']  { left: 1.15em; }
.swal2-icon.swal2-error [class^='swal2-x-mark-line'][class$='right'] { right: 1.15em; }
.swal2-icon.swal2-success {
    background: #dcfce7 !important;
    box-shadow: 0 0 0 10px rgba(220, 252, 231, .45);
}
.swal2-icon.swal2-success .swal2-success-ring { border-color: transparent !important; }
.swal2-icon.swal2-success .swal2-success-fix,
.swal2-icon.swal2-success [class^='swal2-success-circular-line'] { background: transparent !important; }
.swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: #16a34a !important;
    height: .22em;
    border-radius: 2px;
}
.swal2-icon.swal2-warning {
    background: #fef3c7 !important;
    color: #b45309 !important;
    box-shadow: 0 0 0 10px rgba(254, 243, 199, .45);
}
.swal2-icon.swal2-info {
    background: #e0e7ff !important;
    color: #4338ca !important;
    box-shadow: 0 0 0 10px rgba(224, 231, 255, .45);
}
.swal2-icon.swal2-question {
    background: #ede9fe !important;
    color: #6d28d9 !important;
    box-shadow: 0 0 0 10px rgba(237, 233, 254, .45);
}
.swal2-icon .swal2-icon-content {
    font-size: 2.6em !important;
    font-weight: 600;
}

/* ---- Botones: pastilla, con el violeta de la marca al pasar ---- */
.swal2-actions {
    margin-top: 1.5em !important;
    gap: .6rem !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
}
.swal2-actions .swal2-styled { margin: 0 !important; }
.swal2-popup .swal2-confirm {
    border-radius: 999px !important;
    min-height: 44px;
    padding: .6rem 1.9rem !important;
    font-weight: 600 !important;
    font-size: .95rem !important;
    background-color: #1c1917 !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: none !important;
    transition: background-color .2s ease, transform .15s ease;
}
.swal2-popup .swal2-confirm:hover { background-color: #534ab7 !important; }
.swal2-popup .swal2-confirm:active { transform: scale(.98); }
.swal2-popup .swal2-confirm:focus,
.swal2-popup .swal2-cancel:focus,
.swal2-popup .swal2-deny:focus { outline: 0 !important; box-shadow: none !important; }
/* swal auto-enfoca el confirm al abrir: el ring queda como glow suave e
   intencional (se conserva por accesibilidad, no se elimina). */
.swal2-popup .swal2-confirm:focus-visible,
.swal2-popup .swal2-cancel:focus-visible,
.swal2-popup .swal2-deny:focus-visible { outline: 0 !important; box-shadow: 0 0 0 5px rgba(83, 74, 183, .16) !important; }
.swal2-popup .swal2-cancel {
    border-radius: 999px !important;
    min-height: 44px;
    padding: .6rem 1.6rem !important;
    font-weight: 600 !important;
    font-size: .95rem !important;
    background-color: transparent !important;
    border: 1px solid #e7e5e4 !important;
    color: #44403c !important;
    box-shadow: none !important;
    transition: background-color .2s ease;
}
.swal2-popup .swal2-cancel:hover { background-color: #f5f5f4 !important; color: #1c1917 !important; }
.swal2-popup .swal2-deny {
    border-radius: 999px !important;
    min-height: 44px;
    padding: .6rem 1.6rem !important;
    font-weight: 600 !important;
    background-color: #fee2e2 !important;
    border: 0 !important;
    color: #991b1b !important;
    box-shadow: none !important;
}
.swal2-popup .swal2-loader { border-color: #534ab7 transparent #534ab7 transparent !important; }

/* ---- Inputs dentro del modal ---- */
.swal2-popup .swal2-input,
.swal2-popup .swal2-textarea,
.swal2-popup .swal2-select {
    border-radius: 12px !important;
    border: 1px solid #e7e5e4 !important;
    box-shadow: none !important;
    font-size: 16px !important;
}
.swal2-popup .swal2-input:focus,
.swal2-popup .swal2-textarea:focus {
    border-color: #534ab7 !important;
    box-shadow: 0 0 0 .2rem rgba(83, 74, 183, .18) !important;
}

/* ---- Entrada y salida: suave, sin rebote ---- */
@keyframes fd-modal-in {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: none; }
}
@keyframes fd-modal-out {
    to { opacity: 0; transform: translateY(8px) scale(.97); }
}
.swal2-show { animation: fd-modal-in .28s cubic-bezier(.2, .9, .3, 1) !important; }
.swal2-hide { animation: fd-modal-out .18s ease-in forwards !important; }

/* ---- Toasts: compactos, mismo vidrio ---- */
.swal2-container .swal2-popup.swal2-toast {
    width: auto;
    border-radius: 14px !important;
    padding: .8rem 1.1rem !important;
    background: rgba(255, 255, 255, .95) !important;
    box-shadow: 0 10px 36px rgba(13, 11, 30, .22) !important;
}
.swal2-popup.swal2-toast .swal2-icon {
    width: 1.9em !important;
    height: 1.9em !important;
    margin: 0 .5em 0 0 !important;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .swal2-show, .swal2-hide { animation: none !important; }
    .swal2-popup .swal2-confirm, .swal2-popup .swal2-cancel { transition: none; }
}
