/* ============================================
   Halloween Theme Styles for Urbex Planet
   Spooky animations and atmospheric effects
   ============================================ */

:root {
  --halloween-orange: #ff6b35;
  --halloween-purple: #6f2dbd;
  --halloween-green: #39ff14;
  --halloween-dark: #1a0d2e;
  --halloween-fog: rgba(138, 43, 226, 0.1);
}

/* ============================================
   Halloween Banner/Toast Notification
   ============================================ */
.halloween-banner {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--halloween-purple), var(--halloween-dark));
  border: 2px solid var(--halloween-orange);
  border-radius: 12px;
  padding: 12px 20px;
  color: white;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.3);
  animation: halloween-banner-appear 0.8s ease-out;
  max-width: 320px;
  text-align: left;
  font-weight: 500;
  pointer-events: auto;
}

.halloween-banner .halloween-icon {
  font-size: 1.2rem;
  margin-right: 6px;
}

.halloween-banner .close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
}

.halloween-banner .close-btn:hover {
  opacity: 1;
}

@keyframes halloween-banner-appear {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   Corner Cobwebs
   ============================================ */
.halloween-cobweb {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.3));
}

.halloween-cobweb.top-left {
  top: 0;
  left: 0;
  width: 150px;
  height: 150px;
}

.halloween-cobweb.top-right {
  top: 0;
  right: 0;
  width: 150px;
  height: 150px;
  transform: scaleX(-1);
}

.halloween-cobweb svg {
  width: 100%;
  height: 100%;
}

/* Navbar Cobwebs - positioned on the navbar itself */
body.halloween-theme nav.navbar::before,
body.halloween-theme nav.navbar::after {
  content: '';
  position: absolute !important;
  top: 0;
  width: 120px;
  height: 120px;
  pointer-events: none;
  opacity: 0.5;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g stroke="%23ffffff" stroke-width="1.5" fill="none" opacity="0.6"><line x1="10" y1="10" x2="100" y2="100"/><line x1="100" y1="10" x2="100" y2="100"/><line x1="190" y1="10" x2="100" y2="100"/><line x1="10" y1="100" x2="100" y2="100"/><path d="M 10 10 Q 30 30 50 30 Q 70 30 100 10"/><path d="M 50 30 Q 70 50 70 70 Q 70 85 100 100"/><path d="M 100 10 Q 120 30 140 30 Q 160 30 190 10"/><path d="M 140 30 Q 120 50 120 70 Q 120 85 100 100"/><path d="M 10 10 Q 10 30 30 50 Q 40 60 10 100"/><path d="M 30 50 Q 50 70 70 70"/><circle cx="100" cy="100" r="4" fill="%23ffffff" opacity="0.8"/><circle cx="100" cy="100" r="2" fill="%23000000"/></g></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 100 !important;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.3));
  display: block !important;
}

body.halloween-theme nav.navbar::before {
  left: 0;
}

body.halloween-theme nav.navbar::after {
  right: 0;
  transform: scaleX(-1);
}

/* ============================================
   Floating Ghosts Animation
   ============================================ */
.halloween-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  font-size: 2rem;
  opacity: 0;
  animation: halloween-ghost-float 15s ease-in-out infinite;
}

@keyframes halloween-ghost-float {
  0% {
    opacity: 0;
    transform: translateY(100vh) translateX(0) rotate(0deg);
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translateY(-150px) translateX(100px) rotate(360deg);
  }
}

/* ============================================
   Floating Bats Animation
   ============================================ */
.halloween-bat {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  font-size: 1.5rem;
  opacity: 0;
  animation: halloween-bat-fly 12s linear infinite;
}

@keyframes halloween-bat-fly {
  0% {
    opacity: 0;
    transform: translateX(-100px) translateY(0);
  }
  5% {
    opacity: 0.8;
  }
  95% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translateX(calc(100vw + 100px)) translateY(-50px);
  }
}

/* ============================================
   Pumpkin Effects on Map Markers
   ============================================ */
.halloween-pumpkin-marker {
  filter: drop-shadow(0 0 8px var(--halloween-orange));
  animation: halloween-pumpkin-glow 2s ease-in-out infinite;
}

@keyframes halloween-pumpkin-glow {
  0%, 100% {
    filter: drop-shadow(0 0 8px var(--halloween-orange));
  }
  50% {
    filter: drop-shadow(0 0 16px var(--halloween-orange));
  }
}

/* ============================================
   Halloween Theme Color Overrides
   ============================================ */
/*
  Apply subtle Halloween theming without disrupting layout.
  We use a simple body background color instead of a fixed overlay.
*/
body.halloween-theme {
  background: linear-gradient(180deg, #0a0a0a 0%, #1a0d2e 100%);
  background-attachment: fixed;
}

/* Navbar Halloween glow effect and cobweb positioning */
.halloween-theme nav.navbar {
  position: sticky !important; /* Maintain sticky but ensure it's explicit */
  overflow: visible !important;
  background-color: rgba(17, 24, 39, 0.84);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.2);
}

/* Ensure navbar has positioning context for cobwebs */
.halloween-theme nav.navbar > .container {
  position: static; /* Reset container positioning so pseudo-elements on nav work */
}

