/**
 * Forum Vote Component
 *
 * Vertical vote widget: up button, score, down button. Used in topic body
 * vote-col and reply body vote-col. Supports active states and score coloring.
 *
 * Template: templates/parts/vote-buttons.php
 *
 * Structure:
 *   .forum-vote
 *     button.forum-vote__btn.forum-vote__btn--up (.forum-vote__btn--active)
 *     span.forum-vote__score (.forum-vote__score--positive, --negative)
 *     button.forum-vote__btn.forum-vote__btn--down (.forum-vote__btn--active)
 *
 * Alpine.js uses :class="{ 'forum-vote__btn--active': userVote === 1 }"
 *
 * @package PC_Kompas_Forum
 */

/* ============================================================================
   VOTE CONTAINER
   ============================================================================ */

.forum-vote {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* ============================================================================
   VOTE BUTTONS
   ============================================================================ */

.forum-vote__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.forum-vote__btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.forum-vote__btn:hover {
    background: var(--bg-hover);
}

.forum-vote__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Directional hover hints */
.forum-vote__btn--up:hover {
    color: var(--accent);
}

.forum-vote__btn--down:hover {
    color: var(--error);
}

/* Active (voted) states — template uses .forum-vote__btn--active class */
.forum-vote__btn--up.forum-vote__btn--active {
    color: var(--accent);
    background: var(--accent-light);
}

.forum-vote__btn--down.forum-vote__btn--active {
    color: var(--error);
    background: var(--error-bg);
}

/* ============================================================================
   SCORE DISPLAY
   ============================================================================ */

.forum-vote__score {
    font-size: clamp(0.875rem, 1vw + 0.2rem, 1rem);
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1;
    min-width: 1.5em;
    text-align: center;
    user-select: none;
}

.forum-vote__score--positive {
    color: var(--success);
}

.forum-vote__score--negative {
    color: var(--error);
}

/* ============================================================================
   DISABLED STATE — own-post voting not allowed
   ============================================================================ */

.forum-vote--disabled .forum-vote__btn {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.forum-vote--disabled .forum-vote__score {
    opacity: 0.5;
}

/* ============================================================================
   ERROR TOOLTIP — positioned above the vote component
   ============================================================================ */

.forum-vote__error {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.4em 0.75em;
    background: var(--error);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: forum-vote-error-in 0.2s ease-out;
}

@keyframes forum-vote-error-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
