/* ============================================
   COMMUNITY — Clean, Professional
   ============================================ */

/* Layout */
.community-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 32px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start
}

/* Inline SVG icons */
.community-wrapper svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0
}

.cat-tab svg,
.sort-btn svg,
.sidebar-card h3 svg {
    opacity: 0.7
}

.cat-tab.active svg {
    opacity: 1
}

/* Cover */
.community-cover {
    grid-column: 1/-1;
    background: #1e293b;
    border-radius: 12px;
    padding: 32px 28px;
    display: flex;
    align-items: center;
    gap: 20px
}

.community-cover * {
    position: relative;
    z-index: 1
}

.cover-avatar {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0
}

.cover-info h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px
}

.cover-info p {
    color: #94a3b8;
    font-size: 13px;
    margin: 0 0 8px
}

.cover-stats {
    display: flex;
    gap: 16px
}

.cover-stat {
    text-align: center
}

.cover-stat .num {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff
}

.cover-stat .lbl {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px
}

/* Composer */
.post-composer {
    background: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    transition: border-color .2s
}

.post-composer:hover {
    border-color: #2563eb
}

.composer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0
}

.composer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.composer-input {
    flex: 1;
    padding: 8px 14px;
    background: #f3f4f6;
    border-radius: 6px;
    color: #555;
    font-size: 13px
}

.composer-actions {
    display: flex;
    gap: 4px
}

.composer-actions button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background .15s
}

.composer-actions button:hover {
    background: #f3f4f6
}

/* Category Tabs */
.cat-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch
}

.cat-tabs::-webkit-scrollbar {
    display: none
}

.cat-tab {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #555
}

.cat-tab:hover {
    border-color: #2563eb;
    color: #2563eb
}

.cat-tab.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb
}

/* Sort Bar */
.sort-bar {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap
}

.sort-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: #f3f4f6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #555;
    transition: all .15s
}

.sort-btn:hover {
    background: #e5e7eb
}

.sort-btn.active {
    background: #1e293b;
    color: #fff
}

.search-box {
    margin-left: auto;
    display: flex;
    gap: 4px
}

.search-box input {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    width: 160px;
    transition: border .15s
}

.search-box input:focus {
    outline: none;
    border-color: #2563eb
}

.search-box button {
    padding: 6px 10px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px
}

/* Post Card */
.post-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 14px;
    overflow: hidden;
    transition: border-color .2s
}

.post-card:hover {
    border-color: #d1d5db
}

.post-card.pinned {
    border-left: 3px solid #2563eb
}

.post-card.featured {
    border-left: 3px solid #d97706
}

.pc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 0
}

.pc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    overflow: hidden;
    flex-shrink: 0
}

.pc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.pc-meta {
    flex: 1
}

.pc-author {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a
}

.pc-time {
    font-size: 12px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px
}

.pc-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap
}

.pc-pin {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eff6ff;
    color: #2563eb
}

.pc-body {
    padding: 10px 16px
}

.pc-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.4
}

.pc-title a {
    color: inherit;
    text-decoration: none
}

.pc-title a:hover {
    color: #2563eb
}

.pc-content {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 6px;
    word-break: break-word
}

.pc-content.truncated {
    max-height: 100px;
    overflow: hidden;
    position: relative
}

.pc-content.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: linear-gradient(transparent, #fff)
}

.pc-see-more {
    color: #2563eb;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-block;
    margin-bottom: 6px
}

/* Post Images */
.pc-images {
    display: grid;
    gap: 2px;
    margin: 6px 16px 0;
    border-radius: 8px;
    overflow: hidden
}

.pc-images.single {
    grid-template-columns: 1fr
}

.pc-images.double {
    grid-template-columns: 1fr 1fr
}

.pc-images.multi {
    grid-template-columns: 1fr 1fr
}

.pc-images img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    cursor: pointer
}

.pc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 16px;
    margin-bottom: 6px
}

.pc-tag {
    font-size: 12px;
    color: #2563eb;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500
}

/* Reaction / Action Bar */
.pc-reactions-summary {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    font-size: 13px;
    color: #888;
    border-top: 1px solid #f3f4f6
}

