/**
 * PiggyTask - Cybernetic Radar Preloader & Page Transition Matrix
 * Exact visual fidelity to dark frosted glass + glowing emerald radar reference.
 */

.piggy-loader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active State */
.piggy-loader.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Dark Frosted Glass Backdrop Overlay (Preserves page context underneath in dark blur) */
.piggy-loader__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 20, 0.82);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
}

/* Center HUD Matrix */
.piggy-loader__center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
  padding: 1.5rem;
}

/* ═══════════════ EMERALD RADAR MATRIX (MATCHES IMAGE 2) ═══════════════ */
.piggy-loader__sonar {
  position: relative;
  width: 130px;
  height: 130px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Concentric Radar Rings */
.sonar-ring {
  position: absolute;
  border-radius: 50%;
  box-sizing: border-box;
}

/* Outer Ring & Orbiting Blip */
.sonar-ring--outer {
  inset: 0;
  border: 1.5px solid rgba(16, 185, 129, 0.42);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.12), inset 0 0 18px rgba(16, 185, 129, 0.08);
  animation: sonarOrbitCW 16s linear infinite;
}

/* Inner Ring & Orbiting Blip */
.sonar-ring--inner {
  inset: 26px;
  border: 1.5px solid rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.2);
  animation: sonarOrbitCCW 12s linear infinite;
}

/* Orbiting Detection Blips on Rings */
.sonar-orbit-blip {
  position: absolute;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #10b981, 0 0 20px rgba(16, 185, 129, 0.9);
}

.sonar-orbit-blip--outer {
  width: 7px;
  height: 7px;
  top: 14px;
  right: 18px;
  animation: blipPulse 2s ease-in-out infinite alternate;
}

.sonar-orbit-blip--inner {
  width: 6px;
  height: 6px;
  bottom: 12px;
  left: 10px;
  animation: blipPulse 1.6s ease-in-out infinite alternate-reverse;
}

/* Crosshairs (Subtle radar axes) */
.sonar-crosshair {
  position: absolute;
  background: rgba(16, 185, 129, 0.18);
  pointer-events: none;
}

.sonar-crosshair--h {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.sonar-crosshair--v {
  height: 100%;
  width: 1px;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

/* Smooth Sweeping Radar Beam */
.sonar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(16, 185, 129, 0.5) 0deg,
    rgba(16, 185, 129, 0.18) 32deg,
    rgba(16, 185, 129, 0.03) 65deg,
    transparent 85deg,
    transparent 360deg
  );
  animation: sonarSweepSpin 2.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.45));
}

/* Glowing Radar Core Dot (Matches Image 2) */
.sonar-core {
  position: relative;
  z-index: 4;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 14px #10b981, 0 0 28px rgba(16, 185, 129, 0.85);
}

.sonar-core::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid #10b981;
  animation: coreRipple 1.8s cubic-bezier(0.2, 0, 0.35, 1) infinite;
  opacity: 0;
}

/* ═══════════════ BRAND IDENTITY (MATCHES IMAGE 2 "TrackFlow" STYLE) ═══════════════ */
.piggy-loader__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.piggy-loader__title {
  font-family: 'Playfair Display', 'Cinzel', Georgia, serif;
  font-style: italic;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #34d399;
  text-shadow: 0 0 16px rgba(52, 211, 153, 0.75), 0 0 35px rgba(16, 185, 129, 0.4);
  line-height: 1.15;
}

.piggy-loader__motto {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(203, 213, 225, 0.7);
  margin-top: 0.25rem;
}

/* ═══════════════ TELEMETRY STATUS BADGE ═══════════════ */
.piggy-loader__telemetry {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.telemetry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #10b981;
  animation: telemetryPulse 1s ease-in-out infinite alternate;
}

.telemetry-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #34d399;
  text-transform: uppercase;
}

/* ═══════════════ KEYFRAMES ═══════════════ */
@keyframes sonarSweepSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes sonarOrbitCW {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes sonarOrbitCCW {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

@keyframes coreRipple {
  0% { transform: scale(0.9); opacity: 0.9; }
  50% { opacity: 0.45; }
  100% { transform: scale(2.8); opacity: 0; }
}

@keyframes blipPulse {
  0% { transform: scale(0.85); opacity: 0.55; }
  100% { transform: scale(1.3); opacity: 1; }
}

@keyframes telemetryPulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .sonar-sweep,
  .sonar-ring--outer,
  .sonar-ring--inner,
  .sonar-core::after,
  .sonar-orbit-blip {
    animation: none !important;
  }
}
