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

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

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-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);
  --color-success: var(--success);
  --color-warning: var(--warning);
  --color-error: var(--error);
  --color-info: var(--info);
  --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 {
  --background: oklch(0.98 0 0);
  --foreground: oklch(0.15 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.15 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.15 0 0);
  --primary: oklch(0.463 0.258 262.881);
  --primary-foreground: oklch(0.98 0 0);
  --secondary: oklch(0.92 0.055 264.901);
  --secondary-foreground: oklch(0.463 0.258 262.881);
  --muted: oklch(0.93 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.55 0.15 205.5);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.925 0.01 0);
  --input: oklch(0.945 0.01 0);
  --ring: oklch(0.463 0.258 262.881);
  --success: oklch(0.582 0.183 142.495);
  --warning: oklch(0.787 0.141 72.031);
  --error: oklch(0.577 0.245 27.325);
  --info: oklch(0.631 0.215 259.262);
  --chart-1: oklch(0.463 0.258 262.881);
  --chart-2: oklch(0.631 0.215 259.262);
  --chart-3: oklch(0.582 0.183 142.495);
  --chart-4: oklch(0.787 0.141 72.031);
  --chart-5: oklch(0.577 0.245 27.325);
  --radius: 0.5rem;
  --sidebar: oklch(0.98 0 0);
  --sidebar-foreground: oklch(0.15 0 0);
  --sidebar-primary: oklch(0.463 0.258 262.881);
  --sidebar-primary-foreground: oklch(0.98 0 0);
  --sidebar-accent: oklch(0.92 0.055 264.901);
  --sidebar-accent-foreground: oklch(0.463 0.258 262.881);
  --sidebar-border: oklch(0.925 0.01 0);
  --sidebar-ring: oklch(0.463 0.258 262.881);
}

.dark {
  --background: oklch(0.125 0 0);
  --foreground: oklch(0.95 0 0);
  --card: oklch(0.175 0 0);
  --card-foreground: oklch(0.95 0 0);
  --popover: oklch(0.175 0 0);
  --popover-foreground: oklch(0.95 0 0);
  --primary: oklch(0.68 0.186 265.215);
  --primary-foreground: oklch(0.125 0 0);
  --secondary: oklch(0.28 0.04 264.901);
  --secondary-foreground: oklch(0.95 0 0);
  --muted: oklch(0.275 0.02 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.7 0.12 205.5);
  --accent-foreground: oklch(0.125 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(0.25 0.01 0);
  --input: oklch(0.2 0.02 0);
  --ring: oklch(0.68 0.186 265.215);
  --success: oklch(0.65 0.15 142.495);
  --warning: oklch(0.85 0.12 72.031);
  --error: oklch(0.704 0.191 22.216);
  --info: oklch(0.75 0.18 259.262);
  --chart-1: oklch(0.68 0.186 265.215);
  --chart-2: oklch(0.75 0.18 259.262);
  --chart-3: oklch(0.65 0.15 142.495);
  --chart-4: oklch(0.85 0.12 72.031);
  --chart-5: oklch(0.704 0.191 22.216);
  --sidebar: oklch(0.125 0 0);
  --sidebar-foreground: oklch(0.95 0 0);
  --sidebar-primary: oklch(0.68 0.186 265.215);
  --sidebar-primary-foreground: oklch(0.95 0 0);
  --sidebar-accent: oklch(0.28 0.04 264.901);
  --sidebar-accent-foreground: oklch(0.95 0 0);
  --sidebar-border: oklch(0.25 0.01 0);
  --sidebar-ring: oklch(0.68 0.186 265.215);
}

/* Vibrant — the "System" toggle option. Light content area (background,
   cards, header, table panels) paired with a dark sidebar — the same split
   Linear/Vercel/Notion use in their light themes. One violet accent drives
   every interactive state; the sidebar keeps its own dark token family
   (applied via .sidebar-surface below) so it stays dark regardless. */
.vibrant {
  --background: oklch(0.97 0.004 265);
  --foreground: oklch(0.2 0.02 265);
  --card: oklch(0.995 0.002 265);
  --card-foreground: oklch(0.2 0.02 265);
  --popover: oklch(0.995 0.002 265);
  --popover-foreground: oklch(0.2 0.02 265);
  --primary: oklch(0.55 0.2 275);
  --primary-foreground: oklch(0.98 0 0);
  --secondary: oklch(0.93 0.02 275);
  --secondary-foreground: oklch(0.32 0.15 275);
  --muted: oklch(0.94 0.006 265);
  --muted-foreground: oklch(0.48 0.02 265);
  --accent: oklch(0.55 0.14 210);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.58 0.22 25);
  --border: oklch(0.88 0.012 265);
  --input: oklch(0.92 0.01 265);
  --ring: oklch(0.55 0.2 275);
  --success: oklch(0.55 0.15 150);
  --warning: oklch(0.72 0.15 80);
  --error: oklch(0.58 0.22 25);
  --info: oklch(0.55 0.14 210);
  --chart-1: oklch(0.55 0.2 275);
  --chart-2: oklch(0.55 0.14 210);
  --chart-3: oklch(0.55 0.15 150);
  --chart-4: oklch(0.72 0.15 80);
  --chart-5: oklch(0.58 0.22 25);
  --sidebar: oklch(0.18 0.02 265);
  --sidebar-foreground: oklch(0.96 0.005 265);
  --sidebar-primary: oklch(0.64 0.19 275);
  --sidebar-primary-foreground: oklch(0.98 0 0);
  --sidebar-accent: oklch(0.28 0.03 265);
  --sidebar-accent-foreground: oklch(0.96 0.005 265);
  --sidebar-border: oklch(0.26 0.025 265);
  --sidebar-ring: oklch(0.64 0.19 275);
}

/* Re-points the shared tokens (--card, --foreground, --muted*, --primary...)
   at the sidebar's own dark family for anything inside this scope, so
   AppSidebar's existing bg-card/text-foreground/text-muted-foreground
   classes render dark without AppSidebar.tsx needing sidebar-specific
   classes. CSS custom properties resolve against the cascade at point of
   use, so this indirection (the same trick .dark/.vibrant use at the root)
   works scoped to just this subtree. */
.vibrant .sidebar-surface {
  --card: var(--sidebar);
  --card-foreground: var(--sidebar-foreground);
  --popover: var(--sidebar);
  --popover-foreground: var(--sidebar-foreground);
  --foreground: var(--sidebar-foreground);
  --muted: var(--sidebar-accent);
  --muted-foreground: oklch(0.72 0.015 265);
  --primary: var(--sidebar-primary);
  --primary-foreground: var(--sidebar-primary-foreground);
  --border: var(--sidebar-border);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  html {
    @apply font-sans scroll-smooth;
  }
  body {
    @apply bg-background text-foreground antialiased;
  }
  h1, h2, h3, h4, h5, h6 {
    @apply font-semibold tracking-tight;
  }
  h1 {
    @apply text-3xl;
  }
  h2 {
    @apply text-2xl;
  }
  h3 {
    @apply text-xl;
  }
  h4 {
    @apply text-lg;
  }
}

@media print {
  body {
    background: white !important;
    color: black !important;
  }

  .print\:hidden {
    display: none !important;
  }

  .invoice-sheet {
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .invoice-header {
    break-inside: avoid;
  }

  .invoice-sheet table {
    width: 100% !important;
  }

  .invoice-sheet tr,
  .invoice-sheet td,
  .invoice-sheet th {
    break-inside: avoid;
  }
}

