/* =============================================
   内容情感分析 - content_sentiment_analysis.css
   三栏布局：历史 | 输入 | 结果
   主题色：情感光谱渐变（暖粉 → 深紫）
   ============================================= */

/* ========== 主容器 ========== */
.csa-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #fdf6ff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.csa-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    min-height: unset;
}

/* ========== 顶部工具栏 ========== */
.csa-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    min-height: 38px;
    background: linear-gradient(135deg, #e91e63 0%, #9c27b0 55%, #673ab7 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(156, 39, 176, 0.4);
    flex-shrink: 0;
}

.csa-toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.csa-toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.csa-toolbar-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #7b1fa2;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.5;
}

.csa-toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.csa-toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.csa-toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮（开始分析） */
.csa-btn-primary {
    background: linear-gradient(135deg, #ff6f00 0%, #e65100 100%) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(230, 81, 0, 0.5);
}

.csa-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff8f00 0%, #ff6f00 100%) !important;
    box-shadow: 0 4px 12px rgba(230, 81, 0, 0.55) !important;
}

/* 分析中 shimmer 动画 */
.csa-btn-primary.csa-btn-loading {
    background: linear-gradient(90deg, #e65100 0%, #ff9800 35%, #e65100 65%, #bf360c 100%) !important;
    background-size: 200% 100% !important;
    animation: csaBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
}

@keyframes csaBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 取消按钮 */
.csa-btn-cancel {
    background: rgba(255, 255, 255, 0.88) !important;
    color: #c62828 !important;
}

/* ========== 主内容：三栏 ========== */
.csa-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fdf6ff;
}

/* ========== 左栏：历史记录 ========== */
.csa-history-panel {
    width: 205px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #ede0f5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csa-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #fdf6ff 0%, #f3e5f5 100%);
    border-bottom: 1px solid #ede0f5;
    flex-shrink: 0;
}

.csa-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #6a1b9a;
}

.csa-history-count {
    font-size: 11px;
    color: #ab47bc;
    font-weight: 400;
    margin-left: 2px;
}

.csa-history-clear-btn {
    background: #fce4ec;
    border: none;
    color: #c62828;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.csa-history-clear-btn:hover { background: #f8bbd0; }

.csa-history-search {
    padding: 7px;
    border-bottom: 1px solid #ede0f5;
    flex-shrink: 0;
}

.csa-history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #e1bee7;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #4a148c;
    background: #fdf6ff;
}

.csa-history-search input:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 2px rgba(156, 39, 176, 0.12);
}

.csa-history-search input::placeholder { color: #ce93d8; }

.csa-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    background: #fff;
}

.csa-history-empty {
    text-align: center;
    padding: 24px 12px;
    color: #ba68c8;
    font-size: 12px;
    line-height: 1.8;
}

.csa-history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 11px;
    margin: 3px 6px;
    background: #fdf6ff;
    border: 1px solid #ede0f5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s;
    position: relative;
    animation: csaFadeIn 0.2s ease;
}

@keyframes csaFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

.csa-history-item:hover {
    background: #f3e5f5;
    border-color: #ce93d8;
    transform: translateX(2px);
}

.csa-history-item.active {
    background: #f3e5f5;
    border-color: #9c27b0;
    box-shadow: inset 3px 0 0 #3b82f6, 0 1px 4px rgba(156, 39, 176, 0.2);
}

.csa-history-item-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fce4ec;
    color: #e53935;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    padding: 0;
}

.csa-history-item:hover .csa-history-item-delete { opacity: 1; }
.csa-history-item-delete:hover { background: #e53935; color: #fff; }

.csa-history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #4a148c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
    padding-right: 18px;
}

.csa-history-item-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.csa-history-item-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.csa-history-item-badge.badge-quick {
    background: #fff3e0;
    color: #e65100;
}

.csa-history-item-badge.badge-deep {
    background: #ede7f6;
    color: #512da8;
}

.csa-history-item-time {
    font-size: 10px;
    color: #ba68c8;
}

/* ========== 中栏：输入面板 ========== */
.csa-input-panel {
    width: 320px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #ede0f5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csa-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(to bottom, #fdf6ff 0%, #f3e5f5 100%);
    border-bottom: 1px solid #ede0f5;
    flex-shrink: 0;
}

.csa-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #6a1b9a;
}

.csa-panel-tip {
    font-size: 11px;
    color: #ab47bc;
}

