/**
 * Buttons Component - Sistema de botones siguiendo BEM
 * Mantiene y extiende los estilos de botones existentes
 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--font-size-base);
  line-height: 1;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Variantes de color */
.btn--primary {
  background: var(--ckm-green);
  color: #00240f;
}

.btn--primary:hover:not(:disabled) {
  background: var(--ckm-green-2);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--ckm-gray);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn--secondary:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn--ghost {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--ckm-green);
  color: var(--ckm-green);
}

.btn--danger {
  background: #dc2626;
  color: var(--white);
}

.btn--danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn--warning {
  background: #f59e0b;
  color: #000;
}

.btn--warning:hover:not(:disabled) {
  background: #d97706;
}

.btn--success {
  background: var(--ckm-green);
  color: #00240f;
}

.btn--success:hover:not(:disabled) {
  background: var(--ckm-green-2);
}

/* Tamaños */
.btn--sm {
  padding: 8px 12px;
  font-size: var(--font-size-sm);
}

.btn--lg {
  padding: 16px 24px;
  font-size: var(--font-size-lg);
}

.btn--xl {
  padding: 20px 32px;
  font-size: var(--font-size-xl);
}

/* Variantes de forma */
.btn--square {
  border-radius: var(--radius-sm);
}

.btn--rounded {
  border-radius: var(--radius);
}

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.btn--icon.btn--sm {
  width: 32px;
  height: 32px;
}

.btn--icon.btn--lg {
  width: 48px;
  height: 48px;
}

/* Estados especiales */
.btn--loading {
  position: relative;
  color: transparent;
}

.btn--loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: btn-spin 0.8s linear infinite;
  color: inherit;
}

.btn--block {
  width: 100%;
}

/* Grupo de botones */
.btn-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.btn-group--attached {
  gap: 0;
}

.btn-group--attached .btn {
  border-radius: 0;
  border-right-width: 1px;
}

.btn-group--attached .btn:first-child {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.btn-group--attached .btn:last-child {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
  border-right-width: 2px;
}

.btn-group--vertical {
  flex-direction: column;
}

.btn-group--center {
  justify-content: center;
}

.btn-group--end {
  justify-content: flex-end;
}

/* Animaciones */
@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 720px) {
  .btn--login {
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group--mobile-row {
    flex-direction: row;
  }
}
