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

/* Dark mode variant */

:root {
  --background: 210 40% 98%;
  --foreground: 222 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222 84% 4.9%;
  --primary: 221 83% 53%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96%;
  --secondary-foreground: 222 84% 4.9%;
  --muted: 210 40% 96%;
  --muted-foreground: 215 16% 47%;
  --accent: 210 40% 96%;
  --accent-foreground: 222 84% 4.9%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 210 40% 98%;
  --border: 214 32% 91%;
  --input: 214 32% 91%;
  --ring: 221 83% 53%;
  --chart-1: 221 83% 53%;
  --chart-2: 215 70% 50%;
  --chart-3: 210 100% 50%;
  --chart-4: 200 100% 50%;
  --chart-5: 190 90% 50%;
  --radius: 0.5rem;
  --sidebar: 0 0% 100%;
  --sidebar-foreground: 222 84% 4.9%;
  --sidebar-primary: 221 83% 53%;
  --sidebar-primary-foreground: 210 40% 98%;
  --sidebar-accent: 210 40% 96%;
  --sidebar-accent-foreground: 222 84% 4.9%;
  --sidebar-border: 214 32% 91%;
  --sidebar-ring: 221 83% 53%;
}

.dark {
  --background: 222 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 217 33% 17%;
  --card-foreground: 210 40% 98%;
  --popover: 217 33% 17%;
  --popover-foreground: 210 40% 98%;
  --primary: 217 91% 60%;
  --primary-foreground: 222 84% 4.9%;
  --secondary: 215 28% 17%;
  --secondary-foreground: 210 40% 98%;
  --muted: 215 28% 17%;
  --muted-foreground: 210 20% 80%;
  --accent: 215 28% 17%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 63% 31%;
  --destructive-foreground: 210 40% 98%;
  --border: 215 28% 17%;
  --input: 215 28% 17%;
  --ring: 217 91% 60%;
  --chart-1: 217 91% 60%;
  --chart-2: 215 70% 50%;
  --chart-3: 210 100% 50%;
  --chart-4: 200 100% 50%;
  --chart-5: 190 90% 50%;
  --sidebar: 222 84% 4.9%;
  --sidebar-foreground: 210 40% 98%;
  --sidebar-primary: 217 91% 60%;
  --sidebar-primary-foreground: 222 84% 4.9%;
  --sidebar-accent: 215 28% 17%;
  --sidebar-accent-foreground: 210 40% 98%;
  --sidebar-border: 215 28% 17%;
  --sidebar-ring: 217 91% 60%;
}

@layer base {
  * {
    @apply border-border;
    outline: 2px solid transparent;
    outline-offset: 2px;
  }
  
  *:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
  }
  
  body {
    @apply bg-background text-foreground;
  }
}

@layer components {
  .gradient-bg {
    @apply bg-gradient-to-br from-blue-600 via-blue-700 to-indigo-800;
  }

  .gradient-text {
    @apply bg-gradient-to-r from-blue-400 via-blue-500 to-indigo-500 bg-clip-text text-transparent font-bold;
  }

  .card-gradient {
    @apply bg-gradient-to-br from-white to-blue-50/50 dark:from-slate-800 dark:to-slate-900/50 border border-blue-200/50 dark:border-slate-700/50;
  }

  .btn-gradient {
    @apply bg-gradient-to-r from-blue-600 via-blue-700 to-indigo-700 hover:from-blue-700 hover:via-blue-800 hover:to-indigo-800 text-white shadow-lg hover:shadow-xl transition-all duration-300;
  }

  .sidebar-gradient {
    @apply bg-gradient-to-b from-slate-900 via-slate-800 to-slate-900;
  }

  /* Dark, immersive newsletter gradient with emphasis from both sides */
  .newsletter-gradient {
    background-image:
      radial-gradient(ellipse at left, rgba(0,0,0,0.45), rgba(0,0,0,0) 55%),
      radial-gradient(ellipse at right, rgba(0,0,0,0.45), rgba(0,0,0,0) 55%),
      linear-gradient(90deg, #0a1a33 0%, #0e2f66 35%, #1e3a8a 50%, #0e2f66 65%, #0a1a33 100%);
    background-blend-mode: overlay, overlay, normal;
  }

  /* Additional utility classes */
  .text-gradient {
    @apply bg-gradient-to-r from-blue-600 to-indigo-600 bg-clip-text text-transparent;
  }

  .border-gradient {
    background: linear-gradient(to right, #2563eb, #4f46e5);
    background-clip: border-box;
    border: 2px solid transparent;
    border-radius: 0.5rem;
  }

  .hover-lift {
    @apply transition-all duration-300 hover:-translate-y-1 hover:shadow-lg;
  }
}

/* Custom scrollbar - Webkit browsers only */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background-color: hsl(var(--muted));
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb {
    background-color: hsl(var(--primary));
    border-radius: 4px;
    transition: background-color 0.2s ease;
  }

  ::-webkit-scrollbar-thumb:hover {
    background-color: hsl(var(--primary) / 0.8);
  }

  ::-webkit-scrollbar-corner {
    background-color: hsl(var(--muted));
  }
}

/* Animation classes */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Responsive utilities */
@media (max-width: 640px) {
  .mobile-hidden {
    display: none !important;
  }
}

@media (min-width: 641px) {
  .desktop-hidden {
    display: none !important;
  }
}

/* Focus states for accessibility */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--ring)), 0 0 0 4px hsl(var(--background));
}

/* Smooth transitions */
.transition-smooth {
  @apply transition-all duration-300 ease-in-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: 0 0% 0%;
    --ring: 0 0% 0%;
  }
  
  .dark {
    --border: 0 0% 100%;
    --ring: 0 0% 100%;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .fade-in,
  .slide-in {
    animation: none;
  }
}
