/* ================================================================
   comments.css — 评论区全局样式（Reddit 风格）
   全局加载以避免 Blazor CSS 隔离在递归组件中失效的问题
   ================================================================ */

/* ── 评论数徽章 ──────────────────────────────────────────── */

.ci-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background-color: #0d6efd;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 0.3rem;
}

/* ── 根级发表表单 ─────────────────────────────────────────── */

.ci-root-form {
    padding: 0.85rem;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .ci-root-form {
    background-color: #1e2124;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ── 评论节点（flex 行：左侧缩进线 + 右侧内容） ─────────── */

.ci-node {
    display: flex;
    gap: 6px;
    margin-top: 0.5rem;
}

/* ── 可点击缩进线（深度 > 0） ────────────────────────────── */

.ci-line {
    width: 2px;
    min-height: 100%;
    background-color: #dee2e6;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.15s, width 0.1s;
    align-self: stretch;
}

.ci-line:hover {
    background-color: #0d6efd;
    width: 3px;
}

[data-bs-theme="dark"] .ci-line {
    background-color: #3d4045;
}

[data-bs-theme="dark"] .ci-line:hover {
    background-color: #0d6efd;
}

/* ── 评论内容容器 ─────────────────────────────────────────── */

.ci-body {
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0;
}

/* ── 头像 ────────────────────────────────────────────────── */

.ci-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .ci-avatar {
    background-color: #343a40;
    color: #adb5bd;
}

/* ── 折叠按钮（根评论标题栏内的 [−]） ───────────────────── */

.ci-toggle-btn {
    width: 18px;
    height: 18px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    background: transparent;
    color: #6c757d;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.15s;
}

.ci-toggle-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
}

[data-bs-theme="dark"] .ci-toggle-btn {
    border-color: #495057;
    color: #adb5bd;
}

[data-bs-theme="dark"] .ci-toggle-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
}

/* ── 用户名 ──────────────────────────────────────────────── */

.ci-username {
    font-size: 0.82rem;
    font-weight: 600;
    color: #212529;
}

[data-bs-theme="dark"] .ci-username {
    color: #e9ecef;
}

/* ── 评论内容 ────────────────────────────────────────────── */

.ci-content {
    font-size: 0.92rem;
    line-height: 1.65;
    color: #212529;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0.2rem 0;
}

[data-bs-theme="dark"] .ci-content {
    color: #cdd1d6;
}

/* ── 操作按钮（Reddit 风格：无边框纯文字） ───────────────── */

.ci-action-btn {
    background: transparent;
    border: none;
    color: #6c757d;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 2px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background-color 0.1s, color 0.1s;
    line-height: 1.5;
}

.ci-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #343a40;
}

.ci-action-btn-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545 !important;
}

[data-bs-theme="dark"] .ci-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #e9ecef;
}

[data-bs-theme="dark"] .ci-action-btn-danger:hover {
    background-color: rgba(220, 53, 69, 0.18);
    color: #f1aeb5 !important;
}

/* ── 折叠状态栏 ──────────────────────────────────────────── */

.ci-collapsed-bar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    user-select: none;
    transition: background-color 0.15s;
}

.ci-collapsed-bar:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .ci-collapsed-bar:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* ── 内联表单面板（回复 / 编辑） ─────────────────────────── */

.ci-form-panel {
    padding: 0.6rem;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

[data-bs-theme="dark"] .ci-form-panel {
    background-color: #1e2124;
    border-color: rgba(255, 255, 255, 0.08);
}

/* ── Textarea ────────────────────────────────────────────── */

.ci-textarea {
    resize: vertical;
    min-height: 56px;
    font-size: 0.88rem;
    border-radius: 5px;
}

.ci-textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

[data-bs-theme="dark"] .ci-textarea {
    background-color: #2b3035;
    color: #e9ecef;
    border-color: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="dark"] .ci-textarea:focus {
    background-color: #2b3035;
    color: #e9ecef;
    border-color: #0d6efd;
}

/* ── 子评论容器 ──────────────────────────────────────────── */

.ci-children {
    margin-top: 0.25rem;
}

/* ── 已删除评论 ──────────────────────────────────────────── */

.ci-deleted .ci-content {
    color: #6c757d !important;
    font-style: italic;
}

/* ── 字数计数 ────────────────────────────────────────────── */

.ci-char-count {
    font-size: 0.73rem;
}

/* ── 空状态 ──────────────────────────────────────────────── */

.ci-empty {
    text-align: center;
    padding: 2rem 0;
    color: #6c757d;
}

.ci-empty i {
    font-size: 2rem;
    opacity: 0.45;
    display: block;
    margin-bottom: 0.5rem;
}

/* ── 划线评论高亮（JS 动态注入，必须全局） ──────────────── */

.inline-comment-anchor {
    text-decoration: underline dashed #fb8500;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    background: rgba(251, 133, 0, 0.08);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.inline-comment-anchor:hover,
.inline-comment-anchor.inline-comment-anchor-active {
    background: rgba(251, 133, 0, 0.18);
    box-shadow: inset 0 -2px 0 rgba(251, 133, 0, 0.45);
}

.inline-comment-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    margin-left: 0.25rem;
    padding: 0 0.28rem;
    border: 0;
    border-radius: 999px;
    background: #fb8500;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-0.05rem);
}

.inline-comment-bubble:hover {
    background: #e87400;
}

[data-bs-theme="dark"] .inline-comment-anchor {
    text-decoration-color: #ffd166;
    background: rgba(255, 209, 102, 0.16);
}

[data-bs-theme="dark"] .inline-comment-anchor:hover,
[data-bs-theme="dark"] .inline-comment-anchor.inline-comment-anchor-active {
    background: rgba(255, 209, 102, 0.28);
    box-shadow: inset 0 -2px 0 rgba(255, 209, 102, 0.45);
}
