/* ================================================================
   community.css — Community Groups / Forums / Discussion
   ================================================================ */

:root {
    --bg:     #070810;
    --bg2:    #0d0e1a;
    --bg3:    #12141f;
    --border: #1e2035;
    --border2:#2a2d45;
    --text:   #e8e9f0;
    --muted:  #6b7091;
    --muted2: #9296b0;
    --purple: #8b5cf6;
    --cyan:   #06b6d4;
    --green:  #10b981;
    --red:    #ef4444;
    --gold:   #f59e0b;
}

/* ── Page layout ──────────────────────────────────────────────── */
.comm-page {
    min-height: 100vh;
    background: var(--bg);
    padding: 80px 0 60px;
}

.comm-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.comm-header {
    margin-bottom: 36px;
}

.comm-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(139,92,246,.08);
    border: 1px solid rgba(139,92,246,.25);
    border-radius: 100px;
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 700;
    color: #a78bfa;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.comm-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: #f0f1f8;
    margin-bottom: 8px;
}

.comm-subtitle {
    color: var(--muted2);
    font-size: 0.95rem;
}

/* ── Main grid ────────────────────────────────────────────────── */
.comm-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .comm-grid { grid-template-columns: 1fr; }
    .comm-sidebar { display: none; }
    .comm-sidebar.active { display: block; }
}

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

.comm-sidebar-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 16px;
}

.comm-sidebar-title {
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--border);
}

.comm-group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}
.comm-group-item:last-child { border-bottom: none; }
.comm-group-item:hover { background: rgba(255,255,255,.03); }
.comm-group-item.active { background: rgba(139,92,246,.1); }

.comm-group-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.comm-group-info { flex: 1; min-width: 0; }

.comm-group-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comm-group-meta {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 1px;
}

.comm-group-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 100px;
    background: rgba(139,92,246,.12);
    color: #a78bfa;
    font-weight: 700;
    flex-shrink: 0;
}

.comm-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    font-family: inherit;
}
.comm-new-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(139,92,246,.4); }

/* ── Main content ─────────────────────────────────────────────── */
.comm-main {
    min-height: 400px;
}

/* Group detail header */
.comm-group-header {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.comm-group-header-icon {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139,92,246,.1);
    border: 1px solid rgba(139,92,246,.2);
    border-radius: 12px;
    flex-shrink: 0;
}

.comm-group-header-info { flex: 1; }

.comm-group-header-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.comm-group-header-desc {
    font-size: 0.82rem;
    color: var(--muted2);
}

.comm-group-header-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.comm-stat {
    font-size: 0.75rem;
    color: var(--muted);
}
.comm-stat strong { color: var(--text); }

.comm-join-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--purple);
    color: var(--purple);
    background: rgba(139,92,246,.08);
    transition: all 0.2s;
    font-family: inherit;
    flex-shrink: 0;
}
.comm-join-btn:hover { background: rgba(139,92,246,.18); }
.comm-join-btn.joined {
    border-color: #3f3f46;
    color: var(--muted);
    background: transparent;
}

/* ── Post composer ────────────────────────────────────────────── */
.comm-composer {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}

.comm-composer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.comm-composer-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.comm-composer-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.85rem;
    resize: none;
    font-family: inherit;
    min-height: 44px;
    transition: border-color 0.2s;
    width: 100%;
}
.comm-composer-input:focus {
    outline: none;
    border-color: var(--purple);
}
.comm-composer-input::placeholder { color: var(--muted); }

.comm-composer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.comm-post-btn {
    padding: 8px 20px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: #fff;
    border: none;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.comm-post-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(139,92,246,.4); }
.comm-post-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.comm-login-prompt {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted2);
}
.comm-login-prompt a { color: var(--purple); text-decoration: none; font-weight: 600; }
.comm-login-prompt a:hover { text-decoration: underline; }

/* ── Post cards ───────────────────────────────────────────────── */
.comm-posts-list { display: flex; flex-direction: column; gap: 12px; }

.comm-post-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.comm-post-card:hover {
    border-color: var(--border2);
    background: #10121e;
}
.comm-post-card.pinned {
    border-color: rgba(245,158,11,.3);
    background: rgba(245,158,11,.03);
}

.comm-post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.comm-post-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.comm-post-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.comm-post-time {
    font-size: 0.73rem;
    color: var(--muted);
    margin-left: auto;
}

