/**
 * Badges Component - Sistema de badges/etiquetas siguiendo BEM
 * Indicadores de estado, categorías y notificaciones
 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Variantes de color */
.badge--primary {
  background: var(--ckm-green);
  color: #00240f;
}

.badge--secondary {
  background: var(--ckm-gray);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge--success {
  background: #16a34a;
  color: var(--white);
}

.badge--warning {
  background: #f59e0b;
  color: #000;
}

.badge--danger {
  background: #dc2626;
  color: var(--white);
}

.badge--info {
  background: #3b82f6;
  color: var(--white);
}

.badge--muted {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

/* Variantes outline */
.badge--outline {
  background: transparent;
  border: 1px solid currentColor;
}

.badge--outline.badge--primary {
  color: var(--ckm-green);
  border-color: var(--ckm-green);
}

.badge--outline.badge--success {
  color: #16a34a;
  border-color: #16a34a;
}

.badge--outline.badge--warning {
  color: #f59e0b;
  border-color: #f59e0b;
}

.badge--outline.badge--danger {
  color: #dc2626;
  border-color: #dc2626;
}

.badge--outline.badge--info {
  color: #3b82f6;
  border-color: #3b82f6;
}

/* Tamaños */
.badge--sm {
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 8px;
}

.badge--lg {
  padding: 6px 12px;
  font-size: var(--font-size-sm);
  border-radius: 16px;
}

.badge--xl {
  padding: 8px 16px;
  font-size: var(--font-size-base);
  border-radius: 20px;
}

/* Formas */
.badge--pill {
  border-radius: 999px;
}

.badge--square {
  border-radius: 4px;
}

.badge--rounded {
  border-radius: var(--radius-sm);
}

/* Badge con dot */
.badge--dot {
  position: relative;
  padding-left: 16px;
}

.badge--dot::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Badge con icono */
.badge__icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.badge--lg .badge__icon {
  width: 14px;
  height: 14px;
}

.badge--xl .badge__icon {
  width: 16px;
  height: 16px;
}

/* Badge de notificación */
.badge--notification {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: var(--white);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid var(--ckm-black);
}

.badge--notification.badge--sm {
  min-width: 14px;
  height: 14px;
  font-size: 8px;
  border-radius: 7px;
}

.badge--notification.badge--lg {
  min-width: 22px;
  height: 22px;
  font-size: 11px;
  border-radius: 11px;
}

/* Estados especiales */
.badge--stock-high {
  background: #16a34a;
  color: var(--white);
}

.badge--stock-medium {
  background: #f59e0b;
  color: #000;
}

.badge--stock-low {
  background: #dc2626;
  color: var(--white);
}

.badge--stock-out {
  background: var(--muted);
  color: var(--ckm-black);
}

.badge--new {
  background: var(--ckm-green);
  color: #00240f;
  animation: badge-pulse 2s infinite;
}

.badge--offer {
  background: #f59e0b;
  color: #000;
  position: relative;
  overflow: hidden;
}

.badge--offer::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: badge-shine 2s infinite;
}

/* Animaciones */
@keyframes badge-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes badge-shine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Badge interactivo */
.badge--interactive {
  cursor: pointer;
  transition: all 0.2s ease;
}

.badge--interactive:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.badge--interactive:active {
  transform: translateY(0);
}

/* Badge removible */
.badge--removable {
  padding-right: 4px;
}

.badge__remove {
  background: transparent;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 0;
  margin-left: var(--space-xs);
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  transition: background-color 0.2s ease;
}

.badge__remove:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Grupo de badges */
.badge-group {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  align-items: center;
}

.badge-group--vertical {
  flex-direction: column;
  align-items: flex-start;
}

/* Badge en tablas */
.table .badge {
  font-size: 10px;
  padding: 2px 6px;
}

/* Badge responsive */
@media (max-width: 720px) {
  .badge--lg {
    padding: 4px 8px;
    font-size: var(--font-size-xs);
  }
  
  .badge--xl {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
  }
}