.reaction-emojis {
    display: flex
}

.reaction-emojis span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin-right: -3px;
    background: #fff;
    border: 1px solid #e5e7eb
}

.pc-actions-bar {
    display: flex;
    border-top: 1px solid #f3f4f6;
    padding: 2px 6px
}

.pc-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border-radius: 6px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: all .15s;
    position: relative
}

.pc-action:hover {
    background: #f3f4f6;
    color: #1a1a1a
}

.pc-action.reacted {
    color: #2563eb
}

/* Reaction Picker */
.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) scale(.85);
    opacity: 0;
    pointer-events: none;
    background: #fff;
    border-radius: 24px;
    padding: 4px 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
    display: flex;
    gap: 2px;
    transition: all .2s;
    z-index: 100
}

.pc-action:hover .reaction-picker,
.reaction-picker.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto
}

.rp-emoji {
    font-size: 24px;
    cursor: pointer;
    padding: 3px;
    border-radius: 50%;
    transition: transform .15s
}

.rp-emoji:hover {
    transform: scale(1.2)
}

/* Quick Comment */
.pc-quick-comment {
    display: flex;
    gap: 6px;
    padding: 6px 14px 10px;
    align-items: center
}

.pc-quick-comment .qc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    overflow: hidden;
    flex-shrink: 0
}

.pc-quick-comment .qc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.pc-quick-comment input {
    flex: 1;
    padding: 6px 12px;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit
}

.pc-quick-comment input:focus {
    outline: none;
    background: #e5e7eb
}

.pc-quick-comment button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600
}

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

.sidebar-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    margin-bottom: 14px
}

.sidebar-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px
}

/* Platform Links */
.platform-links {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.platform-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
    border: 1px solid #e5e7eb
}

.platform-link:hover {
    background: #f9fafb
}

.platform-link .pl-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0
}

.platform-link .pl-info {
    flex: 1
}

.platform-link .pl-name {
    color: #1a1a1a;
    font-size: 13px
}

.platform-link .pl-desc {
    color: #888;
    font-size: 11px;
    font-weight: 400
}

.pl-zalo .pl-icon {
    background: #e0f2fe;
    color: #0068FF
}

.pl-tele .pl-icon {
    background: #e0f2fe;
    color: #0088cc
}

.pl-discord .pl-icon {
    background: #ede9fe;
    color: #5865F2
}

.pl-fb .pl-icon {
    background: #e0f2fe;
    color: #1877F2
}

.pl-fbg .pl-icon {
    background: #fce7f3;
    color: #E91E63
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 4px
}

.tag-chip {
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all .15s;
    border: none
}

.tag-chip:hover {
    background: #2563eb;
    color: #fff
}

/* Rules */
.rules-list {
    list-style: none;
    padding: 0;
    margin: 0
}

.rules-list li {
    font-size: 13px;
    color: #555;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: flex-start;
    gap: 6px
}

.rules-list li:last-child {
    border-bottom: none
}

.rules-list .rule-num {
    background: #eff6ff;
    color: #2563eb;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0
}

/* Pinned */
.pinned-item {
    display: flex;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none
}

.pinned-item:last-child {
    border-bottom: none
}

.pinned-item .pi-cat {
    font-size: 14px;
    flex-shrink: 0
}

.pinned-item .pi-title {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.3
}

.pinned-item:hover .pi-title {
    color: #2563eb
}

/* Empty State */
.community-empty {
    text-align: center;
    padding: 48px 16px;
    color: #888
}

.community-empty .icon {
    font-size: 40px;
    margin-bottom: 10px
}

.community-empty h3 {
    color: #555;
    font-size: 16px;
    margin-bottom: 6px
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #555;
    transition: all .15s
}

.page-btn:hover {
    border-color: #2563eb;
    color: #2563eb
}

.page-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb
}

