/* ==============================================================================
   AGROTSOMBELA — PRELOADER AGROPECUÁRIO INSTITUCIONAL
   Ficheiro: includes/preloader/preloader.css
   Carregado exclusivamente na página inicial (index / home)
   Modo: Escuro permanente (Dark Theme Only)
============================================================================== */

.preloader {
  --bg: #050a08;
  --glow: #10251a;
  --text: #ffffff;
  --muted: rgba(180, 235, 190, 0.68);
  --accent: #45e879;
  --ring-base: rgba(130, 200, 150, 0.12);
  --circle-bg: rgba(100, 180, 120, 0.045);
  --circle-border: rgba(130, 230, 160, 0.25);
  --icon-opacity: 0.08;
  
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle, var(--glow), var(--bg) 72%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
}

.preloader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.agri-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.agri-icon {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: var(--size);
  opacity: var(--icon-opacity);
  user-select: none;
  animation: floatIcon var(--duration) ease-in-out infinite alternate;
  animation-delay: var(--delay);
}

@keyframes floatIcon {
  from {
    transform: translate(-8px, 12px) rotate(-10deg);
  }
  to {
    transform: translate(12px, -24px) rotate(10deg);
  }
}

.i1  { --x: 6%;  --y: 10%; --size: 42px; --duration: 12s; --delay: -2s; }
.i2  { --x: 22%; --y: 25%; --size: 36px; --duration: 15s; --delay: -5s; }
.i3  { --x: 42%; --y: 9%;  --size: 46px; --duration: 13s; --delay: -3s; }
.i4  { --x: 65%; --y: 17%; --size: 40px; --duration: 17s; --delay: -7s; }
.i5  { --x: 85%; --y: 12%; --size: 44px; --duration: 14s; --delay: -4s; }
.i6  { --x: 92%; --y: 39%; --size: 35px; --duration: 12s; --delay: -1s; }
.i7  { --x: 76%; --y: 58%; --size: 43px; --duration: 16s; --delay: -6s; }
.i8  { --x: 88%; --y: 80%; --size: 38px; --duration: 14s; --delay: -8s; }
.i9  { --x: 62%; --y: 84%; --size: 42px; --duration: 16s; --delay: -3s; }
.i10 { --x: 39%; --y: 76%; --size: 34px; --duration: 13s; --delay: -6s; }
.i11 { --x: 18%; --y: 84%; --size: 46px; --duration: 18s; --delay: -2s; }
.i12 { --x: 5%;  --y: 61%; --size: 40px; --duration: 15s; --delay: -9s; }
.i13 { --x: 29%; --y: 48%; --size: 36px; --duration: 17s; --delay: -4s; }
.i14 { --x: 53%; --y: 34%; --size: 32px; --duration: 14s; --delay: -2s; }
.i15 { --x: 11%; --y: 37%; --size: 43px; --duration: 18s; --delay: -5s; }
.i16 { --x: 56%; --y: 59%; --size: 39px; --duration: 13s; --delay: -7s; }
.i17 { --x: 33%; --y: 92%; --size: 34px; --duration: 16s; --delay: -3s; }
.i18 { --x: 95%; --y: 55%; --size: 42px; --duration: 19s; --delay: -6s; }
.i19 { --x: 49%; --y: 20%; --size: 36px; --duration: 15s; --delay: -1s; }
.i20 { --x: 78%; --y: 92%; --size: 40px; --duration: 17s; --delay: -4s; }

.loader {
  position: relative;
  z-index: 2;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-ring {
  position: absolute;
  inset: -12px;
  border: 3px solid var(--ring-base);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 15px color-mix(in srgb, var(--accent) 25%, transparent);
  animation: spin 1.2s linear infinite;
}

.loader-circle {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--circle-bg);
  border: 1px solid var(--circle-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand-icon {
  width: 48%;
  height: 48%;
  max-width: 72px;
  max-height: 72px;
  display: block;
  overflow: visible;
  color: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

.loading-text {
  position: absolute;
  top: calc(50% + 112px);
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  z-index: 2;
  font-weight: 700;
}

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

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

@media (max-width: 600px) {
  .loader {
    width: 120px;
    height: 120px;
  }
  .brand-icon {
    width: 46%;
    height: 46%;
    max-width: 58px;
    max-height: 58px;
  }
  .loading-text {
    top: calc(50% + 95px);
  }
  .agri-icon {
    opacity: 0.065;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agri-icon,
  .loader-ring,
  .brand-icon {
    animation-duration: 4s;
  }
}
