/* =========================================================
   微服务拆分建议工具 - microservice_split_advice.css
   布局风格参考 svg_editor.css，三栏式工作台布局
   ========================================================= */

/* ========== 主容器 ========== */
.msa-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 680px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.msa-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.msa-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.toolbar-center {
    flex: 1;
    justify-content: center;
}

.toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.toolbar-btn {
    padding: 5px 11px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #667eea;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.toolbar-btn:active {
    transform: translateY(0);
}

/* ========== 主内容三栏 ========== */
.msa-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f8fafc;
}

/* ========== 左侧输入面板 ========== */
.msa-input-panel {
    width: 268px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.history-header {
    top: auto;
    position: relative;
    border-top: 2px solid #e2e8f0;
}

.panel-body {
    padding: 12px;
    flex-shrink: 1;
    overflow-y: auto;
    max-height: calc(100vh - 380px);
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
}

.label-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 11px;
    margin-left: 4px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 12px;
    color: #334155;
    background: #fafafa;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.12);
    background: #fff;
}

.form-textarea {
    resize: vertical;
    min-height: 70px;
}

.form-textarea.mono {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 11.5px;
    line-height: 1.6;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2394a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* 生成按钮区 */
.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-bottom: 4px;
}

.btn-analyze {
    flex: 1;
    padding: 10px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    letter-spacing: 0.3px;
}

.btn-analyze:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.45);
}

.btn-analyze:active:not(:disabled) {
    transform: translateY(0);
}

.btn-analyze:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.shortcut-hint {
    font-size: 0.8em;
    opacity: 0.65;
    color: #94a3b8;
    white-space: nowrap;
    transition: transform 0.15s;
}

.shortcut-hint:hover {
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .shortcut-hint { display: none; }
}

/* 历史记录 */
.msa-history-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 80px;
    overflow: hidden;
}

.msa-history-section .history-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.msa-history-section .history-header:hover {
    background: #f1f5f9;
}

.history-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.msa-collapse-icon {
    font-size: 10px;
    color: #64748b;
    display: inline-block;
    width: 12px;
    text-align: center;
    transition: transform 0.25s ease;
}

.msa-history-section.collapsed .msa-collapse-icon {
    transform: rotate(-90deg);
}

.msa-history-section.collapsed .history-list {
    display: none;
}

.clear-history-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 3px;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #fde8e8;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    min-height: 60px;
}

.history-empty {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    padding: 16px 8px;
}

.history-item {
    padding: 9px 11px;
    margin-bottom: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: fadeIn 0.2s ease;
}

.history-item:hover {
    background: #f1f5f9;
    border-color: #c7d6ea;
    transform: translateX(2px);
}

.history-item-name {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 20px;
}

.history-item-time {
    font-size: 11px;
    color: #94a3b8;
}

.history-item-del {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #fde8e8;
    color: #ef4444;
    border: none;
    border-radius: 3px;
    width: 18px;
    height: 18px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.history-item:hover .history-item-del {
    opacity: 1;
}

.history-item-del:hover {
    background: #ef4444;
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 中间结果面板 ========== */
.msa-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    border-right: 1px solid #e2e8f0;
    min-width: 380px;
    position: relative;
}

.result-toolbar {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* 加载遮罩 */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* 结果内容区 */
.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 26px;
    scroll-behavior: smooth;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 320px;
    text-align: center;
    color: #94a3b8;
    padding: 20px;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.45;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 10px;
}

.empty-desc {
    font-size: 13px;
    color: #94a3b8;
    max-width: 310px;
    line-height: 1.7;
    margin-bottom: 20px;
}

.empty-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.tip-item {
    font-size: 12px;
    color: #64748b;
    text-align: left;
}

kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    font-family: monospace;
    color: #475569;
}

/* ========== Markdown 渲染样式 ========== */
.md-result {
    line-height: 1.75;
    color: #334155;
    font-size: 13.5px;
}

.md-result h1 {
    font-size: 18px;
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 16px;
    font-weight: 700;
}

