/* ==========================================
   FORUM PAGE STYLES
   ========================================== */

/* ── Micro badges (used in thread list meta) ── */
.thread-role-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.thread-role-admin {
    background: linear-gradient(160deg, #fbbf24 0%, #d97706 100%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--bevel-amber-edge), 0 2px 5px var(--bevel-amber-glow);
}

.thread-role-vip {
    background: linear-gradient(160deg, #a78bfa 0%, #7c3aed 100%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 #5b21b6, 0 2px 5px rgba(124, 58, 237, .45);
}

/* ── Compact user badges inside chat bubbles ── */
.ubadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
    flex-shrink: 0;
}

.ubadge--online {
    display: none;
}

.ubadge--admin {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0.15rem 0.45rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 1px 1px rgba(120, 53, 15, .35);
}

.ubadge--admin svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.ubadge--vip {
    background: #a855f7;
    color: white;
}

/* Badge container in chat (now tiny) */
.badge-container {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ── Legacy pill badges (kept for any other pages still using them) ── */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 0.375rem;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--bevel-amber-edge), 0 2px 5px var(--bevel-amber-glow);
}

.vip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    background: linear-gradient(135deg, #a855f7, #9333ea);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 0.375rem;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 #5b21b6, 0 2px 5px rgba(139, 92, 246, .4);
}

.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 0.375rem;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--bevel-green-edge), 0 2px 5px var(--bevel-green-glow);
}

.admin-badge svg,
.vip-badge svg,
.online-badge svg {
    width: 12px;
    height: 12px;
}

/* ==========================================
   FORUM HEADER
   ========================================== */
.forum-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
    gap: var(--space-lg);
}

.forum-header-content {
    flex: 1;
}

.forum-header-actions {
    flex-shrink: 0;
    display: flex;
    gap: var(--space-sm);
}

/* ==========================================
   CATEGORY LIST (compact rows)
   ========================================== */
.category-list {
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-xl);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 0 rgba(0, 0, 0, .05), 0 5px 0 rgba(0, 0, 0, .06), 0 16px 28px -10px rgba(0, 0, 0, .2);
}

.category-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.75rem var(--space-lg);
    border-bottom: 1px solid var(--color-gray-200);
    text-decoration: none;
    transition: background 0.12s;
    color: var(--text-primary);
}

.category-row:last-child {
    border-bottom: none;
}

.category-row:hover {
    background: var(--bg-secondary);
}

.category-row-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}

.category-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.category-row-name {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.category-row-desc {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-row-stats {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.category-row-dot {
    opacity: 0.5;
}

.category-row-arrow {
    color: var(--text-tertiary);
    flex-shrink: 0;
    opacity: 0.4;
}

.category-row:hover .category-row-arrow {
    opacity: 0.8;
    color: var(--color-primary);
}

/* ==========================================
   THREAD LIST
   ========================================== */
.thread-list {
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 0 rgba(0, 0, 0, .05), 0 5px 0 rgba(0, 0, 0, .06), 0 16px 28px -10px rgba(0, 0, 0, .2);
}

/* Make whole row a link */
a.thread-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-gray-200);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
    position: relative;
}

a.thread-item:last-child {
    border-bottom: none;
}

a.thread-item:hover {
    background: var(--bg-secondary);
}

a.thread-item:hover .thread-title {
    color: var(--color-primary);
}

/* Avatar with online dot */
.thread-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

.thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-gray-200);
    display: block;
}

.thread-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--bg-primary);
}

.thread-content {
    flex: 1;
    min-width: 0;
}

.thread-title-row {
    margin-bottom: 0.25rem;
}

.thread-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.12s;
}

.thread-pin-icon {
    margin-right: 0.2rem;
}

.thread-lock-icon {
    margin-left: 0.2rem;
    opacity: 0.5;
}

.thread-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: 0.4rem;
}

.thread-meta-sep {
    opacity: 0.4;
}

