/* ============================================================
   ELISEE SCOUT — GLOBAL TRANSITION & MACROAREA LOADER
   Ispirato al design dots progressivi al neon luxury
   Palette ufficiale: Deep Dark (#050608) & Electric Cyan (#38bdf8)
   ============================================================ */

#elisee-global-loader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 999999;
  background: rgba(5, 6, 8, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

#elisee-global-loader.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.es-loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  padding: 2.5rem 3rem;
  -webkit-user-select: none;
  user-select: none;
}

/* Titolo "L O A D I N G . . ." */
.es-loader-title {
  font-family: var(--font-heading, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.72em;
  text-indent: 0.72em; /* Compensa l'ultimo letter-spacing per centrare perfettamente */
  color: #e0f2fe;
  text-transform: uppercase;
  margin: 0;
  padding: 0;
  display: inline-block;
  text-align: center;
  animation: esLoaderTextGlow 2.2s infinite ease-in-out;
}

/* Sottotitolo area in caricamento */
.es-loader-sub {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #64748b;
  margin-top: -0.8rem;
  min-height: 1.1rem;
  text-align: center;
  transition: opacity 0.2s ease;
}

/* Fila orizzontale di punti a scala progressiva */
.es-loader-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
  max-width: 90vw;
}

/* Singolo dot con dimensione calcolata e animazione d'onda */
.es-loader-dot {
  display: inline-block;
  border-radius: 50%;
  background-color: rgba(56, 189, 248, 0.16);
  flex-shrink: 0;
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  animation: esDotWave 2s infinite ease-in-out;
  animation-delay: calc(var(--dot-i, 0) * 0.075s);
  position: relative;
}

/* Animazione onda luminosa sui dots (replica fedele dell'impulso della foto) */
@keyframes esDotWave {
  0%, 100% {
    background-color: rgba(56, 189, 248, 0.14);
    box-shadow: 0 0 0 rgba(56, 189, 248, 0);
    transform: scale(0.95);
    opacity: 0.45;
  }
  30% {
    background-color: #38bdf8;
    background-image: radial-gradient(circle at 35% 35%, #ffffff 0%, #38bdf8 65%, #0284c7 100%);
    box-shadow:
      0 0 12px rgba(56, 189, 248, 0.95),
      0 0 24px rgba(56, 189, 248, 0.65),
      0 0 38px rgba(56, 189, 248, 0.35);
    transform: scale(1.22);
    opacity: 1;
  }
  60% {
    background-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
    transform: scale(1.05);
    opacity: 0.7;
  }
}

/* Pulsazione del testo "LOADING..." */
@keyframes esLoaderTextGlow {
  0%, 100% {
    color: #94a3b8;
    text-shadow: 0 0 0 rgba(56, 189, 248, 0);
    opacity: 0.82;
  }
  50% {
    color: #f0f9ff;
    text-shadow: 0 0 14px rgba(56, 189, 248, 0.65), 0 0 26px rgba(56, 189, 248, 0.3);
    opacity: 1;
  }
}

/* Variante tema oro / presidenza se attivo data-theme="barocco-oro" */
[data-theme="barocco-oro"] .es-loader-title {
  color: #fef3c7;
}
[data-theme="barocco-oro"] .es-loader-dot {
  animation-name: esDotWaveGold;
}
@keyframes esDotWaveGold {
  0%, 100% {
    background-color: rgba(251, 191, 36, 0.14);
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
    transform: scale(0.95);
    opacity: 0.45;
  }
  30% {
    background-color: #fbbf24;
    background-image: radial-gradient(circle at 35% 35%, #ffffff 0%, #fbbf24 65%, #d97706 100%);
    box-shadow:
      0 0 12px rgba(251, 191, 36, 0.95),
      0 0 24px rgba(251, 191, 36, 0.65),
      0 0 38px rgba(251, 191, 36, 0.35);
    transform: scale(1.22);
    opacity: 1;
  }
  60% {
    background-color: rgba(251, 191, 36, 0.35);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
    transform: scale(1.05);
    opacity: 0.7;
  }
}

/* Responsività su schermi compatti/mobile */
@media (max-width: 640px) {
  .es-loader-track {
    gap: 6px;
  }
  .es-loader-title {
    font-size: 0.8rem;
    letter-spacing: 0.55em;
    text-indent: 0.55em;
  }
  .es-loader-sub {
    font-size: 0.68rem;
  }
}