/* Hero sections get spooky gradient */
.halloween-theme .hero-gradient {
  background: linear-gradient(135deg, var(--halloween-purple), var(--halloween-dark), var(--halloween-orange)) !important;
}

/* Cards get subtle Halloween border */
.halloween-theme .admin-card,
.halloween-theme .card,
.halloween-theme .location-card {
  border: 1px solid rgba(255, 107, 53, 0.2);
  box-shadow: 0 4px 12px rgba(111, 45, 189, 0.1);
}

/* Button hover effects */
.halloween-theme .btn-primary:hover {
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
}

/* ============================================
   Flickering Lights Effect
   ============================================ */
@keyframes halloween-flicker {
  0%, 100% {
    opacity: 1;
  }
  41.99% {
    opacity: 1;
  }
  42% {
    opacity: 0.92;
  }
  43% {
    opacity: 1;
  }
  45.99% {
    opacity: 1;
  }
  46% {
    opacity: 0.88;
  }
  46.5% {
    opacity: 1;
  }
}

/* Only apply subtle flicker to brand, not all headings */
.halloween-theme .navbar-brand {
  animation: halloween-flicker 8s linear infinite;
}

/* ============================================
   Fog/Mist Background Effect
   ============================================ */
.halloween-fog {
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background: 
    radial-gradient(circle at 20% 50%, var(--halloween-fog) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--halloween-fog) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, var(--halloween-fog) 0%, transparent 50%);
  animation: halloween-fog-drift 30s ease-in-out infinite;
  opacity: 0.3;
}

@keyframes halloween-fog-drift {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-50%);
  }
}

/* ============================================
   Particle Effects Container
   ============================================ */
.halloween-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.halloween-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--halloween-orange);
  border-radius: 50%;
  opacity: 0.5;
  animation: halloween-particle-fall linear infinite;
}

@keyframes halloween-particle-fall {
  0% {
    transform: translateY(-10px) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(100vh) translateX(50px) rotate(360deg);
    opacity: 0;
  }
}

/* ============================================
   Spooky Text Shadow Effects
   ============================================ */
.halloween-theme .hero h1,
.halloween-theme .page-title {
  text-shadow: 
    0 0 10px var(--halloween-orange),
    0 0 20px var(--halloween-orange),
    0 0 30px var(--halloween-purple);
}

/* ============================================
   Halloween Badge Glow
   ============================================ */
.badge.halloween-badge {
  background: linear-gradient(135deg, var(--halloween-orange), var(--halloween-purple));
  animation: halloween-badge-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 15px var(--halloween-orange);
}

@keyframes halloween-badge-pulse {
  0%, 100% {
    box-shadow: 0 0 15px var(--halloween-orange);
  }
  50% {
    box-shadow: 0 0 25px var(--halloween-orange), 0 0 35px var(--halloween-purple);
  }
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
  .halloween-cobweb {
    width: 80px;
    height: 80px;
    opacity: 0.3;
  }
  
  /* Navbar cobwebs - smaller on mobile */
  body.halloween-theme nav.navbar::before,
  body.halloween-theme nav.navbar::after {
    width: 80px !important;
    height: 80px !important;
    opacity: 0.4 !important;
  }
  
  .halloween-ghost {
    font-size: 1.5rem;
  }
  
  .halloween-bat {
    font-size: 1.2rem;
  }
  
  .halloween-banner {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    font-size: 0.85rem;
    padding: 10px 14px;
  }
  
  /* Reduce particle count visually on mobile */
  .halloween-particle:nth-child(n+11) {
    display: none;
  }
  
  /* Simplify fog on mobile */
  .halloween-fog {
    opacity: 0.15;
  }
}

/* Medium screens (tablets) */
@media (min-width: 769px) and (max-width: 1024px) {
  body.halloween-theme nav.navbar::before,
  body.halloween-theme nav.navbar::after {
    width: 100px !important;
    height: 100px !important;
    opacity: 0.45 !important;
  }
}

/* ============================================
   Accessibility: Reduce Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .halloween-ghost,
  .halloween-bat,
  .halloween-fog,
  .halloween-particle,
  .halloween-banner,
  .halloween-theme .navbar-brand,
  .halloween-theme h1,
  .halloween-theme h2 {
    animation: none;
  }
  
  .halloween-cobweb {
    opacity: 0.3;
  }
}

/* ============================================
   Footer polish in Halloween Mode
   - Remove unintended glows and borders from footer sections
   ============================================ */
.halloween-theme footer {
  background: transparent; /* let the page gradient flow behind */
  border-top: none !important;
  box-shadow: none;
}

/* Footer internal dividers should stay subtle */
.halloween-theme footer hr {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Prevent nav glow/borders inside footer */
.halloween-theme footer nav {
  box-shadow: none !important;
}

/* ============================================
   Print Styles (Hide Halloween Effects)
   ============================================ */
@media print {
  .halloween-ghost,
  .halloween-bat,
  .halloween-cobweb,
  .halloween-fog,
  .halloween-particles,
  .halloween-banner {
    display: none !important;
  }
}
