/* Icon button component — square, borderless-until-hover button used in toolbars.
   Add `data-tooltip` for an on-hover tooltip (centered by default; use
   `icon-button--tooltip-end` to align it to the button's right edge for buttons
   near the edge of a bar). */
.icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
  color: var(--full-contrast);
  background: var(--border-light);
  border-color: var(--border);
}

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

.icon-button svg {
  flex-shrink: 0;
}

.icon-button--sm {
  width: 24px;
  height: 24px;
}

.icon-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: 60;
}

.icon-button[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

.icon-button--tooltip-end[data-tooltip]::after {
  left: auto;
  right: 0;
  transform: none;
}
