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

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

/* Tailwind v4 CSS-first theme configuration */
@theme {
  /* Font Family */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Border Radius */
  --radius-lg: var(--radius);
  --radius-md: calc(var(--radius) - 2px);
  --radius-sm: calc(var(--radius) - 4px);

  /* Colors - Brand */
  --color-cyan-core: hsl(var(--cyan-core));
  --color-cyan-deep: hsl(var(--cyan-deep));
  --color-cyan-dark: hsl(var(--cyan-dark));
  --color-blue-core: hsl(var(--blue-core));
  --color-blue-steel: hsl(var(--blue-steel));
  --color-blue-soft: hsl(var(--blue-soft));

  /* Colors - Icon */
  --color-icon: hsl(var(--icon-default));
  --color-icon-active: hsl(var(--icon-active));
  --color-icon-danger: hsl(var(--icon-danger));

  /* Colors - shadcn/ui semantic */
  --color-border: hsl(var(--border));
  --color-input: hsl(var(--input));
  --color-ring: hsl(var(--ring));
  --color-background: hsl(var(--background));
  --color-foreground: hsl(var(--foreground));
  --color-primary: hsl(var(--primary));
  --color-primary-foreground: hsl(var(--primary-foreground));
  --color-secondary: hsl(var(--secondary));
  --color-secondary-foreground: hsl(var(--secondary-foreground));
  --color-destructive: hsl(var(--destructive));
  --color-destructive-foreground: hsl(var(--destructive-foreground));
  --color-muted: hsl(var(--muted));
  --color-muted-foreground: hsl(var(--muted-foreground));
  --color-accent: hsl(var(--accent));
  --color-accent-foreground: hsl(var(--accent-foreground));
  --color-popover: hsl(var(--popover));
  --color-popover-foreground: hsl(var(--popover-foreground));
  --color-card: hsl(var(--card));
  --color-card-foreground: hsl(var(--card-foreground));

  /* Colors - Sidebar */
  --color-sidebar: hsl(var(--sidebar));
  --color-sidebar-foreground: hsl(var(--sidebar-foreground));
  --color-sidebar-primary: hsl(var(--sidebar-primary));
  --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));
  --color-sidebar-accent: hsl(var(--sidebar-accent));
  --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground));
  --color-sidebar-border: hsl(var(--sidebar-border));
  --color-sidebar-ring: hsl(var(--sidebar-ring));

  /* Colors - Chart */
  --color-chart-1: hsl(var(--chart-1));
  --color-chart-2: hsl(var(--chart-2));
  --color-chart-3: hsl(var(--chart-3));
  --color-chart-4: hsl(var(--chart-4));
  --color-chart-5: hsl(var(--chart-5));

  /* Animations */
  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;
  --animate-fade-in: fade-in 0.3s ease-out;
  --animate-fade-in-up: fade-in-up 0.4s ease-out;
  --animate-scale-in: scale-in 0.2s ease-out;
  --animate-slide-in-right: slide-in-right 0.3s ease-out;
}

@keyframes accordion-down {
  from { height: 0; }
  to { height: var(--radix-accordion-content-height); }
}

