/* ============================================================
   AI 情感分析 — ai_sentiment_analysis.css
   ============================================================ */

/* ---------- 输入区域 ---------- */
.sa-input-area {
    padding: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.08);
    margin-bottom: 24px;
    overflow: hidden;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.required-mark {
    color: #ef4444;
    margin-left: 2px;
}

/* 字符计数 */
.char-count {
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
    margin-top: -2px;
    transition: color 0.2s;
}

.char-count.danger { color: #ef4444; font-weight: 600; }

/* ---------- 分析模式按钮 ---------- */
.mode-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 8px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.mode-btn.active {
    border-color: #3b82f6;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.32);
}

/* 模式提示 */
.mode-tip-group {
    justify-content: flex-end;
}

.mode-tip {
    font-size: 12px;
    color: #9ca3af;
    padding: 9px 0;
    line-height: 1.5;
    font-style: italic;
}

/* ---------- 操作按钮行 ---------- */
.actions-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.shortcut-hint {
    font-size: 11px;
    opacity: 0.72;
    margin-left: 6px;
}

/* ---------- 渐变工具栏 / 标题条（参考 SVG 编辑器 .svg-toolbar 设计） ---------- */
.sa-section-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 50%, #6366f1 100%);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.28);
}

.sa-banner-left {
    display: flex;
    align-items: center;
    gap: 11px;
}

.sa-banner-icon {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.18));
}

.sa-banner-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.sa-banner-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.76);
    margin-top: 2px;
    font-weight: 400;
}

.sa-banner-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    padding: 3px 9px;
    flex-shrink: 0;
}

/* 表单内容区域 */
.sa-form-body {
    padding: 20px 20px 8px;
}

/* ---------- 加载动画 ---------- */
.sa-loading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 28px 24px;
    background: linear-gradient(135deg, #f0f9ff 0%, #eff6ff 100%);
    border: 1.5px solid #bae6fd;
    border-radius: 12px;
    color: #3b82f6;
    font-size: 15px;
    font-weight: 500;
    margin: 8px 0;
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #dbeafe;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: sa-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes sa-spin {
    to { transform: rotate(360deg); }
}

/* 主按钮流光动画 */
@keyframes sa-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.button.btnShimmer {
    background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6, #3b82f6) !important;
    background-size: 200% auto !important;
    animation: sa-shimmer 1.2s linear infinite !important;
    color: #fff !important;
    cursor: not-allowed !important;
    border-color: transparent !important;
}

/* ---------- 结果区域 ---------- */
.sa-results {
    margin-top: 6px;
}

/* ---- 总体概览 ---- */
.sentiment-overview {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 24px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* 情感徽章 */
.sentiment-badge-wrap {
    flex-shrink: 0;
}

.sentiment-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 28px;
    border-radius: 14px;
    border: 2px solid transparent;
    transition: background 0.3s ease, border-color 0.3s ease;
    min-width: 110px;
    text-align: center;
}

/* 积极 */
.sentiment-badge.badge-positive {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #6ee7b7;
}

/* 消极 */
.sentiment-badge.badge-negative {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #fca5a5;
}

/* 中性 */
.sentiment-badge.badge-neutral {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-color: #d1d5db;
}

.sentiment-icon {
    font-size: 36px;
    line-height: 1;
}