.thread-rubriek-tag {
    background: linear-gradient(180deg, #ffffff, var(--bg-secondary));
    border: 1px solid var(--color-gray-200);
    border-radius: 4px;
    padding: 0.05rem 0.4rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 0 rgba(0, 0, 0, .08);
}

.thread-author {
    color: var(--text-secondary);
    font-weight: 500;
}

.thread-stats {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.thread-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.thread-stat-last {
    margin-left: auto;
}

/* Unread state */
.thread-item.thread-unread {
    border-left: 3px solid var(--color-primary);
}

.thread-item.thread-unread .thread-title {
    font-weight: 700;
    color: var(--text-primary);
}

.unread-indicator {
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid white;
}

/* ==========================================
   THREAD HEADER CARD
   ========================================== */
.thread-header-card {
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 0 rgba(0, 0, 0, .05), 0 5px 0 rgba(0, 0, 0, .06), 0 16px 28px -10px rgba(0, 0, 0, .2);
}

.thread-header-meta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.thread-title-main {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.thread-header-stats {
    display: flex;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

/* ==========================================
   CHAT CONVERSATION
   ========================================== */
.chat-conversation {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    padding-bottom: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 0 rgba(0, 0, 0, .05), 0 5px 0 rgba(0, 0, 0, .06), 0 16px 28px -10px rgba(0, 0, 0, .2);
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
}

.chat-message--other {
    justify-content: flex-start;
}

.chat-message--self {
    justify-content: flex-end;
}

.chat-avatar-link {
    flex-shrink: 0;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-gray-200);
    flex-shrink: 0;
    display: block;
}

.chat-avatar--input {
    flex-shrink: 0;
}

/* Avatar wrapper with online dot */
.chat-avatar-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    line-height: 0;
}

.chat-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #10b981;
    border: 2.5px solid var(--bg-primary);
    display: block;
}

.chat-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: min(75%, 640px);
}

.chat-message--self .chat-bubble-wrap {
    align-items: flex-end;
}

.chat-message--other .chat-bubble-wrap {
    align-items: flex-start;
}

/* Username row — now lives INSIDE the bubble at the top */
.chat-username-row {
    display: none;
}

/* hidden — name rendered inside bubble */
.chat-username-row--self {
    display: none;
}

.chat-username {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.2rem;
}

/* Inside-bubble name for other's messages */
.chat-bubble .chat-bubble-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.25rem;
}

/* Self bubble: name in white/translucent */
.chat-bubble--self .chat-bubble-sender {
    color: rgba(255, 255, 255, 0.75);
}

/* Bubbles */
.chat-bubble {
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 18px 18px 18px 4px;
    padding: 0.55rem 0.9rem;
    word-break: break-word;
    border: 1px solid var(--color-gray-200);
}

.chat-bubble--self {
    background: var(--color-primary);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    border-color: transparent;
}

.chat-bubble--op {
    padding: 0.7rem 1rem;
}

