/* DS随心转 AI聊天页面 - 消息内容样式 */

/* 欢迎区域 */
.chat-welcome {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background: #F9F9FB;
}

.welcome-content {
    text-align: center;
    color: #333;
    width: 100%;
    padding: 0 20px;
}

.welcome-content .deepseek-description {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
}

.welcome-content h1 {
    font-size: 24px;
}

.welcome-content p {
    font-size: 14px;
}

/* 品牌欢迎区域 */
.brand-section {
    text-align: center;
    margin-bottom: 60px;
}

.brand-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.brand-header img {
    width: 48px;
    height: 48px;
}

.brand-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    font-family: "Noto Serif SC", serif;
}

.brand-greeting {
    font-size: 16px;
    color: #666;
    font-weight: 400;
}

/* 搜索状态 */
.search-status {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
    border: 1px solid #eee;
}

.search-status .layui-icon {
    margin-right: 6px;
    color: #1976d2;
}

.search-status-completed {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.search-sources-toggle {
    margin-left: auto;
    cursor: pointer;
    color: #1976d2;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 2px;
    user-select: none;
}

.search-sources-list {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-source-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-decoration: none;
    color: #333;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.search-source-item:hover {
    background-color: #f0f0f0;
    text-decoration: none;
}

.search-source-index {
    background: #e3f2fd;
    color: #1976d2;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.search-source-info {
    flex: 1;
    min-width: 0;
}

.search-source-title {
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-source-url {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-source-item.highlight {
    background-color: #fff3cd;
    transition: background-color 0.3s;
}

/* 引用标注 */
.citation-ref {
    color: #1976d2;
    cursor: pointer;
    margin: 0 2px;
    font-weight: 500;
    user-select: none;
}

.citation-ref:hover {
    text-decoration: underline;
}

/* 指令台时间轴样式 */
.command-timeline-status {
    max-width: 520px;
    margin: 18px auto 8px;
    width: 100%;
    padding: 0 14px 0 62px;
}

.timeline-status-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.4px;
    color: #4B5563;
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid rgba(148, 163, 184, 0.26);
}

.command-timeline-status.is-resetting .timeline-status-pill {
    animation: continuityPulse 0.46s ease-out 1;
}

@keyframes continuityPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.22);
    }

    45% {
        transform: scale(1.04);
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.05);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.command-timeline {
    --timeline-area-bg: var(--chat-main-bg, #F9F9FB);
    --timeline-axis-x: 30px;
    --timeline-content-offset: 62px;
    --timeline-line-color: #D9E0EA;
    --timeline-node-color: #7B8EA9;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 14px 180px var(--timeline-content-offset);
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    border-radius: 18px;
    position: relative;
}

.command-timeline::before {
    content: '';
    position: absolute;
    left: var(--timeline-axis-x);
    top: 10px;
    bottom: 20px;
    width: 3px;
    border-radius: 999px;
    background: var(--timeline-line-color);
}

.command-timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.command-timeline-empty i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
    display: block;
}

/* 指令卡片 */
.command-card {
    --command-card-active-bg: #FDF8EE;
    --command-card-active-accent: #2563EB;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    position: relative;
}

.command-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.command-card.active {
    background: var(--command-card-active-bg);
    box-shadow: inset 4px 0 0 var(--command-card-active-accent), 0 12px 26px rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.command-card::before {
    content: '';
    position: absolute;
    top: 22px;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid #ffffff;
    filter: drop-shadow(-1px 0 1px rgba(15, 23, 42, 0.08));
}

.command-card.active::before {
    content: none;
}

.command-card::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    left: calc(var(--timeline-axis-x) - var(--timeline-content-offset) - 5px);
    top: 24px;
    background: var(--timeline-node-color);
    box-shadow: 0 0 0 3px var(--timeline-area-bg);
}

.command-card.generating:not(.active) {
    animation: cardPulse 1.5s ease-in-out infinite;
}

@keyframes cardPulse {

    0%,
    100% {
        box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
    }

    50% {
        box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
    }
}

.command-card-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.command-card.active .command-card-content::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -28px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 10px solid var(--command-card-active-bg);
    filter: drop-shadow(1px 0 0 rgba(15, 23, 42, 0.08));
}

.command-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.command-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.command-user-label {
    font-size: 13px;
    color: #666;
    flex-shrink: 0;
}

.command-answer-title {
    width: 100%;
    margin-bottom: 6px;
    font-size: 18px;
    line-height: 1.45;
    font-weight: 700;
    color: #111827;
    white-space: pre-wrap;
    word-break: break-word;
}

