@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --chart-1: 12 76% 61%;
    --chart-2: 173 58% 39%;
    --chart-3: 197 37% 24%;
    --chart-4: 43 74% 66%;
    --chart-5: 27 87% 67%;
    --radius: 0.5rem;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
    --chart-1: 220 70% 50%;
    --chart-2: 160 60% 45%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}

/* Custom scrollbar styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.8);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.9);
}

/* Ensure mobile playback controls are always on top */
.mobile-playback-controls {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
}

/* Prevent map from interfering with controls */
.leaflet-container {
  touch-action: pan-x pan-y !important;
}

/* Ensure controls are touchable */
.touch-manipulation {
  touch-action: manipulation !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

/* Fix for mobile zoom issues */
@media (max-width: 768px) {
  .mobile-playback-controls {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
  }

  /* Ensure map doesn't capture touch events from controls */
  .leaflet-container {
    touch-action: pan-x pan-y !important;
  }

  /* Make sure controls area is always interactive */
  .mobile-playback-controls * {
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }
}

/* Safe area support for devices with notches */
.safe-area-pb {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Animation speed variable */
:root {
  --animation-speed: 300ms;
}

/* Glassmorphism effects */
.backdrop-blur-xl {
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.backdrop-blur-sm {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Ensure high z-index elements stay on top */
.z-\[9999\] {
  z-index: 9999 !important;
}

.z-\[10000\] {
  z-index: 10000 !important;
}

.bg-gradient-conic-fast {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.4) 30deg,
    rgba(0, 255, 255, 0.3) 60deg,
    transparent 90deg,
    transparent 360deg
  );
}

.bg-gradient-conic-slow {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 255, 255, 0.3) 45deg,
    rgba(0, 150, 255, 0.2) 90deg,
    transparent 135deg,
    transparent 360deg
  );
}

.bg-gradient-conic-reverse {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(100, 150, 255, 0.2) 60deg,
    transparent 120deg,
    transparent 360deg
  );
}


@keyframes spin-fast {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spin-slow {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spin-reverse {
  0% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes matrix-rain {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(200%);
    opacity: 0;
  }
}

@keyframes scan-line {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(400%);
    opacity: 0;
  }
}

@keyframes energy-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.7;
  }
}

@keyframes particle-float {
  0%,
  100% {
    transform: translateY(0px) scale(1);
    opacity: 0.8;
  }
  25% {
    transform: translateY(-8px) scale(1.2);
    opacity: 1;
  }
  50% {
    transform: translateY(-4px) scale(0.8);
    opacity: 0.6;
  }
  75% {
    transform: translateY(-12px) scale(1.1);
    opacity: 0.9;
  }
}

@keyframes orbit-1 {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) translateX(15px) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg) translateX(15px) rotate(-360deg);
  }
}

@keyframes orbit-2 {
  0% {
    transform: translate(-50%, -50%) rotate(120deg) translateX(12px) rotate(-120deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(480deg) translateX(12px) rotate(-480deg);
  }
}

@keyframes orbit-3 {
  0% {
    transform: translate(-50%, -50%) rotate(240deg) translateX(18px) rotate(-240deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(600deg) translateX(18px) rotate(-600deg);
  }
}

@keyframes shockwave {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes glitch {
  0%,
  100% {
    transform: translateX(0);
  }
  10% {
    transform: translateX(-2px);
  }
  20% {
    transform: translateX(2px);
  }
  30% {
    transform: translateX(-1px);
  }
  40% {
    transform: translateX(1px);
  }
  50% {
    transform: translateX(-2px);
  }
  60% {
    transform: translateX(2px);
  }
  70% {
    transform: translateX(-1px);
  }
  80% {
    transform: translateX(1px);
  }
  90% {
    transform: translateX(-2px);
  }
}


@keyframes radar-transform-smooth {
  0% {
    transform: rotate(0deg) scale(1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
  }
  50% {
    transform: rotate(180deg) scale(1.3);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.9));
  }
  100% {
    transform: rotate(360deg) scale(1.5);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 1));
  }
}


.animate-spin-fast {
  animation: spin-fast 0.8s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.animate-spin-slow {
  animation: spin-slow 2s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.animate-spin-reverse {
  animation: spin-reverse 1.5s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.animate-matrix-rain {
  animation: matrix-rain 2s linear infinite;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.animate-scan-line {
  animation: scan-line 1.5s ease-in-out infinite;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.animate-energy-pulse {
  animation: energy-pulse 1s ease-in-out infinite;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.animate-particle-float {
  animation: particle-float 2s ease-in-out infinite;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.animate-orbit-1 {
  animation: orbit-1 3s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.animate-orbit-2 {
  animation: orbit-2 2s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.animate-orbit-3 {
  animation: orbit-3 4s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.animate-shockwave {
  animation: shockwave 0.6s ease-out;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.animate-glitch {
  animation: glitch 0.3s ease-in-out infinite;
  will-change: transform;
  transform: translateZ(0);
}


.animate-radar-transform-smooth {
  animation: radar-transform-smooth 1s ease-out forwards;
  will-change: transform, filter;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.group {
  transform: translateZ(0);
  backface-visibility: hidden;
}

.group:hover {
  transform: translateZ(0);
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


.group > * {
  transform: translateZ(0);
}
