.reaction.user-reacted,
.reaction-btn.user-reacted,
.thread__action.user-reacted {
    color: #ef4444 !important;
}

.reaction.user-reacted i,
.reaction-btn.user-reacted i,
.thread__action.user-reacted i {
    color: #ef4444 !important;
}

.reaction.user-reacted .reaction-count,
.reaction-btn.user-reacted .reaction-count,
.thread__action.user-reacted .reaction-count {
    color: #ef4444 !important;
    font-weight: 700;
}

.reaction.user-reacted span:not(.reaction-count),
.reaction-btn.user-reacted span:not(.reaction-count),
.thread__action.user-reacted span:not(.reaction-count) {
    color: #ef4444 !important;
}

.thread__action.disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.reaction.disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.reaction-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.reaction-btn.active .reaction-icon {
    animation: bounce 0.5s ease;
}

.reaction-count {
    font-weight: 600;
    display: none;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

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

.reaction-btn.has-reactions,
.reaction.has-reactions,
.reactions .reaction.has-reactions,
.thread__action.has-reactions,
.reactions .thread__action.has-reactions {
    border-width: 2px;
    color: var(--primary) !important;
}

.reaction-btn.has-reactions .reaction-count,
.reaction.has-reactions .reaction-count,
.reactions .reaction.has-reactions .reaction-count,
.thread__action.has-reactions .reaction-count,
.reactions .thread__action.has-reactions .reaction-count {
    color: var(--primary);
    font-weight: 500;
    animation: countPulse 0.3s ease;
}

.reaction.has-reactions i,
.reactions .reaction.has-reactions i,
.thread__action.has-reactions i,
.reactions .thread__action.has-reactions i {
    color: #ffffff !important;
}

.thread__action.has-reactions span:not(.reaction-count),
.reactions .thread__action.has-reactions span:not(.reaction-count) {
    color: #ffffff !important;
}

/* Also whiten when only container has class (no class on the action span) */

/* Also whiten when only container has class (no class on the action span) */
.reaction.has-reactions .thread__action,
.reaction.has-reactions .thread__action i,
.reaction.has-reactions .thread__action span:not(.reaction-count) {
    color: #ffffff !important;
}

.reaction.has-reactions.user-reacted .thread__action i,
.reactions .reaction.has-reactions.user-reacted .thread__action i,
.thread__action.has-reactions.user-reacted i,
.reactions .thread__action.has-reactions.user-reacted i {
    color: #ef4444 !important;
}

.reaction.has-reactions.user-reacted .thread__action span:not(.reaction-count),
.reactions .reaction.has-reactions.user-reacted .thread__action span:not(.reaction-count),
.thread__action.has-reactions.user-reacted span:not(.reaction-count),
.reactions .thread__action.has-reactions.user-reacted span:not(.reaction-count) {
    color: #ef4444 !important;
}

.reaction.has-reactions.user-reacted .reaction-count,
.reactions .reaction.has-reactions.user-reacted .reaction-count,
.thread__action.has-reactions.user-reacted .reaction-count,
.reactions .thread__action.has-reactions.user-reacted .reaction-count {
    color: #ef4444 !important;
}

@keyframes countPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@media (max-width: 640px) {
    .reactions-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .reaction-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .reaction-icon {
        font-size: 16px;
    }
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: flex-start;
}

.reaction-count-visible {
    display: inline-block !important;
}

.reaction-count.reaction-count-visible,
.action-count.reaction-count-visible {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.reaction-count,
.action-count {
    display: none;
    margin-left: 4px;
    vertical-align: middle;
}

.reaction-btn.user-reacted,
.reaction-btn.user-reacted i,
.reaction-btn.user-reacted .reaction-count {
    color: #ef4444 !important;
}

.reaction-trigger-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.reaction-trigger {
    cursor: pointer;
}

.reaction-trigger.user-reacted i,
.reaction-trigger.user-reacted .reaction-total-count {
    color: #ef4444 !important;
}

.reaction-total-count {
    font-size: 13px;
    margin-left: 4px;
    display: none;
    vertical-align: middle;
}

.reaction-total-count.has-count {
    display: none; /* Hide total count when showing individual badges */
}

.active-reactions-container {
    display: none;
    align-items: center;
    gap: 6px;
}

.active-reactions-container.has-reactions {
    display: flex;
}

.default-heart {
    display: inline-block;
}

.active-reactions-container.has-reactions ~ .default-heart,
.has-reactions .default-heart {
    display: none;
}

.active-reaction-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 14px;
    font-weight: 600;
}

/* Default active reaction is white */
.thread__action .active-reaction-badge i,
.thread__action .active-reaction-badge span,
.thread__action .active-reaction-badge .active-reaction-count {
    color: #ffffff !important;
}

/* Force white even inside a fully user-reacted parent block, IF this specific badge isn't user-reacted */
.thread__action.user-reacted .active-reaction-badge:not(.user-reacted) i,
.thread__action.user-reacted .active-reaction-badge:not(.user-reacted) span,
.thread__action.user-reacted .active-reaction-badge:not(.user-reacted) .active-reaction-count,
.thread__action.has-reactions.user-reacted .active-reaction-badge:not(.user-reacted) i,
.thread__action.has-reactions.user-reacted .active-reaction-badge:not(.user-reacted) span,
.thread__action.has-reactions.user-reacted .active-reaction-badge:not(.user-reacted) .active-reaction-count {
    color: #ffffff !important;
}

.active-reaction-badge .reaction-emoji {
    font-size: 16px;
}

/* Red coloring only when the current user has reacted to this specific badge */
.thread__action .active-reaction-badge.user-reacted i,
.thread__action .active-reaction-badge.user-reacted span,
.thread__action .active-reaction-badge.user-reacted .active-reaction-count {
    color: #ef4444 !important;
}

.active-reaction-count {
    font-size: 12px;
}

.reaction-picker {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 500;
    background: var(--background);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 6px 10px;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    animation: pickerFadeIn 0.15s ease;
}

.reaction-picker.open {
    display: flex;
}

@keyframes pickerFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reaction-picker-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    color: var(--secondary);
    font-size: 18px;
    min-width: 36px;
}

.reaction-emoji {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.reaction-picker-btn::before {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateX(-50%) translateY(4px);
}

.reaction-picker-btn:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.reaction-picker-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.25);
    color: var(--primary, #fff);
}

.reaction-picker-btn.user-reacted,
.reaction-picker-btn.active {
    color: #ef4444 !important;
}

.reaction-picker-btn.user-reacted:hover,
.reaction-picker-btn.active:hover {
    color: #ef4444 !important;
}

.reaction-picker-count {
    font-size: 11px;
    font-weight: 600;
    display: none;
    color: var(--secondary, #aaa);
    line-height: 1;
}

.reaction-picker-count.has-count {
    display: block;
}

.reaction-picker-btn.user-reacted .reaction-picker-count,
.reaction-picker-btn.active .reaction-picker-count {
    color: #ef4444 !important;
}

.thread__footer {
    padding-top: 1px;
}

.thread__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
    min-height: 30px;
    margin-bottom: 7px;
}

.thread__action i {
    font-size: 16px;
}