/* ─────────────────────────────────────────────────────────────────────── */
/* Button Components                                                         */
/* ─────────────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────────── */
/* Standard Button                                                           */
/* ─────────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background-color: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-colors), var(--transition-motion);
  user-select: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background-color: var(--bg-3);
  border-color: var(--hover-bd);
  color: var(--text);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

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

/* ─────────────────────────────────────────────────────────────────────── */
/* Primary Button (CTA)                                                      */
/* ─────────────────────────────────────────────────────────────────────── */

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 4px 12px -4px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-h);
  border-color: var(--accent-h);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px -2px var(--accent-glow);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Ghost / Subtle Button                                                     */
/* ─────────────────────────────────────────────────────────────────────── */

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

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-2);
  border-color: var(--line);
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Success Button                                                            */
/* ─────────────────────────────────────────────────────────────────────── */

.btn-success {
  background-color: var(--st-accepted-bg);
  color: var(--st-accepted);
  border-color: var(--st-accepted);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--st-accepted);
  color: #fff;
  border-color: var(--st-accepted);
  transform: translateY(-1px);
}

.btn-success:active:not(:disabled) {
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Danger Outline Variant (subtle red, fill on hover)                       */
/* ─────────────────────────────────────────────────────────────────────── */

.btn-danger-outline {
  background-color: var(--t-bug-bg);
  color: var(--t-bug);
  border-color: var(--t-bug);
}

.btn-danger-outline:hover:not(:disabled) {
  background-color: var(--t-bug);
  color: #fff;
  border-color: var(--t-bug);
  transform: translateY(-1px);
}

.btn-danger-outline:active:not(:disabled) {
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Danger Button                                                             */
/* ─────────────────────────────────────────────────────────────────────── */

.btn-danger {
  background-color: var(--t-bug);
  color: #fff;
  border-color: var(--t-bug);
  box-shadow: 0 4px 12px -4px rgba(var(--t-bug-rgb), 0.35);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--t-bug);
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(var(--t-bug-rgb), 0.45);
}

.btn-danger:active:not(:disabled) {
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Icon Button (Square, 34×34px)                                           */
/* ─────────────────────────────────────────────────────────────────────── */

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background-color: var(--bg-2);
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-colors), var(--transition-motion);
  flex-shrink: 0;
}

.iconbtn:hover {
  background-color: var(--bg-3);
  border-color: var(--hover-bd);
  color: var(--accent);
}

.iconbtn:active {
  transform: translateY(1px);
}

.iconbtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.iconbtn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Small Button Variant                                                      */
/* ─────────────────────────────────────────────────────────────────────── */

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-lg {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Button Group                                                              */
/* ─────────────────────────────────────────────────────────────────────── */

.btn-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Loading State                                                             */
/* ─────────────────────────────────────────────────────────────────────── */

.btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn.is-loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
