/* ============================================
   KiwiClub Sweden — Community Styles
   ============================================ */

/* --- Community Header --- */
.community-header {
    padding: 120px 0 40px;
    text-align: center;
    background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary));
    border-bottom: 1px solid var(--border-subtle);
}

.community-header h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.community-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* --- Community Layout --- */
.community-layout {
    padding: 32px 0 80px;
}

.community-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}

/* --- Sidebar --- */
.community-sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.sidebar-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.category-item:hover {
    background: rgba(0, 214, 143, 0.05);
    color: var(--text-primary);
}

.category-item.active {
    background: rgba(0, 214, 143, 0.1);
    color: var(--aurora-green);
    font-weight: 500;
}

.cat-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-link {
    display: block;
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: var(--aurora-green);
}

.sidebar-cta {
    background: linear-gradient(135deg, rgba(0, 214, 143, 0.08), rgba(10, 186, 181, 0.08));
    border-color: var(--border-glow);
}

.sidebar-cta p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.85rem;
}

/* --- Feed Toolbar --- */
.feed-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.feed-filters {
    display: flex;
    gap: 4px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--aurora-green);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(0, 214, 143, 0.1);
    border-color: var(--aurora-green);
    color: var(--aurora-green);
}

.feed-sort select {
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
}

/* --- New Post Button --- */
.new-post-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.3s;
    text-align: left;
    font-family: var(--font-body);
    position: relative;
}

.new-post-btn:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.new-post-avatar {
    font-size: 1.8rem;
}

.new-post-text {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.new-post-actions {
    display: flex;
    gap: 8px;
}

.post-type-hint {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    color: var(--text-muted);
}

/* --- Search --- */
.feed-search {
    margin-bottom: 20px;
}

.feed-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

.feed-search input:focus {
    border-color: var(--aurora-green);
}

.feed-search input::placeholder {
    color: var(--text-muted);
}

/* --- Post Cards --- */
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
}

.post-card:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
    transform: translateX(3px);
}

.post-card.pinned {
    border-left: 3px solid var(--gold);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-meta .author {
    font-weight: 600;
    color: var(--text-secondary);
}

.post-meta .dot {
    width: 3px;
    height: 3px;
    background: var(--text-muted);
    border-radius: 50%;
}

.post-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.post-type-badge.question {
    background: rgba(0, 214, 143, 0.1);
    color: var(--aurora-green);
}

.post-type-badge.story {
    background: rgba(229, 168, 75, 0.1);
    color: var(--gold);
}

.post-type-badge.discussion {
    background: rgba(0, 106, 167, 0.15);
    color: var(--swedish-blue);
}

.post-solved {
    background: rgba(0, 214, 143, 0.15);
    color: var(--aurora-green);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.post-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
}

.post-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.post-category-tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--bg-primary);
    border-radius: 6px;
    color: var(--text-muted);
}

/* --- Loading & Empty States --- */
.loading-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--aurora-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.load-more-btn {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
}

.load-more-btn:hover {
    border-color: var(--aurora-green);
    color: var(--aurora-green);
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--ease-smooth);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.modal-sm {
    max-width: 440px;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--aurora-green);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* --- Post Type Selector --- */
.post-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.type-option input {
    display: none;
}

.type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.type-option input:checked+.type-card {
    border-color: var(--aurora-green);
    background: rgba(0, 214, 143, 0.08);
}

.type-card:hover {
    border-color: var(--aurora-green);
}

.type-icon {
    font-size: 1.5rem;
}

.type-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.type-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- Auth Switch --- */
.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--aurora-green);
    font-weight: 600;
}

/* --- View Post --- */
.view-post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.view-post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.view-post-author-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.view-post-author-info .details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.view-post-content {
    line-height: 1.8;
    font-size: 1rem;
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.view-post-actions {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--aurora-green);
    color: var(--aurora-green);
}

.action-btn.active {
    background: rgba(0, 214, 143, 0.1);
    border-color: var(--aurora-green);
    color: var(--aurora-green);
}

/* --- Comment List --- */
.comments-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.comment-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: 4px;
}

.comment-answer {
    border-left: 3px solid var(--aurora-green);
    padding-left: 12px;
    background: rgba(0, 214, 143, 0.02);
}

.comment-form {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.comment-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    border-radius: 8px;
    outline: none;
    resize: none;
    min-height: 60px;
    transition: border-color 0.3s;
}

.comment-form textarea:focus {
    border-color: var(--aurora-green);
}

.comment-form button {
    align-self: flex-end;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .community-grid {
        grid-template-columns: 1fr;
    }

    .community-sidebar {
        position: static;
    }

    .post-type-selector {
        grid-template-columns: 1fr;
    }

    .new-post-actions {
        display: none;
    }

    .feed-toolbar {
        flex-direction: column;
    }

    .feed-filters {
        overflow-x: auto;
        width: 100%;
        padding-bottom: 4px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        margin: 10px;
    }
}