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

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

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-inter);
  --font-mono: var(--font-geist-mono);
  --font-arabic: var(--font-arabic);
  --font-display: var(--font-playfair);
  --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.625rem;
  --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);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
  /* Container utility */
  .container {
    @apply mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8;
  }
}

@layer utilities {
  /* Dense text utilities */
  .text-balance {
    text-wrap: balance;
  }
  
  /* Gradient text animation */
  .animate-gradient-text {
    animation: gradient-flow 20s ease infinite;
  }
}

@keyframes gradient-flow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Theme Variants */

/* Flat theme - minimal shadows, subtle borders */
.theme-flat {
  --shadow-sm: none;
  --shadow: none;
  --shadow-md: none;
  --shadow-lg: none;
}

.theme-flat .border,
.theme-flat [class*="border"] {
  border-color: oklch(0.9 0 0);
}

.dark.theme-flat .border,
.dark.theme-flat [class*="border"] {
  border-color: oklch(0.25 0 0);
}

/* Default theme - balanced shadows and borders */
.theme-default {
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Brutal theme - strong borders, no radius, bold shadows */
.theme-brutal {
  --radius: 0 !important;
  --shadow-sm: 2px 2px 0 0 currentColor;
  --shadow: 3px 3px 0 0 currentColor;
  --shadow-md: 4px 4px 0 0 currentColor;
  --shadow-lg: 6px 6px 0 0 currentColor;
}

.theme-brutal .border,
.theme-brutal [class*="border"] {
  border-width: 2px;
  border-color: currentColor;
}

/* Flat button overrides */
.theme-flat button,
.theme-flat [role="button"] {
  box-shadow: none !important;
}

.theme-flat input,
.theme-flat select,
.theme-flat textarea {
  box-shadow: none !important;
}

/* Density Variants */

/* Compact density - smaller spacing and elements */
.density-compact {
  --spacing-unit: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25;
}

.density-compact .container {
  padding-left: 1rem;
  padding-right: 1rem;
}

.density-compact h1 { font-size: 1.5rem; }
.density-compact h2 { font-size: 1.25rem; }
.density-compact h3 { font-size: 1rem; }

/* Default density */
.density-default {
  --spacing-unit: 1rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* Comfortable density - larger spacing and elements */
.density-comfortable {
  --spacing-unit: 1.25rem;
  font-size: 1.125rem;
  line-height: 1.75;
}

.density-comfortable .container {
  padding-left: 2rem;
  padding-right: 2rem;
}

.density-comfortable h1 { font-size: 2.5rem; }
.density-comfortable h2 { font-size: 2rem; }
.density-comfortable h3 { font-size: 1.5rem; }

/* Hero floating animation - smooth multi-directional */
@keyframes float {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(4px, -8px);
  }
  50% {
    transform: translate(-3px, -4px);
  }
  75% {
    transform: translate(-5px, -10px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* Hero bubble enter animation */
@keyframes bubble-enter {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Hero bubble exit animation */
@keyframes bubble-exit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.8);
  }
}

.animate-bubble-enter {
  animation: bubble-enter 0.5s ease-out forwards;
}

.animate-bubble-exit {
  animation: bubble-exit 0.5s ease-in forwards;
}

/* Flash animation for changed cells */
@keyframes flash {
  0%, 30% {
    background-color: hsl(var(--primary) / 0.25) !important;
    box-shadow: 0 0 12px hsl(var(--primary) / 0.4);
  }
  100% {
    background-color: transparent !important;
    box-shadow: none;
  }
}

.animate-flash {
  animation: flash 0.8s ease-out !important;
}

