@import "tailwindcss";
@import "tw-animate-css";

/* Treat .dark, .theme-midnight and .theme-darkblue as dark contexts for Tailwind's `dark:` variant */
@custom-variant dark (&:is(.dark *, .theme-midnight *, .theme-darkblue *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-outfit, system-ui, sans-serif);
  --font-mono: var(--font-geist-mono);
  --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) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

:root {
  --radius: 0.3rem;
  /* Premium modern rounded corners */
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
}

/* Midnight Theme */
.theme-midnight {
  /* Deep near-black with subtle blue tint */
  --background: #0b0e14;
  --foreground: #e6e9ef;
  --card: #121620;
  --card-foreground: #eef1f6;
  --popover: #121620;
  --popover-foreground: #eef1f6;
  --primary: #4f8cff;
  /* accent blue */
  --primary-foreground: #0b0e14;
  --secondary: #1a2232;
  --secondary-foreground: #e6e9ef;
  --muted: #1a2232;
  --muted-foreground: #9aa7bd;
  --accent: #182233;
  --accent-foreground: #e6e9ef;
  --destructive: #ef4444;
  --border: #2a3446;
  --input: #20293a;
  --ring: #3b82f6;
  --chart-1: #60a5fa;
  --chart-2: #34d399;
  --chart-3: #fbbf24;
  --chart-4: #f472b6;
  --chart-5: #a78bfa;
  --sidebar: #101521;
  --sidebar-foreground: #e6e9ef;
  --sidebar-primary: #4f8cff;
  --sidebar-primary-foreground: #0b0e14;
  --sidebar-accent: #1a2232;
  --sidebar-accent-foreground: #e6e9ef;
  --sidebar-border: #2a3446;
  --sidebar-ring: #3b82f6;
}

/* Dark Blue Theme */
.theme-darkblue {
  /* Navy background with bright blue primary */
  --background: #0a1420;
  --foreground: #e8eef6;
  --card: #0f1b2b;
  --card-foreground: #e8eef6;
  --popover: #0f1b2b;
  --popover-foreground: #e8eef6;
  --primary: #1e88e5;
  --primary-foreground: #07111c;
  --secondary: #132135;
  --secondary-foreground: #e8eef6;
  --muted: #132135;
  --muted-foreground: #a8b6c9;
  --accent: #10243a;
  --accent-foreground: #e8eef6;
  --destructive: #ef4444;
  --border: #22344a;
  --input: #1a2a40;
  --ring: #1e88e5;
  --chart-1: #1e88e5;
  --chart-2: #10b981;
  --chart-3: #f59e0b;
  --chart-4: #f43f5e;
  --chart-5: #8b5cf6;
  --sidebar: #0d1726;
  --sidebar-foreground: #e8eef6;
  --sidebar-primary: #1e88e5;
  --sidebar-primary-foreground: #07111c;
  --sidebar-accent: #132135;
  --sidebar-accent-foreground: #e8eef6;
  --sidebar-border: #22344a;
  --sidebar-ring: #1e88e5;
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  body {
    @apply bg-background text-foreground;
  }
}

@layer base {

  html,
  body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  }

  /* Chrome/Safari/Edge */
  html::-webkit-scrollbar,
  body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  html::-webkit-scrollbar-track,
  body::-webkit-scrollbar-track {
    background: transparent;
  }

  html::-webkit-scrollbar-thumb,
  body::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }

  html:hover::-webkit-scrollbar-thumb,
  body:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.28);
  }
}

@layer utilities {
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  }

  .scrollbar-thin:hover {
    scrollbar-color: rgba(255, 255, 255, 0.38) transparent;
  }

  .scrollbar-thin::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

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

  .scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
  }

  .scrollbar-thin:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.28);
  }
}

/* Line clamp utilities: hard-limit text lines without needing Tailwind's plugin */
@layer utilities {

  .line-clamp-1,
  .line-clamp-2,
  .line-clamp-3,
  .line-clamp-4,
  .line-clamp-5,
  .line-clamp-6 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-1 {
    -webkit-line-clamp: 1;
  }

  .line-clamp-2 {
    -webkit-line-clamp: 2;
  }

  .line-clamp-3 {
    -webkit-line-clamp: 3;
  }

  .line-clamp-4 {
    -webkit-line-clamp: 4;
  }

  .line-clamp-5 {
    -webkit-line-clamp: 5;
  }

  .line-clamp-6 {
    -webkit-line-clamp: 6;
  }
}

/* Shimmer animation for skeleton loaders */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

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

/* Cinematic & Glassmorphism Utilities */
@layer utilities {
  .glass-panel {
    @apply bg-slate-900/40 backdrop-blur-xl border border-white/5 shadow-2xl;
  }

  .glass-panel-hover {
    @apply transition-all duration-300 hover:bg-slate-800/50 hover:border-white/10 hover:shadow-blue-500/10;
  }

  .hover-glow {
    @apply transition-all duration-300;
  }

  .hover-glow:hover {
    box-shadow: 0 0 30px -5px rgba(59, 130, 246, 0.3);
  }

  .text-glow {
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
  }

  .animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
  }

  .animate-slide-up {
    animation: slideUp 0.5s ease-out forwards;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollY {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-50%);
  }
}

@layer utilities {
  .animate-shimmer {
    animation: shimmer 2s infinite;
  }

  .animate-scroll-y {
    animation: scrollY 60s linear infinite;
  }

  /* Smooth transitions for interactive elements */
  .transition-smooth {
    transition: all 200ms ease-in-out;
  }

  .transition-smooth-fast {
    transition: all 150ms ease-in-out;
  }

  .transition-smooth-slow {
    transition: all 300ms ease-in-out;
  }

  /* Focus states for accessibility */
  .focus-ring {
    @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-900;
  }

  .focus-ring-inset {
    @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500;
  }

  .focus-ring-danger {
    @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-900;
  }
}