/* ============================================================
   rzumarli DS — Components
   Implemented from "Design System V.2" (Figma):
   Button (Primary / Secondary / Tertiary / Ghost / Danger,
   states: Default, Hover, Pressed, Disabled) and
   Input / Text Field (Default, Focused, Typing, Filled,
   Disabled, Error, Success).
   All styles hook into tokens.css — re-theme by editing tokens.
   Scope: add class "rds" on a wrapper (or <body>).
   ============================================================ */

/* ---------- Button ---------- */
.rds .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rds-space-8);            /* 8px icon gap */
  font-family: var(--rds-font-sans);
  font-weight: var(--rds-weight-medium);
  font-size: var(--rds-text-base);    /* 16px */
  letter-spacing: var(--rds-tracking-body); /* -0.48px */
  line-height: var(--rds-leading-tight);
  padding: 12px var(--rds-space-24); /* 12px 24px */
  border-radius: var(--rds-radius-12);           /* 10px */
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--rds-transition-fast),
    border-color var(--rds-transition-fast),
    color var(--rds-transition-fast),
    box-shadow var(--rds-transition-fast);
}

.rds .btn:focus-visible {
  outline: 2px solid var(--rds-primary-500);
  outline-offset: 2px;
}

/* Primary — filled brand */
.rds .btn-primary {
  background: var(--rds-primary-600);
  color: var(--rds-white);
}
.rds .btn-primary:hover { background: var(--rds-primary-700); }
.rds .btn-primary:active { background: var(--rds-primary-800); }

/* Secondary — white with border */
.rds .btn-secondary {
  background: var(--rds-white);
  color: var(--rds-neutral-800);
  border-color: var(--rds-neutral-300);
}
.rds .btn-secondary:hover { background: var(--rds-neutral-100); }
.rds .btn-secondary:active {
  background: var(--rds-primary-100);
  border-color: var(--rds-primary-600);
  color: var(--rds-primary-700);
}

/* Tertiary — text button */
.rds .btn-tertiary {
  background: transparent;
  color: var(--rds-primary-600);
  padding-left: var(--rds-space-8);
  padding-right: var(--rds-space-8);
}
.rds .btn-tertiary:hover { text-decoration: underline; }
.rds .btn-tertiary:active { color: var(--rds-primary-800); }

/* Ghost — quiet text button */
.rds .btn-ghost {
  background: transparent;
  color: var(--rds-neutral-700);
  padding-left: var(--rds-space-8);
  padding-right: var(--rds-space-8);
}
.rds .btn-ghost:hover { background: var(--rds-neutral-100); }
.rds .btn-ghost:active { background: var(--rds-neutral-200); }

/* Danger — filled red */
.rds .btn-danger {
  background: var(--rds-danger);
  color: var(--rds-white);
}
.rds .btn-danger:hover { background: var(--rds-danger-strong); }
.rds .btn-danger:active { background: var(--rds-danger-strong); }

/* Sizes */
.rds .btn-sm {
  font-size: var(--rds-text-sm);
  padding: var(--rds-space-8) var(--rds-space-16);
  border-radius: var(--rds-radius-8);
}
.rds .btn-lg {
  font-size: var(--rds-text-lg);
  padding: var(--rds-space-16) var(--rds-space-32);
  border-radius: var(--rds-radius-12);
}

/* Disabled (all variants) */
.rds .btn:disabled,
.rds .btn[aria-disabled="true"] {
  background: var(--rds-neutral-200);
  border-color: transparent;
  color: var(--rds-neutral-400);
  cursor: not-allowed;
  text-decoration: none;
}

/* Button icons — the DS annotation: icons must be 20px */
.rds .btn svg,
.rds .btn .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------- Input / Text Field ---------- */
.rds .field { margin-bottom: var(--rds-space-16); }

.rds .field label {
  display: block;
  font-size: var(--rds-text-sm);
  font-weight: var(--rds-weight-medium);
  color: var(--rds-neutral-800);
  margin-bottom: var(--rds-space-8);
}
.rds .field label .required { color: var(--rds-danger); }

.rds .input {
  width: 100%;
  font-family: var(--rds-font-sans);
  font-size: var(--rds-text-base);
  color: var(--rds-text);
  background: var(--rds-surface);
  border: 1px solid var(--rds-neutral-300);
  border-radius: var(--rds-radius-8);   /* 8px */
  padding: 12px var(--rds-space-16); /* 12px 16px */
  transition: border-color var(--rds-transition-fast),
    box-shadow var(--rds-transition-fast);
}

.rds .input::placeholder { color: var(--rds-neutral-400); }

