@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-accent: #9333ea;

  --color-success: #15803d;
  --color-success-light: #dcfce7;
  --color-warning: #ca8a04;
  --color-warning-light: #fef3c7;
  --color-error: #dc2626;
  --color-error-light: #fee2e2;

  --text: #1f2937;
  --text-h: #0f172a;
  --text-dim: #64748b;

  --bg: #f4f7fb;
  --bg-alt: #edf2f7;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #dbe3ef;
  --code-bg: #eef2f7;

  --radius-xs: 0.375rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  --space-xxs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3rem;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.65;

  --shadow-subtle: 0 1px 2px rgba(15, 23, 42, 0.06);
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 14px 34px rgba(15, 23, 42, 0.12);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.25);

  --surface-gradient:
    radial-gradient(1200px 500px at -10% -10%, rgba(147, 51, 234, 0.1), transparent 60%),
    radial-gradient(900px 420px at 115% -5%, rgba(37, 99, 235, 0.08), transparent 52%),
    linear-gradient(180deg, #f8fbff 0%, #edf2f7 100%);

  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --heading: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e2e8f0;
    --text-h: #f8fafc;
    --text-dim: #94a3b8;

    --bg: #0f172a;
    --bg-alt: #111b2e;
    --surface: #132136;
    --surface-muted: #172842;
    --border: #22334d;
    --code-bg: #1a2942;

    --shadow-subtle: 0 1px 2px rgba(2, 6, 23, 0.35);
    --card-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
    --shadow-hover: 0 14px 34px rgba(2, 6, 23, 0.55);

    --surface-gradient:
      radial-gradient(900px 400px at 0% -5%, rgba(147, 51, 234, 0.2), transparent 60%),
      radial-gradient(800px 420px at 105% -10%, rgba(37, 99, 235, 0.18), transparent 55%),
      linear-gradient(180deg, #0f172a 0%, #111b2e 100%);
  }
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  line-height: var(--line-height-normal);
  background: var(--surface-gradient);
  background-attachment: fixed;
}

#root {
  min-height: 100vh;
  background: transparent;
}

input,
button,
textarea,
select {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading);
  color: var(--text-h);
}

a {
  color: inherit;
}

button,
.button,
.btn {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

button:hover,
.button:hover,
.btn:hover {
  box-shadow: var(--shadow-subtle);
}

button:focus-visible,
.button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

input,
textarea,
select {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--text-dim) 70%, transparent);
}

.card,
.shadow-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.shadow-card {
  box-shadow: var(--card-shadow) !important;
}

/* Toast animation */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.animate-slide-in {
  animation: slide-in 0.3s ease-out;
}

::-webkit-scrollbar {
  width: 8px;
  background: var(--surface-muted);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 7px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 480px) {
  .max-w-7xl,
  .max-w-6xl,
  .max-w-4xl,
  .max-w-3xl,
  .max-w-2xl,
  .max-w-xl,
  .max-w-md,
  .max-w-sm {
    max-width: 100vw !important;
  }
  .p-8,
  .p-7,
  .p-6 {
    padding: 1rem !important;
  }
}
