/**
 * Sonner-Swal for FacturandoRD
 * Modern 2026 redesign for SweetAlert popups inspired by Emil Kowalski (Sonner)
 * Features: Frosted Glass Backdrop, Smooth Scale Entrance, 20px Radius, Multilayer Shadows, Sonner Action Buttons.
 */

/* ==========================================================================
   1. Overlay / Backdrop (Frosted Glass)
   ========================================================================== */
.swal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background-color: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(8px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(8px) saturate(150%) !important;
  z-index: 999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 220ms ease !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

.swal-overlay:before {
  display: none !important;
}

.swal-overlay--show-modal {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ==========================================================================
   2. Modal Card Container
   ========================================================================== */
.swal-modal {
  width: 420px !important;
  max-width: 100% !important;
  background-color: #ffffff !important;
  border-radius: 20px !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
  padding: 30px 24px 24px 24px !important;
  margin: 0 !important;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  box-sizing: border-box !important;
  opacity: 0 !important;
  transform: scale(0.95) !important;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
}

.swal-overlay--show-modal .swal-modal {
  opacity: 1 !important;
  transform: scale(1) !important;
  animation: sonnerSwalEnter 240ms cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes sonnerSwalEnter {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   3. Minimalist Modern Icons (Avatar 54px)
   ========================================================================== */
.swal-icon {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  min-height: 54px !important;
  border-radius: 50% !important;
  margin: 0 auto 16px auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-color: transparent !important;
  animation: none !important;
}

/* Ocultar elementos CSS arcaicos de SweetAlert 2015 */
.swal-icon:after,
.swal-icon:before,
.swal-icon--error__line,
.swal-icon--warning__body,
.swal-icon--warning__dot,
.swal-icon--success__line,
.swal-icon--success__ring,
.swal-icon--success:after,
.swal-icon--success:before,
.swal-icon--info:after,
.swal-icon--info:before {
  display: none !important;
  content: none !important;
}

/* Paleta de colores Sonner para iconos */
.swal-icon--warning {
  background-color: hsl(49, 100%, 95%) !important;
  border-color: hsl(49, 91%, 84%) !important;
  color: hsl(31, 92%, 45%) !important;
}

.swal-icon--error {
  background-color: hsl(359, 100%, 96%) !important;
  border-color: hsl(359, 100%, 90%) !important;
  color: hsl(360, 100%, 45%) !important;
}

.swal-icon--success {
  background-color: hsl(143, 85%, 96%) !important;
  border-color: hsl(145, 92%, 87%) !important;
  color: hsl(140, 100%, 27%) !important;
}

.swal-icon--info {
  background-color: hsl(208, 100%, 96%) !important;
  border-color: hsl(221, 91%, 90%) !important;
  color: hsl(210, 92%, 45%) !important;
}

.swal-icon svg {
  width: 26px !important;
  height: 26px !important;
  display: block !important;
}

/* ==========================================================================
   4. Typography (Title & Text)
   ========================================================================== */
.swal-title {
  font-size: 19px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  letter-spacing: -0.015em !important;
  line-height: 1.3 !important;
  text-align: center !important;
  padding: 0 !important;
  margin: 0 0 8px 0 !important;
  display: block !important;
  width: 100% !important;
}

.swal-title:first-child {
  margin-top: 4px !important;
}

.swal-title:not(:last-child) {
  margin-bottom: 8px !important;
}

.swal-text {
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #64748b !important;
  line-height: 1.55 !important;
  text-align: center !important;
  padding: 0 !important;
  margin: 0 auto !important;
  max-width: 360px !important;
  display: block !important;
  float: none !important;
}

.swal-text:first-child {
  margin-top: 4px !important;
}

.swal-text:last-child {
  margin-bottom: 0 !important;
}

.swal-content {
  padding: 0 !important;
  margin-top: 14px !important;
  width: 100% !important;
  text-align: center !important;
}

.swal-content__input {
  border-radius: 9px !important;
  border: 1px solid #cbd5e1 !important;
  padding: 10px 14px !important;
  font-size: 14px !important;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.swal-content__input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
  outline: none !important;
}

/* ==========================================================================
   5. Action Buttons (Estilo Sonner)
   ========================================================================== */
.swal-footer {
  width: 100% !important;
  margin-top: 24px !important;
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 12px !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

.swal-button-container {
  margin: 0 !important;
  display: inline-flex !important;
  flex: 1 1 auto !important;
  max-width: 185px !important;
}

.swal-button {
  width: 100% !important;
  min-width: 120px !important;
  height: 40px !important;
  line-height: 40px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  border-radius: 9px !important;
  padding: 0 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  border: none !important;
  outline: none !important;
  transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease !important;
  user-select: none !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

.swal-button:focus,
.swal-button--focus {
  outline: none !important;
  box-shadow: none !important;
}

.swal-button:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25) !important;
}

.swal-button:active {
  transform: scale(0.98) !important;
}

/* Botón Cancelar */
.swal-button--cancel {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

.swal-button--cancel:hover {
  background-color: #e2e8f0 !important;
  color: #1e293b !important;
}

/* Botón Peligro (Eliminar, Anular, Acciones Destructivas) */
.swal-button--danger {
  background-color: #e11d48 !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  box-shadow: 0 2px 4px rgba(225, 29, 72, 0.2) !important;
}

.swal-button--danger:hover {
  background-color: #be123c !important;
  box-shadow: 0 4px 6px rgba(225, 29, 72, 0.25) !important;
}

/* Botón Confirmar Estándar (No Peligro) */
.swal-button--confirm:not(.swal-button--danger) {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15) !important;
}

.swal-button--confirm:not(.swal-button--danger):hover {
  background-color: #1e293b !important;
  box-shadow: 0 4px 6px rgba(15, 23, 42, 0.2) !important;
}

/* Responsive Móvil */
@media (max-width: 480px) {
  .swal-modal {
    width: 100% !important;
    padding: 24px 18px 20px 18px !important;
    border-radius: 18px !important;
  }
  .swal-footer {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  .swal-button-container {
    width: 100% !important;
  }
  .swal-button {
    width: 100% !important;
  }
}

/* Modo Oscuro (Dark Theme) */
html[data-theme="dark"] .swal-modal,
body.dark .swal-modal {
  background-color: #1a2231 !important;
  border-color: #1d2939 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] .swal-title,
body.dark .swal-title {
  color: rgba(255, 255, 255, 0.95) !important;
}

html[data-theme="dark"] .swal-text,
body.dark .swal-text {
  color: #98a2b3 !important;
}

html[data-theme="dark"] .swal-button--cancel,
body.dark .swal-button--cancel {
  background-color: #242e42 !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
}

html[data-theme="dark"] .swal-button--cancel:hover,
body.dark .swal-button--cancel:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
}