@keyframes accordion-up {
  from { height: var(--radix-accordion-content-height); }
  to { height: 0; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* CSS Variables for both light and dark modes */
:root {
  /* Brand Colors - Tracearr */
  --cyan-core: 187 80% 50%;     /* #18D1E7 - Primary accent */
  --cyan-deep: 187 86% 42%;     /* #0EAFC8 - Hover/gradients */
  --cyan-dark: 190 85% 31%;     /* #0A7C96 - Shadows/outlines */
  --blue-core: 213 62% 11%;     /* #0B1A2E - Dark background */
  --blue-steel: 213 47% 17%;    /* #162840 - Panels/cards */
  --blue-soft: 212 49% 24%;     /* #1E3A5C - Hover/selection */

  /* Light Mode - Clean, professional with cyan accents */
  --background: 210 25% 97%;    /* #F5F7FA - Slightly cooler than pure white */
  --foreground: 213 62% 11%;    /* Blue Core - primary text */
  --card: 0 0% 100%;            /* Pure white cards */
  --card-foreground: 213 62% 11%;
  --popover: 0 0% 100%;
  --popover-foreground: 213 62% 11%;
  --primary: 187 85% 38%;       /* #0A98AD - Darker cyan for light mode readability */
  --primary-foreground: 0 0% 100%;  /* White text on primary buttons */
  --secondary: 210 25% 93%;     /* #E8ECF1 - Subtle blue-gray */
  --secondary-foreground: 213 50% 25%;
  --muted: 210 20% 94%;         /* #EBEEF2 */
  --muted-foreground: 213 25% 45%; /* #5A6A7A */
  --accent: 210 25% 93%;        /* Same as secondary for hover states */
  --accent-foreground: 213 62% 11%;
  --destructive: 0 72% 51%;     /* #DC2626 */
  --destructive-foreground: 0 0% 100%;
  --border: 214 20% 85%;        /* #CED4DC - Visible but subtle */
  --input: 214 20% 85%;
  --ring: 187 85% 38%;          /* Darker cyan for focus rings */
  --radius: 0.5rem;

  /* Chart Colors - Light Mode */
  --chart-1: 187 85% 38%;       /* Darker cyan */
  --chart-2: 187 90% 30%;       /* Even darker cyan */
  --chart-3: 213 62% 20%;       /* Blue Core lighter */
  --chart-4: 43 90% 45%;        /* Amber */
  --chart-5: 0 72% 51%;         /* Red */

  /* Icon Colors - Light Mode */
  --icon-default: 213 20% 55%;  /* #778899 */
  --icon-active: 187 85% 38%;   /* Darker cyan */
  --icon-danger: 0 72% 51%;     /* #DC2626 */

  /* Sidebar Colors - Light Mode */
  --sidebar: 0 0% 100%;         /* White sidebar */
  --sidebar-foreground: 213 62% 11%;
  --sidebar-primary: 187 85% 38%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 210 25% 94%;
  --sidebar-accent-foreground: 213 62% 11%;
  --sidebar-border: 214 20% 88%;
  --sidebar-ring: 187 85% 38%;
}

.dark {
  /* Dark Mode - Primary theme */
  --background: 220 50% 4%;     /* #050A12 - Deepest dark */
  --foreground: 0 0% 100%;      /* White text */
  --card: 213 62% 11%;          /* Blue Core */
  --card-foreground: 0 0% 100%;
  --popover: 213 47% 17%;       /* Blue Steel */
  --popover-foreground: 0 0% 100%;
  --primary: 187 80% 50%;       /* Cyan Core */
  --primary-foreground: 213 62% 11%;
  --secondary: 213 47% 17%;     /* Blue Steel */
  --secondary-foreground: 0 0% 100%;
  --muted: 213 47% 17%;         /* Blue Steel */
  --muted-foreground: 210 20% 65%;
  --accent: 187 80% 50%;        /* Cyan Core */
  --accent-foreground: 213 62% 11%;
  --destructive: 0 62% 50%;
  --destructive-foreground: 0 0% 100%;
  --border: 213 47% 17%;        /* Blue Steel */
  --input: 213 47% 17%;
  --ring: 187 80% 50%;          /* Cyan Core */

  /* Chart Colors - Dark Mode */
  --chart-1: 187 80% 50%;       /* Cyan Core */
  --chart-2: 187 86% 42%;       /* Cyan Deep */
  --chart-3: 212 49% 40%;       /* Blue Soft lighter */
  --chart-4: 43 80% 55%;        /* Warning */
  --chart-5: 0 75% 55%;         /* Danger */

  /* Icon Colors - Dark Mode */
  --icon-default: 210 20% 55%;
  --icon-active: 187 80% 50%;
  --icon-danger: 0 100% 65%;

  /* Sidebar Colors - Dark Mode */
  --sidebar: 213 62% 11%;       /* Blue Core */
  --sidebar-foreground: 0 0% 100%;
  --sidebar-primary: 187 80% 50%;
  --sidebar-primary-foreground: 213 62% 11%;
  --sidebar-accent: 213 47% 17%;
  --sidebar-accent-foreground: 0 0% 100%;
  --sidebar-border: 213 47% 17%;
  --sidebar-ring: 187 80% 50%;
}

/* Base styles */
* {
  @apply border-border;
}

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

/* Container utility - Tailwind v4 requires @utility for custom config */
@utility container {
  margin-inline: auto;
  padding-inline: 2rem;
  max-width: 1400px;
}

@theme inline {
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-background: hsl(var(--background));
  --color-foreground: hsl(var(--foreground));
  --color-card: hsl(var(--card));
  --color-card-foreground: hsl(var(--card-foreground));
  --color-popover: hsl(var(--popover));
  --color-popover-foreground: hsl(var(--popover-foreground));
  --color-primary: hsl(var(--primary));
  --color-primary-foreground: hsl(var(--primary-foreground));
  --color-secondary: hsl(var(--secondary));
  --color-secondary-foreground: hsl(var(--secondary-foreground));
  --color-muted: hsl(var(--muted));
  --color-muted-foreground: hsl(var(--muted-foreground));
  --color-accent: hsl(var(--accent));
  --color-accent-foreground: hsl(var(--accent-foreground));
  --color-destructive: hsl(var(--destructive));
  --color-destructive-foreground: hsl(var(--destructive-foreground));
  --color-border: hsl(var(--border));
  --color-input: hsl(var(--input));
  --color-ring: hsl(var(--ring));
  --color-chart-1: hsl(var(--chart-1));
  --color-chart-2: hsl(var(--chart-2));
  --color-chart-3: hsl(var(--chart-3));
  --color-chart-4: hsl(var(--chart-4));
  --color-chart-5: hsl(var(--chart-5));
  --color-sidebar: hsl(var(--sidebar));
  --color-sidebar-foreground: hsl(var(--sidebar-foreground));
  --color-sidebar-primary: hsl(var(--sidebar-primary));
  --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));
  --color-sidebar-accent: hsl(var(--sidebar-accent));
  --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground));
  --color-sidebar-border: hsl(var(--sidebar-border));
  --color-sidebar-ring: hsl(var(--sidebar-ring));
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}