.comm-pin-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 100px;
    background: rgba(245,158,11,.12);
    color: #f59e0b;
    font-weight: 700;
}

.comm-post-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.comm-post-body {
    font-size: 0.83rem;
    color: var(--muted2);
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.comm-post-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.comm-post-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--muted);
}
.comm-post-stat svg { width: 13px; height: 13px; }

.comm-post-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.73rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: inherit;
}
.comm-post-delete:hover { color: var(--red); background: rgba(239,68,68,.08); }

/* ── Post detail view ─────────────────────────────────────────── */
.comm-post-detail {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 16px;
}

.comm-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--muted2);
    cursor: pointer;
    margin-bottom: 16px;
    background: none;
    border: none;
    font-family: inherit;
    padding: 0;
}
.comm-back-btn:hover { color: var(--text); }

.comm-detail-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.comm-detail-body {
    font-size: 0.88rem;
    color: var(--muted2);
    line-height: 1.65;
    white-space: pre-wrap;
}

/* ── Comments section ─────────────────────────────────────────── */
.comm-comments-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
}

.comm-comments-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 16px;
}

.comm-comment {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.comm-comment:last-of-type { border-bottom: none; }

.comm-comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4c1d95, #1e3a5f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.comm-comment-content { flex: 1; }

.comm-comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comm-comment-author {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
}

.comm-comment-time {
    font-size: 0.7rem;
    color: var(--muted);
}

.comm-comment-text {
    font-size: 0.83rem;
    color: var(--muted2);
    line-height: 1.55;
    white-space: pre-wrap;
}

.comm-comment-form {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comm-comment-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.83rem;
    resize: none;
    font-family: inherit;
    min-height: 42px;
    transition: border-color 0.2s;
}
.comm-comment-input:focus { outline: none; border-color: var(--purple); }
.comm-comment-input::placeholder { color: var(--muted); }

.comm-comment-submit {
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--purple);
    color: #fff;
    border: none;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: all 0.2s;
}
.comm-comment-submit:hover { background: #7c3aed; }
.comm-comment-submit:disabled { opacity: .5; cursor: not-allowed; }

.comm-login-to-comment {
    margin-top: 14px;
    padding: 12px 16px;
    background: rgba(139,92,246,.06);
    border: 1px solid rgba(139,92,246,.15);
    border-radius: 10px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted2);
}
.comm-login-to-comment a { color: var(--purple); text-decoration: none; font-weight: 600; }

/* ── Empty / loading states ───────────────────────────────────── */
.comm-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
    font-size: 0.9rem;
}
.comm-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.comm-empty-title { font-size: 1rem; font-weight: 700; color: var(--muted2); margin-bottom: 6px; }

.comm-loading {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* ── Create group modal ───────────────────────────────────────── */
.comm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.comm-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.comm-modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 18px;
    width: 100%;
    max-width: 460px;
    padding: 28px;
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.34,1.56,.64,1);
}
.comm-modal-overlay.open .comm-modal {
    transform: translateY(0);
}

.comm-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

.comm-modal-field {
    margin-bottom: 14px;
}

.comm-modal-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.comm-modal-input,
.comm-modal-select,
.comm-modal-textarea {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.comm-modal-input:focus,
.comm-modal-select:focus,
.comm-modal-textarea:focus {
    outline: none;
    border-color: var(--purple);
}
.comm-modal-textarea { resize: vertical; min-height: 80px; }
.comm-modal-select { appearance: none; cursor: pointer; }

.comm-type-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
}

.comm-type-card {
    padding: 12px 10px;
    border: 2px solid var(--border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg3);
}
.comm-type-card:hover { border-color: var(--purple); }
.comm-type-card.selected {
    border-color: var(--purple);
    background: rgba(139,92,246,.1);
}
.comm-type-card-icon { font-size: 1.4rem; margin-bottom: 4px; }
.comm-type-card-name { font-size: 0.72rem; font-weight: 700; color: var(--muted2); }

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

.comm-cancel-btn {
    padding: 9px 20px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--muted2);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.comm-cancel-btn:hover { background: var(--bg3); }

.comm-create-btn {
    padding: 9px 22px;
    border-radius: 8px;
    background: linear-gradient(135deg,#7c3aed,#8b5cf6);
    color: #fff;
    border: none;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.comm-create-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(139,92,246,.4); }
