/* components/buttons.css — Buttons iOS-like (44px hit target, estados, ícone+texto) */

/* ============================================================
   BASE — Todos os buttons
   ============================================================ */

.btn {
  min-height: var(--btn-h);
  padding: var(--btn-py) var(--btn-px);
  border-radius: var(--btn-radius);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  
  transition: transform 150ms ease-out,
              background 150ms ease-out,
              color 150ms ease-out;
}

/* ============================================================
   VARIANTES — PRIMARY / TINTED / PLAIN / DANGER
   ============================================================ */

/* Primary (Filled) — Cor de accent */
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

/* Secondary (Tinted) — Fundo tinted com cor de text */
.btn-tinted {
  background: var(--btn-tinted-bg);
  color: var(--accent);
  border-color: transparent;
}

/* Tertiary (Plain/Ghost) — Só texto */
.btn-plain {
  background: transparent;
  color: var(--btn-plain-text);
  border-color: transparent;
}

/* Destructive (Danger) — Verificar tons para light/dark */
.btn-danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger);
  border-color: transparent;
}

/* ============================================================
   ÍCONE — Monocromático, dentro do botão
   ============================================================ */

.btn .icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex-shrink: 0;
}

.btn .icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* ============================================================
   ESTADOS
   ============================================================ */

/* Active / Pressed */
.btn:active {
  transform: scale(var(--btn-active-scale));
}

/* Disabled / Aria-disabled */
.btn[aria-disabled="true"],
.btn:disabled {
  opacity: var(--btn-disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

/* Focus visível (acessibilidade) */
.btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--btn-radius);
}

/* ============================================================
   SIZING — Variações de tamanho (opcional)
   ============================================================ */

.btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 15px;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 20px;
  font-size: 18px;
}

/* ============================================================
   FULL WIDTH
   ============================================================ */

.btn-block {
  width: 100%;
}

/* ============================================================
   GROUPED (button group horizontal)
   ============================================================ */

.btn-group {
  display: inline-flex;
  gap: 0;
  border-radius: var(--btn-radius);
  overflow: clip;
}

.btn-group .btn {
  border-radius: 0;
  margin: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--btn-radius) 0 0 var(--btn-radius);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--btn-radius) var(--btn-radius) 0;
}

/* ============================================================
   LOADING / SKELETON (opcional)
   ============================================================ */

.btn.is-loading {
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

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