@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.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: 222.2 84% 4.9%;
    --radius: 0.5rem;
    --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%;
  }

  .dark {
    /* Premium Design System - OpenCodeHub Landing */
    --background: 227 45% 5%;
    /* #0B1020 */
    --foreground: 228 33% 92%;
    /* #E6E8F0 */
    --card: 229 40% 12%;
    /* #12172A */
    --card-foreground: 228 33% 92%;
    --popover: 229 40% 12%;
    --popover-foreground: 228 33% 92%;
    --primary: 233 100% 74%;
    /* #7C8CFF */
    --primary-foreground: 227 45% 5%;
    --secondary: 230 100% 82%;
    /* #A3B3FF */
    --secondary-foreground: 227 45% 5%;
    --muted: 229 40% 12%;
    --muted-foreground: 216 11% 65%;
    /* #9AA3B2 */
    --accent: 233 100% 74%;
    --accent-foreground: 227 45% 5%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 0 0% 100% / 0.06;
    /* borderSubtle */
    --input: 229 40% 12%;
    --ring: 233 100% 74%;
    --success: 142 70% 58%;
    /* #4ADE80 */

    /* Premium gradients and effects */
    --hero-gradient: radial-gradient(ellipse at top center, hsl(229 40% 18%) 0%, hsl(227 45% 5%) 60%);
    --glass-blur: 20px;
    --glass-bg: rgba(18, 23, 42, 0.6);

    /* Chart colors */
    --chart-1: 233 100% 74%;
    --chart-2: 142 70% 58%;
    --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 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground));
}

/* Code syntax highlighting base */
.hljs {
  display: block;
  overflow-x: auto;
  padding: 1em;
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
}

/* Monaco Editor customizations */
.monaco-editor {
  border-radius: var(--radius);
}

/* Git diff styles */
.diff-add {
  background-color: rgba(46, 160, 67, 0.15);
}

.diff-remove {
  background-color: rgba(248, 81, 73, 0.15);
}

.diff-add-line {
  @apply bg-green-50 dark:bg-green-900/20 border-l-4 border-green-500;
}

.diff-remove-line {
  @apply bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500;
}

.diff-context-line {
  @apply bg-gray-50 dark:bg-gray-800/50 border-l-4 border-gray-300;
}

/* File tree styles */
.file-tree-item {
  @apply flex items-center gap-2 px-2 py-1 rounded cursor-pointer hover:bg-accent transition-colors;
}

.file-tree-item.selected {
  @apply bg-accent text-accent-foreground;
}

/* Commit graph styles */
.commit-graph-line {
  stroke-width: 2;
  fill: none;
}

.commit-graph-node {
  stroke-width: 2;
}

/* Pipeline status colors */
.pipeline-success {
  @apply text-green-600 dark:text-green-400;
}

.pipeline-failed {
  @apply text-red-600 dark:text-red-400;
}

.pipeline-pending {
  @apply text-yellow-600 dark:text-yellow-400;
}

.pipeline-running {
  @apply text-blue-600 dark:text-blue-400;
}

/* Animation keyframes */
@keyframes pulse-slow {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.animate-pulse-slow {
  animation: pulse-slow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-spin-slow {
  animation: spin-slow 3s linear infinite;
}

/* Markdown preview styles */
.markdown-body {
  @apply text-foreground;
}

.markdown-body h1 {
  @apply text-3xl font-bold mb-4 pb-2 border-b;
}

.markdown-body h2 {
  @apply text-2xl font-bold mb-3 pb-2 border-b;
}

.markdown-body h3 {
  @apply text-xl font-bold mb-2;
}

.markdown-body p {
  @apply mb-4;
}

.markdown-body ul {
  @apply list-disc list-inside mb-4;
}

.markdown-body ol {
  @apply list-decimal list-inside mb-4;
}

.markdown-body code {
  @apply bg-muted px-1.5 py-0.5 rounded text-sm font-mono;
}

.markdown-body pre {
  @apply bg-muted p-4 rounded-lg overflow-x-auto mb-4;
}

.markdown-body pre code {
  @apply bg-transparent p-0;
}

.markdown-body blockquote {
  @apply border-l-4 border-muted-foreground pl-4 italic my-4;
}

.markdown-body table {
  @apply w-full border-collapse mb-4;
}

.markdown-body th,
.markdown-body td {
  @apply border px-4 py-2 text-left;
}

.markdown-body th {
  @apply bg-muted font-semibold;
}

.markdown-body a {
  @apply text-primary hover:underline;
}

.markdown-body img {
  @apply max-w-full rounded-lg;
}

/* Loading skeleton */
.skeleton {
  @apply animate-pulse bg-muted rounded;
}

/* Focus ring utility */
.focus-ring {
  @apply focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background;
}

/* ====== Premium Landing Page Animations ====== */

/* Text reveal animation - staggered word appearance */
@keyframes text-reveal {
  0% {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.animate-text-reveal {
  animation: text-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  opacity: 0;
}

/* Shimmer effect for timeline */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

.animate-shimmer {
  animation: shimmer 3s infinite linear;
}

/* Slide up + fade */
@keyframes slide-fade-up {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slide-fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Soft pulse for dots */
@keyframes soft-pulse {

  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

.animate-soft-pulse {
  animation: soft-pulse 2s ease-in-out infinite;
}

/* Glass card hover effect */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.glass-card:hover {
  background: rgba(18, 23, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* CTA Button Styles */
.btn-primary-glow {
  background: linear-gradient(135deg, hsl(233 100% 74%) 0%, hsl(230 100% 82%) 100%);
  color: hsl(227 45% 5%);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 20px rgba(124, 140, 255, 0.3);
}

.btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 140, 255, 0.5);
}

/* Hero gradient background */
.hero-gradient {
  background: var(--hero-gradient);
}

/* Motion preference support */
@media (prefers-reduced-motion: reduce) {

  .animate-text-reveal,
  .animate-shimmer,
  .animate-slide-up,
  .animate-soft-pulse {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ====== Aceternity UI Styles ====== */

/* Spotlight animation */
@keyframes spotlight {
  0% {
    opacity: 0;
    transform: translate(-72%, -62%) scale(0.5);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -40%) scale(1);
  }
}

.animate-spotlight {
  animation: spotlight 2s ease 0.75s 1 forwards;
}

/* Dot backgrounds for Hero Highlight */
.bg-dot-thick-neutral-800 {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 16px 16px;
}

.bg-dot-thick-primary {
  background-image: radial-gradient(circle, hsl(var(--primary)) 1px, transparent 1px);
  background-size: 16px 16px;
}

/* Grid background */
.bg-grid-white\/\[0\.02\] {
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Gradient text */
.bg-clip-text {
  -webkit-background-clip: text;
  background-clip: text;
}

/* Glass panel for admin dashboard */
.glass-panel {
  background: rgba(18, 23, 42, 0.6);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Custom scrollbar for panels */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Smooth transitions for all interactive elements */
@layer utilities {
  .transition-smooth {
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* Gradient text animation */
@keyframes gradient-x {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.animate-gradient-x {
  animation: gradient-x 3s ease infinite;
}