/* Canonical shared buttons (CSS consolidation Phase 1B). */

.nn-button.nn-button {
  box-sizing: border-box;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--nn-space-2);
  max-width: 100%;
  min-height: var(--nn-button-height);
  padding: 0 var(--nn-button-padding-x);
  border: 1px solid var(--nn-color-border-strong);
  border-radius: var(--nn-radius-control);
  background: #fff;
  color: var(--nn-color-text);
  box-shadow: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  vertical-align: middle;
}

.nn-button.nn-button > i,
.nn-button.nn-button > svg {
  flex: 0 0 auto;
}

.nn-button.nn-button:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):hover {
  border-color: var(--nn-color-border-strong);
  background: #f8fafc;
  color: var(--nn-color-text);
  text-decoration: none;
}

.nn-button.nn-button:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):active {
  background: #f1f5f9;
}

.nn-button.nn-button:focus-visible {
  outline: 2px solid var(--nn-color-accent);
  outline-offset: 2px;
}

.nn-button.nn-button--primary {
  border-color: var(--nn-color-accent);
  background: var(--nn-color-accent);
  color: #fff;
}

.nn-button.nn-button--primary:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):hover,
.nn-button.nn-button--primary:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):active {
  border-color: var(--nn-color-accent-hover);
  background: var(--nn-color-accent-hover);
  color: #fff;
}

.nn-button.nn-button--secondary {
  border-color: var(--nn-color-border-strong);
  background: #fff;
  color: var(--nn-color-text);
}

.nn-button.nn-button--danger {
  border-color: var(--nn-color-danger);
  background: #fff;
  color: var(--nn-color-danger);
}

.nn-button.nn-button--danger:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):hover,
.nn-button.nn-button--danger:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):active {
  border-color: var(--nn-color-danger);
  background: var(--nn-color-danger-soft);
  color: var(--nn-color-danger);
}

.nn-button.nn-button--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--nn-color-text-muted);
}

.nn-button.nn-button--ghost:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):hover,
.nn-button.nn-button--ghost:not(:disabled):not([aria-disabled="true"]):not(.is-disabled):active {
  border-color: transparent;
  background: #f8fafc;
  color: var(--nn-color-text);
}

.nn-button.nn-button--compact {
  min-height: var(--nn-button-height-compact);
  padding-right: var(--nn-button-padding-x-compact);
  padding-left: var(--nn-button-padding-x-compact);
  font-size: 0.82rem;
}

.nn-button.nn-button--icon {
  width: var(--nn-button-height);
  min-width: var(--nn-button-height);
  height: var(--nn-button-height);
  min-height: var(--nn-button-height);
  padding: 0;
}

.nn-button.nn-button--icon.nn-button--compact {
  width: var(--nn-button-height-compact);
  min-width: var(--nn-button-height-compact);
  height: var(--nn-button-height-compact);
  min-height: var(--nn-button-height-compact);
}

.nn-button.nn-button:disabled,
.nn-button.nn-button[disabled],
.nn-button.nn-button[aria-disabled="true"],
.nn-button.nn-button.is-disabled {
  opacity: 0.55;
  box-shadow: none;
  cursor: not-allowed;
}

.nn-button.nn-button[aria-disabled="true"],
.nn-button.nn-button.is-disabled {
  pointer-events: none;
}

.nn-button.nn-button.is-loading,
.nn-button.nn-button.is-saving,
.nn-button.nn-button[aria-busy="true"] {
  cursor: wait;
}

@media (max-width: 767px) {
  .nn-button.nn-button:not(.nn-button--compact):not(.nn-button--icon) {
    min-height: 44px;
  }

  .nn-button.nn-button--icon:not(.nn-button--compact) {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
}
