/**
 * Creator Suite — Helpfulness Reaction System
 *
 * Shared stylesheet for reaction buttons on all four post types.
 * Enqueued on sn_review, sn_comparison, sn_roundup, and sn_guide singles.
 *
 * Elementor / page-builder isolation strategy
 * ─────────────────────────────────────────────
 * The <button> element is used (not <a>) because Elementor is more aggressive
 * with link/anchor styling. All rules on .sn-reaction-btn are scoped under the
 * .sn-reactions parent to raise specificity above page-builder globals, and
 * the reset block below uses !important to guarantee that Elementor's injected
 * hover/focus/border styles cannot bleed through.
 *
 * Elementor injects styles via --e-global-color-* CSS variables and rule blocks
 * like `.elementor-widget-container button:hover`. Using a scoped .sn-reactions
 * prefix with !important on the reset properties wins that specificity battle
 * without touching any global selectors.
 *
 * @package Creator_Suite
 */

/* =========================================================
   Container
   ========================================================= */

.sn-reactions {
    background: var(--sn-card, #F4F4F4);
    border: 1px solid var(--sn-border, #E5E5E5);
    border-radius: 8px;
    padding: 28px 24px;
    margin: 40px 0;
    text-align: center;
}

/* =========================================================
   Heading
   ========================================================= */

.sn-reactions .sn-reactions-heading {
    font-family: var(--sn-font-body, 'Inter', sans-serif);
    font-size: 15px;
    font-weight: 600;
    color: var(--sn-muted, #6B7280);
    margin: 0 0 20px;
    line-height: 1.4;
}

/* =========================================================
   Button Row
   ========================================================= */

.sn-reactions .sn-reactions-buttons {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

/* =========================================================
   Page-builder / Theme Reset
   ─────────────────────────────────────────────────────────
   These !important declarations prevent Elementor, Divi, Beaver
   Builder, and generic theme styles from injecting borders,
   outlines, box-shadows, or hover colors onto the button element.
   The visual appearance comes entirely from .sn-reaction-btn-icon
   (the inner <span>), so resetting the button wrapper is safe.
   ========================================================= */

.sn-reactions .sn-reaction-btn,
.sn-reactions .sn-reaction-btn:hover,
.sn-reactions .sn-reaction-btn:focus,
.sn-reactions .sn-reaction-btn:active,
.sn-reactions .sn-reaction-btn:visited {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    background-color: transparent !important;
    /* Override Elementor --e-global-color-* variable injection */
    color: inherit !important;
}

/* =========================================================
   Individual Button
   ========================================================= */

.sn-reactions .sn-reaction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0;
    cursor: pointer;
    transition: opacity 0.2s ease;
    /* Ensure no inherited background or border from theme resets */
    background: transparent;
    border: none;
}

/* Suppress the default focus ring on the button wrapper;
   focus-visible styles are applied to the inner icon span instead */
.sn-reactions .sn-reaction-btn:focus {
    outline: none !important;
}

.sn-reactions .sn-reaction-btn:focus-visible .sn-reaction-btn-icon {
    box-shadow: 0 0 0 3px var(--sn-accent, #2a9d8f), 0 0 0 5px rgba(42, 157, 143, 0.2) !important;
}

/* =========================================================
   Icon Circle
   ─────────────────────────────────────────────────────────
   The teal circle is a <span>, not the button itself, so
   page-builder button selectors cannot target it directly.
   All background-color transitions happen here, not on the
   button wrapper, which keeps the reset block fully safe.
   ========================================================= */

.sn-reactions .sn-reaction-btn-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--sn-accent, #2a9d8f);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    position: relative;
    /* Hard-reset any border/shadow that a parent rule might cascade in */
    border: none;
    box-shadow: none;
    outline: none;
}

.sn-reactions .sn-reaction-btn-icon svg {
    width: 28px;
    height: 28px;
    display: block;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Hover — icon scale/darken — only when not yet voted.
   Scoped to the icon span so the !important button reset above
   does not suppress this intentional interaction state. */
.sn-reactions .sn-reaction-btn:not(.voted):hover .sn-reaction-btn-icon {
    background: #218e82;
    transform: scale(1.08);
}

/* =========================================================
   Button Label
   ========================================================= */

.sn-reactions .sn-reaction-btn-label {
    font-family: var(--sn-font-body, 'Inter', sans-serif);
    font-size: 13px;
    font-weight: 500;
    color: var(--sn-primary, #1A1A1A);
    line-height: 1.3;
    transition: color 0.2s ease;
    /* Suppress any Elementor link-colour cascade */
    text-decoration: none;
}

/* =========================================================
   Active (selected) State
   ========================================================= */

.sn-reactions .sn-reaction-btn.active .sn-reaction-btn-icon {
    background: #155f56;
    box-shadow: 0 0 0 3px #2a9d8f, 0 0 0 5px rgba(42, 157, 143, 0.2);
}

.sn-reactions .sn-reaction-btn.active .sn-reaction-btn-label {
    color: #155f56;
    font-weight: 700;
}

/* Checkmark badge on the active icon */
.sn-reactions .sn-reaction-btn.active .sn-reaction-btn-icon::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #155f56;
    border-radius: 50%;
    border: 2px solid var(--sn-card, #F4F4F4);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolyline points='2,6 5,9 10,3' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 10px 10px;
    background-position: center;
    background-repeat: no-repeat;
}

/* =========================================================
   Voted (post-vote) State — non-selected buttons dim out
   ========================================================= */

.sn-reactions.has-voted .sn-reaction-btn {
    cursor: default;
    pointer-events: none;
}

.sn-reactions.has-voted .sn-reaction-btn:not(.active) .sn-reaction-btn-icon {
    opacity: 0.35;
}

.sn-reactions.has-voted .sn-reaction-btn:not(.active) .sn-reaction-btn-label {
    opacity: 0.45;
}

/* =========================================================
   Summary Line
   ========================================================= */

.sn-reactions .sn-reactions-summary {
    display: none;
    font-family: var(--sn-font-body, 'Inter', sans-serif);
    font-size: 14px;
    color: var(--sn-muted, #6B7280);
    margin: 20px 0 0;
    line-height: 1.5;
}

.sn-reactions .sn-reactions-summary.visible {
    display: block;
}

/* =========================================================
   Responsive — Mobile
   ========================================================= */

@media (max-width: 480px) {
    .sn-reactions {
        padding: 24px 16px;
        margin: 32px 0;
    }

    .sn-reactions .sn-reactions-buttons {
        gap: 16px;
    }

    .sn-reactions .sn-reaction-btn-icon {
        width: 52px;
        height: 52px;
    }

    .sn-reactions .sn-reaction-btn-icon svg {
        width: 26px;
        height: 26px;
    }

    .sn-reactions .sn-reaction-btn-label {
        font-size: 12px;
    }

    .sn-reactions .sn-reactions-heading {
        font-size: 14px;
    }
}