/* Write Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.modal-overlay.active {
    display: flex
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto
}

.modal-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    padding: 4px
}

.form-group {
    margin-bottom: 14px
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border .15s;
    box-sizing: border-box
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb
}

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

.cat-select-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.cat-radio {
    display: none
}

.cat-radio-label {
    padding: 5px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all .15s
}

.cat-radio:checked+.cat-radio-label {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb
}

.form-submit {
    width: 100%;
    padding: 10px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer
}

.form-submit:hover {
    background: #1e40af
}

.form-submit:disabled {
    opacity: .5;
    cursor: not-allowed
}

/* Setup Notice */
.setup-notice {
    text-align: center;
    padding: 48px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    grid-column: 1/-1
}

.setup-notice h2 {
    font-size: 1.2rem;
    color: #1a1a1a;
    margin-bottom: 6px
}

.setup-notice a {
    display: inline-block;
    margin-top: 14px;
    padding: 8px 20px;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600
}

/* DARK MODE */
body.dark-mode .post-card,
body.dark-mode .sidebar-card,
body.dark-mode .post-composer,
body.dark-mode .modal-card {
    background: #1e293b;
    border-color: #334155
}

body.dark-mode .pc-title,
body.dark-mode .pc-author,
body.dark-mode .cover-info h1,
body.dark-mode .sidebar-card h3,
body.dark-mode .pc-title a,
body.dark-mode .pinned-item .pi-title {
    color: #e5e7eb
}

body.dark-mode .pc-content {
    color: #94a3b8
}

body.dark-mode .pc-content.truncated::after {
    background: linear-gradient(transparent, #1e293b)
}

body.dark-mode .composer-input,
body.dark-mode .pc-quick-comment input {
    background: #0f172a;
    color: #e5e7eb
}

body.dark-mode .cat-tab {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8
}

body.dark-mode .cat-tab.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb
}

body.dark-mode .sort-btn {
    background: #0f172a;
    color: #94a3b8
}

body.dark-mode .sort-btn.active {
    background: #e5e7eb;
    color: #0f172a
}

body.dark-mode .search-box input {
    background: #0f172a;
    border-color: #334155;
    color: #e5e7eb
}

body.dark-mode .pc-reactions-summary,
.dark-mode .pc-actions-bar {
    border-top-color: #334155
}

body.dark-mode .pc-action {
    color: #94a3b8
}

body.dark-mode .pc-action:hover {
    background: #334155;
    color: #e5e7eb
}

body.dark-mode .platform-link {
    border-color: #334155
}

body.dark-mode .platform-link .pl-name {
    color: #e5e7eb
}

body.dark-mode .tag-chip {
    background: #334155;
    color: #94a3b8
}

body.dark-mode .rules-list li {
    color: #94a3b8;
    border-bottom-color: #334155
}

body.dark-mode .page-btn {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8
}

body.dark-mode .page-btn.active {
    background: #2563eb;
    color: #fff
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e5e7eb
}

body.dark-mode .form-group label {
    color: #94a3b8
}

body.dark-mode .modal-card h2 {
    color: #e5e7eb
}

body.dark-mode .setup-notice {
    background: #1e293b;
    border-color: #334155
}

body.dark-mode .setup-notice h2 {
    color: #e5e7eb
}

body.dark-mode .reaction-picker {
    background: #1e293b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3)
}

body.dark-mode .cat-radio-label {
    border-color: #334155;
    color: #94a3b8
}

body.dark-mode .pinned-item {
    border-bottom-color: #334155
}

body.dark-mode .pc-tag {
    background: #334155;
    color: #93c5fd
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .community-wrapper {
        grid-template-columns: 1fr;
        padding: 12px
    }

    .sidebar {
        position: static
    }

    .community-cover {
        flex-direction: column;
        text-align: center;
        padding: 24px 16px
    }

    .cover-stats {
        justify-content: center
    }

    .search-box {
        margin-left: 0;
        width: 100%
    }

    .search-box input {
        flex: 1
    }
}

@media (max-width: 500px) {
    .pc-header {
        padding: 10px 12px 0
    }

    .pc-body {
        padding: 8px 12px
    }

    .pc-actions-bar {
        padding: 2px 4px
    }

    .pc-tags {
        padding: 0 12px
    }

    .pc-quick-comment {
        padding: 6px 10px 8px
    }

    .composer-actions {
        display: none
    }
}