/* OWME Mystical Animations & Spiritual Effects */

/* ========== ANIMATED FAULT LINES ========== */
@keyframes faultPulse {
  0%, 100% {
    opacity: 0.5;
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px rgba(255, 68, 68, 0.3));
  }
  50% {
    opacity: 0.9;
    stroke-width: 3;
    filter: drop-shadow(0 0 12px rgba(255, 68, 68, 0.8));
  }
}

@keyframes faultLineMove {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -50; }
}

.fault-line-animated {
  animation: faultPulse 4s ease-in-out infinite;
  stroke-dasharray: 15 8 5 8;
  animation: faultPulse 4s ease-in-out infinite, faultLineMove 20s linear infinite;
}

/* ========== SACRED SITE MARKERS ========== */
@keyframes sacredPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.4));
  }
  50% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.8));
  }
}

@keyframes sacredRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.sacred-marker {
  animation: sacredPulse 3s ease-in-out infinite;
}

.sacred-marker-inner {
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 50%;
  position: relative;
}

.sacred-marker-inner::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: 50%;
  animation: sacredPulse 2s ease-in-out infinite;
}

/* ========== MYSTERY SCORE GLOW ========== */
@keyframes mysteryGlow {
  0%, 100% {
    filter: drop-shadow(0 0 6px var(--accent-glow));
    text-shadow: 0 0 10px currentColor;
  }
  33% {
    filter: drop-shadow(0 0 12px var(--accent-ether));
    text-shadow: 0 0 20px currentColor;
  }
  66% {
    filter: drop-shadow(0 0 8px var(--accent-sacred));
    text-shadow: 0 0 15px currentColor;
  }
}

.mystery-glow {
  animation: mysteryGlow 4s ease-in-out infinite;
}

/* ========== GLOWING TEXT ========== */
.glow-text {
  text-shadow: 0 0 10px currentColor;
}

@keyframes textGlowPulse {
  0%, 100% { text-shadow: 0 0 10px currentColor; }
  50% { text-shadow: 0 0 25px currentColor, 0 0 40px currentColor; }
}

.glow-text-animated {
  animation: textGlowPulse 3s ease-in-out infinite;
}

/* ========== PANEL GLOW EFFECTS ========== */
@keyframes panelGlowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.1),
                0 0 40px rgba(0, 255, 136, 0.05);
  }
  50% {
    box-shadow: 0 0 40px rgba(167, 139, 250, 0.2),
                0 0 60px rgba(0, 255, 136, 0.1);
  }
}

.panel-glow {
  animation: panelGlowPulse 5s ease-in-out infinite;
}

/* ========== SEARCH PIN MARKERS ========== */
@keyframes pinPulse {
  0%, 100% {
    transform: scale(1) translateY(0);
    box-shadow: 0 0 10px var(--accent-glow);
  }
  25% {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 0 20px var(--accent-glow);
  }
  50% {
    transform: scale(1) translateY(-6px);
    box-shadow: 0 0 30px var(--accent-glow);
  }
  75% {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 0 18px var(--accent-glow);
  }
}

.search-pin {
  background: var(--accent-glow);
  border: 2px solid white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  box-shadow: 0 0 15px var(--accent-glow);
  animation: pinPulse 2s ease-in-out infinite;
}

/* ========== MAP LOADING ANIMATION ========== */
@keyframes mapLoad {
  0% {
    opacity: 0;
    transform: scale(0.98);
    filter: blur(10px);
  }
  50% {
    opacity: 0.8;
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes mapReveal {
  0% {
    clip-path: circle(0% at 50% 50%);
  }
  100% {
    clip-path: circle(100% at 50% 50%);
  }
}

#map {
  animation: mapLoad 1.2s ease-out, mapReveal 2s ease-out 0.5s both;
}

/* ========== FLOATING PARTICLES ========== */
@keyframes floatParticle {
  0%, 100% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.6; }
  50% {
    transform: translateY(-100px) translateX(20px) scale(1.2);
    opacity: 0.3;
  }
  90% { opacity: 0.6; }
}

@keyframes floatParticleAlt {
  0%, 100% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  20% { opacity: 0.4; }
  50% {
    transform: translateY(-80px) translateX(-15px) scale(0.8);
    opacity: 0.2;
  }
  80% { opacity: 0.5; }
}

.floating-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-ether);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(1px);
  animation: floatParticle 8s ease-in-out infinite;
}

.floating-particle:nth-child(2) {
  animation: floatParticleAlt 10s ease-in-out infinite;
  animation-delay: 2s;
  background: var(--accent-glow);
}

.floating-particle:nth-child(3) {
  animation: floatParticle 12s ease-in-out infinite;
  animation-delay: 4s;
  background: var(--accent-sacred);
}

/* ========== LAYER TOGGLE ANIMATIONS ========== */
@keyframes layerSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.map-overlay-toggle {
  animation: layerSlideIn 0.4s ease-out backwards;
}

.map-overlay-toggle:nth-child(1) { animation-delay: 0.1s; }
.map-overlay-toggle:nth-child(2) { animation-delay: 0.2s; }
.map-overlay-toggle:nth-child(3) { animation-delay: 0.3s; }
.map-overlay-toggle:nth-child(4) { animation-delay: 0.4s; }
.map-overlay-toggle:nth-child(5) { animation-delay: 0.5s; }
.map-overlay-toggle:nth-child(6) { animation-delay: 0.6s; }

/* Active layer indicator pulse */
@keyframes activePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(0, 255, 136, 0);
  }
}

