/**
 * Comment Votes v2 — Mockup B (chip pill style)
 *
 * Unified upvote/downvote UI for chapter comments, inline comments, and quotes.
 * Loaded in Phase 1 but not yet activated visually — Phase 2 will swap legacy
 * `.madara-vote-btn` markup for `.madara-vote-wrapper-v2` markup and the
 * styles below will take effect.
 *
 * Spec: plan/2026-05-09-comment-quotes-redesign-mockup-B.md section C.2.
 */

/* v1.4.53 — Heart UI (Instagram-style like button).
   Single button + count below. Replaces upvote/downvote chip pair.
   Applies globally: main comments, inline comments, reply, quote rep,
   quote commentary (rule 37: same component, single CSS class). */

.madara-vote-wrapper-v2.mvb-heart-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

/* v1.4.55: heart chip = CHỈ icon trái tim, KHÔNG khung tròn bao quanh.
   Inactive  → fill trong suốt + stroke (đường viền) theme color → hình trái tim outline
   Active    → fill theme color (đầy)
   Size 14x14, chip tối giản không bg/border/padding. */
.mvb-chip.mvb-heart {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    width: auto !important;
    color: var(--madara-main-color, #eb3349);
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.mvb-chip.mvb-heart:hover {
    transform: scale(1.15);
}
.mvb-chip.mvb-heart:active { transform: scale(0.92); }
.mvb-chip.mvb-heart.mvb-active {
    color: var(--madara-main-color, #eb3349);
}
.mvb-chip.mvb-heart.mvb-loading {
    opacity: 0.5;
    pointer-events: none;
}

.mvb-heart-icon {
    width: 14px !important;
    height: 14px !important;
    display: block;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.8;
    transition: fill 0.2s ease;
}
/* v1.4.56: inline SVG path có attribute `fill="currentColor"` — attribute
   này thắng CSS `fill` áp lên parent SVG. Phải target trực tiếp `path`
   với !important để override inline attr. */
.mvb-chip.mvb-heart:not(.mvb-active) .mvb-heart-icon,
.mvb-chip.mvb-heart:not(.mvb-active) .mvb-heart-icon path {
    fill: transparent !important;
}
.mvb-chip.mvb-heart.mvb-active .mvb-heart-icon,
.mvb-chip.mvb-heart.mvb-active .mvb-heart-icon path {
    fill: currentColor !important;
}

.mvb-heart-wrap .mvb-count {
    font-size: 11px !important;
    color: #888 !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
    text-align: center;
    min-width: 8px;
}
.mvb-heart-wrap .mvb-count:empty { display: none !important; }
.mvb-count.mvb-bump { animation: mvbBump 250ms ease-out; }
@keyframes mvbBump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Hide legacy downvote button entirely (safety: if old markup lingers
   in cached HTML, hide it so user sees only the heart). */
.madara-vote-wrapper-v2 .mvb-down { display: none !important; }

/* Positioning per context: heart wrapper sits top-right of each
   comment-like card, sharing the visual row with the comment header. */

/* 1. Main chapter comment — Madara theme uses `.comment-body`.
   v1.5.48: REPLY moved into inline flow (below comment-content). Heart
   no longer needs to dodge REPLY at the top → heart now sits VERTICALLY
   CENTERED on the right edge of the comment body. */
.comment-body { position: relative; }
.comment-body .mvb-heart-wrap {
    position: absolute !important;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    z-index: 2;
}
li.comment > .comment-body .mvb-heart-wrap,
.comment > article.comment-body .mvb-heart-wrap {
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
}

/* 2. Inline comment (.ic-comment in inline-comments.js) */
.ic-comment { position: relative; }
.ic-comment .mvb-heart-wrap {
    position: absolute !important;
    top: 8px;
    right: 8px;
    z-index: 2;
}
/* Hide the legacy vote chip pair area inside .ic-comment-footer if it
   still exists with old class names */
.ic-comment-footer .madara-vote-wrapper-v2 {
    /* When wrapper is moved to absolute top-right, remove its space from footer */
}

/* 3. Quote group rep vote — was in .mq-group-meta */
.mq-group-card { position: relative; }
.mq-group-meta .mvb-heart-wrap,
.mq-group-vote .mvb-heart-wrap {
    /* Inside meta row — keep inline but push to right with margin-left:auto */
    margin-left: auto;
}
.mq-group-meta { display: flex; align-items: center; gap: 10px; }
.mq-group-vote { margin-left: auto; }

/* 4. Quote commentary vote */
.mq-commentary { position: relative; }
.mq-commentary-votes-wrap {
    position: absolute !important;
    top: 4px;
    right: 0;
    margin: 0 !important;
}
.mq-commentary-body { padding-right: 36px; }

@media (max-width: 480px) {
    .mvb-heart-icon { width: 14px !important; height: 14px !important; }
    .mvb-heart-wrap .mvb-count { font-size: 10px !important; }
    /* v1.5.48: heart center-vertical on mobile too. */
    .comment-body .mvb-heart-wrap {
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
    }
    .ic-comment .mvb-heart-wrap {
        top: 6px;
        right: 6px;
    }
}
