@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

@layer base {
  :root {
    /* HGTX Codex - Light Theme */
    --background: 210 40% 98%;
    --foreground: 222 47% 11%;

    --card: 0 0% 100%;
    --card-foreground: 222 47% 11%;

    --popover: 0 0% 100%;
    --popover-foreground: 222 47% 11%;

    --primary: 190 100% 45%;
    --primary-foreground: 0 0% 100%;

    --secondary: 210 100% 45%;
    --secondary-foreground: 0 0% 100%;

    --muted: 210 40% 96%;
    --muted-foreground: 215 16% 47%;

    --accent: 190 100% 50%;
    --accent-foreground: 0 0% 100%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;

    --success: 142 71% 45%;
    --success-foreground: 0 0% 100%;

    --warning: 38 92% 50%;
    --warning-foreground: 222 47% 11%;

    --border: 214 32% 91%;
    --input: 214 32% 91%;
    --ring: 190 100% 45%;

    --radius: 0.75rem;

    /* Sidebar specific - Light */
    --sidebar-background: 210 40% 99%;
    --sidebar-foreground: 222 47% 11%;
    --sidebar-primary: 190 100% 45%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 210 40% 95%;
    --sidebar-accent-foreground: 222 47% 11%;
    --sidebar-border: 214 32% 88%;
    --sidebar-ring: 190 100% 45%;

    /* Custom gradients - Light */
    --gradient-cyber: linear-gradient(135deg, hsl(190 100% 45%) 0%, hsl(210 100% 45%) 100%);
    --gradient-subtle: linear-gradient(180deg, hsl(210 40% 98%) 0%, hsl(210 40% 95%) 100%);
    --glow-cyan: 0 0 40px hsl(190 100% 50% / 0.15);
    --glow-blue: 0 0 30px hsl(210 100% 50% / 0.12);

    /* Animation speeds */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --color-1: oklch(66.2% 0.225 25.9);
    --color-2: oklch(60.4% 0.26 302);
    --color-3: oklch(69.6% 0.165 251);
    --color-4: oklch(80.2% 0.134 225);
    --color-5: oklch(90.7% 0.231 133);
  }

  .dark {
    /* HGTX Codex - Dark Theme */
    --background: 222 47% 5%;
    --foreground: 200 100% 95%;

    --card: 222 40% 8%;
    --card-foreground: 200 100% 95%;

    --popover: 222 45% 10%;
    --popover-foreground: 200 100% 95%;

    --primary: 190 100% 50%;
    --primary-foreground: 222 47% 5%;

    --secondary: 210 100% 50%;
    --secondary-foreground: 222 47% 5%;

    --muted: 222 30% 15%;
    --muted-foreground: 200 20% 65%;

    --accent: 190 100% 60%;
    --accent-foreground: 222 47% 5%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 200 100% 95%;

    --success: 142 71% 45%;
    --success-foreground: 222 47% 5%;

    --warning: 38 92% 50%;
    --warning-foreground: 222 47% 5%;

    --border: 222 30% 18%;
    --input: 222 30% 18%;
    --ring: 190 100% 50%;

    /* Sidebar specific - Dark */
    --sidebar-background: 222 45% 7%;
    --sidebar-foreground: 200 100% 90%;
    --sidebar-primary: 190 100% 50%;
    --sidebar-primary-foreground: 222 47% 5%;
    --sidebar-accent: 222 35% 12%;
    --sidebar-accent-foreground: 190 100% 60%;
    --sidebar-border: 222 30% 15%;
    --sidebar-ring: 190 100% 50%;

    /* Custom gradients - Dark */
    --gradient-cyber: linear-gradient(135deg, hsl(190 100% 50%) 0%, hsl(210 100% 50%) 100%);
    --gradient-subtle: linear-gradient(180deg, hsl(222 45% 8%) 0%, hsl(222 47% 5%) 100%);
    --glow-cyan: 0 0 40px hsl(190 100% 50% / 0.3);
    --glow-blue: 0 0 30px hsl(210 100% 50% / 0.25);
    --color-1: oklch(66.2% 0.225 25.9);
    --color-2: oklch(60.4% 0.26 302);
    --color-3: oklch(69.6% 0.165 251);
    --color-4: oklch(80.2% 0.134 225);
    --color-5: oklch(90.7% 0.231 133);
  }
  .theme {
    --animate-shiny-text: shiny-text 8s infinite;
    --animate-gradient: gradient 8s linear infinite;
    --animate-rainbow: rainbow var(--speed, 2s) infinite linear;
    --animate-shimmer-slide: shimmer-slide var(--speed) ease-in-out infinite alternate;
    --animate-spin-around: spin-around calc(var(--speed) * 2) infinite linear;
    --animate-rippling: rippling var(--duration) ease-out;
    --animate-blink-cursor: blink-cursor 1.2s step-end infinite;
    --animate-background-position-spin: background-position-spin 3000ms infinite alternate;
    --animate-ripple: ripple var(--duration,2s) ease calc(var(--i, 0)*.2s) infinite;
  }
}