.chat-bubble--unread {
    border-color: var(--color-success, #10b981);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

/* Sender name + badges inside the bubble */
.chat-bubble-header {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.chat-bubble-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.chat-bubble--self .chat-bubble-sender {
    color: rgba(255, 255, 255, 0.8);
}

.chat-bubble-content {
    font-size: var(--text-base);
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-bubble--self .chat-bubble-content a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.chat-edited {
    font-size: 0.68rem;
    opacity: 0.6;
    margin-top: 0.25rem;
    font-style: italic;
}

.chat-time {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-time--self {
    justify-content: flex-end;
}

.chat-actions {
    display: inline-flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.chat-message:hover .chat-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.15rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.chat-action-btn:hover {
    color: var(--text-primary);
}

.chat-action-btn--delete:hover {
    color: var(--color-error, #ef4444);
}

.chat-new-badge {
    background: var(--color-success, #10b981);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 9999px;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 1px 0 var(--bevel-green-edge), 0 2px 4px var(--bevel-green-glow);
}

.chat-message--unread .chat-bubble {
    border-color: var(--color-success, #10b981);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.chat-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    padding: var(--space-xs) 0;
}

.chat-divider::before,
.chat-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-gray-200);
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-2xl);
    color: var(--text-tertiary);
    text-align: center;
}

.chat-locked-notice {
    text-align: center;
    padding: var(--space-md);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    border-top: 1px solid var(--color-gray-200);
    margin-top: var(--space-sm);
}

/* Input */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    border-top: 1px solid var(--color-gray-200);
    margin-top: var(--space-sm);
    position: sticky;
    bottom: 0;
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    z-index: 10;
}

.chat-input-form {
    flex: 1;
}

.chat-input-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-secondary, #f3f4f6);
    border: 2px solid var(--color-gray-200);
    position: relative;
    border-radius: 24px;
    padding: 0.4rem 0.4rem 0.4rem 0.75rem;
    transition: border-color 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .05);
}

.chat-input-box:focus-within {
    border-color: var(--color-primary);
}

.chat-textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    font-size: var(--text-base);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 0.3rem 0;
    max-height: 200px;
    overflow-y: auto;
    font-family: inherit;
}

.chat-textarea::placeholder {
    color: var(--text-tertiary);
}

.chat-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(160deg, var(--color-primary-light) 0%, var(--color-primary) 55%, var(--color-primary-dark) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 3px 0 var(--bevel-primary-edge), 0 4px 10px var(--bevel-primary-glow);
    transition: transform .15s ease, box-shadow .15s ease;
}

.chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 5px 0 var(--bevel-primary-edge), 0 6px 14px var(--bevel-primary-glow);
}

.chat-send-btn:active {
    transform: translateY(2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 var(--bevel-primary-edge), 0 2px 6px rgba(0, 0, 0, .18);
}

/* ==========================================
   SUBSCRIPTION BAR
   ========================================== */
.chat-subscribe-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    background: var(--bg-secondary);
    border: 1px dashed var(--color-gray-300, #d1d5db);
    border-radius: var(--radius-lg);
    margin: 0.4rem 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.chat-subscribe-bar svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.chat-subscribe-bar span {
    flex: 1;
    min-width: 0;
}

.chat-subscribe-bar--active {
    background: rgba(249, 115, 22, 0.06);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.chat-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    --bevel-light: #fb923c;
    --bevel-base: #f97316;
    --bevel-dark: #ea580c;
    --bevel-edge: var(--bevel-primary-edge);
    --bevel-glow: var(--bevel-primary-glow);
    background: linear-gradient(160deg, var(--bevel-light) 0%, var(--bevel-base) 55%, var(--bevel-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--bevel-edge), 0 2px 6px var(--bevel-glow);
    transition: transform .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}

.chat-subscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 3px 0 var(--bevel-edge), 0 3px 8px var(--bevel-glow);
}

.chat-subscribe-btn:active {
    transform: translateY(2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 var(--bevel-edge), 0 2px 6px rgba(0, 0, 0, .16);
}

.chat-subscribe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-subscribe-btn--active {
    --bevel-light: #cbd5e1;
    --bevel-base: #94a3b8;
    --bevel-dark: #64748b;
    --bevel-edge: var(--bevel-gray-edge);
    --bevel-glow: var(--bevel-gray-glow);
    color: #fff;
}

.chat-subscribe-btn--active:hover {
    background: linear-gradient(160deg, var(--bevel-light) 0%, var(--bevel-base) 55%, var(--bevel-dark) 100%);
}

/* ==========================================
   EMOJI BUTTON + PICKER
   ========================================== */
.chat-emoji-btn {
    background: linear-gradient(180deg, #ffffff, #f3f4f6);
    border: 1px solid var(--color-gray-200);
    cursor: pointer;
    padding: 0.3rem;
    color: var(--text-tertiary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 0 rgba(0, 0, 0, .08);
    transition: color 0.15s, transform .1s ease, box-shadow .1s ease;
    flex-shrink: 0;
}

.chat-emoji-btn:hover {
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 2px 0 rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .08);
}

.chat-emoji-btn:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 rgba(0, 0, 0, 0);
}

.emoji-picker {
    background: var(--bg-primary);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.13);
    margin: 0 0 0.4rem 0;
    overflow: hidden;
    z-index: 100;
}

.emoji-picker-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--color-gray-200);
    background: var(--bg-secondary);
}

.emoji-categories {
    display: flex;
    gap: 0.15rem;
}

.emoji-cat-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.25rem;
    border-radius: var(--radius-md);
    line-height: 1;
    opacity: 0.55;
    transition: background 0.1s, opacity 0.1s;
}

