/* Default Theme Variable Fallbacks (Active when no data-base-color attribute is set) */
:root:not([data-base-color]) {
  --radius: 0.65rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.488 0.243 264.376);
  --primary-foreground: oklch(0.97 0.014 254.604);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(1 0 0);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.708 0 0);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.141 0.005 285.823);
  --sidebar-primary: oklch(0.546 0.245 262.881);
  --sidebar-primary-foreground: oklch(0.97 0.014 254.604);
  --sidebar-accent: oklch(0.967 0.001 286.375);
  --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
  --sidebar-border: oklch(0.92 0.004 286.32);
  --sidebar-ring: oklch(0.708 0 0);
}

:root {
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-serif: Source Serif 4, serif;
  --font-mono: JetBrains Mono, monospace;
  --kpi-gradient-from: oklch(0.97 0 0);
}

.dark {
  --kpi-gradient-from: oklch(0.269 0 0);
}

/* Global Element Styles */
* {
  border-color: var(--border);
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
}

/* Direct utility classes for CSS custom property binding */
.bg-background { background-color: var(--background); }
.text-foreground { color: var(--foreground); }

.bg-primary, a.bg-primary, button.bg-primary { 
  background-color: var(--primary) !important; 
  color: var(--primary-foreground) !important; 
}
.bg-primary *, a.bg-primary *, button.bg-primary * {
  color: inherit;
  stroke: currentColor;
}
.text-primary-foreground, a.text-primary-foreground, button.text-primary-foreground { 
  color: var(--primary-foreground) !important; 
}

.bg-secondary, a.bg-secondary, button.bg-secondary { 
  background-color: var(--secondary) !important; 
  color: var(--secondary-foreground) !important; 
}
.bg-secondary *, a.bg-secondary *, button.bg-secondary * {
  color: inherit;
  stroke: currentColor;
}
.text-secondary-foreground, a.text-secondary-foreground, button.text-secondary-foreground { 
  color: var(--secondary-foreground) !important; 
}

.bg-destructive, a.bg-destructive, button.bg-destructive { 
  background-color: var(--destructive) !important; 
  color: var(--destructive-foreground) !important; 
}
.bg-destructive *, a.bg-destructive *, button.bg-destructive * {
  color: inherit;
  stroke: currentColor;
}
.text-destructive-foreground, a.text-destructive-foreground, button.text-destructive-foreground { 
  color: var(--destructive-foreground) !important; 
}

.bg-muted { background-color: var(--muted); }
.text-muted-foreground { color: var(--muted-foreground); }
.bg-accent { background-color: var(--accent); }
.text-accent-foreground { color: var(--accent-foreground); }
.bg-card { background-color: var(--card); }
.text-card-foreground { color: var(--card-foreground); }
.bg-popover { background-color: var(--popover); }
.text-popover-foreground { color: var(--popover-foreground); }
.border-border { border-color: var(--border); }
.border-input { border-color: var(--input); }

/* Padding Utilities fallback for RCL components */
.p-5 { padding: 1.25rem; }

/* Aspect Ratio Primitive Content Helper */
.aspect-ratio-content {
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  inset: 0 !important;
}

.aspect-ratio-content > * {
  width: 100% !important;
  height: 100% !important;
}

/* Tailwind v4 Theme Integration */
@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);

  --font-sans: var(--font-sans);
  --font-mono: var(--font-mono);
  --font-serif: var(--font-serif);

  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  --shadow-2xs: var(--shadow-2xs);
  --shadow-xs: var(--shadow-xs);
  --shadow-sm: var(--shadow-sm);
  --shadow: var(--shadow);
  --shadow-md: var(--shadow-md);
  --shadow-lg: var(--shadow-lg);
  --shadow-xl: var(--shadow-xl);
  --shadow-2xl: var(--shadow-2xl);
}
