/* ═══════════════════════════════════════════════════════════
   SURAKSHA MEDICAL — PREMIUM PAGE LOADER
═══════════════════════════════════════════════════════════ */

/* Lock scroll while loader is active */
body.loading { overflow: hidden; }

/* ── Overlay ────────────────────────────────────────────── */
#pageLoader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0f1e;
  opacity: 1;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#pageLoader.exit {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

/* ── Gradient background ────────────────────────────────── */
.loader-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%,
    rgba(13, 148, 136, 0.18) 0%,
    rgba(15, 23, 42, 0.95) 60%,
    #0a0f1e 100%);
  animation: bgPulse 4s ease-in-out infinite;
}
@keyframes bgPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.85; }
}

/* ── Particles ──────────────────────────────────────────── */
.loader-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,184,166,0.6), transparent 70%);
  animation: particleDrift linear infinite;
  opacity: 0;
}
@keyframes particleDrift {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-20vh) scale(1.5); opacity: 0; }
}

/* ── Center stage ───────────────────────────────────────── */
.loader-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ── Glow ring ──────────────────────────────────────────── */
.loader-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
}

/* Outer glow pulse */
.loader-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,184,166,0.25) 0%, transparent 70%);
  animation: glowPulse 2s ease-in-out infinite;
  opacity: 0;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.4; }
  50%       { transform: scale(1.15); opacity: 0.9; }
}

/* Spinning ring */
.loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #14b8a6;
  border-right-color: rgba(20,184,166,0.3);
  animation: ringSpinOuter 1.4s linear infinite;
  box-shadow: 0 0 20px rgba(20,184,166,0.4),
              inset 0 0 20px rgba(20,184,166,0.05);
}
.loader-ring-inner {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-bottom-color: #38bdf8;
  border-left-color: rgba(56,189,248,0.25);
  animation: ringSpinInner 1s linear infinite reverse;
  box-shadow: 0 0 12px rgba(56,189,248,0.3);
}
@keyframes ringSpinOuter {
  to { transform: rotate(360deg); }
}
@keyframes ringSpinInner {
  to { transform: rotate(360deg); }
}

/* ── Logo box ───────────────────────────────────────────── */
.loader-logo-box {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  background: linear-gradient(135deg, #0d9488, #14b8a6, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(20,184,166,0.5),
              0 0 80px rgba(20,184,166,0.2),
              inset 0 1px 0 rgba(255,255,255,0.2);
  opacity: 0;
  transform: scale(0.6);
  animation: logoReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s forwards;
  position: relative;
  overflow: hidden;
}
@keyframes logoReveal {
  to { opacity: 1; transform: scale(1); }
}

/* Shimmer sweep */
.loader-logo-box::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.35) 50%,
    transparent 60%
  );
  animation: shimmer 2.5s ease-in-out 1.2s infinite;
}
@keyframes shimmer {
  0%   { left: -75%; }
  100% { left: 125%; }
}

.loader-logo-box img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.loader-logo-box i {
  font-size: 2rem;
  color: #fff;
}

/* ── Brand name — letter reveal ─────────────────────────── */
.loader-brand {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  display: flex;
  gap: 0;
  overflow: hidden;
  margin-bottom: 10px;
}
.loader-brand .word { display: flex; margin-right: 0.3em; }
.loader-brand .word:last-child { margin-right: 0; }
.loader-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px);
  animation: letterUp 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

@keyframes letterUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Tagline ────────────────────────────────────────────── */
.loader-tagline {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(94, 234, 212, 0.85);
  opacity: 0;
  transform: translateY(10px);
  animation: taglineReveal 0.4s ease 0.6s forwards;
  margin-bottom: 48px;
}

/* ── Divider line ───────────────────────────────────────── */
.loader-divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20,184,166,0.6), transparent);
  margin: 0 auto 48px;
  opacity: 0;
  animation: taglineReveal 0.4s ease 0.65s forwards;
}

/* ── Progress bar ───────────────────────────────────────── */
.loader-progress-wrap {
  width: min(320px, 80vw);
  opacity: 0;
  animation: taglineReveal 0.3s ease 0.7s forwards;
}
.loader-progress-track {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.loader-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #0d9488, #14b8a6, #38bdf8);
  box-shadow: 0 0 12px rgba(20,184,166,0.7);
  transition: width 0.05s linear;
  position: relative;
}
/* Moving glow dot at tip */
.loader-progress-fill::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(56,189,248,0.9), 0 0 16px rgba(20,184,166,0.6);
}
.loader-progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}
.loader-progress-pct {
  color: rgba(94,234,212,0.8);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Content reveal after loader ────────────────────────── */
#mainContent {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1),
              transform 0.7s cubic-bezier(0.4,0,0.2,1);
}
#mainContent.revealed {
  opacity: 1;
  transform: translateY(0);
}
