/**
 * ThunderOT Wiki - Lightning & Thunder Effects
 * Immersive storm effects for the wiki
 * 
 * Includes:
 * - Animated lightning bolts
 * - Lightning flash effects
 * - Atmospheric storm clouds
 */

/* ============================================
   LIGHTNING EFFECTS CONTAINER
   ============================================ */

.lightning-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

/* ============================================
   LIGHTNING BOLT ANIMATIONS
   ============================================ */

.lightning-bolt {
  position: absolute;
  width: 4px;
  height: 0;
  background: linear-gradient(to bottom,
      transparent 0%,
      rgba(255, 255, 255, 0.95) 10%,
      rgba(180, 200, 255, 0.9) 50%,
      rgba(100, 150, 255, 0.8) 80%,
      transparent 100%);
  filter: blur(0.5px);
  opacity: 0;
  transform-origin: top center;
  box-shadow:
    0 0 15px 5px rgba(180, 200, 255, 0.8),
    0 0 30px 10px rgba(100, 150, 255, 0.6),
    0 0 60px 20px rgba(80, 120, 220, 0.4);
}

/* Primary bolt animation */
@keyframes lightningStrike {
  0% {
    height: 0;
    opacity: 0;
    transform: scaleY(0);
  }

  5% {
    height: 100vh;
    opacity: 1;
    transform: scaleY(1);
  }

  8% {
    opacity: 0.3;
  }

  12% {
    opacity: 1;
  }

  15% {
    opacity: 0.5;
  }

  20% {
    opacity: 1;
  }

  25% {
    opacity: 0;
    height: 100vh;
  }

  100% {
    opacity: 0;
    height: 0;
  }
}

/* Branch lightning */
.lightning-branch {
  position: absolute;
  width: 2px;
  background: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.9) 0%,
      rgba(160, 180, 255, 0.7) 50%,
      transparent 100%);
  filter: blur(0.3px);
  box-shadow:
    0 0 10px 3px rgba(180, 200, 255, 0.6),
    0 0 20px 6px rgba(100, 150, 255, 0.4);
  transform-origin: top center;
}

/* ============================================
   LIGHTNING FLASH EFFECT
   ============================================ */

.lightning-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 0%,
      rgba(200, 220, 255, 0.4) 0%,
      rgba(180, 200, 255, 0.2) 30%,
      rgba(100, 150, 255, 0.1) 60%,
      transparent 100%);
  pointer-events: none;
  opacity: 0;
  z-index: 9998;
}

@keyframes flashEffect {
  0% {
    opacity: 0;
  }

  5% {
    opacity: 1;
  }

  10% {
    opacity: 0.3;
  }

  15% {
    opacity: 0.8;
  }

  20% {
    opacity: 0.2;
  }

  25% {
    opacity: 0.6;
  }

  30% {
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}

/* ============================================
   STORM CLOUDS EFFECT
   ============================================ */

.storm-clouds {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background:
    linear-gradient(to bottom,
      rgba(20, 25, 40, 0.9) 0%,
      rgba(30, 35, 50, 0.6) 40%,
      transparent 100%);
  pointer-events: none;
  z-index: -1;
}

.storm-clouds::before,
.storm-clouds::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(ellipse 200px 100px at 20% 30%, rgba(40, 50, 70, 0.8), transparent),
    radial-gradient(ellipse 300px 150px at 60% 20%, rgba(35, 45, 65, 0.7), transparent),
    radial-gradient(ellipse 250px 120px at 80% 40%, rgba(45, 55, 75, 0.8), transparent),
    radial-gradient(ellipse 180px 90px at 40% 50%, rgba(30, 40, 60, 0.6), transparent);
  animation: cloudDrift 60s ease-in-out infinite;
}

.storm-clouds::after {
  animation-delay: -30s;
  animation-direction: reverse;
  opacity: 0.7;
}

@keyframes cloudDrift {

  0%,
  100% {
    transform: translateX(-5%);
  }

  50% {
    transform: translateX(5%);
  }
}

/* ============================================
   RAIN EFFECT (SUBTLE)
   ============================================ */

.rain-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9997;
  overflow: hidden;
}

.rain-drop {
  position: absolute;
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom,
      transparent 0%,
      rgba(180, 200, 255, 0.3) 50%,
      rgba(180, 200, 255, 0.5) 100%);
  opacity: 0.4;
  animation: rainFall linear infinite;
}

@keyframes rainFall {
  0% {
    transform: translateY(-100px) rotate(15deg);
    opacity: 0;
  }

  10% {
    opacity: 0.4;
  }

  90% {
    opacity: 0.4;
  }

  100% {
    transform: translateY(100vh) rotate(15deg);
    opacity: 0;
  }
}

/* ============================================
   ELECTRIC AURA ON ELEMENTS
   ============================================ */

.electric-aura {
  position: relative;
}

.electric-aura::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: transparent;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    0 0 5px rgba(100, 150, 255, 0),
    0 0 10px rgba(100, 150, 255, 0),
    inset 0 0 5px rgba(100, 150, 255, 0);
  transition: box-shadow 0.3s ease;
}

