/**
 * Vote System Styles - Flame Design
 */

.vote-container {
    user-select: none;
}

.vote-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-width: 2px;
    font-weight: 600;
}

.vote-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.vote-btn:active {
    transform: scale(0.95);
}

/* Vote UP button (HOT) - Using flame colors */
.vote-btn.btn-success,
.vote-btn.btn-outline-success {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%) !important;
    border-color: #FF6B6B !important;
    color: #ffffff !important;
    min-width: 85px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
}

.vote-btn.btn-success:hover,
.vote-btn.btn-outline-success:hover {
    background: linear-gradient(135deg, #FF8E53 0%, #FF6B6B 100%) !important;
    border-color: #FF8E53 !important;
}

.vote-btn.btn-success.active,
.vote-btn.btn-outline-success.active {
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #E55555 0%, #E57E47 100%) !important;
}

/* Vote DOWN button (COLD) - Using cyan/blue colors */
.vote-btn.btn-danger,
.vote-btn.btn-outline-danger {
    background-color: transparent !important;
    border-color: #17a2b8 !important;
    color: #17a2b8 !important;
    min-width: 85px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
}

body[data-theme="dark"] .vote-btn.btn-danger,
body[data-theme="dark"] .vote-btn.btn-outline-danger {
    color: #17a2b8 !important;
    border-color: #17a2b8 !important;
}

body[data-theme="light"] .vote-btn.btn-danger,
body[data-theme="light"] .vote-btn.btn-outline-danger {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
}

.vote-btn.btn-danger:hover,
.vote-btn.btn-outline-danger:hover {
    background: linear-gradient(135deg, #17a2b8 0%, #0dcaf0 100%) !important;
    border-color: #17a2b8 !important;
    color: #ffffff !important;
}

.vote-btn.btn-danger.active,
.vote-btn.btn-outline-danger.active {
    box-shadow: 0 0 0 4px rgba(23, 162, 184, 0.3);
    background: linear-gradient(135deg, #138496 0%, #0bb5d1 100%) !important;
    color: #ffffff !important;
    border-color: #138496 !important;
}

/* Button text styling */
.vote-btn .vote-count {
    font-size: 0.75em;
    opacity: 0.9;
    font-weight: 600;
}

/* Vote score animation */
.vote-score {
    font-size: 1.2rem;
    min-width: 50px;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 700;
    color: var(--text-primary);
}

/* Color based on positive/negative score */
.vote-score.text-success {
    color: #FF6B6B !important;
}

.vote-score.text-info {
    color: #17a2b8 !important;
}

.vote-score.vote-updated {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

/* Vote messages */
.vote-message {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vote-message-success {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
}

.vote-message-error {
    background-color: #dc3545;
    color: white;
}

.vote-message.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Vertical layout */
.vote-container.flex-column {
    width: fit-content;
    gap: 0.5rem;
}

.vote-container.flex-column .vote-score {
    font-size: 1.5rem;
    padding: 0.5rem 0;
    font-weight: 700;
}

/* Horizontal layout */
.vote-container.flex-row {
    gap: 1rem;
    align-items: center;
    padding: 0.5rem;
}

/* Card container enhancement for vote system */
.card .vote-container {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius);
}

/* Vote container in site header */
.site-header .vote-container {
    background: transparent !important;
    padding: 0;
}

/* Vote button icons */
.vote-btn i {
    font-size: 1.2em;
}

.vote-btn-lg i {
    font-size: 1.4em;
}

/* Button text spacing */
.vote-btn .ms-1 {
    font-weight: 600;
}

/* Disabled state */
.vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.vote-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Loading state */
.vote-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.vote-btn.loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 3px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Theme support */
body[data-theme="dark"] .vote-score {
    color: #ffffff;
}

body[data-theme="light"] .vote-score {
    color: #1a1a1a;
}

/* Responsive */
@media (max-width: 576px) {
    .vote-btn {
        font-size: 1.1em;
        padding: 0.5rem 0.75rem;
        min-width: 75px;
    }

    .vote-score {
        font-size: 1rem;
        min-width: 40px;
    }

    .vote-container.flex-row {
        gap: 0.5rem;
        padding: 0.25rem;
    }
}

@media (max-width: 380px) {
    .vote-btn {
        min-width: 60px;
        font-size: 1em;
        padding: 0.4rem 0.5rem;
    }

    /* Hide vote count numbers on very small screens */
    .vote-btn .vote-count {
        display: none;
    }

    .vote-container.flex-row {
        gap: 0.25rem;
    }

    .vote-score {
        font-size: 0.9rem;
        min-width: 35px;
    }
}

/* ==================================================
   COMPACT VOTE SYSTEM FOR HOME PAGE
   ================================================== */

.vote-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.35rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 0.7rem;
    line-height: 1;
    user-select: none;
    margin-left: auto;
    margin-right: 8px;
    flex-shrink: 0;
}

body[data-theme="dark"] .vote-compact {
    background: rgba(255, 255, 255, 0.08);
}

.vote-compact-btn {
    background: transparent;
    border: none;
    padding: 0.1rem 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.7rem;
    color: inherit;
    opacity: 0.7;
}

.vote-compact-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.vote-compact-btn:active {
    transform: scale(0.95);
}

.vote-compact-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Hot button (upvote) */
.vote-compact-hot {
    color: #FF6B6B;
}

.vote-compact-hot:hover {
    background: rgba(255, 107, 107, 0.15);
}

.vote-compact-hot.active {
    background: rgba(255, 107, 107, 0.25);
    opacity: 1;
    font-weight: 600;
}

/* Cold button (downvote) */
.vote-compact-cold {
    color: #17a2b8;
}

.vote-compact-cold:hover {
    background: rgba(23, 162, 184, 0.15);
}

.vote-compact-cold.active {
    background: rgba(23, 162, 184, 0.25);
    opacity: 1;
    font-weight: 600;
}

/* Score display */
.vote-compact-score {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    color: inherit;
    opacity: 0.85;
}

/* Vote counts inside buttons */
.vote-compact-btn span {
    font-weight: 500;
}

/* Animation for updated scores */
.vote-compact .vote-updated {
    animation: compactPulse 0.4s ease;
}

@keyframes compactPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Prevent click-through on vote compact */
.vote-compact {
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.vote-compact * {
    pointer-events: auto;
}

/* Ensure clicks on vote compact don't trigger parent link */
a .vote-compact {
    pointer-events: all;
}

/* Make vote compact stand out slightly on hover */
.site-ultra-item:hover .vote-compact {
    background: rgba(0, 0, 0, 0.08);
}

body[data-theme="dark"] .site-ultra-item:hover .vote-compact {
    background: rgba(255, 255, 255, 0.12);
}

/* Responsive adjustments for very small screens */
@media (max-width: 380px) {
    .vote-compact {
        font-size: 0.65rem;
        gap: 0.2rem;
        padding: 0.1rem 0.25rem;
    }

    .vote-compact-btn {
        font-size: 0.65rem;
        padding: 0.05rem 0.2rem;
    }

    .vote-compact-score {
        font-size: 0.65rem;
        min-width: 18px;
    }
}