@layer base {
  * {
    @apply border-border transition-colors;
  }

  body {
    @apply bg-background text-foreground font-sans antialiased;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
  }

  /* Scrollbar styling */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    @apply bg-background;
  }

  ::-webkit-scrollbar-thumb {
    @apply bg-muted rounded-full;
  }

  ::-webkit-scrollbar-thumb:hover {
    @apply bg-primary/50;
  }
}

@layer components {
  .glass-effect {
    @apply bg-card/80 backdrop-blur-xl border border-border/50;
  }

  .cyber-glow {
    box-shadow: var(--glow-cyan);
  }

  .cyber-border {
    @apply border border-primary/30 rounded-lg;
    box-shadow: 0 0 20px hsl(190 100% 50% / 0.1);
  }

  .gradient-text {
    @apply bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent;
  }

  .metric-card {
    @apply bg-card rounded-xl p-5 border border-border shadow-sm transition-all duration-300 hover:shadow-md hover:border-primary/30;
  }

  .nav-item {
    @apply flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200 w-full;
    display: flex;
    align-items: center;
    text-decoration: none;
  }

  .nav-item svg,
  .nav-item .w-5 {
    flex-shrink: 0;
  }

  .nav-item span {
    white-space: nowrap;
  }

  .nav-item-inactive {
    @apply text-muted-foreground hover:text-foreground hover:bg-sidebar-accent;
  }

  .nav-item-active {
    @apply text-primary bg-sidebar-accent font-medium;
  }

  .status-dot {
    @apply w-2 h-2 rounded-full;
  }

  .status-connected {
    @apply bg-success;
    box-shadow: 0 0 8px hsl(var(--success) / 0.6);
    animation: pulse 2s infinite;
  }

  .status-error {
    @apply bg-destructive;
    box-shadow: 0 0 8px hsl(var(--destructive) / 0.6);
    animation: pulse 2s infinite;
  }

  .status-warning {
    @apply bg-warning;
    box-shadow: 0 0 8px hsl(var(--warning) / 0.6);
    animation: pulse 2s infinite;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@theme inline {
  @keyframes shiny-text {
  0%, 90%, 100% {
    background-position: calc(-100% - var(--shiny-width)) 0;
    }
  30%, 60% {
    background-position: calc(100% + var(--shiny-width)) 0;
    }
  }
  @keyframes gradient {
  to {
    background-position: var(--bg-size, 300%) 0;
    }
  }
  @keyframes rainbow {
  0% {
    background-position: 0%;
    }
  100% {
    background-position: 200%;
    }
  }
  @keyframes shimmer-slide {
  to {
    transform: translate(calc(100cqw - 100%), 0);
    }
  }
  @keyframes spin-around {
  0% {
    transform: translateZ(0) rotate(0);
    }
  15%, 35% {
    transform: translateZ(0) rotate(90deg);
    }
  65%, 85% {
    transform: translateZ(0) rotate(270deg);
    }
  100% {
    transform: translateZ(0) rotate(360deg);
    }
  }
  @keyframes rippling {
  0% {
    opacity: 1;
    }
  100% {
    transform: scale(2);
    opacity: 0;
    }
  }
  @keyframes blink-cursor {
  0%, 49% {
    opacity: 1;
    }
  50%, 100% {
    opacity: 0;
    }
  }
  @keyframes background-position-spin {
  0% {
    background-position: top center;
    }
  100% {
    background-position: bottom center;
    }
  }
  @keyframes ripple {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    }
  50% {
    transform: translate(-50%, -50%) scale(0.9);
    }
  }
}