/* ==========================================================================
   Rainflower Pharmaceuticals - Brand Logo Preloader
   Ultra-modern, smooth, responsive loading screen with logo centerpiece
   ========================================================================== */

/* Critical Preloader Container */
#rf-preloader,
.rf-preloader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 99999999;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.55s cubic-bezier(0.25, 1, 0.5, 1),
              visibility 0.55s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.55s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, visibility, transform;
}

/* Exit State */
#rf-preloader.rf-preloader-done,
.rf-preloader.rf-preloader-done {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(1.02);
}

/* Lock scrolling while preloader is active */
body.rf-preloader-active {
  overflow: hidden !important;
}

/* Ambient Radial Glow Backdrop */
.rf-preloader-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 50% 50%,
      rgba(18, 180, 139, 0.12) 0%,
      rgba(245, 158, 11, 0.05) 35%,
      rgba(255, 255, 255, 0) 70%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(18, 180, 139, 0.04) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 20% 80%,
      rgba(245, 158, 11, 0.04) 0%,
      transparent 40%
    );
  pointer-events: none;
  animation: rf-ambient-pulse 5s ease-in-out infinite alternate;
}

/* Main Content Centerpiece */
.rf-preloader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  animation: rf-content-intro 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Floating Logo Card */
.rf-preloader-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 40px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(18, 180, 139, 0.18);
  box-shadow: 
    0 20px 50px -10px rgba(18, 180, 139, 0.15),
    0 10px 25px -5px rgba(14, 30, 46, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: rf-card-float 3.5s ease-in-out infinite alternate;
}

/* Orbital Ambient Halo Rings */
.rf-preloader-rings {
  position: absolute;
  inset: -14px;
  pointer-events: none;
  border-radius: 36px;
}

/* Spinning Ring 1 - Emerald Arc */
.rf-ring-1 {
  position: absolute;
  inset: -8px;
  border-radius: 36px;
  border: 2px solid transparent;
  border-top-color: #12b48b;
  border-right-color: rgba(18, 180, 139, 0.3);
  animation: rf-orbit-spin 3s linear infinite;
}

/* Spinning Ring 2 - Amber/Orange Arc (Counter-spin) */
.rf-ring-2 {
  position: absolute;
  inset: -15px;
  border-radius: 42px;
  border: 2px dashed rgba(245, 158, 11, 0.35);
  border-bottom-color: #f59e0b;
  animation: rf-orbit-spin-reverse 5s linear infinite;
}

/* Orbiting Glow Particle */
.rf-orbit-dot {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background-color: #12b48b;
  box-shadow: 0 0 14px 3px rgba(18, 180, 139, 0.8), 0 0 6px #12b48b;
  animation: rf-dot-travel 3s linear infinite;
}

/* Logo Image Container */
.rf-logo-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  border-radius: 12px;
  line-height: 0;
}

/* The Rainflower Logo */
.rf-preload-logo {
  max-width: 210px;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(18, 180, 139, 0.12));
  animation: rf-logo-breathe 2.8s ease-in-out infinite;
  transform-origin: center center;
}

/* Luminous Shimmer Light Sweep across Logo */
.rf-logo-shimmer {
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.75) 50%,
    rgba(255, 255, 255, 0) 80%,
    transparent 100%
  );
  transform: skewX(-25deg);
  animation: rf-shimmer-pass 2.8s ease-in-out infinite;
  pointer-events: none;
}

/* Progress Bar Container */
.rf-progress-wrap {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rf-progress-bar {
  width: 190px;
  height: 4px;
  background-color: rgba(18, 180, 139, 0.14);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Indeterminate Smooth Progress Movement */
.rf-progress-indeterminate {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(
    90deg,
    rgba(18, 180, 139, 0.2) 0%,
    #12b48b 50%,
    #f59e0b 80%,
    #12b48b 100%
  );
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(18, 180, 139, 0.5);
  animation: rf-progress-glide 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Loading Meta Information */
.rf-loading-meta {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rf-loading-title {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: #0e1e2e;
  text-transform: uppercase;
}

.rf-loading-subtitle {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
}

/* Dynamic Animated Ellipsis */
.rf-ellipsis::after {
  content: "";
  display: inline-block;
  width: 16px;
  text-align: left;
  animation: rf-ellipsis-steps 1.5s steps(4, end) infinite;
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

/* Ambient Pulse */
@keyframes rf-ambient-pulse {
  0% {
    transform: scale(0.96);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* Content Entrance */
@keyframes rf-content-intro {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Card Float Oscillation */
@keyframes rf-card-float {
  0% {
    transform: translateY(0);
    box-shadow: 
      0 18px 45px -10px rgba(18, 180, 139, 0.14),
      0 8px 20px -5px rgba(14, 30, 46, 0.05);
  }
  100% {
    transform: translateY(-7px);
    box-shadow: 
      0 26px 60px -10px rgba(18, 180, 139, 0.22),
      0 14px 28px -5px rgba(14, 30, 46, 0.08);
  }
}

/* Logo Gentle Breathe */
@keyframes rf-logo-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 4px 10px rgba(18, 180, 139, 0.12));
  }
  50% {
    transform: scale(1.032);
    filter: drop-shadow(0 8px 22px rgba(18, 180, 139, 0.26));
  }
}

/* Shimmer Pass */
@keyframes rf-shimmer-pass {
  0% {
    left: -120%;
  }
  40%, 100% {
    left: 150%;
  }
}

/* Orbit Spin Clockwise */
@keyframes rf-orbit-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Orbit Spin Counter-Clockwise */
@keyframes rf-orbit-spin-reverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

/* Orbit Dot Travel around the perimeter */
@keyframes rf-dot-travel {
  0% {
    transform: rotate(0deg) translateY(-85px) rotate(0deg);
  }
  100% {
    transform: rotate(360deg) translateY(-85px) rotate(-360deg);
  }
}

/* Indeterminate Progress Glide */
@keyframes rf-progress-glide {
  0% {
    left: -50%;
    width: 30%;
  }
  50% {
    left: 25%;
    width: 60%;
  }
  100% {
    left: 100%;
    width: 40%;
  }
}

/* Ellipsis Step Animation */
@keyframes rf-ellipsis-steps {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
  100% {
    content: "";
  }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 576px) {
  .rf-preloader-card {
    padding: 24px 28px;
    border-radius: 22px;
  }

  .rf-preload-logo {
    max-width: 170px;
  }

  .rf-progress-bar {
    width: 150px;
  }

  .rf-loading-title {
    font-size: 12px;
  }

  .rf-loading-subtitle {
    font-size: 11px;
  }

  .rf-ring-1 {
    inset: -6px;
    border-radius: 28px;
  }

  .rf-ring-2 {
    inset: -12px;
    border-radius: 34px;
  }
}

/* Respect Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  #rf-preloader,
  .rf-preloader,
  .rf-preloader-backdrop,
  .rf-preloader-card,
  .rf-preload-logo,
  .rf-logo-shimmer,
  .rf-ring-1,
  .rf-ring-2,
  .rf-orbit-dot,
  .rf-progress-indeterminate {
    animation: none !important;
    transition: opacity 0.3s ease !important;
  }

  .rf-logo-shimmer,
  .rf-orbit-dot {
    display: none !important;
  }
}
