@tailwind base;
@tailwind components;
@tailwind utilities;

/* =====================================================================
   Base reset & typography
   ===================================================================== */

@layer base {
  * {
    border-color: var(--line);
  }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body {
    background-color: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    letter-spacing: -0.02em;
    color: var(--ink);
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  ::selection {
    background-color: color-mix(in srgb, var(--primary-500) 30%, transparent);
  }

  :focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /* Custom scrollbar */
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background-color: var(--line-strong);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--ink-faint);
  }
}

/* =====================================================================
   Reusable component layers
   ===================================================================== */

@layer components {
  /* Card */
  .card {
    @apply rounded-2xl border border-line bg-surface shadow-card;
  }

  /* Buttons */
  .btn {
    @apply inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2 text-sm font-medium transition-all duration-200 focus-visible:outline-none disabled:opacity-50 disabled:pointer-events-none;
  }
  .btn-primary {
    @apply btn bg-primary-600 text-white hover:bg-primary-700 active:scale-[0.98];
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), 0 4px 12px rgba(79, 70, 229, 0.2);
  }
  .btn-secondary {
    @apply btn border border-line bg-surface text-ink hover:bg-surface-raised active:scale-[0.98];
  }
  .btn-ghost {
    @apply btn text-ink-muted hover:bg-surface-raised hover:text-ink active:scale-[0.98];
  }
  .btn-danger {
    @apply btn bg-red-600 text-white hover:bg-red-700 active:scale-[0.98];
  }
  .btn-sm {
    @apply px-3 py-1.5 text-xs;
  }
  .btn-lg {
    @apply px-6 py-3 text-base;
  }

  /* Inputs */
.input {
    @apply w-full rounded-xl border border-line bg-surface px-3.5 py-2.5 text-sm text-ink placeholder:text-ink-faint transition-colors focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary;
  }
  .input-error {
    @apply border-red-500 focus:border-red-500 focus:ring-2 focus:ring-red-500;
  }
  .label {
    @apply mb-1.5 block text-sm font-medium text-ink;
  }

  /* Badges */
  .badge {
    @apply inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium;
  }

  /* Table */
  .table-wrap {
    @apply w-full overflow-x-auto rounded-2xl border border-line bg-surface;
  }
  .table {
    @apply w-full text-sm;
  }
.table thead th {
    @apply border-b border-line bg-surface-raised px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-ink-muted;
  }
  .table tbody td {
    @apply border-b border-line-subtle px-4 py-3 text-ink;
  }
  .table tbody tr {
    @apply transition-colors hover:bg-surface-raised;
  }
  .table tbody tr:last-child td {
    @apply border-b-0;
  }
}