.sentiment-label {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.sentiment-badge.badge-positive .sentiment-label { color: #065f46; }
.sentiment-badge.badge-negative .sentiment-label { color: #7f1d1d; }
.sentiment-badge.badge-neutral  .sentiment-label { color: #374151; }

.sentiment-sub {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* 分数仪表盘 */
.score-panel {
    flex: 1;
    min-width: 220px;
}

.score-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.score-gauge-wrap {
    position: relative;
    margin-bottom: 8px;
}

.score-gauge-track {
    height: 14px;
    background: #e5e7eb;
    border-radius: 7px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.10);
}

.score-gauge-fill {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(to right, #ef4444 0%, #f97316 20%, #eab308 40%, #84cc16 60%, #22c55e 80%, #10b981 100%);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.score-gauge-pointer {
    position: absolute;
    top: -6px;
    width: 26px;
    height: 26px;
    background: #fff;
    border: 3px solid #3b82f6;
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.40);
    z-index: 1;
    pointer-events: none;
}

.gauge-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.gauge-scale-labels span {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
}

.scale-negative { color: #ef4444 !important; }
.scale-neutral  { color: #6b7280 !important; }
.scale-positive { color: #10b981 !important; }

.score-number {
    font-size: 32px;
    font-weight: 800;
    color: #1f2937;
    margin-top: 10px;
    letter-spacing: -0.02em;
}

.score-number::after {
    content: " / 100";
    font-size: 14px;
    font-weight: 400;
    color: #9ca3af;
}

/* 情感状态类徽章弹跳动画（符合规范） */
@keyframes sa-badge-pop {
    from { transform: scale(0.82); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    to   { transform: scale(1);    opacity: 1; }
}

.sentiment-badge.badge-anim {
    animation: sa-badge-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* .emotion-badge 通用弹跳动画（量化结果展示强感知） */
.emotion-badge {
    animation: sa-badge-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* 卡片入场动画 */
.sa-anim-in,
.hg-anim-in {
    animation: sa-card-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes sa-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 分析摘要 ---- */
.sa-summary {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: 12px;
    margin-bottom: 20px;
}

.summary-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1.4;
}

.summary-text {
    font-size: 14px;
    color: #92400e;
    line-height: 1.7;
    font-weight: 500;
}

/* ---- 详情双列网格 ---- */
.sa-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.sa-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 18px;
    transition: box-shadow 0.22s ease, border-color 0.22s ease;
    will-change: box-shadow;
}

.sa-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.sa-card-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 1.5px solid #f3f4f6;
}

.card-title-icon {
    font-size: 16px;
}

/* ---- 情绪成分列表 ---- */
.emotions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.emotion-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emotion-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    width: 52px;
    flex-shrink: 0;
    text-align: right;
}

.emotion-bar-track {
    flex: 1;
    height: 10px;
    background: #f3f4f6;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.emotion-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}

.emotion-score-text {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* 情绪颜色映射 */
.emotion-joy     { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.emotion-expect  { background: linear-gradient(90deg, #34d399, #10b981); }
.emotion-trust   { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.emotion-surprise{ background: linear-gradient(90deg, #c084fc, #a855f7); }
.emotion-fear    { background: linear-gradient(90deg, #6b7280, #4b5563); }
.emotion-disgust { background: linear-gradient(90deg, #84cc16, #65a30d); }
.emotion-anger   { background: linear-gradient(90deg, #f87171, #ef4444); }
.emotion-sadness { background: linear-gradient(90deg, #818cf8, #6366f1); }
.emotion-calm    { background: linear-gradient(90deg, #94a3b8, #64748b); }
.emotion-miss    { background: linear-gradient(90deg, #f9a8d4, #ec4899); }
.emotion-gratitude { background: linear-gradient(90deg, #86efac, #22c55e); }
.emotion-excited { background: linear-gradient(90deg, #fb923c, #f97316); }
.emotion-default { background: linear-gradient(90deg, #93c5fd, #3b82f6); }

/* 关键情感词第二标题（带分隔线） */
.sa-aspects-title {
    margin-top: 16px !important;
    padding-top: 16px !important;
    border-top: 1.5px solid #f3f4f6 !important;
}

/* ---- 关键情感词 ---- */
.key-phrases-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.key-phrase-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #1d4ed8;
    transition: all 0.2s ease;
    cursor: pointer;
    will-change: transform;
    user-select: none;
}

.key-phrase-tag:hover {
    background: #dbeafe;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.18);
}

/* ---- 多维度分析 ---- */
.aspects-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.aspect-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 9px;
    border: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.aspect-item:hover {
    background: #f3f4f6;
}

.aspect-name {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

.aspect-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.aspect-badge.badge-positive {
    background: #d1fae5;
    color: #065f46;
}

.aspect-badge.badge-negative {
    background: #fee2e2;
    color: #7f1d1d;
}

.aspect-badge.badge-neutral {
    background: #f3f4f6;
    color: #6b7280;
}

/* ---- 结果操作栏 ---- */
.sa-result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1.5px solid #f3f4f6;
    margin-top: 4px;
}

.action-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* ---- 情感分数动态颜色 ---- */
.score-positive { color: #059669 !important; }
.score-negative { color: #dc2626 !important; }
.score-neutral  { color: #6b7280 !important; }

/* ---- 空状态提示 ---- */
.sa-empty-hint {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
    padding: 4px 0;
}

/* ---- Toast 轻提示 ---- */
.sa-toast {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
    white-space: nowrap;
    pointer-events: none;
}

/* ---------- 暗黑模式 ---------- */
body.dark-mode .form-group label {
    color: #e2e8f0;
}

body.dark-mode .sa-input-area {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

body.dark-mode .sa-section-banner {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 50%, #4338ca 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .sa-banner-badge {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

body.dark-mode .sa-loading {
    background: linear-gradient(135deg, #0c2340 0%, #172033 100%);
    border-color: #1e3a5f;
    color: #60a5fa;
}

body.dark-mode .mode-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .mode-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: #172033;
}

body.dark-mode .mode-btn.active {
    color: #fff;
    border-color: #3b82f6;
    background: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 100%);
}

body.dark-mode .mode-tip { color: #475569; }

body.dark-mode .loading-spinner {
    border-color: #1e3a5f;
    border-top-color: #60a5fa;
}

body.dark-mode .sentiment-overview {
    background: linear-gradient(135deg, #0f2942 0%, #0f172a 100%);
}

body.dark-mode .sentiment-badge.badge-positive {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #047857;
}

body.dark-mode .sentiment-badge.badge-positive .sentiment-label { color: #6ee7b7; }

body.dark-mode .sentiment-badge.badge-negative {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    border-color: #991b1b;
}

body.dark-mode .sentiment-badge.badge-negative .sentiment-label { color: #fca5a5; }

body.dark-mode .sentiment-badge.badge-neutral {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #475569;
}

body.dark-mode .sentiment-badge.badge-neutral .sentiment-label { color: #e2e8f0; }

body.dark-mode .sentiment-sub { color: #64748b; }

body.dark-mode .score-title { color: #94a3b8; }

body.dark-mode .score-gauge-track { background: #334155; }

body.dark-mode .score-gauge-pointer {
    background: #1e293b;
    border-color: #60a5fa;
}

body.dark-mode .score-number { color: #f1f5f9; }
body.dark-mode .score-number::after { color: #475569; }

body.dark-mode .sa-summary {
    background: #1c1a08;
    border-color: #854d0e;
}

body.dark-mode .summary-text { color: #fbbf24; }

body.dark-mode .sa-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .sa-card-title {
    color: #f1f5f9;
    border-color: #334155;
}

body.dark-mode .emotion-name { color: #cbd5e1; }

body.dark-mode .emotion-bar-track { background: #334155; }

body.dark-mode .emotion-score-text { color: #475569; }

body.dark-mode .key-phrase-tag {
    background: #172033;
    border-color: #1d4ed8;
    color: #93c5fd;
}

body.dark-mode .key-phrase-tag:hover {
    background: #1e3a5f;
    border-color: #60a5fa;
}

body.dark-mode .aspect-item {
    background: #0f172a;
    border-color: #1e293b;
}

body.dark-mode .aspect-item:hover { background: #1e293b; }

body.dark-mode .aspect-name { color: #cbd5e1; }

body.dark-mode .aspect-badge.badge-positive {
    background: #064e3b;
    color: #6ee7b7;
}

body.dark-mode .aspect-badge.badge-negative {
    background: #450a0a;
    color: #fca5a5;
}

body.dark-mode .aspect-badge.badge-neutral {
    background: #1e293b;
    color: #64748b;
}

body.dark-mode .action-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .action-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: #172033;
}

body.dark-mode .sa-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    border-color: #475569;
}

body.dark-mode .sa-result-actions {
    border-top-color: #334155;
}

body.dark-mode .sa-aspects-title {
    border-top-color: #334155 !important;
}

body.dark-mode .score-positive { color: #34d399 !important; }
body.dark-mode .score-negative { color: #f87171 !important; }
body.dark-mode .score-neutral  { color: #94a3b8 !important; }

body.dark-mode .sa-empty-hint { color: #475569; }

body.dark-mode .sa-toast {
    background: #0f172a;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

body.dark-mode .required-mark { color: #f87171; }
body.dark-mode .char-count { color: #64748b; }
body.dark-mode .char-count.danger { color: #f87171; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .sentiment-overview {
        flex-direction: column;
        align-items: stretch;
    }

    .sentiment-badge-wrap {
        display: flex;
        justify-content: center;
    }

    .sa-detail-grid {
        grid-template-columns: 1fr;
    }

    .actions-group {
        flex-wrap: wrap;
    }

    .mode-tip-group {
        display: none;
    }
}
