/**
 * Saara Spaces - Modern Enterprise Feedback, Modal & Loader Suite
 * Ultra-modern glassmorphic notifications, customized SweetAlert2 themes, and branded multi-tier loaders.
 */

/* ==========================================================================
   1. Modern Top-Right Toaster System (SaaraToast)
   ========================================================================== */
.saara-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: auto;
  z-index: 999999 !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 48px);
}

.saara-toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  background: #ffffff !important;
  color: #0f172a !important;
  border-radius: 14px !important;
  padding: 16px 18px 18px 16px !important;
  box-shadow: 
    0 16px 36px -4px rgba(15, 23, 42, 0.16),
    0 4px 12px -2px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(15, 23, 42, 0.08) !important;
  border: 1px solid #e2e8f0 !important;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transform-origin: top right;
  animation: saaraToastIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.saara-toast:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 20px 42px -6px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(15, 23, 42, 0.12) !important;
}

.saara-toast.toast-exiting {
  animation: saaraToastOut 0.24s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

/* Toast Type Accents & High-Contrast Colors */
.saara-toast.toast-success {
  border-left: 4.5px solid #059669 !important;
}
.saara-toast.toast-success .toast-orb {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border: 1.5px solid #a7f3d0 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2) !important;
}
.saara-toast.toast-success .toast-progress-bar {
  background: linear-gradient(90deg, #10b981, #059669) !important;
}

.saara-toast.toast-error {
  border-left: 4.5px solid #dc2626 !important;
}
.saara-toast.toast-error .toast-orb {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1.5px solid #fecaca !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2) !important;
}
.saara-toast.toast-error .toast-progress-bar {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
}

.saara-toast.toast-warning {
  border-left: 4.5px solid #d97706 !important;
}
.saara-toast.toast-warning .toast-orb {
  background: #fffbeb !important;
  color: #d97706 !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2) !important;
}
.saara-toast.toast-warning .toast-progress-bar {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
}

.saara-toast.toast-info {
  border-left: 4.5px solid #065f61 !important;
}
.saara-toast.toast-info .toast-orb {
  background: #eef7f7 !important;
  color: #065f61 !important;
  border: 1.5px solid #b5dede !important;
  box-shadow: 0 2px 8px rgba(6, 95, 97, 0.2) !important;
}
.saara-toast.toast-info .toast-progress-bar {
  background: linear-gradient(90deg, #0d9488, #065f61) !important;
}

/* Toast Icon Orb */
.toast-orb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.toast-orb svg {
  width: 20px;
  height: 20px;
}

/* Toast Body */
.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.9375rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.35;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.toast-message {
  font-size: 0.84rem !important;
  color: #334155 !important;
  line-height: 1.5;
  word-break: break-word;
  font-weight: 450;
}

/* Toast Dismiss Button */
.toast-dismiss {
  background: transparent;
  border: none;
  color: #94a3b8 !important;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s ease;
  margin-top: -2px;
  margin-right: -4px;
}

.toast-dismiss:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.toast-dismiss svg {
  width: 15px;
  height: 15px;
}

/* Interactive Auto-Dismiss Progress Bar */
.toast-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: #f1f5f9;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  animation: saaraToastProgress linear forwards;
}

/* Pause progress countdown when hovering over toast */
.saara-toast:hover .toast-progress-bar {
  animation-play-state: paused;
}

@keyframes saaraToastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes saaraToastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-16px) scale(0.95);
  }
}

@keyframes saaraToastProgress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ==========================================================================
   2. Modern SweetAlert2 Luxury Theme Overrides
   ========================================================================== */
/* Frosted Glass Backdrop */
.swal2-container.saara-swal-container {
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  background: rgba(15, 23, 42, 0.65) !important;
  z-index: 999999 !important;
}

/* Modern Card Popup */
.saara-swal-popup {
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif) !important;
  border-radius: 24px !important;
  padding: 34px 32px 30px 32px !important;
  background: #ffffff !important;
  box-shadow: 0 25px 65px -12px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.05) !important;
  border: none !important;
  max-width: 440px !important;
  width: calc(100% - 36px) !important;
  text-align: center !important;
}

