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

body {
  font-family: var(--font-body), sans-serif;
}

@layer base {
  :root {
    --background: 210 20% 98%;
    --foreground: 224 7.1% 4.1%;
    --card: 0 0% 100%;
    --card-foreground: 224 7.1% 4.1%;
    --popover: 0 0% 100%;
    --popover-foreground: 224 7.1% 4.1%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 20% 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 20% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.75rem;
    --chart-1: 221.2 83.2% 53.3%;
    --chart-2: 212 95% 68%;
    --chart-3: 216 92% 60%;
    --chart-4: 210 98% 78%;
    --chart-5: 212 97% 87%;

    --sidebar-background: 0 0% 100%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 221.2 83.2% 53.3%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 240 5.9% 90%;
    --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: 217.2 91.2% 59.8%;
    --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: 224.3 76.3% 48%;
    
    --sidebar-background: 240 10% 3.9%;
    --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%;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
    font-feature-settings: "rlig" 1, "calt" 1;
    text-rendering: optimizeLegibility;
  }
}

@layer components {
  .app-ambient-bg {
    background:
      radial-gradient(circle at 12% 18%, hsl(var(--primary) / 0.18), transparent 30rem),
      radial-gradient(circle at 88% 8%, rgb(14 165 233 / 0.16), transparent 28rem),
      radial-gradient(circle at 70% 92%, rgb(168 85 247 / 0.14), transparent 34rem),
      linear-gradient(135deg, hsl(var(--background)), hsl(var(--muted) / 0.58));
  }

  .app-aurora {
    pointer-events: none;
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .app-aurora::before,
  .app-aurora::after {
    content: "";
    position: absolute;
    width: 34rem;
    height: 34rem;
    border-radius: 9999px;
    filter: blur(90px);
    opacity: 0.34;
    animation: float-orb 16s ease-in-out infinite;
  }

  .app-aurora::before {
    top: -12rem;
    right: 12%;
    background: hsl(var(--primary) / 0.46);
  }

  .app-aurora::after {
    bottom: -16rem;
    left: 5%;
    background: rgb(20 184 166 / 0.34);
    animation-delay: -7s;
  }

  .app-noise {
    pointer-events: none;
    position: absolute;
    inset: 0;
    opacity: 0.38;
    background-image:
      linear-gradient(hsl(var(--foreground) / 0.035) 1px, transparent 1px),
      linear-gradient(90deg, hsl(var(--foreground) / 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
  }

  .glass-panel {
    @apply border border-white/50 bg-white/70 shadow-xl shadow-slate-900/5 backdrop-blur-2xl dark:border-white/10 dark:bg-slate-950/60 dark:shadow-black/20;
  }

  .interactive-card {
    @apply relative overflow-hidden transition-all duration-300 ease-out hover:-translate-y-1 hover:border-primary/30 hover:shadow-2xl hover:shadow-primary/10;
  }

  .interactive-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms ease;
    background: linear-gradient(135deg, hsl(var(--primary) / 0.12), transparent 35%, rgb(14 165 233 / 0.1));
  }

  .interactive-card:hover::before {
    opacity: 1;
  }

  .page-header-shell {
    @apply relative overflow-hidden rounded-[2rem] border border-white/60 bg-white/70 p-5 shadow-xl shadow-slate-900/5 backdrop-blur-2xl dark:border-white/10 dark:bg-slate-950/60 md:p-6;
  }

  .page-header-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, hsl(var(--primary) / 0.16), transparent 22rem);
  }

  .page-header-content {
    @apply relative z-10;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  @apply bg-transparent;
}
::-webkit-scrollbar-thumb {
  @apply bg-muted-foreground/20 rounded-full hover:bg-muted-foreground/30 transition-colors;
}

/* Card hover effects and refinements */
.card-stack-effect {
  @apply transition-all duration-300 hover:shadow-lg hover:border-primary/30;
}

.bg-subtle {
  @apply bg-muted/30 dark:bg-primary/5;
}

.animate-gradient-x {
  background-size: 220% 220%;
  animation: gradient-x 5s ease infinite;
}

.animate-shake {
  animation: shake 0.55s ease-in-out;
}

@keyframes gradient-x {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-10deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}

@keyframes float-orb {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(2rem, -1.5rem, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
