/* Optimized CSS to improve performance */

/* Only import the weights we need */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

@layer base {
  :root {
    --background: 210 40% 98%;
    --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: 206 100% 50%;
    --primary-foreground: 210 40% 98%;

    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;

    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;

    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;

    --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: 206 100% 50%;

    --radius: 0.5rem;

    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 240 5.9% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }

  .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: 206 100% 50%;
    --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%;
    
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 224.3 76.3% 48%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }

  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground font-['Inter',sans-serif] antialiased;
    text-rendering: optimizeLegibility;
  }
  
  /* Improve performance by using content-visibility for off-screen content */
  .content-visibility-auto {
    content-visibility: auto;
  }
}

/* Optimize commonly used utility classes to avoid large CSS files */
@layer utilities {
  .glass {
    @apply bg-white/80 backdrop-blur-md border border-white/20 shadow-lg;
  }
  
  .text-balance {
    text-wrap: balance;
  }

  .text-pretty {
    text-wrap: pretty;
  }
  
  /* Add high-contrast text utility */
  .text-high-contrast {
    @apply text-gray-900 dark:text-white;
  }
  
  /* Add accessible button styles with better contrast */
  .btn-accessible {
    @apply bg-primary text-white font-medium px-4 py-2 rounded-md hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary/50;
  }
}

/* Optimize animations for better performance */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
  will-change: transform;
}

/* Optimize map-related styles for better rendering */
.map-container {
  width: 100%;
  height: 100%;
  contain: content;
}

.marker {
  background-color: theme('colors.blue.600');
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* Optimize page transitions */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px) translateZ(0);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0) translateZ(0);
  transition: opacity 300ms, transform 300ms;
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px) translateZ(0);
  transition: opacity 300ms, transform 300ms;
}

/* Optimize loading indicator */
.loading-dot {
  @apply inline-block h-2 w-2 rounded-full bg-blue-500;
  will-change: transform, opacity;
}

@keyframes loading {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Add media query for responsive optimization */
@media (max-width: 768px) {
  /* Reduce animations on mobile devices for better performance */
  .animate-float {
    animation: none;
  }
  
  /* Optimize layout shifts for mobile */
  .content-container {
    contain: layout style;
  }
}