.csa-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 文本输入区 */
.csa-textarea-wrap {
    position: relative;
    flex: 1;
    min-height: 180px;
}

.csa-textarea {
    width: 100%;
    height: 100%;
    min-height: 180px;
    padding: 12px;
    border: 1.5px solid #e1bee7;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.7;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    color: #37125a;
    background: #fdf6ff;
}

.csa-textarea:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

.csa-textarea::placeholder { color: #ce93d8; }

.csa-char-counter {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 11px;
    color: #ba68c8;
    pointer-events: none;
}

.csa-char-counter.over-limit { color: #e53935; font-weight: 600; }

/* 抖动动画（输入为空时） */
@keyframes csaShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.csa-textarea.shake {
    animation: csaShake 0.4s ease;
    border-color: #e53935 !important;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.12) !important;
}

/* 分析模式选择 */
.csa-mode-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.csa-mode-label {
    font-size: 12px;
    font-weight: 600;
    color: #7b1fa2;
}

.csa-mode-options {
    display: flex;
    gap: 8px;
}

.csa-mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border: 1.5px solid #e1bee7;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #7b1fa2;
    background: #fdf6ff;
    transition: all 0.2s;
    user-select: none;
}

.csa-mode-option:hover {
    border-color: #9c27b0;
    background: #f3e5f5;
}

.csa-mode-option.selected {
    border-color: #9c27b0;
    background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%);
    color: #4a148c;
    box-shadow: 0 1px 4px rgba(156, 39, 176, 0.2);
}

.csa-mode-icon {
    font-size: 14px;
}

/* 模式切换提示 */
.csa-mode-hint {
    font-size: 11px;
    color: #ab47bc;
    min-height: 14px;
    display: block;
    margin-top: -4px;
    transition: opacity 0.3s;
}

/* 快捷示例标签 */
.csa-quick-label {
    font-size: 12px;
    font-weight: 600;
    color: #7b1fa2;
}

.csa-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: -4px;
}

.csa-quick-tag {
    padding: 3px 9px;
    background: #f3e5f5;
    border: 1px solid #e1bee7;
    border-radius: 12px;
    font-size: 11px;
    color: #6a1b9a;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.csa-quick-tag:hover {
    background: #e1bee7;
    border-color: #9c27b0;
    color: #4a148c;
    transform: translateY(-1px);
}

/* 使用说明 */
.csa-tips-box {
    padding: 11px 13px;
    background: #f9f3ff;
    border: 1px solid #ede0f5;
    border-radius: 6px;
    font-size: 12px;
    color: #7b1fa2;
}

.csa-tips-box p {
    margin: 0 0 7px;
    font-weight: 600;
    color: #6a1b9a;
}

.csa-tips-box ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.8;
}

.csa-tips-box li { color: #8e24aa; }
.csa-tips-box ul li::marker { color: #ce93d8; }

/* ========== 右栏：分析结果 ========== */
.csa-result-panel {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
}

.csa-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(to bottom, #fdf6ff 0%, #f3e5f5 100%);
    border-bottom: 1px solid #ede0f5;
    flex-shrink: 0;
}

.csa-result-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #6a1b9a;
}

.csa-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.csa-result-mode-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #ede7f6;
    color: #512da8;
    font-weight: 600;
}

.csa-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* 占位提示 */
.csa-result-placeholder {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ba68c8;
    text-align: center;
    padding: 20px;
}

.csa-placeholder-icon {
    font-size: 52px;
    margin-bottom: 16px;
    opacity: 0.7;
    animation: csaPlaceholderFloat 3s ease-in-out infinite;
}

@keyframes csaPlaceholderFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.csa-placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: #9c27b0;
    margin: 0 0 10px;
}

.csa-placeholder-desc {
    font-size: 13px;
    color: #ba68c8;
    margin: 3px 0;
}

/* 加载中 */
.csa-result-loading {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.csa-loading-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.csa-loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e91e63, #9c27b0);
    animation: csaDotBounce 1.2s ease-in-out infinite;
}

.csa-loading-dots span:nth-child(1) { animation-delay: 0s; }
.csa-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.csa-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes csaDotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%           { transform: scale(1.1); opacity: 1; }
}

.csa-loading-text {
    font-size: 13px;
    color: #9c27b0;
    margin: 0;
    animation: csaTextFade 2s ease-in-out infinite;
}

