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

@layer base {
  html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  body {
    @apply bg-canvas-soft text-ink font-sans text-sm leading-5;
    letter-spacing: -0.28px;
  }
  h1, h2, h3, h4 {
    @apply font-semibold text-ink;
  }
  h1 { font-size: 32px; line-height: 40px; letter-spacing: -1.28px; }
  h2 { font-size: 24px; line-height: 32px; letter-spacing: -0.96px; }
  h3 { font-size: 20px; line-height: 28px; letter-spacing: -0.6px; }
  h4 { font-size: 16px; line-height: 24px; letter-spacing: 0; font-weight: 500; }
  ::selection {
    background: #171717;
    color: #f2f2f2;
  }
}

@layer components {
  /* Buttons */
  .btn {
    @apply inline-flex items-center justify-center font-medium text-sm transition-colors;
    border-radius: 100px;
    height: 40px;
    padding: 0 16px;
    letter-spacing: -0.28px;
  }
  .btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 14px;
  }
  .btn-xs {
    height: 28px;
    padding: 0 10px;
    font-size: 13px;
  }
  .btn-primary {
    @apply btn bg-ink text-white;
  }
  .btn-primary:hover {
    @apply bg-body;
  }
  .btn-secondary {
    @apply btn bg-canvas text-ink border border-hairline;
  }
  .btn-secondary:hover {
    @apply bg-canvas-soft-2;
  }
  .btn-danger {
    @apply btn bg-error text-white;
  }
  .btn-danger:hover {
    background: #c50000;
  }
  .btn-success {
    @apply btn bg-link text-white;
  }
  .btn-success:hover {
    background: #0761d1;
  }

  /* Inputs */
  .input {
    @apply w-full bg-canvas text-ink border border-hairline text-sm;
    border-radius: 6px;
    height: 40px;
    padding: 0 12px;
    letter-spacing: -0.28px;
    outline: none;
    transition: border-color 0.15s;
  }
  .input:focus {
    border-color: #171717;
  }
  .input-sm {
    height: 32px;
  }
  select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
  }
  textarea.input {
    height: auto;
    padding: 10px 12px;
    line-height: 1.6;
  }

  .label {
    @apply block text-sm font-medium text-ink mb-1;
    letter-spacing: -0.28px;
  }

  /* Cards */
  .card {
    @apply bg-canvas;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0px 1px 1px rgba(0,0,0,0.02), 0px 2px 2px rgba(0,0,0,0.04), inset 0 0 0 1px rgba(0,0,0,0.08);
  }
  .card-soft {
    @apply bg-canvas-soft;
    border-radius: 8px;
    padding: 24px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  }

  /* Table */
  .table-base {
    @apply w-full text-sm text-left;
  }
  .table-base th {
    @apply text-xs font-normal text-mute uppercase tracking-wide font-mono;
    padding: 8px 12px;
    border-bottom: 1px solid #ebebeb;
    background: #fafafa;
  }
  .table-base td {
    padding: 10px 12px;
    border-bottom: 1px solid #f5f5f5;
    color: #171717;
  }
  .table-base tr:hover td {
    background: #fafafa;
  }

  /* Badge */
  .badge {
    @apply inline-flex items-center text-xs font-normal;
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0;
  }
  .badge-success {
    @apply badge bg-link-bg-soft text-link-deep;
  }
  .badge-pending {
    @apply badge bg-warning-soft text-warning-deep;
  }
  .badge-error {
    @apply badge bg-error-soft text-error-deep;
  }
  .badge-neutral {
    @apply badge bg-canvas-soft-2 text-body;
  }

  /* Progress bar */
  .progress-bar {
    @apply w-full rounded-full overflow-hidden;
    height: 4px;
    background: #ebebeb;
  }
  .progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: #171717;
    transition: width 0.3s;
  }

  /* Flash messages */
  .flash-success {
    @apply text-sm p-3 rounded-md bg-link-bg-soft text-link-deep;
    box-shadow: inset 0 0 0 1px rgba(0,112,243,0.15);
  }
  .flash-error {
    @apply text-sm p-3 rounded-md bg-error-soft text-error-deep;
    box-shadow: inset 0 0 0 1px rgba(238,0,0,0.15);
  }

  /* Mono label */
  .mono-label {
    @apply font-mono text-xs text-mute;
    letter-spacing: 0;
  }
}
