/* =====================================================================
   MAILNEX OFFICIAL BRANDED PRELOADER STYLES
   Colors:
     - Pure White:    #FFFFFF
     - Deep Green:    #193E20
     - Golden Yellow: #EFA627
   ===================================================================== */

.mailnex-preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.26s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.mailnex-preloader.mailnex-preloader-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.mailnex-preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.mailnex-preloader-ring-wrapper {
  position: relative;
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Surrounding SVG Circular Spinner */
.mailnex-preloader-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  animation: mailnexRingSpin 1.4s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.mailnex-preloader-track {
  opacity: 0.22;
}

.mailnex-preloader-arc.arc-green {
  stroke-dasharray: 60 216;
  stroke-dashoffset: 0;
  animation: mailnexArcGreen 1.4s ease-in-out infinite;
}

.mailnex-preloader-arc.arc-golden {
  stroke-dasharray: 60 216;
  stroke-dashoffset: -138;
  animation: mailnexArcGolden 1.4s ease-in-out infinite;
}

/* Centered Official MailNex M Icon */
.mailnex-preloader-icon-container {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.mailnex-preloader-icon {
  width: 50px;
  height: 50px;
  max-width: 50px;
  max-height: 50px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(25, 62, 32, 0.12));
  animation: mailnexIconSubtlePulse 2.4s ease-in-out infinite;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Keyframe Animations */
@keyframes mailnexRingSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes mailnexArcGreen {
  0% {
    stroke-dasharray: 60 216;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 110 166;
    stroke-dashoffset: -15;
  }
  100% {
    stroke-dasharray: 60 216;
    stroke-dashoffset: -276;
  }
}

@keyframes mailnexArcGolden {
  0% {
    stroke-dasharray: 60 216;
    stroke-dashoffset: -138;
  }
  50% {
    stroke-dasharray: 110 166;
    stroke-dashoffset: -153;
  }
  100% {
    stroke-dasharray: 60 216;
    stroke-dashoffset: -414;
  }
}

@keyframes mailnexIconSubtlePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.025);
    opacity: 0.94;
  }
}

/* Accessibility: Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  .mailnex-preloader-ring {
    animation: none;
    transform: rotate(45deg);
  }
  .mailnex-preloader-arc.arc-green,
  .mailnex-preloader-arc.arc-golden,
  .mailnex-preloader-icon {
    animation: none;
  }
}

/* Lightweight In-Page / Button Loading Feedback (Utility) */
.mailnex-inline-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(239, 166, 39, 0.3);
  border-top-color: #EFA627;
  border-right-color: #193E20;
  border-radius: 50%;
  animation: mailnexRingSpin 0.75s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
