/**
 * Design System Base Styles
 * Modern SaaS aesthetic inspired by Stripe, Linear, and Vercel
 */

/* CSS Custom Properties for theme switching */
:root {
  color-scheme: light;

  /* Light mode colors */
  --color-background: 255 255 255;
  --color-foreground: 23 23 23;
  --color-muted: 245 245 245;
  --color-muted-foreground: 115 115 115;
  --color-border: 229 229 229;
  --color-input: 229 229 229;

  /* Brand colors */
  --color-primary: 14 165 233;
  --color-primary-foreground: 255 255 255;

  /* Semantic colors */
  --color-success: 34 197 94;
  --color-warning: 245 158 11;
  --color-error: 239 68 68;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.3);
}

.dark {
  color-scheme: dark;

  /* Dark mode colors */
  --color-background: 10 10 10;
  --color-foreground: 250 250 250;
  --color-muted: 38 38 38;
  --color-muted-foreground: 163 163 163;
  --color-border: 64 64 64;
  --color-input: 64 64 64;

  /* Shadows in dark mode (slightly stronger) */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.5);
}

/* Base typography */
body {
  font-family: 'Inter var', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  font-variation-settings: 'opsz' auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Smooth transitions for theme switching */
* {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

/* Remove transitions on theme change to prevent flash */
.theme-transitioning,
.theme-transitioning * {
  transition: none !important;
}

/* Turbo Frame Loading States */
turbo-frame[busy] {
  opacity: 0.6;
  pointer-events: none;
}

/* Turbo Progress Bar */
.turbo-progress-bar {
  height: 3px;
  background: linear-gradient(
    to right,
    rgb(14 165 233),
    rgb(99 102 241)
  );
}

/* Enhanced Hover Effects */
.hover-lift {
  transition: all 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hover-scale {
  transition: transform 0.2s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

/* Dark mode form input base styles */
/* Uses :where() for low specificity so Tailwind utilities can override */
.dark :where(input[type="text"], input[type="email"], input[type="url"],
input[type="password"], input[type="number"], input[type="tel"],
input[type="search"], input[type="date"], input[type="datetime-local"],
input[type="month"], input[type="time"], input[type="week"],
input:not([type]), textarea, select, select[multiple]) {
  background-color: #171717;
  border-color: #404040;
  color: #f5f5f5;
}

.dark :where(input, textarea, select)::placeholder {
  color: #737373;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Focus visible for accessibility */
*:focus-visible {
  @apply outline-none ring-2 ring-primary-500 ring-offset-2;
}

/* Selection styling */
::selection {
  @apply bg-primary-200 text-primary-900;
}

.dark ::selection {
  @apply bg-primary-800 text-primary-100;
}

/* Custom scrollbar (webkit browsers) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  @apply bg-gray-100 dark:bg-gray-900;
}

::-webkit-scrollbar-thumb {
  @apply bg-gray-300 dark:bg-gray-700 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
  @apply bg-gray-400 dark:bg-gray-600;
}

/* Line clamp utilities (for truncating text) */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