.command-user-text {
    font-size: 14px;
    color: #2B2B2B;
    font-weight: 500;
    line-height: 1.6;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.command-user-text::before {
    content: '我：';
}

.command-card.active .command-user-text {
    white-space: pre-line;
    word-break: break-word;
}

.command-card.active .command-user-text.is-multiline-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    white-space: pre-line;
    overflow: hidden;
}

.command-card.active .command-user-text.is-expanded {
    display: block;
    white-space: pre-wrap;
    overflow: visible;
}

.command-question-toggle {
    margin-top: 6px;
    padding: 0;
    border: none;
    background: none;
    color: #6B7280;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.command-question-toggle:hover {
    color: #1F2937;
    text-decoration: underline;
}

.command-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.command-file-item {
    border: 1px solid rgba(37, 99, 235, 0.2);
    background: rgba(37, 99, 235, 0.03);
    border-radius: 6px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #2563EB;
    cursor: default;
}

.command-file-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.command-file-item .file-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.command-status-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.command-status-badge.generating {
    background: rgba(59, 130, 246, 0.1);
    color: #2563EB;
}

.command-status-badge.generating::before {
    content: "⏳";
}

.command-status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.command-status-badge.success::before {
    content: "✅";
    margin-right: 2px;
}

.command-status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

.command-status-badge.error::before {
    content: "❌";
    margin-right: 2px;
}

.command-time {
    font-size: 12px;
    color: #999;
}

.timeline-connector {
    display: none;
}

.command-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    display: none;
    gap: 12px;
}

.command-card:hover .command-card-actions {
    display: flex;
}

.command-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: none;
}

.command-action-btn:hover {
    color: #2563EB;
    transform: translateY(-1px);
}

.command-action-btn.copy-question:hover {
    color: #10B981;
}

.command-action-btn.edit-resend:hover {
    color: #F59E0B;
}

/* Command timeline tooltip: keep above neighbor action buttons */
.command-action-btn[data-tooltip],
.footer-btn[data-tooltip] {
    position: relative;
}

.command-action-btn[data-tooltip]::after,
.footer-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 6000;
    margin-left: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.command-action-btn[data-tooltip]::before,
.footer-btn[data-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    top: auto;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 6000;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.command-action-btn[data-tooltip]:hover,
.footer-btn[data-tooltip]:hover {
    z-index: 40;
}

.command-action-btn[data-tooltip]:hover::after,
.command-action-btn[data-tooltip]:hover::before,
.footer-btn[data-tooltip]:hover::after,
.footer-btn[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

.command-action-btn[data-tooltip]:hover::after,
.footer-btn[data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(-2px);
}

/* 消息列表容器 - 兼容旧版 */
.chat-messages {
    flex: none;
    padding: 20px 0 160px 0;
    margin: 0 auto;
    width: 90%;
    display: none;
}

/* 消息通用样式 */
.message {
    display: flex;
    margin-bottom: 24px;
    align-items: flex-start;
    max-width: 100%;
}

.message.user-message {
    justify-content: flex-end;
}

.message.ai-message {
    justify-content: flex-start;
}

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: relative;
    max-width: 85%;
}

.ai-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    position: relative;
    padding-left: 42px;
    /* Logo space */
}

