/* ─── Community Channel ─────────────────────────────────────────────── */

.cm-page { max-width: 900px; margin: 0 auto; padding: 1rem; }
.cm-header { margin-bottom: 1rem; }
.cm-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin: 0; }

.cm-loading {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.cm-loading-sm {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
}

/* ─── Feed Header (create buttons) ───────────────────────────────── */

.cm-feed-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}
.cm-create-btn {
    background: var(--color-primary, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cm-create-btn:hover { opacity: 0.85; }
.cm-create-btn-admin {
    background: #f59e0b;
    color: #000;
}

/* ─── Empty State ─────────────────────────────────────────────────── */

.cm-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}
.cm-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}
.cm-empty-text {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.cm-empty-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
}
.cm-empty-state .cm-btn {
    margin-top: 0.75rem;
}

/* ─── Compose Modal ──────────────────────────────────────────────── */

.cm-compose-modal {
    max-width: 520px;
    width: 100%;
}
.cm-compose-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    resize: vertical;
    min-height: 3.5rem;
    padding: 0.625rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.cm-compose-input:focus {
    border-color: var(--color-primary, #3b82f6);
}
.cm-compose-input::placeholder { color: var(--text-secondary); opacity: 0.6; }
.cm-compose-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}
.cm-char-count { font-size: 0.75rem; color: var(--text-secondary); }

/* ─── Post Card ───────────────────────────────────────────────────── */

