/**
 * comment.css - 评论系统全局组件样式（移动端）
 *
 * 包含：评论弹窗、评论项、@用户弹窗、语音录制弹窗、空状态
 * 这些组件在多个页面（首页、说说详情、文章详情等）中共用，
 * 必须作为核心 CSS 全局加载，不能放在页面级 CSS 中。
 */

/* ==================== 评论弹窗 ==================== */
.ls-comment-popup .ls-popup-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.ls-comment-popup .ls-popup-footer {
    padding: 0;
    border-top: none;
    padding-bottom: 0;
}

.ls-comment-tabs {
    display: flex;
    gap: 0;
    padding: 0 14px;
    border-bottom: 1px solid var(--ls-border-light);
    flex-shrink: 0;
}

.ls-comment-tab {
    padding: 10px 20px 10px 0;
    font-size: 13px;
    color: var(--ls-text-tertiary);
    position: relative;
}

.ls-comment-tab.active {
    color: var(--ls-text);
    font-weight: 600;
}

.ls-comment-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 20px;
    height: 2px;
    background: var(--ls-primary);
    border-radius: 1px;
    width: 30%;
    margin: auto;
}

.ls-comment-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 14px;
}

.ls-comment-loading,
.ls-comment-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--ls-text-tertiary);
    font-size: 13px;
    gap: 8px;
}

.ls-comment-empty i { font-size: 36px; opacity: 0.3; }

/* 评论输入栏 */
.ls-comment-input-bar {
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border-top: 1px solid var(--ls-border-light);
    background: var(--ls-bg-card);
    flex-shrink: 0;
    padding-bottom: calc(8px + var(--ls-safe-bottom));
}

/* 回复提示 */
.ls-comment-reply-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 6px;
    background: var(--ls-primary-light);
    border-radius: 6px;
    font-size: 12px;
    color: var(--ls-primary);
}

.ls-comment-reply-hint .ls-comment-reply-text { flex: 1; }
.ls-comment-reply-hint .ls-comment-reply-cancel { font-size: 14px; cursor: pointer; }

/* @标签 */
.ls-comment-at-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ls-comment-at-tags:empty { display: none; }

.ls-at-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: var(--ls-primary-light);
    color: var(--ls-primary);
    border-radius: 4px;
    font-size: 12px;
}

.ls-at-tag .ls-at-tag-remove { font-size: 12px; cursor: pointer; }

.ls-comment-at-tags:not(:empty) { margin-bottom: 6px; }

/* 语音预览 */
.ls-comment-voice-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: var(--ls-primary-light);
    border-radius: 8px;
}

.ls-comment-voice-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--ls-primary);
    font-weight: 500;
}

.ls-comment-voice-info i { font-size: 16px; }

.ls-comment-voice-play-btn,
.ls-comment-voice-del {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
}

.ls-comment-voice-play-btn { background: var(--ls-primary); color: #fff; }
.ls-comment-voice-del { color: var(--ls-text-tertiary); }

.ls-comment-input-wrap {
    width: 100%;
    margin-bottom: 6px;
}

/* 富文本编辑器 */
.ls-comment-editor {
    width: 100%;
    min-height: 36px;
    max-height: 100px;
    padding: 8px 12px;
    border: 1px solid var(--ls-border);
    border-radius: 12px;
    font-size: 13px;
    color: var(--ls-text);
    background: var(--ls-bg-secondary);
    outline: none;
    overflow-y: auto;
    line-height: 1.5;
    font-family: inherit;
    word-break: break-word;
    -webkit-overflow-scrolling: touch;
}

.ls-comment-editor:focus { border-color: var(--ls-primary); }

.ls-comment-editor:empty:not(:focus)::before {
    content: attr(data-placeholder);
    color: var(--ls-text-placeholder);
    pointer-events: none;
}

.ls-comment-editor.has-content::before { display: none; }

.ls-comment-editor .ls-emoji {
    width: 20px;
    height: 20px;
    vertical-align: -4px;
}

/* 评论图片预览 */
.ls-comment-img-preview {
    display: none;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.ls-comment-img-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.ls-comment-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ls-comment-img-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
}

/* 评论工具栏 */
.ls-comment-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ls-comment-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--ls-text-secondary);
    font-size: 20px;
}

