/**
 * Insights Like Module CSS
 * Styles for the like button across all content types
 * JavaScript handles text content, CSS handles appearance only
 */

/* ========== GLOBAL FLAG OVERRIDES ========== */

/* Reset font-size that flag module sets to 0 */
.flag a {
    font-size: 14px !important;
}

/* CRITICAL: Hide the flag module's ::before pseudo-element emoji */
.flag a::before {
    content: '' !important;
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

/* Base flag link styling */
.flag {
    display: inline-block;
}

.flag a {

    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-color: #999;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 0 0 1px #bdbdbd inset;
    border-radius: .25em;

}

/* Like count display styling */
.like-count-display {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    min-width: 20px;
    text-align: center;
}

.like-count-display.is-empty {
    display: none !important;
}

.flag.action-flag .like-count-display {
    color: #999;
}

.flag.action-unflag .like-count-display {
    color: #999;
    font-weight: 700;
}

.flag a:hover {
    background: none;
}

/* ========== UNLIKED STATE (action-flag) ========== */

/* .flag.action-flag a {
  color: #666;
  border: 1px solid #ddd;
  background-color: #f5f5f5;
} */

.flag.action-flag a:hover {
    /* color: #333;
    border-color: #999;
    background-color: #eeeeee; */
}

/* ========== LIKED STATE (action-unflag) ========== */

.flag.action-unflag a {
    color: #fff;
    /* border: 1px solid #ff6b6b;
  background-color: #ff6b6b; */
    font-weight: 600;
}

.flag.action-unflag a:hover {
    color: #fff;

}

/* ========== CONTEXT-SPECIFIC OVERRIDES ========== */

/* Article actions wrapper */
/* .article-actions .flag a {
  font-size: 14px !important;
}

.article-actions .flag.action-flag a {
  color: #666;
  border: 1px solid #ddd;
  background-color: #f5f5f5;
}

.article-actions .flag.action-unflag a {
  color: #fff;
  border: 1px solid #ff6b6b;
  background-color: #ff6b6b;
  font-weight: 600;
} */

/* Like wrapper */
.insights-like-wrapper .flag a {
    font-size: 14px !important;
}

.insights-like-wrapper .flag.action-flag a {
    color: #666;
    border: 1px solid #ddd;
    background-color: #f5f5f5;
}

.insights-like-wrapper .flag.action-unflag a {
    color: #fff;
    border: 1px solid #ff6b6b;
    background-color: #ff6b6b;
    font-weight: 600;
}

/* ========== ANIMATIONS ========== */

/* Scale animation on like click */
@keyframes likeScale {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

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

/* Pop animation after liked */
@keyframes likePop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.3);
    }

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

/* Pulse animation for liked state */
@keyframes likePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

/* Bounce animation for unlike */
@keyframes likeBounce {

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

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

/* Icon fade in/out */
@keyframes iconFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(-10px);
    }

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

@keyframes iconFadeOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }
}

/* Icon overlay styles */
.flag .like-icon {
    position: absolute;
    font-size: 32px;
    pointer-events: none;
    animation: iconFadeIn 0.6s ease-out;
    z-index: 10;
}

.flag .like-icon.removing {
    animation: iconFadeOut 0.4s ease-in;
}

/* Thumbs up icon styles */
.flag .thumbs-up-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

body.darktheme .flag.action-flag .thumbs-up-icon {
    filter: grayscale(1) invert(1) !important;
}

body.darktheme .flag.action-unflag .thumbs-up-icon {
    filter: none !important;
}

.flag.action-flag .thumbs-up-icon {
    background-image: url('../../../../sites/default/files/static/post-like.png');
}

.flag.action-unflag .thumbs-up-icon {
    background-image: url('../../../../sites/default/files/media/wp/2025/09/post-like-active.png');
    filter: none;
}

/* Animate button on click */
.flag a.animating {
    animation: likeScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Pulse animation for liked state */
.flag.action-unflag a {
    animation: likePulse 0.6s ease-out;
}

/* Bounce animation when unliking */
.flag.action-flag a {
    animation: likeBounce 0.4s ease-in-out;
}

/* ========== LIKES COUNT DISPLAY ========== */

.likes-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.likes-count {
    display: inline-block;
    padding: 6px 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    border: 1px solid #ddd;
    white-space: nowrap;
}

.likes-count::before {
    content: '';
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .flag a {
        padding: 5px 10px;
        font-size: 12px !important;
    }
}
