/*
   BUTTONS COMPONENT - assets/css/components/buttons.css
   Sistema híbrido: ui-premium (glassmorphism sofisticado) e ui-minimal (limpo e sólido).
   Base neutra + variantes, tamanhos, utilitários.
   Integrado a variáveis CSS.
*/

/* Animações */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Estilos Base (neutra e minimal universal) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-sizing: border-box;
  gap: 0.5rem;
  color: inherit;
}

/* Tamanhos */
.btn-sm {
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
}

.btn-md {
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 0.5rem;
}

.btn-lg {
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
  border-radius: 0.75rem;
}

/* Utilitários */
.btn-full {
  width: 100%;
}

.btn-icon svg,
.btn-icon img {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.btn-icon-only {
  padding: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  justify-content: center;
}

.btn-sm.btn-icon-only {
  width: 2rem;
  height: 2rem;
  padding: 0.25rem;
}

.btn-lg.btn-icon-only {
  width: 3rem;
  height: 3rem;
  padding: 0.75rem;
}

.btn-circle {
  border-radius: 50%;
  aspect-ratio: 1;
  padding: 0;
  min-height: auto;
}

/* Loading */
.btn-loading {
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

/* Estados */
.btn:hover {
  /* Sobrescrito por temas */
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* =====================================
   TEMA PREMIUM: Glassmorphism leve, brilho,
   gradientes sutis, sombras suaves, hover animado
   ===================================== */
body.ui-premium .btn {
  background: var(--glass-bg, rgba(255, 255, 255, 0.1));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
  color: var(--color-text-premium, #ffffff);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

body.ui-premium .btn:hover {
  transform: translateY(-1px) scale(1.02);
  background: var(--glass-bg-hover, rgba(255, 255, 255, 0.2));
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

body.ui-premium .btn:active {
  transform: translateY(0) scale(1);
}

body.ui-premium .btn:focus-visible {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Variantes Premium */
body.ui-premium .btn-primary {
  background: linear-gradient(135deg, var(--color-primary, #3b82f6), var(--color-primary-dark, #1d4ed8));
  border-color: rgba(59, 130, 246, 0.3);
  color: white;
  box-shadow:
    0 4px 20px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

body.ui-premium .btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-dark, #1d4ed8), var(--color-primary, #3b82f6));
  box-shadow:
    0 8px 32px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

body.ui-premium .btn-secondary {
  background: linear-gradient(135deg, var(--color-secondary, #6b7280), #4b5563);
  color: white;
}

body.ui-premium .btn-secondary:hover {
  background: linear-gradient(135deg, #4b5563, var(--color-secondary, #6b7280));
}

body.ui-premium .btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

body.ui-premium .btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3);
}

body.ui-premium .btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

body.ui-premium .btn-success:hover {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
}

body.ui-premium .btn-outline {
  background: transparent;
  border-color: var(--glass-border, rgba(255, 255, 255, 0.4));
  color: var(--color-text-premium, #ffffff);
  box-shadow: none;
}

body.ui-premium .btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body.ui-premium .btn-ghost {
  background: transparent;
  border: none;
  color: var(--color-text-premium, #ffffff);
  box-shadow: none;
}

body.ui-premium .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* =====================================
   TEMA MINIMAL: Limpo, sólido, bordas sutis,
   hover discreto, sem glassmorphism
   ===================================== */
body.ui-minimal .btn {
  background: var(--color-bg-btn, #ffffff);
  border: 1px solid var(--color-border, #d1d5db);
  color: var(--color-text-minimal, #111827);
  box-shadow: none;
}

body.ui-minimal .btn:hover {
  background: var(--color-hover-bg, #f9fafb);
  border-color: var(--color-border-hover, #9ca3af);
  transform: none;
}

body.ui-minimal .btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Variantes Minimal */
body.ui-minimal .btn-primary {
  background: var(--color-primary, #3b82f6);
  border-color: var(--color-primary, #3b82f6);
  color: white;
}

body.ui-minimal .btn-primary:hover {
  background: var(--color-primary-dark, #1d4ed8);
  border-color: var(--color-primary-dark, #1d4ed8);
}

body.ui-minimal .btn-secondary {
  background: var(--color-secondary, #6b7280);
  border-color: var(--color-secondary, #6b7280);
  color: white;
}

body.ui-minimal .btn-secondary:hover {
  background: #4b5563;
  border-color: #4b5563;
}

body.ui-minimal .btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

body.ui-minimal .btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

body.ui-minimal .btn-success {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

body.ui-minimal .btn-success:hover {
  background: #059669;
  border-color: #059669;
}

body.ui-minimal .btn-outline {
  background: transparent;
  border-color: var(--color-border, #d1d5db);
  color: var(--color-text-minimal, #111827);
}

body.ui-minimal .btn-outline:hover {
  background: var(--color-hover-bg, #f9fafb);
  border-color: var(--color-primary, #3b82f6);
  color: var(--color-primary, #3b82f6);
}

body.ui-minimal .btn-ghost {
  background: transparent;
  border: none;
  color: var(--color-text-minimal, #111827);
}

body.ui-minimal .btn-ghost:hover {
  background: var(--color-hover-bg, #f3f4f6);
  color: var(--color-primary, #3b82f6);
}