/* IconButton Component Styles */

.mint-icon-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  /* Flat surface (1d): no gradient overlay, no hover lift. */
  transition:
    color 0.15s var(--mint-ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    background-color 0.15s var(--mint-ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    border-color 0.15s var(--mint-ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    box-shadow 0.15s var(--mint-ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1));
  cursor: pointer;
  border: none;
  box-sizing: border-box;
}

.mint-icon-button:hover:not(.mint-icon-button--disabled):not(.mint-icon-button--ghost):not(:focus-visible) {
  box-shadow: var(--shadow-sm);
}

.mint-icon-button:active:not(.mint-icon-button--disabled) {
  box-shadow: none;
  transition-duration: 0.05s;
}

.mint-icon-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

.mint-icon-button--disabled {
  opacity: var(--mint-disabled-opacity);
  cursor: not-allowed;
}

/* Colored variants shift to neutral bg when disabled for WCAG AA contrast */
.mint-icon-button--primary.mint-icon-button--disabled,
.mint-icon-button--cta.mint-icon-button--disabled,
.mint-icon-button--danger.mint-icon-button--disabled,
.mint-icon-button--success.mint-icon-button--disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Variants */
.mint-icon-button--primary {
  background-color: var(--color-primary);
  color: white;
}

.mint-icon-button--primary:hover:not(.mint-icon-button--disabled) {
  background-color: var(--color-primary-hover);
}

.mint-icon-button--secondary {
  background-color: var(--bg-secondary);
  color: var(--text-secondary-strong);
  border: 1px solid var(--border-color);
}

.mint-icon-button--secondary:hover:not(.mint-icon-button--disabled) {
  background-color: var(--bg-tertiary);
}

.mint-icon-button--cta {
  background-color: var(--color-cta);
  color: white;
}

.mint-icon-button--cta:hover:not(.mint-icon-button--disabled) {
  background-color: var(--color-cta-hover);
}

.mint-icon-button--danger {
  background-color: var(--mint-error);
  color: white;
}

.mint-icon-button--danger:hover:not(.mint-icon-button--disabled) {
  background-color: var(--mint-error-hover);
}

.mint-icon-button--success {
  background-color: var(--mint-success);
  color: white;
}

.mint-icon-button--success:hover:not(.mint-icon-button--disabled) {
  background-color: var(--mint-success-hover);
}

.mint-icon-button--ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.mint-icon-button--ghost:hover:not(.mint-icon-button--disabled) {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Pressed: one step darker than hover, since the flat surface has no lift. */
.mint-icon-button--ghost:active:not(.mint-icon-button--disabled) {
  background-color: color-mix(in srgb, var(--text-primary) 10%, var(--bg-tertiary));
}

/* Sizes — icons 16px at sm/md, 20px at lg, matching BaseButton icons (1d). */
.mint-icon-button--sm {
  width: var(--form-height-sm);
  height: var(--form-height-sm);
  padding: 0.375rem;
}

.mint-icon-button--md {
  width: var(--form-height-md);
  height: var(--form-height-md);
  padding: 0.5rem;
}

.mint-icon-button--lg {
  width: var(--form-height-lg);
  height: var(--form-height-lg);
  padding: 0.75rem;
}

.mint-icon-button__icon--sm,
.mint-icon-button__icon--md,
.mint-icon-button__icon--lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mint-icon-button__icon--sm {
  width: 1rem;
  height: 1rem;
}

.mint-icon-button__icon--md {
  width: 1rem;
  height: 1rem;
}

.mint-icon-button__icon--lg {
  width: 1.25rem;
  height: 1.25rem;
}

/* A bare <svg> in the slot has no intrinsic size and collapses to 0 width as a
   flex item; fill the sized icon box so callers need not size their icon. */
.mint-icon-button__icon--sm > svg,
.mint-icon-button__icon--md > svg,
.mint-icon-button__icon--lg > svg {
  width: 100%;
  height: 100%;
}

/* Spinner */
.mint-icon-button__spinner {
  animation: mint-spin 1s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .mint-icon-button {
    transition:
      color 0.15s ease,
      background-color 0.15s ease,
      border-color 0.15s ease,
      box-shadow 0.15s ease;
  }
}