/* Clicked / focused */
.rds .input:focus {
  outline: none;
  border: 2px solid var(--rds-primary-600);
  padding: calc(12px - 1px) calc(var(--rds-space-16) - 1px);
  box-shadow: 0 0 0 4px var(--rds-primary-100);
}

/* Disabled */
.rds .input:disabled {
  background: var(--rds-neutral-100);
  border-color: var(--rds-neutral-200);
  color: var(--rds-neutral-400);
  cursor: not-allowed;
}
.rds .input:disabled::placeholder { color: var(--rds-neutral-400); }

/* Hint line with status dot */
.rds .field .hint {
  display: flex;
  align-items: center;
  gap: var(--rds-space-4);
  font-size: var(--rds-text-xs);
  color: var(--rds-text-muted);
  margin-top: var(--rds-space-8);
}
.rds .field .hint::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--rds-radius-99);
  background: currentColor;
  flex-shrink: 0;
}

/* Error state */
.rds .field.is-error .input { border-color: var(--rds-danger); }
.rds .field.is-error .input:focus {
  border: 2px solid var(--rds-danger);
  padding: calc(12px - 1px) calc(var(--rds-space-16) - 1px);
  box-shadow: 0 0 0 4px var(--rds-danger-soft);
}
.rds .field.is-error .hint { color: var(--rds-danger-strong); }

/* Success state */
.rds .field.is-success .input { border-color: var(--rds-success); }
.rds .field.is-success .input:focus {
  border: 2px solid var(--rds-success);
  padding: calc(12px - 1px) calc(var(--rds-space-16) - 1px);
  box-shadow: 0 0 0 4px var(--rds-success-soft);
}
.rds .field.is-success .hint { color: var(--rds-success-strong); }

/* Text area */
.rds textarea.input {
  min-height: 96px;
  resize: vertical;
}

/* ---------- Card ---------- */
.rds .card {
  background: var(--rds-surface);
  border: 1px solid var(--rds-border);
  border-radius: var(--rds-radius-16);
  box-shadow: var(--rds-shadow-sm);
  overflow: hidden;
}

.rds .card-header {
  padding: var(--rds-space-16) var(--rds-space-24);
  border-bottom: 1px solid var(--rds-border);
}

.rds .card-header h3 {
  margin: 0;
  font-size: var(--rds-text-base);
  font-weight: var(--rds-weight-semibold);
  letter-spacing: var(--rds-tracking-body);
}

.rds .card-header p {
  margin: var(--rds-space-4) 0 0;
  font-size: var(--rds-text-sm);
  color: var(--rds-text-muted);
}

.rds .card-body { padding: var(--rds-space-24); }

.rds .card-footer {
  padding: 12px var(--rds-space-24);
  border-top: 1px solid var(--rds-border);
  background: var(--rds-surface-subtle);
  display: flex;
  gap: var(--rds-space-8);
  justify-content: flex-end;
}

/* ---------- Badge ---------- */
.rds .badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--rds-text-xs);
  font-weight: var(--rds-weight-medium);
  line-height: 1;
  padding: var(--rds-space-4) var(--rds-space-8);
  border-radius: var(--rds-radius-99);
  background: var(--rds-neutral-100);
  color: var(--rds-neutral-700);
}

.rds .badge-brand   { background: var(--rds-primary-100); color: var(--rds-primary-800); }
.rds .badge-success { background: var(--rds-success-soft); color: var(--rds-success-strong); }
.rds .badge-warning { background: var(--rds-warning-soft); color: var(--rds-warning-strong); }
.rds .badge-danger  { background: var(--rds-danger-soft);  color: var(--rds-danger-strong); }

/* ---------- Alert ---------- */
.rds .alert {
  display: flex;
  gap: 12px;
  padding: 12px var(--rds-space-16);
  border-radius: var(--rds-radius-8);
  border: 1px solid var(--rds-border);
  font-size: var(--rds-text-sm);
  background: var(--rds-surface-subtle);
}

.rds .alert strong {
  display: block;
  font-weight: var(--rds-weight-semibold);
  margin-bottom: 2px;
}

.rds .alert p { margin: 0; color: var(--rds-neutral-600); }

.rds .alert-brand   { border-color: var(--rds-primary-300); background: var(--rds-primary-50); }
.rds .alert-success { border-color: var(--rds-success); background: var(--rds-success-soft); }
.rds .alert-warning { border-color: var(--rds-warning); background: var(--rds-warning-soft); }
.rds .alert-danger  { border-color: var(--rds-danger);  background: var(--rds-danger-soft); }
