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

/* Medora tokens (generated). Imported BEFORE the legacy @theme blocks below on purpose: where a
   name exists in both (see design/MIGRATION.md), the legacy value still wins, so un-redesigned
   pages do not change. Delete the legacy blocks to switch those names to Medora. */
@import "../styles/tokens.generated.css";

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

@theme {
  /* Brand */
  --color-brand-primary: #004542;
  --color-brand-primary-light: #EAF0EB;
  --color-brand-primary-dark: #2C4630;
  --color-brand-accent: #D99B26;
  --color-brand-teal: #00ACA6; /* bright teal accent */
  --color-brand-teal-hover: #008F8A; /* darker teal hover */
  --color-brand-highlight: #B0D86D; /* small brand highlights */

  /* Backgrounds & Surfaces */
  --color-bg-main: #F6F6F6; /* main workspace */
  --color-bg-surface: #FFFFFF; /* cards, forms, dialogs, menus, popovers */
  --color-bg-subtle: #F5F5F5; /* subtle sections */
  --color-bg-input: #EDF0EE;
  --color-bg-input-hover: #E3E8E5;
  --color-bg-selected: #C1FCF8; /* selected items / rows */
  --color-border-subtle: #D9E2E1;
  --color-border-hover: #D1DCD3;
  --color-border-strong: #AABDBB; /* emphasized boundaries */
  --color-focus-ring: #007A75; /* keyboard focus */
  --color-backdrop: rgb(0 17 16 / 0.5); /* modal backdrop: #001110 at 50% */

  /* Text & Typography */
  --color-text-primary: #001110;
  --color-text-secondary: #666666; /* secondary metadata */
  --color-text-placeholder: #65736C;
  --color-text-placeholder-focus: #8A9690;

  /* States: Error */
  --color-state-error: #B91C1C;
  --color-state-error-light: #FEE2E2;
  --color-state-error-dark: #8F2D18;

  /* States: Success */
  --color-state-success: #166534; /* success text: 6.49:1 on #DCFCE7 (was #AABDBB, 1.8:1) */
  --color-state-success-light: #DCFCE7;

  /* States: Warning */
  --color-state-warning: #92400E;
  --color-state-warning-light: #FEF3C7;

  /* States: Info */
  --color-state-info: #1D4ED8;
  --color-state-info-light: #DBEAFE;

  /* States: Neutral */
  --color-state-neutral: #475569;
  --color-state-neutral-light: #E2E8F0;

  /* Avatar Fallbacks */
  --color-avatar-01-bg: #EAF0EB; --color-avatar-01-text: #2C4630;
  --color-avatar-02-bg: #FDF4E3; --color-avatar-02-text: #8A5C0F;
  --color-avatar-03-bg: #E8EDEA; --color-avatar-03-text: #33423A;
  --color-avatar-04-bg: #F7EBEB; --color-avatar-04-text: #7A3B3B;
  --color-avatar-05-bg: #FAF0E6; --color-avatar-05-text: #7A5228;
  --color-avatar-06-bg: #EBF1F5; --color-avatar-06-text: #2B4C63;
  --color-avatar-07-bg: #EEF1E6; --color-avatar-07-text: #414E29;
  --color-avatar-08-bg: #F1EDF5; --color-avatar-08-text: #533C66;
  --color-avatar-09-bg: #F8EFEA; --color-avatar-09-text: #784731;
  --color-avatar-10-bg: #E6F2EE; --color-avatar-10-text: #1F4E40;

  /* Legacy aliases so existing classes (bg-primary, text-muted, ...) pick up the new palette */
  --color-primary: var(--color-brand-primary);
  --color-primary-light: var(--color-brand-primary-light);
  --color-primary-hover: var(--color-brand-primary-dark);
  --color-sidebar: var(--color-bg-surface);
  --color-sidebar-border: var(--color-border-subtle);
  --color-active-bg: var(--color-brand-primary-light);
  --color-active-text: var(--color-brand-primary);
  --color-card: var(--color-bg-surface);
  --color-muted: var(--color-text-secondary);
  --color-badge-green: var(--color-state-success);
  --color-badge-green-bg: var(--color-state-success-light);

  --font-sans: var(--font-geist), system-ui, sans-serif;
  --font-display: var(--font-bricolage), var(--font-geist), system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--color-bg-main);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
}

/* Hide scrollbar while keeping scroll ability */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}

.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

@theme inline {
  --font-heading: var(--font-sans);
  --color-sidebar-ring: var(--sidebar-ring);
  --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-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-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-foreground: var(--foreground);
  --color-background: var(--background);
  --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: var(--color-bg-surface);
  --foreground: var(--color-text-primary);
  --card: var(--color-bg-surface);
  --card-foreground: oklch(0.145 0 0);
  --popover: var(--color-bg-surface);
  --popover-foreground: oklch(0.145 0 0);
  --primary: var(--color-brand-primary);
  --primary-foreground: #ffffff;
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: var(--color-text-secondary);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: var(--color-state-error);
  --border: var(--color-border-subtle);
  --input: var(--color-border-subtle);
  --ring: var(--color-focus-ring);
  --chart-1: oklch(0.87 0 0);
  --chart-2: oklch(0.556 0 0);
  --chart-3: oklch(0.439 0 0);
  --chart-4: oklch(0.371 0 0);
  --chart-5: oklch(0.269 0 0);
  --radius: 0.625rem;
  --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.87 0 0);
  --chart-2: oklch(0.556 0 0);
  --chart-3: oklch(0.439 0 0);
  --chart-4: oklch(0.371 0 0);
  --chart-5: oklch(0.269 0 0);
  --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);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
  html {
    @apply font-sans;
  }
  /* Everything you can click shows the pointer; disabled controls keep the arrow (01-actions-and-inputs §0.3).
     Tailwind 4 no longer gives buttons a pointer. Base layer, so a cursor-* utility on an element still wins. */
  :where(button, [role="button"], [role="tab"], [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], select, summary, input[type="checkbox"], input[type="radio"], input[type="file"], label:has(> input[type="checkbox"], > input[type="radio"])):not(:disabled, [aria-disabled="true"], [data-disabled]) {
    cursor: pointer;
  }
}