.ls-comment-tool-btn:active { background: var(--ls-bg-secondary); }

.ls-comment-send-btn {
    margin-left: auto;
    padding: 0 14px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 16px;
    background: var(--ls-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.ls-comment-send-btn.ls-sending {
    opacity: 0.5;
    pointer-events: none;
}

/* 表情面板样式已内联至 emoji.js */
/* @用户弹窗样式已内联至 at-user.js */
/* 语音录制弹窗样式已内联至 comment-voice.js */

/* ==================== 评论项 ==================== */
.ls-comment-item {
    display: flex;
    gap: 10px;
    padding: 12px 0;
}

.ls-comment-list > .ls-comment-item { border-bottom: 0.5px solid var(--ls-border-light); }
.ls-comment-list > .ls-comment-item:last-child { border-bottom: none; }

/* 一级评论头像 32px */
.ls-comment-list > .ls-comment-item > .ls-avatar { width: 32px; height: 32px; }
.ls-comment-list > .ls-comment-item > .ls-avatar .ls-avatar-verify img { width: 12px; height: 12px; }

.ls-ci-main { flex: 1; min-width: 0; }

.ls-ci-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.ls-ci-nickname {
    font-size: 13px;
    font-weight: 500;
    color: var(--ls-text-secondary);
}

.ls-ci-author-tag {
    font-size: 10px;
    padding: 0 4px;
    background: var(--ls-primary-light);
    color: var(--ls-primary);
    border-radius: 3px;
    line-height: 16px;
}

.ls-ci-content { margin-bottom: 4px; }

.ls-ci-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ls-text);
    word-break: break-word;
}

.ls-ci-reply-ref {
    font-size: 12px;
    color: var(--ls-text-tertiary);
    background: var(--ls-bg-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    line-height: 1.5;
}

.ls-ci-sticky {
    display: inline-block;
    font-size: 10px;
    padding: 0 4px;
    background: var(--ls-danger-light);
    color: var(--ls-danger);
    border-radius: 3px;
    margin-right: 4px;
    line-height: 16px;
}

.ls-ci-at-list { font-size: 13px; }
.ls-ci-at { color: var(--ls-primary); text-decoration: none; }

/* 评论图片 */
.ls-ci-images {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.ls-ci-img-item {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.ls-ci-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 评论语音 */
.ls-ci-voice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--ls-primary-light);
    border-radius: 16px;
    margin-bottom: 4px;
}

.ls-ci-voice-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
}

.ls-ci-voice-wave i {
    width: 2px;
    height: 8px;
    background: var(--ls-primary);
    border-radius: 1px;
}

.ls-ci-voice em { font-size: 12px; color: var(--ls-primary); font-style: normal; }

/* 语音播放动画 */
.ls-ci-voice.is-playing .ls-ci-voice-wave i {
    animation: ls-ci-voice-wave 0.8s ease-in-out infinite;
}

.ls-ci-voice.is-playing .ls-ci-voice-wave i:nth-child(1) { animation-delay: 0s; }
.ls-ci-voice.is-playing .ls-ci-voice-wave i:nth-child(2) { animation-delay: 0.15s; }
.ls-ci-voice.is-playing .ls-ci-voice-wave i:nth-child(3) { animation-delay: 0.3s; }

@keyframes ls-ci-voice-wave {
    0%, 100% { height: 4px; }
    50% { height: 14px; }
}

/* 评论操作栏 */
.ls-ci-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ls-text-quaternary);
    margin-top: 4px;
}

.ls-ci-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.ls-ci-up,
.ls-ci-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--ls-text-quaternary);
}