.md-result h2 {
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    margin-top: 28px;
    margin-bottom: 12px;
    padding-bottom: 7px;
    border-bottom: 2px solid #667eea;
    background: linear-gradient(90deg, rgba(102,126,234,0.06) 0%, transparent 100%);
    padding-left: 8px;
    border-radius: 0 4px 0 0;
}

.md-result h2:first-child {
    margin-top: 0;
}

.md-result h3 {
    font-size: 13.5px;
    font-weight: 600;
    color: #475569;
    margin-top: 18px;
    margin-bottom: 8px;
}

.md-result p {
    font-size: 13px;
    line-height: 1.8;
    color: #475569;
    margin-bottom: 10px;
}

.md-result ul,
.md-result ol {
    font-size: 13px;
    line-height: 1.8;
    color: #475569;
    padding-left: 22px;
    margin-bottom: 12px;
}

.md-result li {
    margin-bottom: 5px;
}

.md-result table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    overflow: hidden;
}

.md-result th {
    background: linear-gradient(to bottom, #f1f5f9, #e9eef5);
    padding: 9px 12px;
    text-align: left;
    border: 1px solid #e2e8f0;
    font-weight: 700;
    color: #475569;
    font-size: 12px;
}

.md-result td {
    padding: 8px 12px;
    border: 1px solid #e8edf4;
    color: #334155;
    vertical-align: top;
}

.md-result tr:nth-child(even) td {
    background: #f8fafc;
}

.md-result tr:hover td {
    background: #f0f4ff;
    transition: background 0.15s;
}

.md-result code {
    background: #f0f4ff;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.md-result pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #667eea;
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    margin-bottom: 16px;
    font-size: 12px;
}

.md-result pre code {
    background: none;
    padding: 0;
    border: none;
    color: #334155;
    font-size: 12px;
}

.md-result blockquote {
    border-left: 3px solid #667eea;
    padding: 10px 16px;
    background: linear-gradient(90deg, rgba(102,126,234,0.05) 0%, transparent 100%);
    margin: 14px 0;
    border-radius: 0 6px 6px 0;
    color: #64748b;
    font-size: 13px;
}

.md-result hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 18px 0;
}

.md-result strong {
    color: #334155;
    font-weight: 700;
}

/* ========== 右侧参考面板 ========== */
.msa-reference-panel {
    width: 285px;
    background: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.ref-body {
    overflow-y: auto;
    flex: 1;
}

.ref-section {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.ref-title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #e2e8f0;
    letter-spacing: 0.2px;
}

.ref-item {
    padding: 8px 11px;
    background: #f8fafc;
    border: 1px solid #e8edf4;
    border-left: 3px solid #667eea;
    border-radius: 5px;
    margin-bottom: 6px;
    transition: all 0.15s;
}

.ref-item:hover {
    background: #f1f5fb;
    border-left-color: #764ba2;
}

.ref-item.warn {
    border-left-color: #f59e0b;
    background: #fffbf0;
}

.ref-item.warn:hover {
    background: #fef3c7;
}

.ref-item-name {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 3px;
}

.ref-item-desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.55;
}

/* 基础设施清单 */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 4px;
    transition: background 0.15s;
}

.check-item:hover {
    background: #f1f5f9;
}

