/**
 * AI执行结果样式模块
 * 包含：表格、代码块、数字显示、列表、分隔线
 */

/* ==================== 消息气泡中的表格样式 ==================== */

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
    background-color: #ffffff;
}

.message-bubble table th {
    background-color: #f5f7fa;
    padding: 8px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #e4e7ed;
    white-space: nowrap;
}

.message-bubble table td {
    padding: 8px;
    border: 1px solid #e4e7ed;
    color: #606266;
}

.message-bubble tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.message-bubble tbody tr:hover {
    background-color: #f5f7fa;
}

/* ==================== 消息气泡中的代码块样式 ==================== */

.message-bubble pre {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.5;
    margin: 10px 0;
}

.message-bubble code {
    font-family: 'Courier New', Consolas, Monaco, monospace;
    color: #333;
}

/* 内联代码 */
.message-bubble :not(pre) > code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

/* ==================== 结果展示样式 ==================== */

/* 数字显示（大号） */
.message-bubble .result-number {
    font-size: 36px;
    font-weight: bold;
    color: #67c23a;
    text-align: center;
    padding: 20px;
}

/* 列表样式 */
.message-bubble ul {
    padding-left: 20px;
    margin: 10px 0;
}

.message-bubble li {
    margin: 5px 0;
    line-height: 1.6;
}

/* 分隔线 */
.message-bubble hr {
    border: none;
    border-top: 1px solid #e4e7ed;
    margin: 15px 0;
}

/* ==================== 🆕 阶段7：工具执行结果样式 ==================== */

.tool-result .execution-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
}

.tool-result .execution-status.success {
    color: #fff;
    font-weight: 600;
}

.tool-result .execution-intent {
    color: rgba(255, 255, 255, 0.95);
}

.tool-result .execution-time {
    color: rgba(255, 255, 255, 0.8);
}

.tool-result .execution-content {
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.tool-result .execution-error {
    border: 2px solid #f56c6c;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* ==================== 🆕 阶段4.1：执行结果独立气泡样式 ==================== */

/* 执行头部（独立气泡 - 简化版）*/
/* 🔧 修复5：统一气泡颜色，使用默认消息气泡颜色 */
.execution-header-standalone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ffffff;  /* 🔧 修复5：改为白色背景，与普通消息一致 */
    border: 1px solid #e4e7ed;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.execution-header-standalone .execution-status {
    font-weight: 600;
    font-size: 13px;
    color: #67c23a;  /* 🔧 修复5：改为绿色文字 */
}

.execution-header-standalone .execution-intent {
    font-size: 13px;
    color: #606266;  /* 🔧 修复5：改为深色文字 */
    font-weight: 500;
}

/* 执行表格（独立气泡）*/
.execution-table-standalone {
    background: #fff;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    overflow: hidden;
}

.execution-table-standalone .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f5f7fa;
    border-bottom: 1px solid #e4e7ed;
}

.execution-table-standalone .table-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.execution-table-standalone .table-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.execution-table-standalone .table-title {
    font-size: 14px;
    font-weight: 600;
    color: #303133;
}

.execution-table-standalone .table-count {
    font-size: 12px;
    color: #909399;
}

.execution-table-standalone .table-total-time {
    font-size: 12px;
    color: #67c23a;
    font-weight: 500;
    padding: 2px 8px;
    background: #f0f9ff;
    border-radius: 4px;
}

/* 🔧 修复9：统一按钮宽度和样式 */
.execution-table-standalone .btn-save-tool {
    padding: 6px 16px;  /* 🔧 增加padding使按钮更舒适 */
    min-width: 100px;  /* 🔧 统一最小宽度 */
    background: #fff;
    color: #4facfe;
    border: 1px solid #4facfe;
    border-radius: 6px;  /* 🔧 增加圆角 */
    font-size: 13px;  /* 🔧 增加字体大小 */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.execution-table-standalone .btn-save-tool:hover {
    background: #4facfe;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(79, 172, 254, 0.3);
}

.execution-table-standalone .btn-save-tool:active {
    transform: translateY(0);
}

.execution-table-standalone .btn-download-result {
    padding: 6px 16px;  /* 🔧 增加padding使按钮更舒适 */
    min-width: 100px;  /* 🔧 统一最小宽度 */
    background: #fff;
    color: #606266;
    border: 1px solid #dcdfe6;
    border-radius: 6px;  /* 🔧 增加圆角 */
    font-size: 13px;  /* 🔧 增加字体大小 */
    cursor: pointer;
    transition: all 0.2s ease;
}

.execution-table-standalone .btn-download-result:hover {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}

/* 🔧 阶段7：使用attachment-table-wrapper样式，移除冗余padding */
.execution-table-standalone .table-content {
    /* padding已由attachment-table-wrapper提供 */
    max-height: 400px;  /* 与文件预览一致 */
    overflow: auto;  /* 保持滚动 */
}

/* 表格样式优化 */
.execution-table-standalone .table-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.execution-table-standalone .table-content table th {
    background-color: #f5f7fa;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #e4e7ed;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.execution-table-standalone .table-content table td {
    padding: 10px;
    border: 1px solid #e4e7ed;
    color: #606266;
}

.execution-table-standalone .table-content tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.execution-table-standalone .table-content tbody tr:hover {
    background-color: #f0f2f5;
    transition: background-color 0.2s ease;
}

/* ==================== 旧版：AI回复三块结构样式（已弃用）==================== */

.ai-response-structured {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 8px 0;
}

/* 1️⃣ 执行头部 */
.ai-response-structured .response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(79, 172, 254, 0.15);
}

.ai-response-structured .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ai-response-structured .execution-status {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}

.ai-response-structured .execution-intent {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.ai-response-structured .execution-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin-left: auto;
}

.ai-response-structured .header-right {
    display: flex;
    align-items: center;
}

.ai-response-structured .btn-save-tool {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #4facfe;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-response-structured .btn-save-tool:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}

.ai-response-structured .btn-save-tool:active {
    transform: translateY(0);
}

/* 2️⃣ 结果预览区（独立卡片样式）*/
.ai-response-structured .response-result {
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-top: 4px;
}

.ai-response-structured .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f5f7fa;
    border-bottom: 1px solid #e4e7ed;
}

.ai-response-structured .result-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-response-structured .result-header-right {
    display: flex;
    align-items: center;
}

.ai-response-structured .result-title {
    font-size: 14px;
    font-weight: 600;
    color: #303133;
}

.ai-response-structured .result-count {
    font-size: 12px;
    color: #909399;
}

.ai-response-structured .btn-download-result {
    padding: 4px 10px;
    background: #fff;
    color: #606266;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-response-structured .btn-download-result:hover {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}

.ai-response-structured .result-content {
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
}

/* 结果内容中的表格优化 */
.ai-response-structured .result-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ai-response-structured .result-content table th {
    background-color: #f5f7fa;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #e4e7ed;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ai-response-structured .result-content table td {
    padding: 10px;
    border: 1px solid #e4e7ed;
    color: #606266;
}

.ai-response-structured .result-content tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.ai-response-structured .result-content tbody tr:hover {
    background-color: #f0f2f5;
    transition: background-color 0.2s ease;
}

