/* ═══════════════════════════════════════════════════════════════
   XBANGING — Comments System  (prefix: ca-comments-*)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Section wrapper ─────────────────────────────────────────── */
.ca-comments-section {
    margin-top: 40px;
    padding: 0 0 40px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
}
.ca-comments-section {
  padding-inline: 16px;
}

/* ─── Header ──────────────────────────────────────────────────── */
.ca-comments-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #1a1a1a;
}

.ca-comments-title {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ca-comments-title i {
    color: #cc0000;
    font-size: 20px;
}

.ca-comments-count {
    color: #999;
    font-size: 14px;
    font-weight: 400;
}

/* ─── Compose box ─────────────────────────────────────────────── */
.ca-compose-box {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    align-items: flex-start;
}

.ca-compose-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.ca-compose-input-wrap {
    flex: 1;
    min-width: 0;
}

.ca-compose-textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    border-radius: 0;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    transition: border-bottom-color 0.2s;
    height: auto;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    box-sizing: border-box;
    display: block;
}

.ca-compose-textarea:focus {
    outline: none;
    border-bottom-color: #cc0000;
}

.ca-compose-textarea::placeholder {
    color: #555;
}

.ca-compose-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.ca-char-count {
    font-size: 0.8rem;
    color: #999;
    margin-right: auto;
}

.ca-char-count.ca-char-warn {
    color: #ff9800;
}

/* ─── Login prompt ────────────────────────────────────────────── */
.ca-login-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    background: #0d0d0d;
    border: 1px solid #1f1f1f;
    border-radius: 8px;
    margin-bottom: 28px;
    color: #888;
    font-size: 15px;
}

.ca-login-link {
    color: #f1f1f1;
    text-decoration: none;
    font-weight: 600;
}

.ca-login-link:hover {
    color: #e60000;
    text-decoration: underline;
}

/* ─── Comment cards ───────────────────────────────────────────── */
.ca-comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #090909;
}

.ca-comment-card {
    padding: 16px;
    position: relative;
}

.ca-comment-card.is-pinned {
    border-left: 3px solid #cc0000;
}

.ca-comment-card.ca-deleted {
    opacity: 0.5;
}

/* ─── Comment header ──────────────────────────────────────────── */
.ca-comment-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ca-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #8c0000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.ca-comment-avatar--reply {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.ca-comment-meta {
    flex: 1;
    min-width: 0;
}

.ca-comment-author {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f1f1;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ca-comment-time {
    font-size: 0.8rem;
    color: #999;
    margin-top: 1px;
}

.ca-pin-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 8px;
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

.ca-pin-indicator i {
    color: #cc0000;
    font-size: 13px;
}

/* ─── Comment body ────────────────────────────────────────────── */
.ca-comment-body {
    font-size: 1.1rem;
    color: #f1f1f1;
    line-height: 1.6;
    word-break: break-word;
    margin-bottom: 12px;
}

.ca-comment-body.ca-deleted-placeholder {
    color: #444;
    font-style: italic;
}

.ca-mention {
    color: #cc0000;
    font-weight: 600;
}

.ca-edited-badge {
    font-size: 10px;
    color: #555;
    margin-left: 6px;
}

/* ─── Inline edit textarea ────────────────────────────────────── */
.ca-edit-wrap {
    margin-bottom: 12px;
}

.ca-edit-textarea {
    width: 100%;
    background: #0d0d0d;
    border: 1px solid #cc0000;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px 14px;
    resize: none;
    min-height: 80px;
    box-sizing: border-box;
    display: block;
}

.ca-edit-textarea:focus {
    outline: none;
}

.ca-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ─── Action bar ──────────────────────────────────────────────── */
.ca-comment-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  line-height: 1;
}

.ca-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  font-size: 1.09rem;
    font-weight: 600;
    color: #f1f1f1;
    padding: 0;
    transition: color 0.15s;
    font-family: inherit;
}

.ca-action-btn:hover {
    color: #888;
}

.ca-action-btn.ca-like-btn.liked {
    color: #cc0000;
  line-height: 1;
}

.ca-action-btn.ca-like-btn.liked i {
    color: #cc0000;
}

.ca-action-btn.ca-reply-btn:hover,
.ca-action-btn.ca-edit-btn:hover {
    color: #ccc;
}

.ca-action-btn.ca-delete-btn:hover {
    color: #e74c3c;
}

/* ─── Reply thread ────────────────────────────────────────────── */
.ca-replies-thread {
    margin-top: 16px;
    padding-left: 16px;
    border-left: 2px solid #cc0000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ca-reply-card {
    background: #111111;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 12px;
}

/* ─── Reply compose ───────────────────────────────────────────── */
.ca-reply-compose {
    margin-top: 12px;
    display: none;
}

.ca-reply-compose.active {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ca-reply-textarea {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    border-radius: 0;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    padding: 6px 0;
    resize: none;
    min-height: 48px;
    box-sizing: border-box;
    transition: border-bottom-color 0.2s;
}

.ca-reply-textarea:focus {
    outline: none;
    border-bottom-color: #cc0000;
}

.ca-reply-submit-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.ca-btn-primary {
    background: #cc0000;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.ca-btn-primary:hover {
    background: #e60000;
}

.ca-btn-primary:disabled {
    opacity: 0.5;
    cursor: default;
}

.ca-btn-ghost {
    background: none;
    color: #888;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.ca-btn-ghost:hover {
    border-color: #555;
    color: #ccc;
}

/* ─── Emoji trigger ───────────────────────────────────────────── */
.ca-emoji-trigger {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 1.6rem;
    color: #888;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    font-family: inherit;
}

.ca-emoji-trigger:hover {
    color: #cc0000;
}

.ca-emoji-trigger.active {
    color: #cc0000;
}

/* ─── Emoji picker popover ────────────────────────────────────── */
#ca-emoji-picker-wrap {
    position: fixed;
    z-index: 99999;
    display: none;
    filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.7));
}

#ca-emoji-picker-wrap em-emoji-picker {
    --border-radius: 10px;
    --color-border: #252525;
    --background-rgb: 13, 13, 13;
    --rgb-color: 255, 255, 255;
    --rgb-input: 26, 26, 26;
    height: 400px;
}

/* ─── Load more ───────────────────────────────────────────────── */
.ca-load-more-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    background: none;
    border: 1px solid #252525;
    border-radius: 8px;
    color: #888;
    font-size: 13px;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.ca-load-more-btn:hover {
    border-color: #444;
    color: #ccc;
}

/* ─── Spinner ─────────────────────────────────────────────────── */
.ca-spinner-wrap {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

.ca-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #252525;
    border-top-color: #cc0000;
    border-radius: 50%;
    animation: ca-spin 0.7s linear infinite;
}

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

/* ─── Empty state ─────────────────────────────────────────────── */
.ca-empty-state {
    text-align: center;
    padding: 48px 0;
    color: #444;
}

.ca-empty-state i {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.ca-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ─── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ca-comments-section {
        margin-top: 28px;
    }

    .ca-comment-card {
        padding: 12px;
    }

    .ca-comment-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .ca-comment-avatar--reply {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .ca-comment-author {
        font-size: 12px;
    }

    .ca-comment-body {
        font-size: 13px;
    }

    .ca-compose-avatar {
        width: 30px;
        height: 30px;
    }

    .ca-compose-actions {
        flex-wrap: wrap;
    }

    .ca-comment-actions {
        gap: 15px;
    }

    .ca-emoji-trigger {
        display: none;
    }
}
