/* ============================================
   Forum Styles - Compact High-Density Layout
   ============================================ */

.forum-section {
    padding: 5rem 0 2rem; /* Top padding for fixed navbar (~80px) */
}

/* Forum Header */
.forum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.forum-header h1 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--heading-color, #fff);
}

.forum-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.forum-search {
    width: 180px;
}

.forum-search-input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 4px;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    color: var(--text-color, #fff);
    font-size: 0.8rem;
}

.forum-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #00d4ff);
}

.forum-search-input::placeholder {
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

/* Buttons */
.btn-primary {
    padding: 0.5rem 1rem;
    background: var(--primary-gradient, linear-gradient(135deg, #00d4ff 0%, #00ff88 100%));
    border: none;
    border-radius: 4px;
    color: #000;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.btn-primary.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    border-radius: 4px;
    color: var(--text-color, #fff);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color, #00d4ff);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.5rem 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text-color, #fff);
}

/* Forum Tabs */
.forum-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    margin-bottom: 0.75rem;
}

.forum-tab {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.forum-tab:hover {
    color: var(--text-color, #fff);
}

.forum-tab.active {
    color: var(--primary-color, #00d4ff);
    border-bottom-color: var(--primary-color, #00d4ff);
}

.tab-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    font-size: 0.7rem;
    border-radius: 10px;
    margin-left: 0.25rem;
}

.tab-content {
    min-height: 200px;
}

/* Categories Grid - Compact */
.forum-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.forum-category-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
}

.forum-category-compact:hover {
    background: var(--card-hover-bg, rgba(255, 255, 255, 0.08));
    border-color: var(--primary-color, #00d4ff);
}

.forum-category-compact.selected {
    border-color: var(--primary-color, #00d4ff);
    background: rgba(0, 212, 255, 0.1);
}

.cat-icon {
    font-size: 1rem;
}

.cat-name {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color, #fff);
}

.cat-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color, #00d4ff);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* Topics List - Compact */
.topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.topic-item:hover {
    background: var(--card-hover-bg, rgba(255, 255, 255, 0.06));
    border-color: var(--primary-color, #00d4ff);
}

.topic-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-gradient, linear-gradient(135deg, #00d4ff 0%, #00ff88 100%));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #000;
    flex-shrink: 0;
}

.topic-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

.topic-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--heading-color, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-meta {
    font-size: 0.7rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.topic-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    flex-shrink: 0;
}

/* Badges */
.topic-badge {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    margin-right: 0.35rem;
}

.topic-badge.pinned {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.topic-badge.locked {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.topic-badge.pending {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

.topic-badge.approved {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.topic-badge.rejected {
    background: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
}

.topic-category {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    font-size: 0.65rem;
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary-color, #00d4ff);
    border-radius: 3px;
}

/* Placeholders */
.topic-placeholder,
.topic-placeholder-compact {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    font-size: 0.85rem;
}

.topic-placeholder-compact {
    padding: 1.5rem 1rem;
}

.topic-placeholder a {
    color: var(--primary-color, #00d4ff);
}

/* My Posts Summary */
.my-posts-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border-radius: 4px;
    font-size: 0.75rem;
}

.status-pill.pending {
    border-left: 3px solid #ff9800;
}

.status-pill.approved {
    border-left: 3px solid #00ff88;
}

.status-pill.rejected {
    border-left: 3px solid #ff4d4d;
}

.status-pill .count {
    font-weight: 600;
    color: var(--text-color, #fff);
}

.status-pill .label {
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
}

/* My Post Item */
.my-post-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.my-post-item .post-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    width: 40px;
}

.my-post-item .post-title {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-color, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-post-item .post-date {
    font-size: 0.7rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

.my-post-item .edit-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--primary-color, #00ff88);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.my-post-item .edit-btn:hover {
    background: rgba(0, 255, 136, 0.25);
    border-color: rgba(0, 255, 136, 0.5);
}

/* New Topic Form - Compact */
.new-topic-form {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 6px;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.form-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--heading-color, #fff);
}

.form-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-row input {
    flex: 1;
}

.form-row select {
    width: 120px;
}

.form-row input,
.form-row select,
.new-topic-form textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color, #fff);
    font-size: 0.85rem;
    font-family: inherit;
}

.new-topic-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 80px;
}

.form-row input:focus,
.form-row select:focus,
.new-topic-form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #00d4ff);
}

.form-row select option {
    background: #1a1a2e;
    color: #fff;
}

.form-actions-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.form-hint {
    font-size: 0.7rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.4));
}

/* Forum Message Toast */
#forum-message {
    position: fixed;
    top: 70px;
    right: 20px;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    z-index: 1000;
    max-width: 350px;
    font-size: 0.85rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   Topic View
   ============================================ */

.topic-view {
    margin-top: 0.5rem;
}

.topic-detail {
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.topic-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.topic-detail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient, linear-gradient(135deg, #00d4ff 0%, #00ff88 100%));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: #000;
    flex-shrink: 0;
}

.topic-detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.topic-detail-info {
    flex: 1;
    min-width: 0;
}

.topic-detail-title {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-color, #fff);
}

.topic-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

.topic-detail-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-color, #fff);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.topic-detail-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    font-size: 0.75rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

/* Replies Section */
.replies-section {
    margin-top: 1rem;
}

.replies-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--heading-color, #fff);
    margin: 0 0 0.75rem 0;
}

.replies-header span {
    font-weight: 400;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reply-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 4px;
}

.reply-item.solution {
    border-color: rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.05);
}

.reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient, linear-gradient(135deg, #00d4ff 0%, #00ff88 100%));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #000;
    flex-shrink: 0;
}

.reply-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.reply-body {
    flex: 1;
    min-width: 0;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.reply-author {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color, #fff);
}

.reply-date {
    font-size: 0.7rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
}

.reply-content {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-color, #fff);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.solution-badge {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

/* Reply Form */
.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 6px;
}

.reply-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color, #fff);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.reply-form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #00d4ff);
}

.reply-form-locked {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    font-size: 0.85rem;
}

.no-replies {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .forum-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .forum-actions {
        width: 100%;
    }

    .forum-search {
        flex: 1;
        width: auto;
    }

    .forum-categories-grid {
        flex-direction: column;
    }

    .forum-category-compact {
        min-width: 100%;
    }

    .topic-item {
        flex-wrap: wrap;
    }

    .topic-stats {
        width: 100%;
        margin-top: 0.25rem;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row select {
        width: 100%;
    }

    .my-posts-summary {
        flex-wrap: wrap;
    }
}