.check-item input[type="checkbox"] {
    accent-color: #667eea;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* 粒度参考表 */
.granularity-table {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    font-size: 12px;
}

.gt-row {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

.gt-row:last-child {
    border-bottom: none;
}

.gt-header {
    background: linear-gradient(to bottom, #f1f5f9, #eaeff6);
    font-weight: 700;
    color: #475569;
}

.gt-row span {
    flex: 1;
    padding: 7px 11px;
    border-right: 1px solid #e2e8f0;
}

.gt-row span:last-child {
    border-right: none;
    text-align: center;
    font-weight: 600;
    color: #667eea;
}

.gt-header span:last-child {
    color: #475569;
}

.gt-row:not(.gt-header):hover {
    background: #f8fafc;
}

/* 策略说明 */
.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.strategy-item {
    padding: 8px 11px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    transition: all 0.15s;
}

.strategy-item:hover {
    background: #f0f4ff;
    border-color: #c7d2fe;
}

.strategy-name {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 3px;
}

.strategy-desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.5;
}

/* ========== 暗黑模式 ========== */
body.theme-dark .msa-container {
    background: #1e293b;
}

body.theme-dark .msa-main {
    background: #1e293b;
}

body.theme-dark .msa-input-panel,
body.theme-dark .msa-result-panel,
body.theme-dark .msa-reference-panel {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .panel-header {
    background: linear-gradient(to bottom, #1e293b, #162035);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .history-header {
    border-top-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .form-group label {
    color: #94a3b8;
}

body.theme-dark .form-input,
body.theme-dark .form-textarea,
body.theme-dark .form-select {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .form-input:focus,
body.theme-dark .form-textarea:focus,
body.theme-dark .form-select:focus {
    border-color: #667eea;
    background: #22304a;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.18);
}

body.theme-dark .history-item {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .history-item:hover {
    background: #22304a;
}

body.theme-dark .history-item-name {
    color: #e2e8f0;
}

body.theme-dark .result-content {
    background: #0f172a;
}

body.theme-dark .loading-overlay {
    background: rgba(15, 23, 42, 0.92);
}

body.theme-dark .empty-title {
    color: #94a3b8;
}

body.theme-dark .empty-tips {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .tip-item {
    color: #64748b;
}

body.theme-dark kbd {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.theme-dark .md-result {
    color: #cbd5e1;
}

body.theme-dark .md-result h1 {
    color: #e2e8f0;
}

body.theme-dark .md-result h2 {
    color: #cbd5e1;
    border-bottom-color: #667eea;
    background: linear-gradient(90deg, rgba(102,126,234,0.12) 0%, transparent 100%);
}

body.theme-dark .md-result h3 {
    color: #94a3b8;
}

body.theme-dark .md-result p,
body.theme-dark .md-result li {
    color: #94a3b8;
}

body.theme-dark .md-result th {
    background: linear-gradient(to bottom, #1e293b, #1a2840);
    border-color: #334155;
    color: #cbd5e1;
}

body.theme-dark .md-result td {
    border-color: #2a3a50;
    color: #94a3b8;
}

body.theme-dark .md-result tr:nth-child(even) td {
    background: #1a2332;
}

body.theme-dark .md-result tr:hover td {
    background: #1e2d40;
}

body.theme-dark .md-result code {
    background: #1e293b;
    border-color: rgba(102, 126, 234, 0.25);
    color: #93c5fd;
}

body.theme-dark .md-result pre {
    background: #1e293b;
    border-color: #334155;
    border-left-color: #667eea;
}

body.theme-dark .md-result pre code {
    color: #e2e8f0;
}

body.theme-dark .md-result blockquote {
    background: rgba(102, 126, 234, 0.08);
    color: #94a3b8;
}

body.theme-dark .md-result hr {
    border-top-color: #334155;
}

body.theme-dark .md-result strong {
    color: #e2e8f0;
}

body.theme-dark .ref-section {
    border-bottom-color: #1e293b;
}

body.theme-dark .ref-title {
    color: #94a3b8;
    border-bottom-color: #334155;
}

body.theme-dark .ref-item {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.15);
    border-left-color: #667eea;
}

body.theme-dark .ref-item:hover {
    background: #22304a;
}

body.theme-dark .ref-item.warn {
    background: #1e1a0e;
    border-left-color: #f59e0b;
}

body.theme-dark .ref-item.warn:hover {
    background: #252010;
}

body.theme-dark .ref-item-name {
    color: #e2e8f0;
}

body.theme-dark .ref-item-desc {
    color: #64748b;
}

body.theme-dark .check-item {
    color: #64748b;
}

body.theme-dark .check-item:hover {
    background: #1e293b;
}

body.theme-dark .granularity-table {
    border-color: #334155;
}

body.theme-dark .gt-row {
    border-color: #334155;
}

body.theme-dark .gt-header {
    background: linear-gradient(to bottom, #1e293b, #1a2332);
    color: #cbd5e1;
}

body.theme-dark .gt-row span {
    border-color: #334155;
}

body.theme-dark .gt-row:not(.gt-header):hover {
    background: #1a2332;
}

body.theme-dark .strategy-item {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.15);
}

body.theme-dark .strategy-item:hover {
    background: #22304a;
    border-color: rgba(102, 126, 234, 0.3);
}

body.theme-dark .strategy-desc {
    color: #64748b;
}

body.theme-dark .action-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.theme-dark .action-btn:hover {
    background: #22304a;
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .msa-reference-panel {
        display: none;
    }
    .msa-container {
        min-height: 580px;
    }
}

@media (max-width: 640px) {
    .msa-input-panel {
        width: 220px;
    }
    .toolbar-title {
        display: none;
    }
}

/* ========== 骨架屏加载动画 ========== */
.skeleton-loading {
    padding: 20px 24px;
}

.sk-analyzing-label {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: rgba(102, 126, 234, 0.07);
    border-radius: 6px;
    border-left: 3px solid #667eea;
    animation: sk-pulse 2s ease-in-out infinite;
}

@keyframes sk-pulse {
    0%, 100% { opacity: 0.9; }
    50%       { opacity: 0.45; }
}

.skeleton-block {
    background: linear-gradient(90deg, #eef2ff 25%, #e0e7ff 50%, #eef2ff 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: sk-shimmer 1.6s infinite linear, sk-pulse 2.4s ease-in-out infinite;
}

@keyframes sk-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sk-section {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.sk-section:last-child { border-bottom: none; }

.sk-h2  { height: 18px; width: 52%; margin-bottom: 10px; }
.sk-line { height: 12px; }
.sk-row  { height: 28px; border-radius: 3px; }

.w90 { width: 90%; }
.w85 { width: 85%; }
.w80 { width: 80%; }
.w75 { width: 75%; }
.w65 { width: 65%; }
.mt4 { margin-top: 6px; }
.mt8 { margin-top: 10px; }

/* 分析中标题动态点 */
.analyzing-dots {
    display: inline-block;
    min-width: 18px;
    text-align: left;
    letter-spacing: 1px;
}

/* ========== 模块数量徽章 ========== */
.module-count-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(102, 126, 234, 0.12);
    color: #667eea;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
    border: 1px solid rgba(102, 126, 234, 0.22);
    line-height: 1.8;
}

/* ========== 草稿暂存指示 ========== */
.draft-indicator {
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

/* ========== 结果字数统计 ========== */
.result-char-count {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    padding: 8px 2px 2px;
    font-size: 11px;
    color: #94a3b8;
    background: linear-gradient(to top, white 65%, transparent);
    pointer-events: none;
    margin-top: 4px;
}

/* ========== 返回顶部按钮 ========== */
.scroll-top-btn {
    position: absolute;
    bottom: 22px;
    right: 22px;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.55);
}

/* ========== 暗黑模式补充 ========== */
body.theme-dark .skeleton-block {
    background: linear-gradient(90deg, #1e293b 25%, #2a3a50 50%, #1e293b 75%);
    background-size: 200% 100%;
}

body.theme-dark .sk-analyzing-label {
    background: rgba(102, 126, 234, 0.14);
    color: #93c5fd;
    border-left-color: #667eea;
}

body.theme-dark .sk-section {
    border-bottom-color: #1e293b;
}

body.theme-dark .result-char-count {
    background: linear-gradient(to top, #0f172a 65%, transparent);
    color: #475569;
}

body.theme-dark .module-count-badge {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
    color: #93c5fd;
}

body.theme-dark .draft-indicator {
    color: #4ade80;
}

/* 折叠历史记录暗黑模式 */
body.theme-dark .msa-history-section .history-header:hover {
    background: #1e293b;
}

body.theme-dark .msa-collapse-icon {
    color: #94a3b8;
}
