:root {
    --vote-up-color: #28a745;
    --vote-down-color: #dc3545;
    --best-answer-bg: #f0fdf4;
    --best-answer-border: #86efac;
}

[data-bs-theme="dark"] {
    --best-answer-bg: #0a2e1a;
    --best-answer-border: #166534;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
}

.vote-btn {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.vote-btn:hover { opacity: 0.7; }
.vote-btn.voted-up { color: var(--vote-up-color); }
.vote-btn.voted-down { color: var(--vote-down-color); }
.vote-count { font-weight: 700; font-size: 1.1rem; }

.answer-best {
    background-color: var(--best-answer-bg);
    border: 2px solid var(--best-answer-border);
    border-radius: 0.5rem;
    padding: 1rem;
    position: relative;
}
.answer-best::before {
    content: "\F26A";
    font-family: "bootstrap-icons";
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--best-answer-border);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.question-stats {
    display: flex;
    gap: .5rem;
    color: #6c757d;
    font-size: 0.5rem;
    flex-direction: column;
}
.question-stats > div {
    text-align: center;
    padding: 0.35rem 0.25rem;
    border-radius: 0.375rem;
    background: #f8f9fa;
}
[data-bs-theme="dark"] .question-stats > div {
    background: #1a1d20;
}
.question-stats .stat-number {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    color: #212529;
}
[data-bs-theme="dark"] .question-stats .stat-number {
    color: #f8f9fa;
}
.question-stats .stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

.question-card {
    transition: box-shadow 0.15s;
}
.question-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
[data-bs-theme="dark"] .question-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-width-0 {
    min-width: 0;
}

.tag-badge {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    margin: 0.1rem;
    text-decoration: none;
}
.tag-badge:hover {
    background: #dee2e6;
    color: #212529;
}
[data-bs-theme="dark"] .tag-badge {
    background: #2d3748;
    color: #a0aec0;
}
[data-bs-theme="dark"] .tag-badge:hover {
    background: #4a5568;
    color: #e2e8f0;
}

.user-card {
    text-align: center;
    padding: 1rem;
}
.user-card .username {
    font-weight: 600;
    margin-top: 0.5rem;
}
.user-card .reputation {
    color: #6c757d;
    font-size: 0.85rem;
}

.reputation-badge {
    background: #ffc107;
    color: #212529;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.ql-editor {
    min-height: 180px;
}
.ql-editor .ql-code-block,
.ql-editor .ql-code-block-container {
    background: #f4f4f5;
    color: #24292e;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    margin: 0.5rem 0;
}
[data-bs-theme="dark"] .ql-editor .ql-code-block,
[data-bs-theme="dark"] .ql-editor .ql-code-block-container {
    background: #1e1e2e;
    color: #cdd6f4;
}
.ql-editor p > .ql-code-block-container {
    display: inline;
    background: #f0f0f2;
    color: #d63384;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
}
[data-bs-theme="dark"] .ql-editor p > .ql-code-block-container {
    background: #313244;
    color: #f5c2e7;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
    opacity: 1;
}
.htmx-request.htmx-indicator {
    opacity: 1;
}

.rank-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.45rem;
    border-radius: 0.75rem;
    color: #fff;
    font-weight: 600;
    vertical-align: middle;
}

.paid-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.category-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
    min-height: 100px;
}
.category-card:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
[data-bs-theme="dark"] .category-card {
    background: #1a1d20;
    border-color: #374151;
}
[data-bs-theme="dark"] .category-card:hover {
    background: #2d3035;
    border-color: #4b5563;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.category-card .bi {
    color: #0d6efd;
}
[data-bs-theme="dark"] .category-card .bi {
    color: #60a5fa;
}

.sidebar-widget {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}
[data-bs-theme="dark"] .sidebar-widget {
    border-color: #374151;
}

.sidebar-widget h6 {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
    .question-stats {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
        min-width: auto;
    }
    .question-stats > div {
        min-width: 48px;
        padding: 0.25rem;
    }
    .question-stats .stat-number {
        font-size: 0.95rem;
    }
    .question-stats .stat-label {
        font-size: 0.55rem;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin { animation: spin 0.8s linear infinite; }
