/* Keyframes, Spinners, and Transitions */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes pulseBorder {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes wave {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal) forwards;
}

.animate-pulse-warning {
  animation: pulseBorder 2s infinite;
}

.animate-spin-slow {
  animation: spin 8s linear infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.shimmer-bg {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

/* Page transitions */
.page-view {
  animation: fadeIn var(--transition-slow) forwards;
}

/* Staggered load delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* Slow Animated Gradient Background */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animate-gradient-bg {
  background-size: 240% 240% !important;
  animation: gradientShift 16s ease infinite !important;
}

/* Modal Popup Custom Animations */
@keyframes scaleUp {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* Page Loader Overlay */
.page-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff; /* pure white for clean look */
  z-index: 999999; /* ensure it's on top of everything */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}

.page-loader-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Container for Logo & Animated Outline */
.loader-logo-ring {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.loader-logo-img {
  width: 136px;
  height: 136px;
  object-fit: contain;
  z-index: 2;
  animation: logoPulse 2.5s ease-in-out infinite;
}

.loader-fallback-emblem {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: var(--grad-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  animation: logoPulse 2.5s ease-in-out infinite;
  box-shadow: 0 4px 15px rgba(9, 79, 64, 0.2);
}

/* SVG Outline Ring styling */
.loader-outline-ring-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  z-index: 1;
}

.loader-ring-bg {
  fill: none;
  stroke: rgba(6, 95, 70, 0.08); /* subtle primary-color opacity */
  stroke-width: 4px;
}

.loader-ring-active {
  fill: none;
  stroke: var(--primary-color); /* main institutional dark green */
  stroke-width: 4px;
  stroke-linecap: round;
  stroke-dasharray: 289; /* 2 * PI * r (r=46) -> 2 * 3.14159 * 46 ≈ 289 */
  stroke-dashoffset: 289;
  animation: ringDrawSpin 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Text and brand info */
.loader-text-brand {
  font-family: var(--font-family, "Plus Jakarta Sans"), sans-serif;
  font-size: 1.75rem;
  font-weight: 850;
  color: var(--primary-color);
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
  opacity: 0;
  transform: translateY(10px);
  animation: slideUpFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.loader-text-sub {
  font-family: var(--font-family, "Plus Jakarta Sans"), sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  max-width: 280px;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(10px);
  animation: slideUpFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

/* Sub-spinner dots */
.loader-spinner-subtle {
  display: flex;
  gap: 0.4rem;
  opacity: 0;
  animation: fadeInPure 0.5s ease 0.6s forwards;
}

.loader-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-mint);
  animation: dotJump 1.4s infinite ease-in-out;
}

.loader-dot:nth-child(2) {
  animation-delay: 0.2s;
  background-color: var(--accent-teal);
}

.loader-dot:nth-child(3) {
  animation-delay: 0.4s;
  background-color: var(--primary-color);
}

/* Keyframe Animations */
@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 2px 5px rgba(6, 95, 70, 0.1));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 5px 15px rgba(6, 95, 70, 0.25));
  }
}

@keyframes ringDrawSpin {
  0% {
    stroke-dashoffset: 289;
    transform: rotate(0deg);
  }
  50% {
    stroke-dashoffset: 72; /* Draw in to 75% */
    transform: rotate(180deg);
  }
  100% {
    stroke-dashoffset: 289; /* Retract */
    transform: rotate(360deg);
  }
}

@keyframes slideUpFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInPure {
  to {
    opacity: 1;
  }
}

@keyframes dotJump {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Animated Footer Patterns & Shimmers */
@keyframes footerLatticeDrift {
  0% {
    background-position: 0px 0px, 0px 0px;
  }
  100% {
    background-position: 64px 64px, -64px 64px;
  }
}

@keyframes footerAuraFloat1 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.22;
  }
  50% {
    transform: translate(30px, -20px) scale(1.15);
    opacity: 0.38;
  }
}

@keyframes footerAuraFloat2 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.18;
  }
  50% {
    transform: translate(-35px, 25px) scale(1.18);
    opacity: 0.32;
  }
}

@keyframes footerTopBorderFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes footerGradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes footerWavesShift {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 0 0, 64px 0;
  }
}


