/* eXtreme Reactions 1.0.6 */
.extreme-reactions {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    min-height: 30px;
    clear: both;
    font-size: 13px;
}

/* JS moves the bar into SMF's native .under_message footer. Desktop uses
   one shared action row: reactions/likes on the left and post actions on the
   right. This is scoped only to posts mounted by this mod. */
@media (min-width: 721px) {
    /* SMF 2.1 uses a floated .poster and a separately margined .postarea on
       desktop, so the right column does not naturally inherit the poster
       height. JS writes the measured poster height into this custom property.
       It is only a MINIMUM: long text/attachments can always make the post
       taller. This lets the actions behave as a true bottom footer. */
    .extreme-reactions-postarea {
        display: flex !important;
        flex-direction: column !important;
        min-height: var(--extreme-reactions-poster-height, 0px) !important;
        box-sizing: border-box !important;
    }

    .extreme-reactions-postarea .post .inner {
        min-height: 0 !important;
    }

    .under_message.extreme-reactions-footer {
        display: flex !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        column-gap: 10px !important;
        row-gap: 7px !important;
        width: 100% !important;
        margin-top: auto !important;
        padding-top: 7px !important;
        padding-bottom: 7px !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
    }

    .under_message.extreme-reactions-footer::after {
        content: none !important;
        display: none !important;
    }

    .under_message.extreme-reactions-footer > .extreme-reactions {
        flex: 1 1 160px !important;
        width: auto !important;
        min-width: 34px !important;
        min-height: 30px !important;
        float: none !important;
        clear: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .under_message.extreme-reactions-footer > ul.floatleft {
        flex: 0 0 auto !important;
        float: none !important;
        clear: none !important;
        margin: 0 !important;
    }

    .under_message.extreme-reactions-footer > .quickbuttons.quickbuttons_post {
        flex: 0 0 auto !important;
        float: none !important;
        clear: none !important;
        margin: 0 0 0 auto !important;
    }
}

.extreme-reactions-active {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.extreme-reactions .extreme-reaction-pill,
.extreme-reactions .extreme-reaction-add {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    height: 30px !important;
    min-height: 30px !important;
    border: 1px solid rgba(140, 150, 160, .35) !important;
    border-radius: 8px !important;
    background: rgba(90, 100, 110, .12) !important;
    background-image: none !important;
    color: inherit !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px;
    padding: 3px 8px !important;
    margin: 0 !important;
    line-height: 1 !important;
    cursor: pointer;
    vertical-align: middle;
    transition: border-color .12s ease, background-color .12s ease, transform .08s ease;
}

.extreme-reactions .extreme-reaction-pill:hover,
.extreme-reactions .extreme-reaction-add:hover {
    border-color: rgba(190, 160, 105, .75) !important;
    background: rgba(190, 160, 105, .10) !important;
}

.extreme-reactions .extreme-reaction-pill:active,
.extreme-reactions .extreme-reaction-add:active {
    transform: translateY(1px);
}

.extreme-reactions .extreme-reaction-pill.is-selected {
    border-color: #c99a5c !important;
    background: rgba(201, 154, 92, .18) !important;
}

.extreme-reaction-pill-emoji {
    display: block !important;
    width: 21px !important;
    height: 21px !important;
    max-width: none !important;
    object-fit: contain;
    margin: 0 !important;
}

.extreme-reaction-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    min-height: 20px;
    font-weight: 700;
    font-size: 12px;
    opacity: .9;
    cursor: help;
}

.extreme-reactions .extreme-reaction-add {
    width: 34px !important;
    padding: 0 !important;
    gap: 0;
    opacity: .78;
}

.extreme-reaction-add span {
    font-size: 18px;
    line-height: 1;
}

.extreme-reaction-add b {
    font-size: 12px;
    margin-left: -1px;
    margin-top: -9px;
}

.extreme-reactions.is-loading {
    opacity: .65;
    pointer-events: none;
}

.extreme-reaction-rating {
    font-weight: 700;
    color: #d1a064;
}

/* Global Discord-like picker, attached to body. */
.extreme-reaction-picker,
.extreme-reaction-people {
    position: fixed;
    z-index: 2147483000;
    display: none;
    box-sizing: border-box;
    border: 1px solid #3b3d44;
    border-radius: 12px;
    background: #1e1f22;
    color: #dbdee1;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .32);
    font-family: Arial, Helvetica, sans-serif;
    scrollbar-width: thin;
    scrollbar-color: #4e5058 #1e1f22;
}

.extreme-reaction-picker {
    width: 344px;
    max-width: calc(100vw - 16px);
    max-height: min(520px, calc(100vh - 16px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
}

.extreme-reaction-picker.is-open,
.extreme-reaction-people.is-open {
    display: block;
}

.extreme-reaction-picker-top {
    position: sticky;
    top: -10px;
    z-index: 2;
    margin: -10px -10px 6px;
    padding: 10px 10px 7px;
    background: #1e1f22;
}

.extreme-reaction-search-wrap {
    position: relative;
}

.extreme-reaction-search {
    box-sizing: border-box;
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 11px;
    border: 1px solid #3f4147;
    border-radius: 7px;
    outline: none;
    background: #111214;
    color: #f2f3f5;
    font-size: 14px;
}

.extreme-reaction-search::placeholder { color: #949ba4; }
.extreme-reaction-search:focus { border-color: #6b6f78; }
.extreme-reaction-section { margin-top: 8px; }
.extreme-reaction-section[hidden] { display: none; }
.extreme-reaction-section-title {
    margin: 4px 1px 7px;
    color: #949ba4;
    font-size: 12px;
    font-weight: 700;
}

.extreme-reaction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 4px;
}

.extreme-picker-emoji {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 100% !important;
    aspect-ratio: 1 / 1;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 2px !important;
    border: 0;
    border-radius: 6px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.extreme-picker-emoji:hover,
.extreme-picker-emoji:focus-visible {
    background: #35373c;
    outline: none;
}
.extreme-picker-emoji[hidden] { display: none; }
.extreme-picker-emoji-img {
    display: block !important;
    width: 34px !important;
    height: 34px !important;
    max-width: 100% !important;
    object-fit: contain;
    margin: 0 !important;
    user-select: none;
    -webkit-user-drag: none;
}

/* Who-reacted popover. Hover a reaction on desktop or tap its number. */
.extreme-reaction-people {
    width: 260px;
    max-width: calc(100vw - 16px);
    max-height: min(360px, calc(100vh - 16px));
    overflow: hidden;
}

.extreme-reaction-people-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    border-bottom: 1px solid #34363c;
    color: #f2f3f5;
    font-size: 13px;
}

.extreme-reaction-people-emoji {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    object-fit: contain;
    margin: 0 !important;
}

.extreme-reaction-people-body {
    max-height: 300px;
    overflow-y: auto;
    padding: 6px;
    overscroll-behavior: contain;
}

.extreme-reaction-people-body.is-loading {
    padding: 12px;
    color: #949ba4;
}

.extreme-reaction-person {
    padding: 7px 8px;
    border-radius: 6px;
    color: #dbdee1;
    font-size: 13px;
    line-height: 1.25;
}
.extreme-reaction-person:hover { background: #2b2d31; }
.extreme-reaction-person a,
.extreme-reaction-person a:visited {
    color: #dbdee1 !important;
    text-decoration: none !important;
}
.extreme-reaction-person a:hover { color: #fff !important; }

@media (max-width: 720px) {
    .under_message.extreme-reactions-footer > .extreme-reactions {
        width: 100% !important;
        gap: 5px;
        margin: 0 0 7px !important;
        padding: 8px 0 0 !important;
    }

    .extreme-reaction-picker {
        width: calc(100vw - 16px);
        max-height: min(66vh, 520px);
        border-radius: 10px;
    }

    .extreme-picker-emoji { min-height: 36px; }
    .extreme-picker-emoji-img {
        width: 32px !important;
        height: 32px !important;
    }

    .extreme-reaction-people {
        width: min(280px, calc(100vw - 16px));
        border-radius: 10px;
    }

    /* The number doubles as a touch target for opening the participant list. */
    .extreme-reaction-count {
        min-width: 18px;
        min-height: 24px;
    }
}


@media (prefers-reduced-motion: reduce) {
    .extreme-reaction-pill,
    .extreme-reaction-add { transition: none; }
}
