/* ============================================================================
   TEMA MODERNO — Reacciones elegantes
   Unifica el selector de reacciones de index, descubre, grupos y páginas.
   ========================================================================== */

/* Contenedores: posición y puente de hover */
.reaction-container,
.reaction-wrapper,
.btn-reaction-wrapper {
    position: relative;
}

.reaction-container::after,
.reaction-wrapper::after,
.btn-reaction-wrapper::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 12px;
    display: block;
    background: transparent;
    pointer-events: auto;
}

/* Selector flotante */
.reaction-container .reaction-box,
.reaction-wrapper .reactions-picker,
.btn-reaction-wrapper .reactions-box {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    z-index: 3000;
    display: flex !important;
    align-items: center;
    gap: 2px;
    padding: 6px;
    margin: 0;
    list-style: none;
    white-space: nowrap;
    border-radius: 14px !important;
    border: 1px solid var(--border-color, #E8E0D3) !important;
    background: var(--card-bg, #fff) !important;
    box-shadow: 0 14px 30px rgba(60, 45, 30, .14), 0 2px 6px rgba(60, 45, 30, .06) !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(.97);
    transform-origin: bottom left;
    transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .2, 1), visibility .18s;
    animation: none !important;
}

.reaction-container:hover .reaction-box,
.reaction-container:focus-within .reaction-box,
.reaction-wrapper:hover .reactions-picker,
.reaction-wrapper:focus-within .reactions-picker,
.btn-reaction-wrapper:hover .reactions-box,
.btn-reaction-wrapper:focus-within .reactions-box {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Iconos del selector */
.react-btn,
.r-icon,
.reaction-icon {
    width: 40px;
    height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 10px;
    font-size: 1.45rem !important;
    line-height: 1;
    text-decoration: none !important;
    cursor: pointer;
    user-select: none;
    background: transparent;
    transition: transform .16s ease, background-color .16s ease;
}

.react-btn:hover,
.r-icon:hover,
.reaction-icon:hover {
    transform: translateY(-2px) scale(1.08);
    background: var(--hover-bg, #FFF2E8);
}

.react-btn:active,
.r-icon:active,
.reaction-icon:active {
    transform: scale(.94);
}

/* Emojis consistentes */
.react-btn,
.r-icon,
.reaction-icon,
.reaction-bar .btn {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

/* Barra de reacciones de grupos (dropdown) */
.reaction-bar {
    min-width: 252px !important;
    padding: 6px !important;
    border-radius: 14px !important;
    border: 1px solid var(--border-color, #E8E0D3) !important;
    background: var(--card-bg, #fff) !important;
    box-shadow: 0 14px 30px rgba(60, 45, 30, .14), 0 2px 6px rgba(60, 45, 30, .06) !important;
}

.reaction-bar.show {
    animation: ft-react-in .18s ease both;
}

.reaction-bar form {
    gap: 2px;
    justify-content: center !important;
}

.reaction-bar .btn {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem !important;
    line-height: 1;
    border-radius: 10px !important;
    border: 0 !important;
    background: transparent !important;
    transition: transform .16s ease, background-color .16s ease;
}

.reaction-bar .btn:hover {
    transform: translateY(-2px) scale(1.08);
    background: var(--hover-bg, #FFF2E8) !important;
}

.reaction-bar .btn:active {
    transform: scale(.94);
}

/* Botones de acción elegantes */
.action-btn,
.interaction-btn,
.btn-post-action {
    transition: background-color .18s ease, color .18s ease, transform .16s ease;
}

.action-btn:hover,
.interaction-btn:hover,
.btn-post-action:hover {
    background: var(--hover-bg, #FFF2E8) !important;
}

.action-btn.reacted,
.interaction-btn.text-primary {
    background: rgba(29, 91, 240, .10) !important;
    color: var(--accent-blue, #1D5BF0) !important;
    border-radius: 8px;
}

/* Pequeño pulso al confirmar una reacción (lo agrega el JS) */
.ft-react-pop {
    animation: ft-react-pop .34s cubic-bezier(.2, .8, .2, 1);
}

@keyframes ft-react-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

@keyframes ft-react-in {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modo oscuro */
body.dark-mode .reaction-container .reaction-box,
body.dark-mode .reaction-wrapper .reactions-picker,
body.dark-mode .btn-reaction-wrapper .reactions-box,
body.dark-mode .reaction-bar {
    background: var(--card-bg, #071831) !important;
    border-color: var(--border-color, #14294E) !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .30) !important;
}

body.dark-mode .react-btn:hover,
body.dark-mode .r-icon:hover,
body.dark-mode .reaction-icon:hover,
body.dark-mode .reaction-bar .btn:hover {
    background: var(--hover-bg, #102C58) !important;
}

body.dark-mode .action-btn.reacted,
body.dark-mode .interaction-btn.text-primary {
    background: rgba(127, 176, 255, .14) !important;
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .reaction-container .reaction-box,
    .reaction-wrapper .reactions-picker,
    .btn-reaction-wrapper .reactions-box,
    .reaction-bar.show,
    .react-btn,
    .r-icon,
    .reaction-icon,
    .action-btn,
    .interaction-btn,
    .btn-post-action,
    .ft-react-pop {
        animation: none !important;
        transition: none !important;
    }
}
