/* =====================================================
   HEADER CREDITS BADGE - Indicador de creditos restantes
   ===================================================== */

.hm-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px 4px 8px;
    border-radius: 16px;
    font-family: inherit;
    cursor: default;
    margin: 0 4px;
    white-space: nowrap;
    transition: all 0.3s ease;
    animation: hm-fadeIn 0.5s ease;
    flex-shrink: 0;
    height: 30px;
}

.hm-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.hm-badge.hm-badge-clickable {
    cursor: pointer;
    position: relative;
    z-index: 3;
}

.hm-badge.hm-badge-clickable:focus {
    outline: 2px solid rgba(255, 255, 255, 0.65);
    outline-offset: 2px;
}

/* Icono SVG: misma capa (blanco / crema) en todos los estados del badge */
.hm-badge-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.94) !important;
    filter: none !important;
    opacity: 1 !important;
}

/* Numero de mensajes */
.hm-badge-count {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.3px;
}

/* Etiqueta "mensajes" */
.hm-badge-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

/* --- Colores por estado --- */

/* Alto: verde */
.hm-badge-high {
    background: rgba(40, 167, 69, 0.18);
    color: #d4f5e0;
    border: 1px solid rgba(40, 167, 69, 0.35);
}

/* Estados conservan color de fondo / texto; el icono sigue monocromo vía .hm-badge-icon */

/* Medio: amarillo */
.hm-badge-medium {
    background: rgba(255, 193, 7, 0.18);
    color: #fff3cd;
    border: 1px solid rgba(255, 193, 7, 0.35);
}

/* Bajo: rojo pulsante */
.hm-badge-low {
    background: rgba(220, 53, 69, 0.20);
    color: #f8d7da;
    border: 1px solid rgba(220, 53, 69, 0.40);
    animation: hm-fadeIn 0.5s ease, hm-pulse-red 2s ease-in-out infinite;
}

/* Vacio: gris */
.hm-badge-empty {
    background: rgba(108, 117, 125, 0.18);
    color: #c0c5ca;
    border: 1px solid rgba(108, 117, 125, 0.30);
    opacity: 0.7;
}

.hm-badge-empty .hm-badge-icon {
    color: rgba(255, 255, 255, 0.82) !important;
    opacity: 0.88 !important;
}

/* --- Badge Dorado (Créditos y Usuarios) --- */

.hm-badge-credits,
.hm-badge-users {
    background: rgba(255, 255, 255, 0.14) !important;
    color: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
    animation: hm-fadeIn 0.5s ease !important;
    position: relative;
    overflow: hidden;
}

.hm-badge-credits .hm-badge-icon,
.hm-badge-users .hm-badge-icon {
    color: rgba(255, 255, 255, 0.94) !important;
    filter: none !important;
}

.hm-badge-credits .hm-badge-count,
.hm-badge-users .hm-badge-count {
    color: rgba(255, 255, 255, 0.98) !important;
    text-shadow: none !important;
}

.hm-badge-credits .hm-badge-label,
.hm-badge-users .hm-badge-label {
    color: rgba(255, 255, 255, 0.88) !important;
    opacity: 0.95;
}

/* Usuarios: sin barrido (solo créditos) */
.hm-badge-users::after {
    display: none !important;
}

/* Créditos: barrido luminoso periódico para destacar en la cabecera */
.hm-badge-credits::after {
    display: block !important;
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 65%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 35%,
        rgba(255, 255, 255, 0.42) 50%,
        rgba(255, 255, 255, 0.08) 65%,
        transparent 100%
    );
    animation: hm-credits-sweep 3.8s ease-in-out infinite;
    pointer-events: none;
    border-radius: inherit;
}

.hm-badge-credits.hm-badge-low::after {
    display: none !important;
}

.hm-badge-credits:hover,
.hm-badge-users:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

/* Bajo creditos/usuarios: mantener pulso rojo pero con toque dorado */
.hm-badge-credits.hm-badge-low,
.hm-badge-users.hm-badge-low {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.22) 0%, rgba(212, 175, 55, 0.15) 100%) !important;
    border: 1px solid rgba(220, 53, 69, 0.45) !important;
    animation: hm-fadeIn 0.5s ease, hm-pulse-red 2s ease-in-out infinite;
}

.hm-badge-users.hm-badge-low::after {
    display: none;
}

/* --- Animaciones --- */

@keyframes hm-fadeIn {
    from { opacity: 0; transform: translateX(-10px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes hm-pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
    50% { box-shadow: 0 0 8px 2px rgba(220, 53, 69, 0.25); }
}

@keyframes hm-golden-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.18), 0 0 3px rgba(255, 215, 0, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
    50% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.38), 0 0 28px rgba(255, 215, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
}

@keyframes hm-shimmer-sweep {
    0% { left: -100%; }
    30% { left: 100%; }
    100% { left: 100%; }
}

@keyframes hm-credits-sweep {
    0%, 8% { left: -120%; opacity: 0; }
    12% { opacity: 1; }
    42% { left: 135%; opacity: 1; }
    48%, 100% { left: 135%; opacity: 0; }
}

/* --- Responsive: ocultar label en pantallas pequenas --- */
@media (max-width: 768px) {
    .hm-badge-label {
        display: none;
    }
    .hm-badge {
        padding: 5px 10px;
    }
}