@keyframes csaTextFade {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

/* 结果内容区 */
.csa-result-content {
    /* animation 不硬编码在基础类上，由 JS 添加 .csa-result-enter 触发 */
}

.csa-result-content.csa-result-enter {
    animation: csaResultIn 0.35s ease-out forwards;
}

@keyframes csaResultIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 错误提示 */
.csa-result-error {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.csa-error-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    text-align: center;
}

.csa-error-icon { font-size: 32px; }
.csa-error-msg  { font-size: 14px; color: #c62828; margin: 0; font-weight: 500; }
.csa-error-tip  { font-size: 12px; color: #e57373; margin: 0; }

.csa-error-retry-btn {
    margin-top: 4px;
    padding: 6px 20px;
    background: linear-gradient(135deg, #e91e63 0%, #9c27b0 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.35);
}

.csa-error-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.45);
}

/* 重新分析按钮 */
.csa-btn-reanalyze {
    padding: 3px 9px;
    background: #ede7f6;
    border: 1px solid #ce93d8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #6a1b9a;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.5;
}

.csa-btn-reanalyze:hover {
    background: #e1bee7;
    border-color: #9c27b0;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(156, 39, 176, 0.2);
}

/* 字数统计徽标 */
.csa-result-word-count {
    font-size: 11px;
    color: #ab47bc;
    background: #f3e5f5;
    border: 1px solid #e1bee7;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* 结果区 strong 标签 */
.sentiment-result strong,
.csa-result-content strong {
    font-weight: 700;
    color: #6a1b9a;
}

/* 结果区 h4 通用样式 */
.sentiment-result h4,
.csa-result-content h4 {
    font-size: 13px;
    font-weight: 700;
    color: #7b1fa2;
    margin: 10px 0 6px;
}

/* 结果区 h5 通用样式 */
.sentiment-result h5,
.csa-result-content h5 {
    font-size: 12px;
    font-weight: 600;
    color: #8e24aa;
    margin: 8px 0 4px;
}
.sentiment-result li::marker,
.csa-result-content li::marker {
    color: #9c27b0;
}

/* ========== AI 生成结果样式 ========== */
.sentiment-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 情感概览 */
.sentiment-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 50%, #ede7f6 100%);
    border-radius: 10px;
    border: 1px solid #e1bee7;
}

/* 情感标签 */
.sentiment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.sentiment-positive {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #1b5e20;
    border: 1.5px solid #a5d6a7;
}

.sentiment-negative {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: #b71c1c;
    border: 1.5px solid #ef9a9a;
}

.sentiment-neutral {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #0d47a1;
    border: 1.5px solid #90caf9;
}

.sentiment-mixed {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #bf360c;
    border: 1.5px solid #ffcc80;
}

/* 情感得分条 */
.sentiment-score-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-label {
    font-size: 12px;
    color: #7b1fa2;
    font-weight: 600;
    white-space: nowrap;
    min-width: 52px;
}

.score-track {
    flex: 1;
    height: 10px;
    background: #e8d5f5;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.score-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #e53935 0%, #fb8c00 35%, #fdd835 55%, #43a047 100%);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}

.score-value {
    font-size: 13px;
    font-weight: 700;
    color: #6a1b9a;
    min-width: 36px;
    text-align: right;
}

/* 情感强度 */
.sentiment-intensity {
    font-size: 13px;
    color: #6a1b9a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.intensity-tag {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #e91e63, #9c27b0);
    color: #fff;
}

/* 情感关键词 */
.sentiment-keywords {
    padding: 14px 16px;
    background: #fdf6ff;
    border: 1px solid #ede0f5;
    border-radius: 8px;
}

.sentiment-keywords h4,
.sentiment-summary h4,
.sentiment-section h4 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #6a1b9a;
}

/* 结果区 Markdown 元素补全 */
.sentiment-result h2,
.csa-result-content h2 {
    font-size: 15px;
    font-weight: 700;
    color: #6a1b9a;
    margin: 14px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1.5px solid #e1bee7;
}

.sentiment-result h3,
.csa-result-content h3 {
    font-size: 13px;
    font-weight: 700;
    color: #7b1fa2;
    margin: 12px 0 6px;
}

.sentiment-result em,
.csa-result-content em {
    color: #8e24aa;
    font-style: italic;
}

.sentiment-result pre,
.csa-result-content pre {
    background: #f3e5f5;
    border: 1px solid #e1bee7;
    border-radius: 5px;
    padding: 10px 12px;
    font-size: 12px;
    overflow-x: auto;
    margin: 8px 0;
    line-height: 1.6;
}

.sentiment-result code,
.csa-result-content code {
    background: #f3e5f5;
    color: #880e4f;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.sentiment-result pre code,
.csa-result-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.sentiment-result blockquote,
.csa-result-content blockquote {
    border-left: 3px solid #9c27b0;
    background: #fdf6ff;
    margin: 8px 0;
    padding: 8px 14px;
    color: #6a1b9a;
    font-size: 13px;
    border-radius: 0 5px 5px 0;
}

.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.keyword-tag {
    padding: 4px 11px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: default;
    transition: transform 0.15s;
}

.keyword-tag:hover { transform: scale(1.05); }

.kw-pos {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.kw-neg {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.kw-neu {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* 情感小结 */
.sentiment-summary {
    padding: 14px 16px;
    background: #fffde7;
    border: 1px solid #fff59d;
    border-radius: 8px;
}

.sentiment-summary p {
    margin: 0;
    font-size: 13px;
    color: #5d4037;
    line-height: 1.7;
}

/* 深度分析各小节 */
.sentiment-section {
    padding: 14px 16px;
    background: #fdf6ff;
    border: 1px solid #ede0f5;
    border-radius: 8px;
}

.sentiment-section p {
    margin: 0 0 6px;
    font-size: 13px;
    color: #4a148c;
    line-height: 1.7;
}

.sentiment-section ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.sentiment-section li {
    font-size: 13px;
    color: #4a148c;
    line-height: 1.7;
    margin-bottom: 2px;
}

/* 六维情感雷达 */
.emotion-radar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.emotion-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emotion-name {
    font-size: 12px;
    color: #6a1b9a;
    font-weight: 500;
    min-width: 36px;
}

.emotion-bar {
    flex: 1;
    height: 8px;
    background: #e8d5f5;
    border-radius: 4px;
    overflow: hidden;
}

.emotion-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* 不同情绪不同颜色 */
.emotion-item:nth-child(1) .emotion-fill { background: #43a047; } /* 喜悦 */
.emotion-item:nth-child(2) .emotion-fill { background: #1e88e5; } /* 悲伤 */
.emotion-item:nth-child(3) .emotion-fill { background: #e53935; } /* 愤怒 */
.emotion-item:nth-child(4) .emotion-fill { background: #7b1fa2; } /* 恐惧 */
.emotion-item:nth-child(5) .emotion-fill { background: #f4511e; } /* 惊讶 */
.emotion-item:nth-child(6) .emotion-fill { background: #6d4c41; } /* 厌恶 */

.emotion-score {
    font-size: 12px;
    font-weight: 700;
    color: #6a1b9a;
    min-width: 20px;
    text-align: right;
}

/* ========== 示例模态框 ========== */
.csa-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 100001;
    backdrop-filter: blur(2px);
}

.csa-modal-overlay.show { display: block; }

.csa-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 580px;
    max-width: 96vw;
    max-height: 82vh;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    z-index: 100002;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
}

.csa-modal.show {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.csa-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #e91e63 0%, #9c27b0 100%);
    color: #fff;
    flex-shrink: 0;
}

.csa-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.csa-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.csa-modal-close:hover { background: rgba(255, 255, 255, 0.35); }

.csa-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.csa-example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.csa-example-card {
    padding: 13px 15px;
    background: #fdf6ff;
    border: 1.5px solid #e1bee7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.csa-example-card:hover {
    border-color: #9c27b0;
    background: #f3e5f5;
    box-shadow: 0 3px 10px rgba(156, 39, 176, 0.14);
    transform: translateY(-2px);
}

.csa-example-card-header {
    display: flex;
    align-items: center;
    gap: 7px;
}

.csa-example-icon { font-size: 18px; }

.csa-example-title {
    font-size: 13px;
    font-weight: 600;
    color: #6a1b9a;
}

.csa-example-preview {
    font-size: 12px;
    color: #7b1fa2;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 示例加载占位 */
.csa-examples-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: #ab47bc;
    font-size: 13px;
    grid-column: 1 / -1;
}

.csa-examples-loading::before {
    content: '';
    width: 28px;
    height: 28px;
    border: 3px solid #e1bee7;
    border-top-color: #9c27b0;
    border-radius: 50%;
    animation: csaSpinLoad 0.8s linear infinite;
}

@keyframes csaSpinLoad {
    to { transform: rotate(360deg); }
}

/* 亮色模式滚动条 */
.csa-history-list::-webkit-scrollbar,
.csa-input-body::-webkit-scrollbar,
.csa-result-body::-webkit-scrollbar { width: 5px; }

.csa-history-list::-webkit-scrollbar-track,
.csa-input-body::-webkit-scrollbar-track,
.csa-result-body::-webkit-scrollbar-track { background: transparent; }

.csa-history-list::-webkit-scrollbar-thumb,
.csa-input-body::-webkit-scrollbar-thumb,
.csa-result-body::-webkit-scrollbar-thumb {
    background: rgba(156, 39, 176, 0.2);
    border-radius: 3px;
}

.csa-history-list::-webkit-scrollbar-thumb:hover,
.csa-input-body::-webkit-scrollbar-thumb:hover,
.csa-result-body::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 39, 176, 0.42);
}
@media (max-width: 900px) {
    .csa-input-panel  { width: 260px; }
    .csa-history-panel { width: 170px; }
}

@media (max-width: 680px) {
    .csa-main-content { flex-direction: column; }
    .csa-history-panel { width: 100%; height: 120px; border-right: none; border-bottom: 1px solid #ede0f5; }
    .csa-input-panel  { width: 100%; border-right: none; border-bottom: 1px solid #ede0f5; }
    .csa-result-panel { min-width: unset; }
    .csa-history-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 6px; }
    .csa-history-item { flex-direction: row; min-width: 160px; max-width: 200px; }
}

/* ========== 暗黑模式 ========== */
body.dark .csa-container {
    background: #1a0a2e;
}

body.dark .csa-main-content {
    background: #1a0a2e;
}

body.dark .csa-toolbar {
    background: linear-gradient(135deg, #880e4f 0%, #4a148c 55%, #311b92 100%);
    box-shadow: 0 2px 10px rgba(136, 14, 79, 0.5);
}

body.dark .csa-toolbar-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #e1bee7;
}

body.dark .csa-toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
}

body.dark .csa-history-panel {
    background: #12001f;
    border-right-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-history-header {
    background: linear-gradient(to bottom, #1a0a2e 0%, #240035 100%);
    border-bottom-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-history-header h3 { color: #e1bee7; }
body.dark .csa-history-count     { color: #ce93d8; }
body.dark .csa-history-clear-btn { background: rgba(229, 57, 53, 0.15); color: #ef9a9a; }
body.dark .csa-history-clear-btn:hover { background: rgba(229, 57, 53, 0.28); }

body.dark .csa-history-search {
    border-bottom-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-history-search input {
    background: #12001f;
    border-color: rgba(225, 190, 231, 0.25);
    color: #e1bee7;
}

body.dark .csa-history-search input::placeholder { color: #7b4e8c; }
body.dark .csa-history-search input:focus { border-color: #ab47bc; box-shadow: 0 0 0 2px rgba(171, 71, 188, 0.2); }

body.dark .csa-history-list { background: #12001f; }
body.dark .csa-history-empty { color: #7b4e8c; }

body.dark .csa-history-item {
    background: #1a0a2e;
    border-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-history-item:hover {
    background: rgba(171, 71, 188, 0.15);
    border-color: rgba(171, 71, 188, 0.4);
}

body.dark .csa-history-item.active {
    background: rgba(156, 39, 176, 0.18);
    border-color: #9c27b0;
    box-shadow: inset 3px 0 0 #3b82f6;
}

body.dark .csa-history-item-title { color: #e1bee7; }
body.dark .csa-history-item-time  { color: #9e6bb0; }

body.dark .csa-input-panel {
    background: #12001f;
    border-right-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-panel-header {
    background: linear-gradient(to bottom, #1a0a2e 0%, #240035 100%);
    border-bottom-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-panel-header h3 { color: #e1bee7; }
body.dark .csa-panel-tip        { color: #9e6bb0; }

body.dark .csa-input-body { background: #12001f; }

body.dark .csa-textarea {
    background: #1a0a2e;
    border-color: rgba(225, 190, 231, 0.25);
    color: #f3e5f5;
}

body.dark .csa-textarea:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.2);
}

body.dark .csa-textarea::placeholder { color: #6a3b7a; }

body.dark .csa-char-counter { color: #9e6bb0; }

body.dark .csa-mode-label { color: #e1bee7; }

body.dark .csa-mode-option {
    background: #1a0a2e;
    border-color: rgba(225, 190, 231, 0.2);
    color: #e1bee7;
}

body.dark .csa-mode-option:hover { background: rgba(171, 71, 188, 0.18); border-color: #ab47bc; }

body.dark .csa-mode-option.selected {
    background: rgba(156, 39, 176, 0.2);
    border-color: #ab47bc;
    color: #e1bee7;
}

body.dark .csa-mode-hint { color: #ab47bc; }

body.dark .csa-quick-label { color: #e1bee7; }

body.dark .csa-quick-tag {
    background: rgba(171, 71, 188, 0.15);
    border-color: rgba(171, 71, 188, 0.3);
    color: #e1bee7;
}

body.dark .csa-quick-tag:hover {
    background: rgba(171, 71, 188, 0.3);
    border-color: #ab47bc;
}

body.dark .csa-tips-box {
    background: rgba(171, 71, 188, 0.08);
    border-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-tips-box p  { color: #e1bee7; }
body.dark .csa-tips-box li { color: #ce93d8; }

body.dark .csa-result-panel { background: #12001f; }

body.dark .csa-result-header {
    background: linear-gradient(to bottom, #1a0a2e 0%, #240035 100%);
    border-bottom-color: rgba(225, 190, 231, 0.15);
}

body.dark .csa-result-header h3 { color: #e1bee7; }
body.dark .csa-result-mode-badge { background: rgba(81, 45, 168, 0.35); color: #ce93d8; }
body.dark .csa-result-word-count { background: rgba(171, 71, 188, 0.15); border-color: rgba(171, 71, 188, 0.3); color: #ce93d8; }
body.dark .csa-btn-reanalyze { background: rgba(171, 71, 188, 0.15); border-color: rgba(171, 71, 188, 0.35); color: #e1bee7; }
body.dark .csa-btn-reanalyze:hover { background: rgba(171, 71, 188, 0.28); border-color: #ab47bc; }

body.dark .sentiment-result strong,
body.dark .csa-result-content strong { color: #f3e5f5; }

body.dark .sentiment-result h4,
body.dark .csa-result-content h4 { color: #ce93d8; }

body.dark .sentiment-result h5,
body.dark .csa-result-content h5 { color: #ab47bc; }

body.dark .csa-result-body { background: #12001f; }

body.dark .csa-placeholder-title { color: #ce93d8; }
body.dark .csa-placeholder-desc  { color: #7b4e8c; }

body.dark .csa-loading-text { color: #ce93d8; }

/* 暗黑模式错误盒子 */
body.dark .csa-error-box {
    background: rgba(183, 28, 28, 0.12);
    border-color: rgba(239, 154, 154, 0.2);
}
body.dark .csa-error-msg { color: #ef9a9a; }
body.dark .csa-error-tip { color: #ce93d8; }
body.dark .csa-error-retry-btn {
    background: linear-gradient(135deg, #880e4f 0%, #4a148c 100%);
    box-shadow: 0 2px 8px rgba(136, 14, 79, 0.4);
}

/* 暗黑模式 AI 结果样式 */
body.dark .sentiment-overview {
    background: linear-gradient(135deg, rgba(136, 14, 79, 0.15) 0%, rgba(74, 20, 140, 0.15) 100%);
    border-color: rgba(171, 71, 188, 0.25);
}

body.dark .sentiment-positive {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.25), rgba(27, 94, 32, 0.2));
    color: #a5d6a7;
    border-color: rgba(165, 214, 167, 0.3);
}

body.dark .sentiment-negative {
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.25), rgba(136, 0, 0, 0.2));
    color: #ef9a9a;
    border-color: rgba(239, 154, 154, 0.3);
}

body.dark .sentiment-neutral {
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.25), rgba(13, 71, 161, 0.2));
    color: #90caf9;
    border-color: rgba(144, 202, 249, 0.3);
}

body.dark .sentiment-mixed {
    background: linear-gradient(135deg, rgba(191, 54, 12, 0.25), rgba(130, 34, 0, 0.2));
    color: #ffcc80;
    border-color: rgba(255, 204, 128, 0.3);
}

body.dark .score-track { background: rgba(225, 190, 231, 0.15); }
body.dark .score-value { color: #e1bee7; }
body.dark .score-label { color: #ce93d8; }

body.dark .sentiment-intensity { color: #e1bee7; }

body.dark .sentiment-keywords,
body.dark .sentiment-section {
    background: rgba(171, 71, 188, 0.06);
    border-color: rgba(225, 190, 231, 0.15);
}

body.dark .sentiment-keywords h4,
body.dark .sentiment-summary h4,
body.dark .sentiment-section h4 { color: #e1bee7; }

body.dark .kw-pos { background: rgba(46, 125, 50, 0.2); color: #a5d6a7; border-color: rgba(165, 214, 167, 0.25); }
body.dark .kw-neg { background: rgba(183, 28, 28, 0.2); color: #ef9a9a; border-color: rgba(239, 154, 154, 0.25); }
body.dark .kw-neu { background: rgba(21, 101, 192, 0.2); color: #90caf9; border-color: rgba(144, 202, 249, 0.25); }

body.dark .sentiment-summary {
    background: rgba(245, 236, 0, 0.05);
    border-color: rgba(253, 216, 53, 0.2);
}

body.dark .sentiment-summary p { color: #ffe082; }
body.dark .sentiment-section p  { color: #e1bee7; }
body.dark .sentiment-section li { color: #ce93d8; }

body.dark .emotion-bar { background: rgba(225, 190, 231, 0.12); }
body.dark .emotion-name { color: #ce93d8; }
body.dark .emotion-score { color: #e1bee7; }

/* 暗黑模式 Markdown 元素 */
body.dark .sentiment-result h2,
body.dark .csa-result-content h2 {
    color: #e1bee7;
    border-bottom-color: rgba(225, 190, 231, 0.2);
}

body.dark .sentiment-result h3,
body.dark .csa-result-content h3 { color: #ce93d8; }

body.dark .sentiment-result em,
body.dark .csa-result-content em { color: #f48fb1; }

body.dark .sentiment-result pre,
body.dark .csa-result-content pre {
    background: rgba(171, 71, 188, 0.1);
    border-color: rgba(225, 190, 231, 0.15);
    color: #e1bee7;
}

body.dark .sentiment-result code,
body.dark .csa-result-content code {
    background: rgba(171, 71, 188, 0.2);
    color: #f48fb1;
}

body.dark .sentiment-result blockquote,
body.dark .csa-result-content blockquote {
    border-left-color: #ab47bc;
    background: rgba(171, 71, 188, 0.08);
    color: #e1bee7;
}

body.dark .sentiment-result li::marker,
body.dark .csa-result-content li::marker { color: #ce93d8; }

body.dark .csa-modal-overlay { background: rgba(0, 0, 0, 0.55); }

body.dark .csa-examples-loading { color: #ab47bc; }
body.dark .csa-examples-loading::before { border-color: rgba(171, 71, 188, 0.3); border-top-color: #ab47bc; }

body.dark .csa-modal {
    background: #1a0a2e;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

body.dark .csa-modal-body { background: #1a0a2e; }

body.dark .csa-example-card {
    background: #12001f;
    border-color: rgba(225, 190, 231, 0.2);
}

body.dark .csa-example-card:hover {
    background: rgba(156, 39, 176, 0.15);
    border-color: #9c27b0;
}

body.dark .csa-example-title   { color: #e1bee7; }
body.dark .csa-example-preview { color: #ce93d8; }

/* 暗黑模式滚动条 */
body.dark .csa-history-list::-webkit-scrollbar,
body.dark .csa-input-body::-webkit-scrollbar,
body.dark .csa-result-body::-webkit-scrollbar { width: 5px; }

body.dark .csa-history-list::-webkit-scrollbar-thumb,
body.dark .csa-input-body::-webkit-scrollbar-thumb,
body.dark .csa-result-body::-webkit-scrollbar-thumb {
    background: rgba(171, 71, 188, 0.4);
    border-radius: 3px;
}

body.dark .csa-history-list::-webkit-scrollbar-thumb:hover,
body.dark .csa-input-body::-webkit-scrollbar-thumb:hover,
body.dark .csa-result-body::-webkit-scrollbar-thumb:hover {
    background: rgba(171, 71, 188, 0.7);
}