.saara-swal-popup.swal2-show {
  animation: saaraSwalZoom 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.saara-swal-popup.swal2-hide {
  animation: saaraSwalFadeOut 0.16s ease-in forwards !important;
}

@keyframes saaraSwalZoom {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes saaraSwalFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* Custom Ambient Halo Icons */
.saara-swal-popup .swal2-icon {
  margin: 0 auto 20px auto !important;
  width: 64px !important;
  height: 64px !important;
  border: none !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.saara-swal-popup .swal2-icon.swal2-warning {
  background: #fffbeb !important;
  color: #f59e0b !important;
  box-shadow: 0 0 0 8px #fef3c7 !important;
}
.saara-swal-popup .swal2-icon.swal2-warning .swal2-icon-content {
  font-size: 32px !important;
  font-weight: 700 !important;
  color: #d97706 !important;
  line-height: 64px !important;
}

.saara-swal-popup .swal2-icon.swal2-error {
  background: #fef2f2 !important;
  color: #ef4444 !important;
  box-shadow: 0 0 0 8px #fee2e2 !important;
}

.saara-swal-popup .swal2-icon.swal2-success {
  background: #ecfdf5 !important;
  color: #10b981 !important;
  box-shadow: 0 0 0 8px #d1fae5 !important;
}

.saara-swal-popup .swal2-icon.swal2-info,
.saara-swal-popup .swal2-icon.swal2-question {
  background: #eef7f7 !important;
  color: #065f61 !important;
  box-shadow: 0 0 0 8px #d2ecec !important;
}

/* Luxury Sign Out Custom Icon */
.saara-swal-popup .swal2-icon.saara-swal-signout-icon,
.saara-swal-popup .swal2-icon.swal2-signout {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  box-shadow: 0 0 0 8px #ffe4e6 !important;
  border: none !important;
}
.saara-swal-popup .swal2-icon.saara-swal-signout-icon svg,
.saara-swal-popup .swal2-icon.swal2-signout svg {
  color: #e11d48 !important;
  display: block !important;
}

/* Luxury Publish Custom Icon */
.saara-swal-popup .swal2-icon.saara-swal-publish-icon {
  background: #ecfdf5 !important;
  color: #059669 !important;
  box-shadow: 0 0 0 8px #d1fae5 !important;
  border: none !important;
}
.saara-swal-popup .swal2-icon.saara-swal-publish-icon svg {
  color: #059669 !important;
  display: block !important;
}

/* Luxury Unpublish Custom Icon */
.saara-swal-popup .swal2-icon.saara-swal-unpublish-icon {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  box-shadow: 0 0 0 8px #ffe4e6 !important;
  border: none !important;
}
.saara-swal-popup .swal2-icon.saara-swal-unpublish-icon svg {
  color: #e11d48 !important;
  display: block !important;
}

/* SweetAlert Typography */
.saara-swal-popup .swal2-title {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.015em !important;
  padding: 0 !important;
  margin: 0 0 10px 0 !important;
}

.saara-swal-popup .swal2-html-container {
  font-size: 0.9375rem !important;
  color: #475569 !important;
  line-height: 1.55 !important;
  margin: 0 0 28px 0 !important;
}

.saara-swal-popup .swal2-html-container strong {
  color: #0f172a;
  font-weight: 600;
}

/* SweetAlert Symmetrical Action Buttons */
.saara-swal-popup .swal2-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  pointer-events: auto !important;
}

.saara-swal-popup .swal2-actions button:not(.swal2-deny) {
  margin: 0 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 10 !important;
  height: 44px !important;
  min-height: 44px !important;
  user-select: none !important;
  border-radius: 12px !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
}

.saara-swal-popup .swal2-actions button:not(.swal2-deny) * {
  pointer-events: none !important;
}

/* Strictly remove and suppress the "No" / Deny button */
.saara-swal-popup .swal2-deny,
.saara-swal-popup button.swal2-deny,
.swal2-popup .swal2-actions .swal2-deny {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  outline: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Cancel Button (Clean high-contrast slate) */
.saara-swal-popup .saara-swal-cancel-btn,
.saara-swal-popup .btn-saara-secondary,
.saara-swal-popup .swal2-cancel {
  flex: 1 !important;
  background: #ffffff !important;
  color: #475569 !important;
  border: 1.5px solid #cbd5e1 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.saara-swal-popup .saara-swal-cancel-btn:hover,
.saara-swal-popup .btn-saara-secondary:hover,
.saara-swal-popup .swal2-cancel:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
  transform: translateY(-1px) !important;
}

/* Confirm Danger Button (Crimson Gradient) */
.saara-swal-popup .saara-swal-confirm-danger,
.saara-swal-popup .btn-danger,
.saara-swal-popup .swal2-confirm {
  flex: 1 !important;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.saara-swal-popup .saara-swal-confirm-danger:hover,
.saara-swal-popup .btn-danger:hover,
.saara-swal-popup .swal2-confirm:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45) !important;
  transform: translateY(-1px) !important;
  color: #ffffff !important;
}

/* Confirm Primary Button */
.saara-swal-popup .saara-swal-confirm-primary,
.saara-swal-popup .btn-saara-primary {
  flex: 1 !important;
  background: linear-gradient(135deg, #0d7678 0%, #065f61 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(6, 95, 97, 0.35) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.saara-swal-popup .saara-swal-confirm-primary:hover,
.saara-swal-popup .btn-saara-primary:hover {
  background: linear-gradient(135deg, #065f61 0%, #033233 100%) !important;
  box-shadow: 0 6px 18px rgba(6, 95, 97, 0.45) !important;
  transform: translateY(-1px) !important;
  color: #ffffff !important;
}

/* Completely suppress top-right 'X' close button to keep strictly one Cancel button */
.saara-swal-popup .swal2-close {
  display: none !important;
}

/* Built-in Spinner State in Swal Confirm Button */
.saara-swal-popup .swal2-confirm.swal2-loading {
  position: relative !important;
  pointer-events: none !important;
}

/* ==========================================================================
/* ==========================================================================
/* ==========================================================================
/* ==========================================================================
   3. Simple & Clean SaaraSpace Data Loader Suite
   ========================================================================== */
/* Lightweight Frosted Overlay */
.saara-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.saara-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Inline Container Loader */
.saara-loader-overlay.is-inline {
  position: absolute;
  border-radius: inherit;
  width: 100%;
  height: 100%;
}

/* Simple Clean White Floating Card */
.saara-simple-loader-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 20px 28px;
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 170px;
  max-width: 280px;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.saara-loader-overlay.active .saara-simple-loader-card {
  transform: scale(1);
}

/* Crisp Brand Teal Spinner */
.saara-simple-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #0d7678;
  border-radius: 50%;
  animation: saaraSimpleSpin 0.75s linear infinite;
}

@keyframes saaraSimpleSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Simple Readable Status Message */
.saara-simple-message {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  color: #334155;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
}

/* ==========================================================================
   4. Table & Card Skeleton Shimmer Waves
   ========================================================================== */
.saara-skeleton {
  position: relative;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 6px;
}

.saara-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.65) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: saaraSkeletonShimmer 1.5s infinite;
}

@keyframes saaraSkeletonShimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Responsive mobile adjustments */
@media (max-width: 640px) {
  .saara-toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
  .saara-toast {
    padding: 14px 14px 16px 14px;
  }
}

/* ==========================================================================
   6. Form Validation Error Visual Styles (.input-error)
   ========================================================================== */
.input-error,
.form-input.input-error,
.drawer-form-input.input-error,
input.input-error,
select.input-error,
textarea.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
  background-color: #fffafb !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-error:focus,
.form-input.input-error:focus,
.drawer-form-input.input-error:focus,
input.input-error:focus,
select.input-error:focus,
textarea.input-error:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25) !important;
  outline: none !important;
}

/* ==========================================================================
   7. Dedicated Luxury Sign Out Popup & Fallback Modal System
   ========================================================================== */
.saara-swal-signout-popup {
  max-width: 440px !important;
  padding: 34px 30px 28px 30px !important;
}

.saara-swal-signout-popup .swal2-title {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.015em !important;
  margin: 0 0 8px 0 !important;
}

.saara-signout-modal-desc {
  font-size: 0.9375rem !important;
  color: #475569 !important;
  line-height: 1.55 !important;
  margin: 0 0 4px 0 !important;
}

.saara-signout-subtext {
  font-size: 0.8125rem !important;
  color: #64748b !important;
  line-height: 1.4 !important;
  margin-top: 6px !important;
}

/* Fallback pure-DOM modal backdrop when SweetAlert2 is offline */
.saara-fallback-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 9999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  animation: saaraSwalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes saaraSwalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.saara-fallback-modal-backdrop.closing {
  opacity: 0 !important;
  transition: opacity 0.18s ease-in !important;
}

.saara-fallback-modal-backdrop.closing .saara-swal-popup {
  animation: saaraSwalFadeOut 0.18s ease-in forwards !important;
}