/* Active electric aura during lightning */
.lightning-active .electric-aura::after {
  animation: electricPulse 0.2s ease-out;
}

@keyframes electricPulse {
  0% {
    box-shadow:
      0 0 5px rgba(100, 150, 255, 0.8),
      0 0 15px rgba(100, 150, 255, 0.6),
      inset 0 0 10px rgba(100, 150, 255, 0.4);
  }

  100% {
    box-shadow:
      0 0 5px rgba(100, 150, 255, 0),
      0 0 10px rgba(100, 150, 255, 0),
      inset 0 0 5px rgba(100, 150, 255, 0);
  }
}

/* ============================================
   THUNDER ICON ANIMATION
   ============================================ */

.thunder-icon {
  display: inline-block;
  animation: thunderShake 0.3s ease-in-out;
  color: #FFD700;
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.8),
    0 0 20px rgba(255, 215, 0, 0.6),
    0 0 30px rgba(255, 215, 0, 0.4);
}

@keyframes thunderShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-3px) rotate(-2deg);
  }

  40% {
    transform: translateX(3px) rotate(2deg);
  }

  60% {
    transform: translateX(-2px) rotate(-1deg);
  }

  80% {
    transform: translateX(2px) rotate(1deg);
  }
}

/* ============================================
   LOGO LIGHTNING EFFECT
   ============================================ */

.header-logo {
  transition: all 0.3s ease;
}

.lightning-active .header-logo span {
  text-shadow:
    0 0 10px rgba(180, 200, 255, 0.8),
    0 0 20px rgba(100, 150, 255, 0.6),
    0 0 40px rgba(80, 120, 220, 0.4);
}

/* ============================================
   CONTROL BUTTON STYLES
   ============================================ */

.lightning-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(100, 150, 255, 0.3), rgba(80, 120, 220, 0.2));
  border: 2px solid rgba(100, 150, 255, 0.5);
  color: rgba(180, 200, 255, 0.9);
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  box-shadow:
    0 0 15px rgba(100, 150, 255, 0.3),
    0 0 30px rgba(80, 120, 220, 0.2),
    inset 0 0 10px rgba(100, 150, 255, 0.1);
  backdrop-filter: blur(10px);
}

.lightning-toggle:hover {
  transform: scale(1.1);
  box-shadow:
    0 0 25px rgba(100, 150, 255, 0.5),
    0 0 50px rgba(80, 120, 220, 0.3),
    inset 0 0 15px rgba(100, 150, 255, 0.2);
  border-color: rgba(180, 200, 255, 0.8);
}

.lightning-toggle.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 180, 0, 0.3));
  border-color: rgba(255, 215, 0, 0.7);
  color: rgba(255, 215, 0, 0.95);
  box-shadow:
    0 0 25px rgba(255, 215, 0, 0.5),
    0 0 50px rgba(255, 180, 0, 0.3),
    inset 0 0 15px rgba(255, 215, 0, 0.2);
}

.lightning-toggle svg {
  width: 24px;
  height: 24px;
}

/* Tooltip */
.lightning-toggle::before {
  content: 'Efeitos de Tempestade';
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 10px;
  padding: 8px 16px;
  background: rgba(20, 30, 50, 0.95);
  border: 1px solid rgba(100, 150, 255, 0.3);
  border-radius: 8px;
  color: rgba(180, 200, 255, 0.9);
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.lightning-toggle:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ============================================
   SCREEN SHAKE EFFECT
   ============================================ */

@keyframes screenShake {

  0%,
  100% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-2px, -1px);
  }

  20% {
    transform: translate(2px, 1px);
  }

  30% {
    transform: translate(-1px, 2px);
  }

  40% {
    transform: translate(1px, -2px);
  }

  50% {
    transform: translate(-2px, 1px);
  }

  60% {
    transform: translate(2px, -1px);
  }

  70% {
    transform: translate(-1px, -2px);
  }

  80% {
    transform: translate(1px, 2px);
  }

  90% {
    transform: translate(-2px, -1px);
  }
}

.screen-shake {
  animation: screenShake 0.4s ease-in-out;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .lightning-toggle {
    width: 44px;
    height: 44px;
    bottom: 15px;
    right: 15px;
  }

  .lightning-toggle svg {
    width: 20px;
    height: 20px;
  }

  .lightning-toggle::before {
    display: none;
  }
}

/* ============================================
   REDUCED MOTION PREFERENCE
   ============================================ */

@media (prefers-reduced-motion: reduce) {

  .lightning-bolt,
  .lightning-branch,
  .lightning-flash,
  .rain-drop,
  .storm-clouds::before,
  .storm-clouds::after {
    animation: none !important;
  }

  .screen-shake {
    animation: none !important;
  }
}

/* Disable effects class - Updated to keep rain and clouds active */
.lightning-disabled .lightning-container,
.lightning-disabled .lightning-flash {
  display: none !important;
}