.emoji-cat-btn:hover {
    background: var(--color-gray-100, #f3f4f6);
    opacity: 1;
}

.emoji-cat-btn.active {
    background: rgba(249, 115, 22, 0.1);
    opacity: 1;
}

.emoji-search {
    flex: 1;
    min-width: 60px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-full);
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
}

.emoji-search:focus {
    border-color: var(--color-primary);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    padding: 0.35rem;
    max-height: 190px;
    overflow-y: auto;
}

.emoji-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.2rem;
    border-radius: var(--radius-md);
    line-height: 1;
    text-align: center;
    transition: background 0.1s, transform 0.1s;
}

.emoji-item:hover {
    background: rgba(249, 115, 22, 0.1);
    transform: scale(1.2);
}

/* ==========================================
   LINK HIGHLIGHTING
   ========================================== */
.chat-link {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: rgba(249, 115, 22, 0.35);
    word-break: break-all;
}

.chat-link:hover {
    color: var(--color-primary-dark);
    text-decoration-color: var(--color-primary-dark);
}

.chat-bubble--self .chat-link {
    color: rgba(255, 255, 255, 0.92);
    text-decoration-color: rgba(255, 255, 255, 0.45);
}

.chat-bubble--self .chat-link:hover {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, 0.85);
}

/* ==========================================
   MOBILE
   ========================================== */
@media (max-width: 768px) {
    .forum-header {
        flex-direction: column;
        align-items: stretch;
    }

    .forum-header-actions {
        flex-direction: column;
    }

    .forum-header-actions .btn {
        width: 100%;
    }

    .category-row-desc {
        display: none;
    }

    .category-row-stats {
        display: none;
    }

    .thread-stat-last {
        display: none;
    }

    .chat-bubble-wrap {
        max-width: 88%;
    }

    .thread-title-main {
        font-size: var(--text-xl);
    }
}

