/**
 * BaliMed CUP - Modern Animated SweetAlert2 Design System
 * Dioptimalkan untuk Layar HP, Tablet, dan Desktop dengan Animasi Berenergi & Responsif
 */

/* ==========================================================================
   1. KEYFRAME ANIMATIONS (BOUNCE, ZOOM, PULSE, SHAKE)
   ========================================================================== */

@keyframes swalBounceIn {
  0% {
    opacity: 0;
    transform: scale3d(0.65, 0.65, 0.65) translateY(-25px);
  }
  50% {
    opacity: 1;
    transform: scale3d(1.04, 1.04, 1.04) translateY(0);
  }
  75% {
    transform: scale3d(0.98, 0.98, 0.98);
  }
  100% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes swalBounceOut {
  0% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
  35% {
    transform: scale3d(1.03, 1.03, 1.03);
  }
  100% {
    opacity: 0;
    transform: scale3d(0.7, 0.7, 0.7) translateY(-20px);
  }
}

@keyframes swalSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-40px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes swalShake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-7px); }
  30%, 60%, 90% { transform: translateX(7px); }
}

@keyframes swalIconPop {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-20deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.15) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes swalBackdropFade {
  0% {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  100% {
    opacity: 1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

/* ==========================================================================
   2. CORE POPUP ANIMATION CLASSES
   ========================================================================== */

.swal-animate-bounce-in,
.swal2-popup.swal-animate-bounce-in {
  animation: swalBounceIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

.swal-animate-bounce-out,
.swal2-popup.swal-animate-bounce-out {
  animation: swalBounceOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

.swal-animate-shake,
.swal2-popup.swal-animate-shake {
  animation: swalShake 0.45s ease-in-out !important;
}

/* Pastikan animasi tetap aktif di HP/tablet meskipun device ada battery saver */
@media (prefers-reduced-motion: reduce) {
  .swal-animate-bounce-in,
  .swal2-popup.swal-animate-bounce-in {
    animation: swalBounceIn 0.35s ease-out forwards !important;
  }
  .swal-animate-bounce-out,
  .swal2-popup.swal-animate-bounce-out {
    animation: swalBounceOut 0.2s ease-in forwards !important;
  }
}

/* ==========================================================================
   3. MODERN POPUP & BACKDROP STYLING (GLOBAL)
   ========================================================================== */

.swal2-container.swal2-backdrop-show {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  animation: swalBackdropFade 0.3s ease-out forwards !important;
}

.swal2-popup {
  border-radius: 20px !important;
  padding: 24px 20px !important;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35),
              0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  background: #ffffff !important;
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Icon Animated Polish */
.swal2-icon {
  margin: 10px auto 16px auto !important;
  animation: swalIconPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.swal2-title {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.35 !important;
  margin-bottom: 8px !important;
  padding: 0 !important;
}

.swal2-html-container {
  font-size: 0.95rem !important;
  color: #475569 !important;
  line-height: 1.55 !important;
  margin: 8px 0 18px 0 !important;
  padding: 0 4px !important;
}

/* Action Buttons Styling */
.swal2-actions {
  margin-top: 18px !important;
  gap: 10px !important;
  width: 100% !important;
  justify-content: center !important;
}

.swal2-styled {
  font-family: inherit !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  padding: 11px 22px !important;
  border-radius: 12px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer !important;
  outline: none !important;
  align-items: center !important;
  justify-content: center !important;
  letter-spacing: 0.2px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Tombol Deny ("No") tidak pernah dipakai dalam sistem dan disembunyikan permanen */
button.swal2-deny,
.swal2-actions button.swal2-deny,
.swal2-deny {
  display: none !important;
}

/* Pastikan tombol apapun yang disembunyikan SweetAlert2 (misal Cancel pada alert sukses/info) tidak pernah muncul */
.swal2-styled[style*="display: none"],
.swal2-styled[style*="display:none"],
.swal2-actions button[style*="display: none"],
.swal2-actions button[style*="display:none"],
button.swal2-cancel[style*="display: none"],
button.swal2-cancel[style*="display:none"] {
  display: none !important;
}

.swal2-confirm {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  color: #ffffff !important;
  border: none !important;
}

.swal2-confirm:hover {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25) !important;
}

.swal2-confirm:active {
  transform: scale(0.97) !important;
}

.swal2-cancel {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

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

.swal2-cancel:active {
  transform: scale(0.97) !important;
}

/* Toast Polish */
.swal2-toast {
  border-radius: 14px !important;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.2) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  padding: 10px 14px !important;
}

/* Toast Backdrop Override (Hapus background hitam dan blur saat toast aktif) */
body.swal2-toast-shown .swal2-container,
body.swal2-toast-shown .swal2-container.swal2-backdrop-show,
.swal2-toast-shown .swal2-container,
.swal2-container:has(.swal2-toast) {
  background: transparent !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  animation: none !important;
  pointer-events: none !important;
}
body.swal2-toast-shown .swal2-toast,
.swal2-container:has(.swal2-toast) .swal2-toast {
  pointer-events: auto !important;
}

/* ==========================================================================
   4. LAYAR HP & TABLET OPTIMIZATION (< 768px dan < 576px)
   ========================================================================== */

@media (max-width: 768px) {
  .swal2-container {
    padding: 16px !important;
  }

  .swal2-popup {
    width: 92% !important;
    max-width: 390px !important;
    padding: 22px 16px !important;
    border-radius: 18px !important;
  }

  .swal2-title {
    font-size: 1.15rem !important;
  }

  .swal2-html-container {
    font-size: 0.90rem !important;
    margin: 6px 0 16px 0 !important;
  }

  .swal2-actions {
    flex-direction: column-reverse !important;
    width: 100% !important;
    margin: 12px 0 0 0 !important;
    gap: 8px !important;
  }

  .swal2-styled:not(.swal2-deny) {
    width: 100% !important;
    min-height: 46px !important;
    margin: 0 !important;
    font-size: 0.95rem !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  .swal2-icon {
    width: 60px !important;
    height: 60px !important;
    margin: 8px auto 14px auto !important;
  }

  .swal2-icon .swal2-icon-content {
    font-size: 40px !important;
  }
}

@media (max-width: 480px) {
  .swal2-popup {
    width: 95% !important;
    max-width: 350px !important;
    padding: 20px 14px !important;
    border-radius: 16px !important;
  }

  .swal2-title {
    font-size: 1.08rem !important;
  }

  .swal2-html-container {
    font-size: 0.88rem !important;
  }

  .swal2-styled:not(.swal2-deny) {
    min-height: 44px !important;
    font-size: 0.92rem !important;
  }
}