.ls-ci-up i,
.ls-ci-reply-btn i { font-size: 15px; }

.ls-ci-up.is-up { color: var(--ls-primary); }

.ls-ci-up em { font-style: normal; }

.ls-ci-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    color: var(--ls-text-quaternary);
}

.ls-ci-more i { font-size: 15px; }

/* ==================== 子评论 ==================== */
.ls-ci-child-list {
    margin-top: 8px;
}

/* 子评论项：更紧凑 */
.ls-ci-child-item {
    gap: 8px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--ls-border-light);
}

.ls-ci-child-item:last-child,
.ls-ci-child-more + .ls-ci-child-item:last-child { border-bottom: none; }

.ls-ci-child-list > .ls-ci-child-item:last-child { border-bottom: none; }

/* 子评论头像 24px */
.ls-ci-child-item > .ls-avatar { width: 24px; height: 24px; }
.ls-ci-child-item > .ls-avatar .ls-avatar-verify img { width: 10px; height: 10px; }

.ls-ci-child-item .ls-ci-nickname { font-size: 12px; }
.ls-ci-child-item .ls-ci-text { font-size: 13px; line-height: 1.5; }
.ls-ci-child-item .ls-ci-content { margin-bottom: 2px; }
.ls-ci-child-item .ls-ci-reply-ref {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 8px 0;
}
.ls-ci-child-item .ls-ci-bar { font-size: 10px; margin-top: 2px; }
.ls-ci-child-item .ls-ci-up i,
.ls-ci-child-item .ls-ci-reply-btn i,
.ls-ci-child-item .ls-ci-more i { font-size: 13px; }
.ls-ci-child-item .ls-ci-images { margin-bottom: 2px; }
.ls-ci-child-item .ls-ci-img-item { width: 60px; height: 60px; border-radius: 6px; }

.ls-ci-child-more {
    font-size: 12px;
    color: var(--ls-primary);
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 2px;
    border-bottom: 0.5px solid var(--ls-border-light);
}

.ls-ci-child-more:last-child { border-bottom: none; }

.ls-ci-child-more i { font-size: 14px; }

/* ==================== 打赏评论样式 ==================== */
.ls-reward-comment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--ls-radius-lg, 8px);
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    font-size: 13px;
    line-height: 1.4;
}
.ls-reward-comment i {
    font-size: 16px;
    color: #f59e0b;
}
.ls-reward-comment b {
    font-weight: 600;
}
.ls-reward-comment-msg {
    margin-top: 4px;
    font-size: 12px;
    color: var(--ls-text-secondary, #666);
    font-style: italic;
}

/* 暗色模式 */
[data-theme="dark"] .ls-reward-comment {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.15), rgba(253, 230, 138, 0.15));
    color: #fcd34d;
}
[data-theme="dark"] .ls-reward-comment i {
    color: #fbbf24;
}
[data-theme="dark"] .ls-reward-comment-msg {
    color: var(--ls-text-tertiary);
}

/* ==================== 送礼评论样式 ==================== */
.ls-gift-comment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 4px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    font-size: 12px;
    color: #9a3412;
    line-height: 20px;
    vertical-align: middle;
}
.ls-gift-comment-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
}
.ls-gift-comment-icon {
    font-size: 14px;
    color: #ea580c;
    flex-shrink: 0;
}
.ls-gift-comment-text {
    white-space: nowrap;
}
.ls-gift-comment-text b {
    color: #c2410c;
    font-weight: 500;
}

/* 暗色模式 */
[data-theme="dark"] .ls-gift-comment {
    background: rgba(234, 88, 12, 0.1);
    border-color: rgba(234, 88, 12, 0.25);
    color: #fdba74;
}
[data-theme="dark"] .ls-gift-comment-icon {
    color: #fb923c;
}
[data-theme="dark"] .ls-gift-comment-text b {
    color: #fdba74;
}
