/* Buttons */
.btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 10px 14px;
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-weight: var(--weight-semibold);
  transition: all 0.2s ease;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: var(--secondary);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-small {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--radius-small);
}

/* Extra small buttons */
.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius-small);
}

/* New unified system */
/* Sizes */
.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--radius-small);
}

.btn-lg {
  padding: 12px 16px;
  font-size: 15px;
}

.btn-block {
  display: inline-flex;
  width: 100%;
}

/* Aliases for existing markup */
.btn-primary {
  --btn-primary-alias: 1;
}

.btn-full {
  width: 100%;
  display: inline-flex;
}

/* Variants */
.btn-success {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

.btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #111827;
}

.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
  color: #111827;
}

.btn-ghost {
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--surface-border);
}

/* Outline variants (white background + colored icon/border) */
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: rgba(79,70,229,0.06);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
}

.btn-outline-danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #dc2626;
}

.btn-outline-danger:hover {
  background: rgba(220,38,38,0.06);
  border-color: #b91c1c;
  color: #b91c1c;
}

/* Icon buttons */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-icon.btn-lg {
  width: 40px;
  height: 40px;
}

.btn-with-icon>.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
}

/* Icon color */
.btn-icon { color: #fff; }
.btn-with-icon { color: inherit; }
.btn-icon svg, .btn-with-icon svg { width: 1em; height: 1em; display: block; fill: currentColor; }

/* Outline icon overrides: colored icons on white background */
.btn-outline.btn-icon { color: var(--primary); }
.btn-outline-danger.btn-icon { color: #dc2626; }

/* Loading state */
.btn.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: btnspin .8s linear infinite;
}

@keyframes btnspin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Backward-compat: .btn-small is defined earlier; no extra alias needed */