/* Reactions — modern pill-style panel + picker. Matches the design
   language from the thread-header / footer refactor: tan accent,
   thin borders, subtle hover lift. */

.likes-container {
    margin-top: 10px;
    position: relative;
}

.like-button-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* "Add reaction" trigger — dashed circle. */
.like-button {
    cursor: pointer;
    position: relative;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px dashed var(--border-color, rgba(120, 85, 85, 0.35));
    background: transparent;
    color: var(--secondary-text, #888);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, color 0.15s ease,
                background 0.15s ease, border-style 0.15s ease;
    outline: none;
    box-shadow: none;
    font-size: 14px;
}

.like-button:hover,
.like-button.active {
    border-style: solid;
    border-color: var(--link-color, #D8A063);
    color: var(--link-color, #D8A063);
    background: rgba(215, 160, 99, 0.08);
}

.like-button:focus { outline: none; box-shadow: none; }

/* Reaction picker popover — square-ish grid (5×5 for 25 reactions),
   roomy enough to browse without squinting. */
.reaction-picker {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 8px;
    background: var(--bg-color, #fff);
    border: 1px solid var(--border-color, rgba(120, 85, 85, 0.25));
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    grid-template-columns: repeat(5, 34px);
    gap: 3px;
    max-width: min(92vw, 240px);
}

.like-button.active .reaction-picker {
    display: grid;
}

[data-theme="dark"] .reaction-picker {
    background: var(--menu-bg, #1C1714);
    border-color: var(--border-color, rgba(215, 160, 99, 0.2));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* Picker icon buttons */
.reaction-button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, transform 0.12s ease,
                border-color 0.12s ease;
}

.reaction-button:hover {
    background: rgba(215, 160, 99, 0.14);
    border-color: rgba(215, 160, 99, 0.4);
    transform: scale(1.12);
}

/* Icon sizes */
.reaction-svg {
    width: 22px;
    height: 22px;
    display: block;
    transition: transform 0.12s ease;
}

/* The inline .reactions-display keeps smaller icons. */
.reaction-item .reaction-svg {
    width: 16px;
    height: 16px;
}

.reaction-svg-small {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    display: inline-block;
}

/* Reactions row under the post — pill buttons with count */
.reactions-display {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.reaction-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 7px;
    border: 1px solid var(--border-color, rgba(120, 85, 85, 0.25));
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-color, inherit);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease,
                transform 0.08s ease;
    line-height: 1;
}

.reaction-item:hover {
    border-color: var(--link-color, #D8A063);
    background: rgba(215, 160, 99, 0.06);
}

.reaction-item.active,
.reaction-item.user-reacted {
    border-color: var(--link-color, #D8A063);
    background: rgba(215, 160, 99, 0.14);
}

.reaction-item:active {
    transform: scale(0.96);
}

.reaction-emoji {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.reaction-count {
    color: var(--text-color, inherit);
    opacity: 0.85;
}

/* "who reacted" byline under the pill row — flat dedup of all users
   across all reactions. Per-pill tooltip shows who used each emoji;
   this gives an at-a-glance roll-call without hovering. */
.likes-list {
    font-size: 12px;
    color: var(--secondary-text, #888);
    margin-top: 8px;
    opacity: 0.85;
}

/* Responsive */
@media (max-width: 600px) {
    .reaction-picker {
        max-width: 92vw;
    }
    .reaction-item {
        font-size: 12px;
        padding: 2px 9px 2px 6px;
    }
}

/* Kill iOS's native image-callout / context menu on long-press. The
   default behaviour pops up "Save Image / Open" because the pill
   contains an <img>; we want the long-press to be ours so we can show
   a "who reacted" popover instead. */
.reaction-item,
.reaction-item img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* "Who reacted" popover — appears on long-press of a pill. Floating
   above the pill, dark bg for contrast in both themes. Auto-dismisses
   on the next tap-anywhere or after ~3s. */
.reactions-tooltip {
    position: absolute;
    z-index: 1100;
    background: rgba(40, 30, 25, 0.95);
    color: #fff;
    border: 1px solid rgba(215, 160, 99, 0.35);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 240px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    white-space: normal;
    word-break: break-word;
}
.reactions-tooltip.is-open {
    opacity: 1;
    transform: translateY(0);
}
