/* =============================================================
   WP Reactions Post Pro — Frontend Styles
   v2.0.0
   ============================================================= */

/* ── Wrapper ────────────────────────────────────────────────── */
.wprp-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 2em 0 1em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Summary line ────────────────────────────────────────────── */
.wprp-summary {
    font-size: .8rem;
    color: #888;
    transition: opacity .2s;
}
.wprp-summary strong { color: #555; }

/* ── Reaction list ───────────────────────────────────────────── */
.wprp-reactions {
    list-style: none;
    margin: 0;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 50px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .07);
}

/* ── Single reaction item ────────────────────────────────────── */
.wprp-reaction {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50px;
    transition: background .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wprp-reaction:hover,
.wprp-reaction:focus-visible {
    background: rgba(0, 0, 0, .05);
    transform: translateY(-4px) scale(1.1);
}

.wprp-reaction--active {
    background: rgba(99, 102, 241, .08);
}

.wprp-reaction--active .wprp-reaction__count {
    color: #6366f1;
    font-weight: 700;
}

/* ── Tooltip ─────────────────────────────────────────────────── */
.wprp-reaction__tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(.85);
    background: rgba(30, 30, 30, .88);
    color: #fff;
    font-size: .7rem;
    white-space: nowrap;
    padding: 3px 9px;
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.wprp-reaction:hover  .wprp-reaction__tooltip,
.wprp-reaction:focus-visible .wprp-reaction__tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ── Emoji icon wrapper ──────────────────────────────────────── */
.wprp-reaction__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    overflow: visible;
    position: relative;
}

/* ── Count badge ─────────────────────────────────────────────── */
.wprp-reaction__count {
    font-size: 2rem;
    color: #666;
    min-height: 1em;
    transition: color .2s;
    line-height: 1;
    margin-top: 4px;
}

/* ── Guest notice ────────────────────────────────────────────── */
.wprp-guest-notice {
    font-size: .8rem;
    color: #e05c1e;
    margin: 4px 0 0;
    animation: wprp-fadeIn .3s ease;
}

/* ── Animated ring on active ─────────────────────────────────── */
.wprp--animated .wprp-reaction--active .wprp-reaction__icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, .4);
    transform: translate(-50%, -50%) scale(.6);
    animation: wprp-ring .6s ease forwards;
    pointer-events: none;
}