@media (max-width: 480px) {

    .thread-header-card,
    .chat-conversation {
        padding: var(--space-md);
    }

    .chat-bubble-wrap {
        max-width: 94%;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .category-row {
        padding: 0.6rem var(--space-md);
    }

    a.thread-item {
        padding: var(--space-sm) var(--space-md);
    }
}

/* ==========================================
   FORUM RICH EDITOR & SPECIAL TAGS
   ========================================== */

/* ── Rich contenteditable editor ── */
.forum-editor-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.forum-editor {
    flex: 1;
    min-width: 0;
    min-height: 1.5em;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    font-size: var(--text-base, 0.9375rem);
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-primary, #111827);
    padding: 0.3rem 0;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Placeholder via data attribute */
.forum-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-tertiary, #9ca3af);
    pointer-events: none;
}

/* Chips sit inline with text — no extra margin */
.forum-chip {
    display: inline-flex;
    vertical-align: middle;
    cursor: default;
    user-select: none;
    margin: 0 2px;
}

/* ── Modals ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: forumFadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes forumFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: forumSlideUp 0.25s ease;
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 700px !important;
}

@keyframes forumSlideUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-gray-900, #111827);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-gray-500, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.4rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: var(--color-gray-100, #f3f4f6);
    color: var(--color-gray-900, #111827);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
}

.modal-content {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--color-gray-100, #f3f4f6);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ── Game picker styles ── */
.game-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--color-gray-200, #e5e7eb);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 16px;
    box-sizing: border-box;
    background: var(--color-gray-50, #f9fafb);
    transition: border-color 0.15s;
}

.game-search-input:focus {
    border-color: var(--color-primary, #f97316);
    background: #fff;
}

.game-picker-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    max-height: 52vh;
    overflow-y: auto;
    padding: 2px 2px 4px;
}

.game-picker-item {
    border: 2px solid var(--color-gray-200, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 0 rgba(0, 0, 0, .05), 0 3px 0 rgba(0, 0, 0, .06);
}

.game-picker-item:hover {
    border-color: var(--color-primary, #f97316);
    transform: translateY(-3px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 0 rgba(0, 0, 0, .05), 0 5px 0 rgba(0, 0, 0, .08), 0 12px 20px -6px rgba(249, 115, 22, .25);
}

.game-picker-item.selected {
    border-color: var(--color-primary, #f97316);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.gpi-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    aspect-ratio: 1;
}

.gpi-info {
    padding: 8px 10px;
    font-size: 12px;
    border-top: 1px solid var(--color-gray-100, #f3f4f6);
    background: var(--color-gray-50, #f9fafb);
}

.gpi-players {
    font-weight: 600;
    color: var(--color-gray-800, #1f2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.gpi-result {
    color: var(--color-gray-500, #6b7280);
    font-size: 11px;
}

.gpi-id {
    color: var(--color-gray-400, #9ca3af);
    font-size: 10px;
    margin-top: 1px;
}

.game-picker-loading,
.game-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--color-gray-400, #9ca3af);
    font-size: 14px;
}

/* Chess board squares */
.gp-square {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(6px, 1.8vw, 14px);
    line-height: 1;
}

.gp-square.light {
    background: #f0d9b5;
}

.gp-square.dark {
    background: #b58863;
}

.gp-piece img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    pointer-events: none;
}

/* ── Game tag ── */
.forum-game-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5986 100%);
    color: #fff;
    border-radius: 8px;
    padding: 3px 10px 3px 6px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    vertical-align: middle;
    transition: opacity .15s, box-shadow .15s;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 0 rgba(0, 0, 0, .3), 0 3px 8px rgba(0, 0, 0, .18);
    pointer-events: all;
}

.forum-game-tag:hover {
    opacity: .85;
}

.forum-game-tag-logo img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: block;
}

.forum-game-tag-text {
    line-height: 1.2;
}

.forum-game-tag-text strong {
    font-weight: 700;
}

/* ── Forum thread tag ── */
.forum-thread-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
    color: #fff;
    border-radius: 8px;
    padding: 3px 10px 3px 7px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    vertical-align: middle;
    transition: opacity .15s, box-shadow .15s;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 0 rgba(2, 44, 56, .45), 0 3px 8px rgba(0, 0, 0, .16);
    pointer-events: all;
}

.forum-thread-tag:hover {
    opacity: .85;
}

/* ── Category/rubriek tag ── */
.forum-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    border-radius: 8px;
    padding: 3px 10px 3px 7px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    vertical-align: middle;
    transition: opacity .15s, box-shadow .15s;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 0 rgba(76, 29, 149, .5), 0 3px 8px rgba(0, 0, 0, .16);
    pointer-events: all;
}

.forum-cat-tag:hover {
    opacity: .85;
}

/* shared tag pieces */
.forum-tag-icon {
    font-size: .9em;
    opacity: .9;
}

.forum-tag-label {
    font-weight: 600;
}

.forum-tag-arrow {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: .7;
}

/* ── URL links ── */
.forum-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    pointer-events: all;
    cursor: pointer;
    border-radius: 3px;
    padding: 0 2px;
    transition: background .12s;
}

.forum-link--internal {
    color: var(--color-secondary, #0891b2);
}

.forum-link--internal:hover {
    background: rgba(8, 145, 178, .08);
}

.forum-link--external {
    color: var(--color-primary, #f97316);
}

.forum-link--external:hover {
    background: rgba(249, 115, 22, .08);
}

.forum-link-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.forum-link-ext-badge {
    font-size: .7em;
    opacity: .7;
    font-weight: 700;
}

/* ── Autocomplete dropdown ── */
.forum-autocomplete {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
    overflow: hidden;
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
}

.forum-ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid #f3f4f6;
}

.forum-ac-item:last-child {
    border-bottom: none;
}

.forum-ac-item:hover,
.forum-ac-item--active {
    background: #f3f4f6;
}

.forum-ac-icon {
    font-size: 1.1em;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.forum-ac-label {
    font-weight: 600;
    font-size: .9rem;
    color: #111827;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-ac-sub {
    font-size: .78rem;
    color: #6b7280;
    flex-shrink: 0;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Game picker button ── */
.forum-game-btn {
    color: #2d5986 !important;
}

.forum-game-btn:hover {
    color: #1e3a5f !important;
}