@import './styles/tokens.css';

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

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;
}

@layer components {
  .ui-page {
    margin-left: auto;
    margin-right: auto;
    max-width: 72rem;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 2rem;
  }

  @media (min-width: 768px) {
    .ui-page {
      padding-left: 1.5rem;
      padding-right: 1.5rem;
    }
  }

  .ui-section {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: var(--card-shadow);
  }

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

  .ui-btn {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 0.625rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
      transform 0.15s ease;
  }

  .ui-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-subtle);
  }

  .ui-btn-primary {
    background: var(--color-primary);
    color: #fff;
  }

  .ui-btn-primary:hover {
    background: var(--color-primary-dark);
  }

  .ui-btn-secondary {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
  }

  .ui-btn-secondary:hover {
    background: var(--surface-muted);
  }

  .ui-input,
  .ui-textarea,
  .ui-select {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .ui-input,
  .ui-select {
    min-height: 2.75rem;
    padding: 0.625rem 0.875rem;
  }

  .ui-textarea {
    padding: 0.625rem 0.875rem;
  }

  .ui-chip,
  .ui-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    padding: 0.25rem 0.625rem;
    font-size: var(--font-size-xs);
    line-height: 1.3;
  }

  .ui-chip {
    background: var(--surface-muted);
    color: var(--text);
    font-weight: 500;
  }

  .ui-badge {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: 600;
  }
}

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

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

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

@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;
  }
}