@keyframes wprp-ring {
    from { transform: translate(-50%, -50%) scale(.6); opacity: 1; }
    to   { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

@keyframes wprp-fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   CSS EMOJI ANIMATIONS
   (ported from original, refined)
   ═══════════════════════════════════════════════════════════════ */

.emoji {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.35);
    transform-origin: center center;
}

.emoji__eyebrows,
.emoji__eyes,
.emoji__face,
.emoji__hand,
.emoji__heart,
.emoji__mouth,
.emoji__thumb,
.emoji__tongue { position: absolute; }

.emoji__eyebrows::after, .emoji__eyebrows::before,
.emoji__eyes::after,     .emoji__eyes::before,
.emoji__face::after,     .emoji__face::before,
.emoji__hand::after,     .emoji__hand::before,
.emoji__heart::after,    .emoji__heart::before,
.emoji__mouth::after,    .emoji__mouth::before,
.emoji__thumb::after,    .emoji__thumb::before,
.emoji__tongue::after,   .emoji__tongue::before { position: absolute; content: ''; }

.emoji__face { width: inherit; height: inherit; }

/* ── Like ── */
.emoji--like {
    background: linear-gradient(#48b9ff, #1463ff);
    box-shadow: none;
}
.emoji--like .emoji__hand {
    left: 25px; bottom: 30px; width: 20px; height: 40px;
    background: #fff; border-radius: 5px; z-index: 0;
    animation: wprp-hands-up 2s linear infinite;
}
.emoji--like .emoji__hand::before {
    left: 25px; bottom: 5px; width: 40px;
    background: inherit; height: 10px;
    border-radius: 2px 10px 10px 2px;
    box-shadow: 1px -9px 0 1px #fff, 2px -19px 0 2px #fff, 3px -29px 0 3px #fff;
}
.emoji--like .emoji__thumb {
    border-bottom: 20px solid #fff; border-left: 20px solid transparent;
    top: -25px; right: -25px; z-index: 2;
    transform: rotate(5deg); transform-origin: 0 100%;
    animation: wprp-thumbs-up 2s linear infinite;
}
.emoji--like .emoji__thumb::before {
    border-radius: 50% 50% 0 0; background: #fff;
    width: 10px; height: 12px; left: -10px; top: -8px;
    transform: rotate(-15deg); transform-origin: 100% 100%;
    box-shadow: -1px 4px 0 -1px #fff;
}

/* ── Love ── */
.emoji--love {
    background: linear-gradient(#fe576c, #fe2640);
    box-shadow: none;
}
.emoji--love .emoji__heart {
    left: calc(50% - 40px); top: calc(50% - 40px);
    width: 80px; height: 80px;
    animation: wprp-heart-beat 1s linear infinite alternate;
}
.emoji--love .emoji__heart::after,
.emoji--love .emoji__heart::before {
    left: calc(50% - 20px); top: calc(50% - 32px);
    width: 40px; height: 64px;
    background: #fff; border-radius: 20px 20px 0 0;
}
.emoji--love .emoji__heart::before {
    transform: translate(20px) rotate(-45deg);
    transform-origin: 0 100%;
}
.emoji--love .emoji__heart::after {
    transform: translate(-20px) rotate(45deg);
    transform-origin: 100% 100%;
}

/* ── Haha ── */
.emoji--haha { background: linear-gradient(#FFED65, #EEAD2F); box-shadow: inset 0 0 10px 2px #eead2b; }
.emoji--haha .emoji__face { animation: wprp-haha-face 2s linear infinite; }
.emoji--haha .emoji__eyes {
    width: 26px; height: 6px; border-radius: 2px;
    left: calc(50% - 13px); top: 35px; transform: rotate(20deg);
    background: 0 0;
    box-shadow: -25px 5px 0 0 #000, 25px -5px 0 0 #000;
}
.emoji--haha .emoji__eyes::after {
    left: 0; top: 0; width: 26px; height: 6px; border-radius: 2px;
    transform: rotate(-40deg); background: 0 0;
    box-shadow: -25px -5px 0 0 #000, 25px 5px 0 0 #000;
}
.emoji--haha .emoji__mouth {
    width: 80px; height: 40px; left: calc(50% - 40px); top: 50%;
    background: linear-gradient(#54290F, #622B0B, #6E3011);
    border-radius: 0 0 40px 40px; overflow: hidden; z-index: 1;
    animation: wprp-haha-mouth 2s linear infinite;
}
.emoji--haha .emoji__tongue {
    width: 70px; height: 30px;
    background: linear-gradient(#ff596d, #fe2640, #fe576c);
    left: calc(50% - 35px); bottom: -10px; border-radius: 50%;
}

/* ── Wow ── */
.emoji--wow { background: linear-gradient(#FFED65, #EEAD2F); box-shadow: inset 0 0 10px 2px #eead2b; }
.emoji--wow .emoji__face { animation: wprp-wow-face 3s linear infinite; }
.emoji--wow .emoji__eyebrows {
    left: calc(50% - 3px); height: 6px; width: 6px;
    border-radius: 50%; background: 0 0;
    box-shadow: -18px 0 0 0 #aa7408, -33px 0 0 0 #aa7408, 18px 0 0 0 #aa7408, 33px 0 0 0 #aa7408;
    animation: wprp-wow-brow 3s linear infinite;
}
.emoji--wow .emoji__eyebrows::after,
.emoji--wow .emoji__eyebrows::before {
    width: 24px; height: 20px;
    border: 6px solid #aa7408; box-sizing: border-box;
    border-radius: 50%;
    border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent;
    top: -3px; left: calc(50% - 12px);
}
.emoji--wow .emoji__eyebrows::before { margin-left: -25px; }
.emoji--wow .emoji__eyebrows::after  { margin-left:  25px; }
.emoji--wow .emoji__eyes {
    width: 16px; height: 24px; left: calc(50% - 8px); top: 35px;
    border-radius: 50%; background: 0 0;
    box-shadow: 25px 0 0 0 #1b2031, -25px 0 0 0 #1b2031;
}
.emoji--wow .emoji__mouth {
    width: 30px; height: 45px; left: calc(50% - 15px); top: 50%;
    border-radius: 50%;
    background: linear-gradient(#54290F, #622B0B, #6E3011);
    animation: wprp-wow-mouth 3s linear infinite;
}

/* ── Sad ── */
.emoji--sad { background: linear-gradient(#FFED65, #EEAD2F); box-shadow: inset 0 0 10px 2px #eead2b; }
.emoji--sad .emoji__face { animation: wprp-sad-face 2s ease-in infinite; }
.emoji--sad .emoji__eyebrows {
    left: calc(50% - 3px); top: 35px; height: 6px; width: 6px;
    border-radius: 50%; background: 0 0;
    box-shadow: -40px 9px 0 0 #aa7408, -25px 0 0 0 #aa7408, 25px 0 0 0 #aa7408, 40px 9px 0 0 #aa7408;
}
.emoji--sad .emoji__eyebrows::after,
.emoji--sad .emoji__eyebrows::before {
    width: 30px; height: 20px;
    border: 6px solid #aa7408; box-sizing: border-box;
    border-radius: 50%;
    border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent;
    top: 2px; left: calc(50% - 15px);
}
.emoji--sad .emoji__eyebrows::before { margin-left: -30px; transform: rotate(-30deg); }
.emoji--sad .emoji__eyebrows::after  { margin-left:  30px; transform: rotate( 30deg); }
.emoji--sad .emoji__eyes {
    width: 14px; height: 16px; left: calc(50% - 7px); top: 50px;
    border-radius: 50%; background: 0 0;
    box-shadow: 25px 0 0 0 #1b2031, -25px 0 0 0 #1b2031;
}
.emoji--sad .emoji__eyes::after {
    background: #548dff; width: 12px; height: 12px;
    margin-left: 6px; border-radius: 0 100% 40% 50% / 0 50% 40% 100%;
    transform-origin: 0 0;
    animation: wprp-tear-drop 2s ease-in infinite;
}
.emoji--sad .emoji__mouth {
    width: 60px; height: 80px; left: calc(50% - 30px); top: 80px;
    box-sizing: border-box;
    border: 6px solid #000; border-radius: 50%;
    border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent;
    background: 0 0;
    animation: wprp-sad-mouth 2s ease-in infinite;
}
.emoji--sad .emoji__mouth::after {
    width: 6px; height: 6px; background: 0 0; border-radius: 50%;
    top: 4px; left: calc(50% - 3px);
    box-shadow: -18px 0 0 0 #000, 18px 0 0 0 #000;
}

/* ── Angry ── */
.emoji--angry {
    background: linear-gradient(#ff110a -10%, #ffda6a);
    box-shadow: inset 0 0 10px 2px #ff110a;
    animation: wprp-angry-color 2s ease-in infinite;
}
.emoji--angry .emoji__face { animation: wprp-angry-face 2s ease-in infinite; }
.emoji--angry .emoji__eyebrows {
    left: calc(50% - 3px); top: 55px; height: 6px; width: 6px;
    border-radius: 50%; background: 0 0;
    box-shadow: -44px 5px 0 0 #000, -7px 16px 0 0 #000, 7px 16px 0 0 #000, 44px 5px 0 0 #000;
}
.emoji--angry .emoji__eyebrows::after,
.emoji--angry .emoji__eyebrows::before {
    width: 50px; height: 20px;
    border: 6px solid #000; box-sizing: border-box; border-radius: 50%;
    border-top-color: transparent; border-left-color: transparent; border-right-color: transparent;
    top: 0; left: calc(50% - 25px);
}
.emoji--angry .emoji__eyebrows::before { margin-left: -25px; transform: rotate( 15deg); }
.emoji--angry .emoji__eyebrows::after  { margin-left:  25px; transform: rotate(-15deg); }
.emoji--angry .emoji__eyes {
    width: 12px; height: 12px; left: calc(50% - 6px); top: 70px;
    border-radius: 50%; background: 0 0;
    box-shadow: 25px 0 0 0 #000, -25px 0 0 0 #000;
}
.emoji--angry .emoji__mouth {
    width: 36px; height: 18px; left: calc(50% - 18px); bottom: 15px;
    background: #000; border-radius: 50%;
    animation: wprp-angry-mouth 2s ease-in infinite;
}

/* ═══════════════════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════════════════ */
@keyframes wprp-heart-beat {
    25% { transform: scale(1.1); }
    75% { transform: scale(.6);  }
}
@keyframes wprp-haha-face {
    10%, 30%, 50% { transform: translateY(25px); }
    20%, 40%      { transform: translateY(15px); }
    60%, 80%      { transform: translateY(0);    }
    70%, 90%      { transform: translateY(-10px);}
}
@keyframes wprp-haha-mouth {
    10%, 30%, 50% { transform: scale(.6);  top: 45%; }
    20%, 40%      { transform: scale(.8);  top: 45%; }
    60%, 80%      { transform: scale(1);   top: 50%; }
    70%           { transform: scale(1.2); top: 50%; }
    90%           { transform: scale(1.1); top: 50%; }
}
@keyframes wprp-wow-face {
    15%, 25%      { transform: rotate( 20deg) translateX(-25px); }
    45%, 65%      { transform: rotate(-20deg) translateX( 25px); }
    75%, 100%     { transform: rotate(0) translateX(0);          }
}
@keyframes wprp-wow-brow {
    15%, 65%      { top: 25px; }
    0%, 75%, 100% { top: 15px; }
}
@keyframes wprp-wow-mouth {
    10%, 30%      { width: 20px; height: 20px; left: calc(50% - 10px); }
    50%, 70%      { width: 30px; height: 40px; left: calc(50% - 15px); }
    75%, 100%     { height: 50px; }
}
@keyframes wprp-sad-face {
    25%, 35%      { top: -15px; }
    55%, 95%      { top:  10px; }
    0%, 100%      { top:    0;  }
}
@keyframes wprp-sad-mouth {
    25%, 35%      { transform: scale(.85); top: 70px; }
    0%, 55%, 100% { transform: scale(1);  top: 80px; }
}
@keyframes wprp-tear-drop {
    0%, 100%  { left:  35px; top: 15px; transform: rotate(45deg) scale(0); }
    25%       { left:  35px;            transform: rotate(45deg) scale(2); }
    49.9%     { left:  35px; top: 65px; transform: rotate(45deg) scale(0); }
    50%       { left: -35px; top: 15px; transform: rotate(45deg) scale(0); }
    75%       { left: -35px;            transform: rotate(45deg) scale(2); }
    99.9%     { left: -35px; top: 65px; transform: rotate(45deg) scale(0); }
}
@keyframes wprp-hands-up {
    25%       { transform: rotate(15deg);                     }
    50%       { transform: rotate(-15deg) translateY(-10px); }
    75%, 100% { transform: rotate(0);                        }
}
@keyframes wprp-thumbs-up {
    25%       { transform: rotate(20deg); }
    50%, 100% { transform: rotate(5deg);  }
}
@keyframes wprp-angry-color {
    45%, 60%       { background-size: 250%; }
    0%, 85%, 100%  { background-size: 100%; }
}
@keyframes wprp-angry-face {
    35%, 60% { transform: translateX(0)   translateY(10px) scale(.9); }
    40%, 50% { transform: translateX(-5px) translateY(10px) scale(.9); }
    45%, 55% { transform: translateX( 5px) translateY(10px) scale(.9); }
}
@keyframes wprp-angry-mouth {
    25%, 50% { height: 6px; bottom: 25px; }
}

/* ── No-animations mode ────────────────────────────────────── */
.wprp-wrap:not(.wprp--animated) .emoji--like  { animation: none; }
.wprp-wrap:not(.wprp--animated) .emoji--love .emoji__heart { animation: none; }
.wprp-wrap:not(.wprp--animated) .emoji--haha .emoji__face,
.wprp-wrap:not(.wprp--animated) .emoji--haha .emoji__mouth { animation: none; }
.wprp-wrap:not(.wprp--animated) .emoji--wow  .emoji__face,
.wprp-wrap:not(.wprp--animated) .emoji--wow  .emoji__eyebrows,
.wprp-wrap:not(.wprp--animated) .emoji--wow  .emoji__mouth  { animation: none; }
.wprp-wrap:not(.wprp--animated) .emoji--sad  .emoji__face,
.wprp-wrap:not(.wprp--animated) .emoji--sad  .emoji__eyes::after,
.wprp-wrap:not(.wprp--animated) .emoji--sad  .emoji__mouth  { animation: none; }
.wprp-wrap:not(.wprp--animated) .emoji--angry .emoji__face,
.wprp-wrap:not(.wprp--animated) .emoji--angry .emoji__mouth,
.wprp-wrap:not(.wprp--animated) .emoji--angry               { animation: none; }

/* ── Dark mode ─────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .wprp-reactions {
        background: #1e1e2e;
        border-color: #2e2e3e;
        box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
    }
    .wprp-reaction:hover,
    .wprp-reaction:focus-visible { background: rgba(255, 255, 255, .08); }
    .wprp-reaction--active        { background: rgba(99, 102, 241, .15); }
    .wprp-reaction__count         { color: #aaa; }
    .wprp-summary                 { color: #888; }
}

/* ── Responsive: mantiene le emoji centrate e visibili ── */
@media (max-width: 480px) {
    .wprp-reactions { 
        padding: 8px 12px; 
        gap: 8px;
    }
    .wprp-reaction__icon { 
        width: 80px; 
        height: 80px; 
    }
    .emoji {
        transform: translate(-50%, -50%) scale(.42);
    }
}

/* ── Top Posts Widget ─────────────────────────────────────────────────────── */
.wprp-top-posts {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.wprp-top-posts__title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #111827;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 10px;
}

.wprp-top-posts__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wprp-top-posts__item {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.wprp-top-posts__item:last-child {
    border-bottom: none;
}

.wprp-top-posts__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: #374151;
    transition: color 0.2s;
}

.wprp-top-posts__link:hover {
    color: #1463ff;
}

.wprp-top-posts__post-title {
    font-weight: 500;
    flex: 1;
    margin-right: 15px;
}

.wprp-top-posts__count {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #6b7280;
    background: #f9fafb;
    padding: 4px 10px;
    border-radius: 20px;
}

.wprp-top-posts__count .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    color: #f7b731;
}