/* ==========================================================================
   PLANET G - PREMIUM BOTANICAL INTERCONNECTED NETWORK FULL PAGE LOADER
   ========================================================================== */


:root {
  --pg-loader-bg-deep: #08150c;
  --pg-loader-bg-radial: #132a18;
  --pg-loader-primary: #4ade80;
  --pg-loader-accent: #2e5927;
  --pg-loader-gold: #d4af37;
  --pg-loader-lime: #a3e635;
  --pg-loader-glow: rgba(74, 222, 128, 0.35);
  --pg-loader-text-muted: #9dc49b;
}

/* ================= LOADER OVERLAY ================= */
.pg-loader-overlay,
#pg-loader-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, var(--pg-loader-bg-radial) 0%, var(--pg-loader-bg-deep) 75%, #040905 100%);
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform, visibility;
  font-family: 'Poppins', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  /* CSS HARD FAILSAFE: Automatically fades out within 1s even if JavaScript is blocked or delayed */
  animation: pg-loader-failsafe 0.9s ease 0.6s forwards;
}

@keyframes pg-loader-failsafe {
  0% {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
  }
  80% {
    opacity: 0.2;
    visibility: visible;
    pointer-events: none;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
  }
}

/* Hidden state when page is ready */
.pg-loader-overlay.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(1.02);
  display: none !important;
}

/* Background Ambient Lighting Effects */
.pg-loader-overlay::before {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--pg-loader-glow) 0%, transparent 65%);
  filter: blur(60px);
  animation: pg-ambient-pulse 4s ease-in-out infinite alternate;
  pointer-events: none;
}

.pg-loader-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.6;
  pointer-events: none;
}

/* ================= LOADER CONTENT CONTAINER ================= */
.pg-loader-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  max-width: 460px;
  width: 92%;
  animation: pg-content-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ================= INTERCONNECTED BOTANICAL NETWORK ================= */
.pg-loader-network-wrap,
.pg-loader-orbit-wrap {
  position: relative;
  width: 270px;
  height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

/* SVG Connecting Beams & Ring Path */
.pg-loader-network-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

/* Base interconnecting ring track */
.pg-net-ring-base {
  fill: none;
  stroke: rgba(74, 222, 128, 0.18);
  stroke-width: 2px;
  stroke-dasharray: 6 6;
}

/* Active flowing energy circuit pulse (Clockwise) */
.pg-net-ring-energy {
  fill: none;
  stroke: #4ade80;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-dasharray: 70 200;
  stroke-dashoffset: 0;
  animation: pg-net-travel 3.2s linear infinite;
  filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.85));
}

/* Secondary Gold Accent Energy Pulse (Counter-Clockwise) */
.pg-net-ring-energy-reverse {
  fill: none;
  stroke: #d4af37;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-dasharray: 45 225;
  stroke-dashoffset: 0;
  animation: pg-net-travel-rev 4.6s linear infinite;
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.75));
}

/* Radial Spokes connecting each Node to Central Planet G Logo */
.pg-net-spoke {
  stroke: rgba(74, 222, 128, 0.45);
  stroke-width: 2px;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
  animation: pg-spoke-pulse 2s ease-in-out infinite alternate;
}

.pg-spoke-top { animation-delay: 0s; }
.pg-spoke-right { animation-delay: 0.5s; }
.pg-spoke-bottom { animation-delay: 1s; }
.pg-spoke-left { animation-delay: 1.5s; }

.pg-net-spoke-diag {
  stroke: rgba(163, 230, 53, 0.22);
  stroke-width: 1.5px;
  stroke-dasharray: 4 6;
}

/* ================= 4 CONNECTED ECOSYSTEM NODES ================= */
.pg-loader-net-node {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a6125 0%, #153215 100%);
  border: 1.8px solid rgba(74, 222, 128, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c4f9cf;
  font-size: 16px;
  box-shadow: 
    0 6px 18px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(74, 222, 128, 0.45),
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
  z-index: 15;
  transition: transform 0.3s ease;
  animation: pg-node-float 3.5s ease-in-out infinite alternate;
}

/* Node Positioning Around Orbit */
.pg-node-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 0s;
}

.pg-node-right {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  animation-delay: 0.6s;
}

.pg-node-bottom {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 1.2s;
}

.pg-node-left {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  animation-delay: 1.8s;
}