.cm-post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.cm-post-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.cm-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}
.cm-post-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}
.cm-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.cm-tier-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}
.cm-tier-pro { background: #3b82f6; color: #fff; }
.cm-tier-admin { background: #f59e0b; color: #000; }
.cm-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.cm-post-content {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

/* ─── See More (truncation) ──────────────────────────────────────── */

.cm-see-more {
    color: var(--color-primary, #3b82f6);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}
.cm-see-more:hover { text-decoration: underline; }

/* ─── Post Image (single, Facebook-style) ────────────────────────── */

.cm-post-image-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 350px;
    cursor: pointer;
}
.cm-post-img-single {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
    display: block;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cm-post-img-single:hover { opacity: 0.9; }

/* ─── Multi-image badge ──────────────────────────────────────────── */

.cm-img-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    pointer-events: none;
}

/* ─── Post Footer ────────────────────────────────────────────────── */

.cm-post-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-primary);
}

/* ─── Like Button ─────────────────────────────────────────────────── */

.cm-like-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.15s;
}
.cm-like-btn:hover { color: #ef4444; }
.cm-like-btn.liked { color: #ef4444; }
.cm-like-btn.liked .cm-like-icon { color: #ef4444; }

/* ─── Comment Button ─────────────────────────────────────────────── */

.cm-comment-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.15s;
}
.cm-comment-btn:hover { color: var(--color-primary, #3b82f6); }

/* ─── Comments Section ───────────────────────────────────────────── */

.cm-comments-section {
    border-top: 1px solid var(--border-primary);
    padding-top: 0.5rem;
    margin-top: 0.375rem;
}
.cm-comments-list {
    max-height: 300px;
    overflow-y: auto;
}
.cm-comment-item {
    display: flex;
    gap: 0.375rem;
    padding: 0.375rem 0;
    align-items: flex-start;
}
.cm-avatar-sm {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-primary, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    flex-shrink: 0;
}
.cm-comment-body {
    flex: 1;
    min-width: 0;
}
.cm-comment-user {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-right: 0.25rem;
}
.cm-comment-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.cm-comment-text {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
    margin-top: 0.125rem;
}
.cm-comment-del {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0 0.25rem;
    margin-left: 0.25rem;
    opacity: 0.5;
    float: right;
}
.cm-comment-del:hover { opacity: 1; color: #ef4444; }

/* ─── Comment Input Row ──────────────────────────────────────────── */

.cm-comment-input-row {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    margin-top: 0.375rem;
}
.cm-comment-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}
.cm-comment-input:focus {
    border-color: var(--color-primary, #3b82f6);
}
.cm-comment-input::placeholder { color: var(--text-secondary); opacity: 0.6; }
.cm-btn-sm {
    background: var(--color-primary, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.cm-btn-sm:hover { opacity: 0.85; }

/* ─── Symbol Tag ──────────────────────────────────────────────────── */

.cm-symbol-tag {
    color: var(--color-primary, #3b82f6);
    font-weight: 600;
    text-decoration: none;
}
.cm-symbol-tag:hover { text-decoration: underline; }

/* ─── Announcement Card (in unified feed) ────────────────────────── */

.cm-announce-card {
    border-left: 4px solid var(--color-primary, #3b82f6);
}
.cm-announce-card.cm-priority-warning {
    border-left-color: #f59e0b;
}
.cm-announce-card.cm-priority-critical {
    border-left-color: #ef4444;
}
.cm-announce-source {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.cm-announce-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.25rem 0;
}
.cm-announce-content {
    white-space: pre-wrap;
}

/* ─── Priority Badge ─────────────────────────────────────────────── */

.cm-priority-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.cm-priority-badge.cm-priority-info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}
.cm-priority-badge.cm-priority-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.cm-priority-badge.cm-priority-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.cm-pin-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* ─── Delete Button ───────────────────────────────────────────────── */

.cm-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: auto;
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.cm-delete-btn:hover { opacity: 1; color: #ef4444; }
.cm-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.cm-edit-btn:hover { opacity: 1; color: var(--color-primary, #3b82f6); }

/* ─── Admin Form (inside modal) ──────────────────────────────────── */

.cm-input,
.cm-textarea,
.cm-select {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    font-family: inherit;
    box-sizing: border-box;
}
.cm-input:focus,
.cm-textarea:focus {
    border-color: var(--color-primary, #3b82f6);
    outline: none;
}
.cm-textarea { resize: vertical; }
.cm-select { width: auto; min-width: 100px; }
.cm-form-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cm-checkbox {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ─── Buttons ─────────────────────────────────────────────────────── */

.cm-btn {
    border: none;
    border-radius: 6px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cm-btn:hover { opacity: 0.85; }
.cm-btn-primary {
    background: var(--color-primary, #3b82f6);
    color: #fff;
}
.cm-btn-outline {
    background: transparent;
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.cm-load-more {
    text-align: center;
    padding: 1rem 0;
}

/* ─── Bell Badge (header) ─────────────────────────────────────────── */

.tm-bell-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-primary);
    padding: 0.25rem;
}
.tm-bell-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ─── Attach Button & Compose Left ───────────────────────────────── */

.cm-compose-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cm-attach-btn {
    background: none;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.5rem;
    color: var(--text-secondary);
    transition: color 0.15s, border-color 0.15s;
}
.cm-attach-btn:hover {
    color: var(--color-primary, #3b82f6);
    border-color: var(--color-primary, #3b82f6);
}

/* ─── Preview Strip ──────────────────────────────────────────────── */

.cm-preview-strip {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}
.cm-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-primary);
    flex-shrink: 0;
}
.cm-preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cm-preview-remove {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.cm-preview-remove:hover {
    background: #ef4444;
}

/* ─── Lightbox ───────────────────────────────────────────────────── */

.cm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cm-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}
.cm-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cm-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ─── Gallery Navigation ─────────────────────────────────────────── */

.cm-gallery-counter {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 14px;
    border-radius: 12px;
}
.cm-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}
.cm-gallery-nav:hover { background: rgba(255, 255, 255, 0.35); }
.cm-gallery-prev { left: 1rem; }
.cm-gallery-next { right: 1rem; }

/* ─── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .cm-page { padding: 0.5rem; }
    .cm-post-header { gap: 0.375rem; }
    .cm-avatar { width: 28px; height: 28px; font-size: 0.7rem; }
    .cm-announce-header { font-size: 0.75rem; }
    .cm-post-image-wrap { max-height: 250px; }
    .cm-post-img-single { max-height: 250px; }
    .cm-comments-list { max-height: 200px; }
    .cm-create-btn { width: 100%; text-align: center; }
    .cm-feed-header { flex-direction: column; }
    .cm-preview-item { width: 50px; height: 50px; }
}