/* AI Logo */
.ai-message-logo {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-message-logo img {
    border-radius: 50%;
    object-fit: cover;
    width: 36px;
    height: 36px;
}

/* 消息气泡 */
.message-bubble {
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
    padding: 12px 16px;
}

.ai-message .message-bubble {
    color: #333;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 消息时间/元信息 */
.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    opacity: 0.7;
}

.user-message .message-time {
    text-align: right;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* 版本切换 */
.message-version-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    user-select: none;
}

.version-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.version-nav-btn:hover:not(:disabled) {
    background: #e0e0e0;
    color: #333;
}

.version-nav-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.version-nav-btn .iconfont {
    font-size: 12px;
}

.version-indicator {
    font-weight: 500;
    min-width: 30px;
    text-align: center;
}

/* 消息编辑按钮 (User) */
.message-edit-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.user-message:hover .message-edit-btn {
    display: inline-flex;
}

.message-edit-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.message-edit-btn .iconfont {
    font-size: 14px;
}

/* 消息编辑状态 */
.message.editing .message-bubble {
    display: none;
}

.message.version-hidden {
    display: none !important;
}

/* User tools container */
.user-message-tools {
    display: none;
    position: absolute;
    left: 0;
    bottom: -28px;
    gap: 4px;
    align-items: center;
}

.user-message:last-of-type .user-message-tools,
.user-message.show-tools .user-message-tools,
.user-message:hover .user-message-tools {
    display: flex;
}

.user-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.user-tool-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.user-tool-btn .layui-icon {
    font-size: 14px;
}

/* 消息编辑区域 */
.message-edit-area {
    display: none;
    width: 100%;
}

.message.editing .message-edit-area {
    display: block;
}

.edit-textarea {
    width: 100%;
    min-height: 60px;
    max-height: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.edit-textarea:focus {
    border-color: #667eea;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.edit-cancel-btn,
.edit-confirm-btn {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.edit-cancel-btn {
    background: #f5f5f5;
    color: #666;
}

.edit-cancel-btn:hover {
    background: #e8e8e8;
}

.edit-confirm-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.edit-confirm-btn:hover {
    opacity: 0.9;
}

/* 消息中的文件显示 */
.message-files {
    padding: 8px;
    border-radius: 8px;
}

.message-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 6px;
    padding: 8px;
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 8px;
    font-size: 14px;
    color: #28a745;
    transition: all 0.2s ease;
}

.message-file .file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.message-file svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* 操作工具栏 */
.message-tools {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.message.ai-message.last-ai-message .message-tools,
.message.ai-message:hover .message-tools {
    opacity: 1;
    visibility: visible;
}

.message-tools .tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    color: white;
    min-width: auto;
    position: relative;
}

.message-tools .tool-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-tools .tool-btn svg {
    width: 20px;
    height: 20px;
}

.message-tools .tool-btn .iconfont {
    font-size: 14px;
}

.message-tools .tool-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* 各种颜色按钮 */
.message-tools .copy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-tools .refine-btn {
    background: linear-gradient(135deg, #00bfa5 0%, #00897b 100%);
}

.message-tools .regenerate-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-tools .export-word {
    background: linear-gradient(135deg, #4285f4 0%, #1a73e8 100%);
}

.message-tools .export-pdf {
    background: linear-gradient(135deg, #ea4335 0%, #d33b2c 100%);
}

.message-tools .export-excel {
    background: linear-gradient(135deg, #34a853 0%, #28a745 100%);
}

.message-tools .export-image {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(1);
        opacity: 0.6;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    40% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
    }
}

/* 推理内容 */
.message-reasoning {
    width: 100%;
    margin-bottom: 12px;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    background-color: #f8f9ff;
    overflow: hidden;
}

.reasoning-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #e3f2fd;
    border-bottom: 1px solid #e1e4e8;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.reasoning-header:hover {
    background-color: #bbdefb;
}

.reasoning-header-left {
    display: flex;
    align-items: center;
}

.reasoning-header i {
    margin-right: 8px;
    color: #1976d2;
    font-size: 16px;
}

.reasoning-header span {
    flex: 1;
    font-weight: 500;
    color: #1976d2;
    font-size: 14px;
}

.reasoning-toggle {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.reasoning-toggle:hover {
    background-color: rgba(25, 118, 210, 0.1);
}

.reasoning-toggle i {
    color: #1976d2;
    font-size: 14px;
    margin: 0;
}

.reasoning-content {
    padding: 16px;
    display: none;
    background-color: #fafafa;
    border-top: 1px solid #e1e4e8;
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
}

/* Markdown Styles (Prose) */
.message-content,
.message-bubble,
.reasoning-content {
    line-height: 1.8;
    word-wrap: break-word;
    font-size: 15px;
    color: #333;
}

.message-content h1,
.message-bubble h1,
.reasoning-content h1 {
    font-size: 1.8em;
    border-bottom: 2px solid #e1e4e8;
    padding-bottom: 8px;
    margin: 24px 0 16px 0;
    font-weight: 600;
    color: #2c3e50;
}

.message-content h2,
.message-bubble h2,
.reasoning-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 6px;
    margin: 20px 0 16px 0;
    font-weight: 600;
    color: #2c3e50;
}

.message-content h3,
.message-bubble h3,
.reasoning-content h3 {
    font-size: 1.3em;
    margin: 16px 0;
    font-weight: 600;
    color: #2c3e50;
}

.message-content h4,
.message-bubble h4,
.reasoning-content h4 {
    font-size: 1.1em;
    margin: 16px 0;
    font-weight: 600;
    color: #2c3e50;
}

.message-content p,
.message-bubble p,
.reasoning-content p {
    margin: 2px 0 16px;
    line-height: 1.8;
}

.message-content ul,
.message-bubble ul,
.reasoning-content ul,
.message-content ol,
.message-bubble ol,
.reasoning-content ol {
    margin: 16px 0;
    padding-left: 24px;
    line-height: 1.8;
}

.message-content li,
.message-bubble li,
.reasoning-content li {
    margin: 8px 0;
}

.message-content pre,
.message-bubble pre,
.reasoning-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 20px;
    overflow: visible;
    margin: 20px 0;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
    word-break: break-all;
}

.message-content code,
.message-bubble code,
.reasoning-content code {
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    background-color: #f1f3f4;
    border: 1px solid #e8eaed;
    border-radius: 4px;
    color: #d73a49;
}

.message-content pre code,
.message-bubble pre code,
.reasoning-content pre code {
    padding: 0;
    background-color: transparent;
    border: 0;
    color: inherit;
    word-break: break-all;
    white-space: pre-wrap;
}

.message-content blockquote,
.message-bubble blockquote {
    border-left: 4px solid #1976d2;
    padding: 16px 20px;
    margin: 20px 0;
    background-color: #f8f9ff;
    color: #495057;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

.message-content table,
.message-bubble table {
    border-collapse: collapse;
    margin: 20px 0;
    width: 100%;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    table-layout: auto;
}

.message-content th,
.message-bubble th {
    background-color: #f6f8fa;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e1e4e8;
    padding: 12px 16px;
    text-align: left;
}

.message-content td,
.message-bubble td {
    background-color: #fff;
    border: 1px solid #e1e4e8;
    padding: 12px 16px;
}

.message-content tr:nth-child(even) td,
.message-bubble tr:nth-child(even) td {
    background-color: #f9f9f9;
}

.message-content .hljs,
.message-bubble .hljs {
    background: #f8f9fa !important;
    line-height: 1.6;
}

.message-content a,
.message-bubble a {
    color: #1976d2;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.2s ease;
    word-break: break-all;
}

.message-content a:hover,
.message-bubble a:hover {
    border-bottom: 1px solid #1976d2;
}

.streaming-temp {
    opacity: 0.7;
    font-style: italic;
    color: #666;
}

/* Math */
.message-content .math-block,
.message-bubble .math-block {
    margin: 0;
    text-align: center;
    overflow-x: auto;
    padding: 0;
}

.message-content .math-inline,
.message-bubble .math-inline {
    display: inline;
    padding: 2px 4px;
}

.message-content .math-error,
.message-bubble .math-error {
    color: #d73a49;
    font-family: monospace;
    background-color: #ffeaea;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ffcdd2;
}

.math-placeholder {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    cursor: help;
}

/* Version Switcher Styles */
.version-pager {
    display: inline-flex;
    align-items: center;
    border-radius: 12px;
    padding: 2px;
    margin-right: 8px;
    color: #666;
    height: 24px;
    flex-shrink: 0;
    margin-top: 0;
}

.version-btn {
    cursor: pointer;
    padding: 0 4px;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
    color: #666;
    /* Default enabled color */
}

.version-btn:hover {
    color: #2563EB;
    /* Ceramic Blue on hover */
    font-weight: bold;
}

.version-btn.disabled {
    cursor: not-allowed;
    color: #E0E0E0;
    /* Very light gray for disabled */
    pointer-events: none;
    opacity: 0.5;
}

.version-count {
    margin: 0 4px;
    font-weight: 600;
    font-size: 13px;
    user-select: none;
}

.command-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.command-user-text {
    overflow-wrap: break-word;
}

/* Response Footer */
.response-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-top: 8px;
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
    border-radius: 0 0 12px 12px;
}

.command-card.active .response-footer {
    background-color: #f7f2e8;
    border-top-color: #e9e0d0;
}

.command-card-content .response-footer {
    margin: 12px -16px -12px -16px;
    /* Negative margin to span full width */
    padding: 8px 16px;
}

.editor-content {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.editor-content.is-card-switching {
    animation: editorCardSwitch 0.2s ease;
}

@keyframes editorCardSwitch {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    45% {
        opacity: 0.08;
        transform: translateY(6px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-center {
    flex: 1;
    justify-content: center;
}

.footer-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 12px;
}

.footer-btn:hover {
    background-color: #e0e0e0;
    color: #333;
}

.regenerate-response-btn .layui-icon {
    font-size: 16px;
}

.copy-response-btn {
    color: #999;
}

.copy-response-btn:hover {
    color: #2563EB;
}

.ai-version-btn {
    cursor: pointer;
    padding: 0 4px;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s;
}

.ai-version-btn:hover {
    color: #2563EB;
    font-weight: bold;
}

.ai-version-btn.disabled {
    cursor: not-allowed;
    color: #999;
    pointer-events: none;
}

/* Model Info in Footer */
.footer-model-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #e0e0e0;
}

.footer-model-logo {
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.footer-model-name {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}
