.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  font-weight: 500;
  line-height: 1.25rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

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

.btn--primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn--primary:hover:not(.btn--disabled) {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn--primary:active:not(.btn--disabled) {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

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

.btn--secondary:hover:not(.btn--disabled) {
  background-color: var(--color-border-dark);
  border-color: var(--color-border-dark);
}

.btn--secondary:active:not(.btn--disabled) {
  background-color: var(--color-border);
  border-color: var(--color-border);
}

.btn--danger {
  background-color: var(--color-error);
  border-color: var(--color-error);
  color: var(--color-text-inverse);
}

.btn--danger:hover:not(.btn--disabled) {
  background-color: var(--color-error);
  border-color: var(--color-error);
  opacity: 0.9;
}

.btn--danger:active:not(.btn--disabled) {
  background-color: var(--color-error);
  border-color: var(--color-error);
  opacity: 0.8;
}

.btn--ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-text-primary);
}

.btn--ghost:hover:not(.btn--disabled) {
  background-color: var(--color-bg-tertiary);
}

.btn--ghost:active:not(.btn--disabled) {
  background-color: var(--color-border-light);
}

.btn--small {
  padding: 0.375rem 0.75rem;
  line-height: 1rem;
}

.btn--medium {
  padding: 0.5rem 1rem;
  line-height: 1.25rem;
}

.btn--large {
  padding: 0.75rem 1.5rem;
  line-height: 1.5rem;
}

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

.btn--loading {
  cursor: wait;
}

.btn--full-width {
  width: 100%;
}

.btn__spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.btn__spinnerIcon {
  width: 100%;
  height: 100%;
  animation: btn-spin 1s linear infinite;
}

.btn__spinnerCircle {
  stroke-dasharray: 31.416;
  stroke-dashoffset: 31.416;
  animation: btn-dash 1.5s ease-in-out infinite;
}

.btn__content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn__content--loading {
  opacity: 0.7;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes btn-dash {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -35px;
  }
  100% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -124px;
  }
}