.map-overlay-toggle.active .indicator {
  animation: activePulse 2s ease-in-out infinite;
}

/* ========== RESULT CARD ANIMATIONS ========== */
@keyframes resultSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-card {
  animation: resultSlideIn 0.5s ease-out backwards;
}

.result-card:nth-child(1) { animation-delay: 0.1s; }
.result-card:nth-child(2) { animation-delay: 0.2s; }
.result-card:nth-child(3) { animation-delay: 0.3s; }
.result-card:nth-child(4) { animation-delay: 0.4s; }
.result-card:nth-child(5) { animation-delay: 0.5s; }

/* ========== AMBIENT ENERGY WAVE ========== */
@keyframes ambientWave {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.ambient-wave-bg {
  background: linear-gradient(-45deg,
    rgba(0, 255, 136, 0.05),
    rgba(167, 139, 250, 0.08),
    rgba(0, 255, 136, 0.05),
    rgba(167, 139, 250, 0.08));
  background-size: 400% 400%;
  animation: ambientWave 15s ease infinite;
}

/* ========== ETHEREAL LINE ========== */
@keyframes etherealLine {
  0% {
    background-position: 0% 50%;
    opacity: 0.3;
  }
  50% {
    background-position: 100% 50%;
    opacity: 0.7;
  }
  100% {
    background-position: 0% 50%;
    opacity: 0.3;
  }
}

.ethereal-line {
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    var(--accent-ether),
    var(--accent-glow),
    var(--accent-ether),
    transparent);
  background-size: 200% 100%;
  animation: etherealLine 4s ease-in-out infinite;
}

/* ========== BREATHING EFFECT ========== */
@keyframes breathingEffect {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.02);
    opacity: 1;
  }
}

.breathing-element {
  animation: breathingEffect 4s ease-in-out infinite;
}

/* ========== ROTALINK EFFECT FOR SACRED SITES ========== */
@keyframes rotaLink {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.rotalink {
  animation: rotaLink 20s linear infinite;
}

.rotalink-reverse {
  animation: rotaLink 25s linear infinite reverse;
}

/* ========== STAR TWINKLE ========== */
@keyframes starTwinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.star-twinkle {
  animation: starTwinkle 2s ease-in-out infinite;
}

/* ========== LOADING ORB ========== */
@keyframes loadingOrb {
  0%, 100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 20px var(--accent-glow);
  }
  50% {
    transform: translateY(-10px) scale(1.1);
    box-shadow: 0 0 40px var(--accent-glow), 0 0 60px rgba(0, 255, 136, 0.3);
  }
}

.loading-orb {
  width: 20px;
  height: 20px;
  background: var(--accent-glow);
  border-radius: 50%;
  animation: loadingOrb 1.5s ease-in-out infinite;
}

/* ========== LEAFLET TOOLTIP SPIRITUAL ========== */
.leaflet-tooltip {
  background: rgba(18, 18, 26, 0.95) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--accent-ether) !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}

.leaflet-tooltip::before {
  border-top-color: var(--accent-ether) !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(18, 18, 26, 0.95) !important;
  border: 1px solid var(--accent-ether) !important;
  border-radius: 12px !important;
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.3);
}

.leaflet-popup-tip {
  background: var(--bg-panel) !important;
}

/* ========== POPUP HEADER SPIRITUAL ========== */
.popup-header {
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(0, 255, 136, 0.1));
  border-radius: 8px 8px 0 0;
  margin: -10px -14px 10px -14px;
}

.popup-header h4 {
  color: var(--accent-glow);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 1px;
  margin: 0;
}

/* ========== COORDINATE DISPLAY ========== */
@keyframes coordUpdate {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.coord-display {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-muted);
  animation: coordUpdate 3s ease-in-out infinite;
}

/* ========== LEAFLET CONTROL STYLES ========== */
.leaflet-bar {
  border: none !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2) !important;
}

.leaflet-touch .leaflet-bar {
  border-radius: 10px !important;
}

/* ========== PROGRESSIVE OVERLAY FADE ========== */
@keyframes overlayFadeIn {
  from {
    opacity: 0;
    transform: scale(1.05);
  }
  to {
    opacity: 0.6;
    transform: scale(1);
  }
}

.overlay-loading {
  animation: overlayFadeIn 1s ease-out forwards;
}

/* ========== WIKI EDITOR MODAL ========== */
.wiki-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 18, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.wiki-editor-content {
  background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-deep) 100%);
  border: 1px solid var(--accent-ether);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 0 60px rgba(167, 139, 250, 0.3);
}

.wiki-editor-content textarea {
  width: 100%;
  height: 150px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 16px;
  border-radius: 10px;
  margin: 16px 0;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}

.wiki-editor-content textarea:focus {
  outline: none;
  border-color: var(--accent-ether);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}

.wiki-editor-actions {
  display: flex;
  gap: 12px;
}

.wiki-editor-actions button {
  flex: 1;
  padding: 12px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.wiki-editor-actions .save-btn {
  background: linear-gradient(135deg, var(--accent-glow) 0%, var(--accent-ether) 100%);
  border: none;
  color: var(--bg-deep);
  font-weight: 500;
}

.wiki-editor-actions .cancel-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.wiki-editor-actions button:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.wiki-edit-link {
  display: inline-block;
  padding: 10px 20px;
  background: #00ff88;
  border-radius: 4px;
  color: #0a0a0f;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.wiki-edit-link:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.wiki-editor-desc {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 13px;
}