/* Pulsing beacon radar wave from each node */
.pg-node-ping {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid rgba(74, 222, 128, 0.75);
  animation: pg-ping-wave 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

.pg-node-right .pg-node-ping { animation-delay: 0.55s; }
.pg-node-bottom .pg-node-ping { animation-delay: 1.1s; }
.pg-node-left .pg-node-ping { animation-delay: 1.65s; }

/* ================= CENTRAL LARGE UNCLIPPED LOGO CARD ================= */
.pg-loader-logo-badge {
  position: relative;
  width: 146px;
  height: 146px;
  border-radius: 22px;
  background: #275920; /* Solid brand green matching logo canvas */
  border: 1.5px solid rgba(163, 230, 53, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.55),
    0 0 45px rgba(74, 222, 128, 0.35),
    inset 0 1px 2px rgba(255, 255, 255, 0.25);
  padding: 8px;
  overflow: hidden;
  z-index: 10;
  animation: pg-badge-breath 2.6s ease-in-out infinite;
}

.pg-loader-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
  display: block;
}

/* ================= BRAND TEXT ================= */
.pg-loader-brand {
  margin-bottom: 22px;
}

.pg-loader-title {
  margin: 0 0 6px 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #ffffff;
  background: linear-gradient(90deg, #ffffff 0%, #bbf7d0 35%, #ffffff 70%, #86efac 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pg-text-shimmer 3s linear infinite;
  text-shadow: 0 0 25px rgba(74, 222, 128, 0.3);
}

.pg-loader-tagline {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--pg-loader-text-muted);
  opacity: 0.88;
}

/* ================= PROGRESS TRACK & BAR ================= */
.pg-loader-progress-wrap {
  width: 220px;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  margin-bottom: 18px;
}

.pg-loader-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2e5927 0%, #4ade80 50%, #a3e635 100%);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.7);
  animation: pg-load-fill 2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* ================= STATUS DOTS ================= */
.pg-loader-status-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pg-loader-status-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pg-loader-primary);
  opacity: 0.3;
  animation: pg-dot-pulse 1.4s ease-in-out infinite;
}

.pg-loader-status-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.pg-loader-status-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ================= KEYFRAME ANIMATIONS ================= */
@keyframes pg-net-travel {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -730; }
}

@keyframes pg-net-travel-rev {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 730; }
}

@keyframes pg-spoke-pulse {
  0% {
    stroke-opacity: 0.3;
    stroke-dashoffset: 0;
  }
  100% {
    stroke-opacity: 0.9;
    stroke-dashoffset: 12;
  }
}

@keyframes pg-ping-wave {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  75%, 100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes pg-node-float {
  0% { filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.4)); }
  100% { filter: drop-shadow(0 0 16px rgba(163, 230, 53, 0.85)); }
}

@keyframes pg-badge-breath {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 40px rgba(74, 222, 128, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.25);
  }
  50% {
    transform: scale(1.035);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 55px rgba(74, 222, 128, 0.55), inset 0 1px 3px rgba(255, 255, 255, 0.35);
  }
}

@keyframes pg-ambient-pulse {
  0% { transform: scale(0.85); opacity: 0.4; }
  100% { transform: scale(1.15); opacity: 0.7; }
}

@keyframes pg-text-shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes pg-load-fill {
  0% {
    width: 5%;
    left: 0%;
  }
  50% {
    width: 65%;
    left: 20%;
  }
  100% {
    width: 100%;
    left: 100%;
  }
}

@keyframes pg-dot-pulse {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
    background: var(--pg-loader-lime);
    box-shadow: 0 0 8px var(--pg-loader-lime);
  }
}

@keyframes pg-content-enter {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ================= MOBILE OPTIMIZATIONS ================= */
@media (max-width: 576px) {
  .pg-loader-network-wrap,
  .pg-loader-orbit-wrap {
    width: 230px;
    height: 230px;
    margin-bottom: 20px;
  }

  .pg-loader-net-node {
    width: 32px;
    height: 32px;
    font-size: 13.5px;
  }

  .pg-loader-logo-badge {
    width: 124px;
    height: 124px;
    border-radius: 18px;
    padding: 6px;
  }

  .pg-loader-logo-img {
    border-radius: 14px;
  }

  .pg-loader-title {
    font-size: 20px;
    letter-spacing: 3.5px;
  }

  .pg-loader-tagline {
    font-size: 11.5px;
    letter-spacing: 1.5px;
  }

  .pg-loader-progress-wrap {
    width: 180px;
  }
}
