@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";

/* Exo 2 Font */
@font-face {
  font-family: 'Exo 2';
  src: url('/fonts/Exo2-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Exo 2';
  src: url('/fonts/Exo2-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Exo 2';
  src: url('/fonts/Exo2-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Exo 2';
  src: url('/fonts/Exo2-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Exo 2';
  src: url('/fonts/Exo2-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-sans);
  --font-mono: var(--font-geist-mono);
  --font-heading: var(--font-sans);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}

:root {
  --radius: 0.625rem;
}

/* Midnight theme defaults — used before ThemeProvider hydrates on client.
   ThemeProvider overrides these inline on :root once JS loads. */
.dark {
  --background: 230 25% 4%;
  --foreground: 210 40% 98%;
  --card: 220 30% 8%;
  --card-foreground: 210 40% 98%;
  --popover: 220 30% 8%;
  --popover-foreground: 210 40% 98%;
  --primary: 217 91% 60%;
  --primary-foreground: 210 40% 98%;
  --secondary: 217 33% 17%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 68%;
  --accent: 217 33% 17%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 84% 60%;
  --border: 217 33% 20%;
  --input: 217 33% 20%;
  --ring: 217 91% 60%;
  --chart-1: 217 91% 60%;
  --chart-2: 160 60% 45%;
  --chart-3: 30 80% 55%;
  --chart-4: 280 65% 60%;
  --chart-5: 340 75% 55%;
  --sidebar: 220 30% 6%;
  --sidebar-foreground: 210 40% 98%;
  --sidebar-primary: 217 91% 60%;
  --sidebar-primary-foreground: 210 40% 98%;
  --sidebar-accent: 217 33% 17%;
  --sidebar-accent-foreground: 210 40% 98%;
  --sidebar-border: 217 33% 20%;
  --sidebar-ring: 217 91% 60%;
  --card-bg: rgba(15, 20, 40, 0.35);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-hover-bg: rgba(15, 20, 40, 0.45);
  --card-hover-border: rgba(255, 255, 255, 0.2);
  --glass-bg: rgba(15, 20, 40, 0.30);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.03);
  --glass-input-bg: rgba(255, 255, 255, 0.06);
  --glass-input-border: rgba(255, 255, 255, 0.1);
  --glass-input-focus: rgba(59, 130, 246, 0.3);
  --glass-input-focus-bg: rgba(255, 255, 255, 0.08);
  --glass-table-header: rgba(255, 255, 255, 0.08);
  --glass-bar-track: rgba(255, 255, 255, 0.10);
  --nav-bg: rgba(6, 6, 17, 0.65);
  --nav-border: rgba(255, 255, 255, 0.08);
  --nav-active: rgba(255, 255, 255, 0.08);
  --nav-hover: rgba(255, 255, 255, 0.05);
  --accent-color: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --card-lift-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  --stat-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --nav-active-glow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Light theme base values (overridden by ThemeProvider inline styles) */
:root:not(.dark) {
  --background: 210 20% 98%;
  --foreground: 215 25% 15%;
  --card: 0 0% 100%;
  --card-foreground: 215 25% 15%;
  --popover: 0 0% 100%;
  --popover-foreground: 215 25% 15%;
  --primary: 217 91% 53%;
  --primary-foreground: 0 0% 100%;
  --secondary: 214 32% 91%;
  --secondary-foreground: 215 25% 15%;
  --muted: 214 32% 91%;
  --muted-foreground: 215 16% 47%;
  --accent: 214 32% 91%;
  --accent-foreground: 215 25% 15%;
  --destructive: 0 84% 60%;
  --border: 214 32% 88%;
  --input: 214 32% 88%;
  --ring: 217 91% 53%;
  --chart-1: 217 91% 53%;
  --chart-2: 160 60% 45%;
  --chart-3: 30 80% 55%;
  --chart-4: 280 65% 60%;
  --chart-5: 340 75% 55%;
  --sidebar: 210 20% 97%;
  --sidebar-foreground: 215 25% 15%;
  --sidebar-primary: 217 91% 53%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 214 32% 91%;
  --sidebar-accent-foreground: 215 25% 15%;
  --sidebar-border: 214 32% 88%;
  --sidebar-ring: 217 91% 53%;

  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-hover-bg: rgba(255, 255, 255, 1);
  --card-hover-border: rgba(0, 0, 0, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-hover: rgba(0, 0, 0, 0.02);
  --glass-input-bg: rgba(255, 255, 255, 0.8);
  --glass-input-border: rgba(0, 0, 0, 0.1);
  --glass-input-focus: rgba(37, 99, 235, 0.3);
  --glass-input-focus-bg: rgba(255, 255, 255, 0.95);
  --glass-table-header: rgba(0, 0, 0, 0.03);
  --glass-bar-track: rgba(0, 0, 0, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.8);
  --nav-border: rgba(0, 0, 0, 0.06);
  --nav-active: rgba(0, 0, 0, 0.05);
  --nav-hover: rgba(0, 0, 0, 0.03);
  --accent-color: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.2);
  --card-lift-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 0 40px rgba(37, 99, 235, 0.02);
  --stat-glow: 0 0 20px rgba(37, 99, 235, 0.08);
  --nav-active-glow: 0 2px 10px rgba(37, 99, 235, 0.15);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply text-foreground;
  }
  html {
    @apply font-sans;
  }
}

/* --- Force readable text in dark mode --- */
.dark body,
.dark [data-slot="card"],
.dark [data-slot="card-content"],
.dark [data-slot="card-header"],
.dark [data-slot="card-title"],
.dark p,
.dark span,
.dark div {
  color: inherit;
}
.dark {
  color: #f1f5f9;
}
.dark [data-slot="card-title"] {
  color: #f1f5f9 !important;
}
.dark .text-muted-foreground {
  color: hsl(var(--muted-foreground, 215 20% 68%)) !important;
}

/* --- Glassmorphism Background --- */
body {
  min-height: 100vh;
  position: relative;
  background: #080818;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 140% 70% at 5% 5%, rgba(59, 130, 246, 0.35), transparent 50%),
    radial-gradient(ellipse 100% 90% at 95% 15%, rgba(139, 92, 246, 0.28), transparent 50%),
    radial-gradient(ellipse 120% 70% at 50% 105%, rgba(16, 185, 129, 0.22), transparent 50%),
    radial-gradient(ellipse 80% 50% at 75% 55%, rgba(236, 72, 153, 0.15), transparent 50%);
}

/* --- Glass Utility --- */
.glass {
  background: rgba(15, 20, 35, 0.45);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Override shadcn Card for glassmorphism --- */
[data-slot="card"] {
  position: relative;
  overflow: hidden;
  background: rgba(15, 20, 35, 0.35) !important;
  backdrop-filter: blur(24px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15) !important;
  --tw-ring-shadow: none !important;
  --tw-ring-color: transparent !important;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  animation: fade-up 0.5s ease-out both;
}
[data-slot="card"]:hover {
  background: rgba(20, 25, 45, 0.45) !important;
  border-color: var(--accent-color, rgba(59, 130, 246, 0.3)) !important;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 0 20px var(--accent-glow, rgba(59, 130, 246, 0.08)) !important;
  transform: translateY(-1px);
}

/* Card inner glow removed — was too visible/distracting */

/* Stagger card animations */
[data-slot="card"]:nth-child(1) { animation-delay: 0ms; }
[data-slot="card"]:nth-child(2) { animation-delay: 60ms; }
[data-slot="card"]:nth-child(3) { animation-delay: 120ms; }
[data-slot="card"]:nth-child(4) { animation-delay: 180ms; }
[data-slot="card"]:nth-child(5) { animation-delay: 240ms; }
[data-slot="card"]:nth-child(6) { animation-delay: 300ms; }

/* --- Animations --- */

/* Card entrance */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
  animation: fade-up 0.5s ease-out both;
}

/* Status dot glow */
.glow-green { box-shadow: 0 0 8px 2px rgba(34, 197, 94, 0.4); }
.glow-red { box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.4); }
.glow-amber { box-shadow: 0 0 8px 2px rgba(245, 158, 11, 0.4); }
.glow-blue { box-shadow: 0 0 8px 2px rgba(59, 130, 246, 0.4); }
.glow-purple { box-shadow: 0 0 8px 2px rgba(168, 85, 247, 0.4); }

/* LIVE badge pulse */
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-live-pulse {
  animation: live-pulse 2s ease-in-out infinite;
}

/* Slide-in for feed items */
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.animate-slide-in {
  animation: slide-in 0.3s ease-out forwards;
}

/* Logo float animation */
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.animate-logo-float {
  animation: logo-float 3s ease-in-out infinite;
}

/* Logo shimmer */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.animate-shimmer {
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
}

/* Number transition */
.tabular-nums-transition {
  font-variant-numeric: tabular-nums;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* VRAM/progress bar glow */
@keyframes bar-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}
.animate-bar-glow {
  animation: bar-glow 2s ease-in-out infinite;
}

/* Card hover lift - softer for glass */
.card-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.card-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-lift-shadow);
}

/* Active nav glow */
.nav-active-glow {
  box-shadow: var(--nav-active-glow);
}

/* --- Gauge Ring (SVG-based circular progress) --- */
.gauge-track {
  fill: none;
  stroke: var(--glass-bar-track);
}
.gauge-fill {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

/* Number glow for big stat values */
.stat-glow {
  text-shadow: var(--stat-glow);
}

/* Glass input fields */
.glass-input {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.glass-input:focus {
  border-color: var(--glass-input-focus);
  background: var(--glass-input-focus-bg);
  outline: none;
}

/* Frosted nav bar */
nav, .dark nav {
  background: rgba(8, 8, 24, 0.7) !important;
  backdrop-filter: blur(24px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(150%) !important;
}

/* Glass table rows */
.glass-table-header {
  background: var(--glass-table-header);
}
.glass-table-row {
  transition: background 0.2s ease;
}
.glass-table-row:hover {
  background: var(--glass-hover);
}

/* Glass progress bar track */
.glass-bar-track {
  background: var(--glass-bar-track);
  border-radius: 999px;
  overflow: hidden;
}

/* Glass bar fill glow */
.glass-bar-fill {
  border-radius: 999px;
  position: relative;
}
.glass-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  animation: bar-shimmer 2s ease-in-out infinite;
}
@keyframes bar-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- Visual Flair Effects --- */

/* Particle/sparkle dots — CSS-only floating dots in background */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 30% 65%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1px 1px at 50% 10%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1px 1px at 85% 75%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1px 1px at 45% 50%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 90% 15%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1.5px 1.5px at 25% 35%, rgba(255,255,255,0.18), transparent),
    radial-gradient(1.5px 1.5px at 60% 80%, rgba(255,255,255,0.14), transparent),
    radial-gradient(1.5px 1.5px at 75% 25%, rgba(255,255,255,0.16), transparent),
    radial-gradient(1.5px 1.5px at 40% 90%, rgba(255,255,255,0.1), transparent);
  animation: sparkle-drift 30s linear infinite;
}
@keyframes sparkle-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(-20px); }
}

/* Gradient text for headings */
.dark h1 {
  background: linear-gradient(135deg, #f1f5f9, var(--accent-color, #3b82f6));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Smooth number counter animation on stat values */
.stat-value {
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active nav tab underline glow */
.nav-active-glow::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color, #3b82f6), transparent);
  border-radius: 2px;
  filter: blur(1px);
}
