/* AI助手样式 - 工程计算中心专用 */
/* 作者: chengliang */
/* 版本: 3.5.0 - 移除最小化和调试功能 */

/* 主容器样式 */
.ai-assistant {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 10000;
}

/* AI按钮样式 */
.ai-button {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10001;
}

/* AI按钮悬停效果 */
.ai-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6);
}

/* 脉冲动画效果 */
.ai-button.pulse {
    animation: pulse 2s infinite;
}

/* 脉冲动画关键帧 */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

/* AI聊天对话框样式 */
.ai-chat-container {
    position: fixed;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e9ecef;
    z-index: 10000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* 显示聊天对话框 */
.ai-chat-container.show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

/* 向上滑动动画 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 聊天对话框遮罩层 */
.ai-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: none;
}

/* 显示遮罩层 */
.ai-chat-overlay.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

/* 淡入动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 聊天对话框头部 */
.ai-chat-header {
    background: linear-gradient(135deg, #2c3e50, #1a2530);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

/* 聊天标题样式 */
.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

/* 聊天操作按钮区域 */
.ai-chat-actions {
    display: flex;
    gap: 8px;
}

/* 单个操作按钮样式 */
.ai-chat-action {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

/* 操作按钮悬停效果 */
.ai-chat-action:hover {
    background: rgba(255,255,255,0.3);
}

/* 关闭按钮悬停效果 */
.ai-chat-action.close:hover {
    transform: rotate(90deg);
}

/* 聊天消息区域 */
.ai-chat-messages {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
}

/* 消息通用样式 */
.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
}

/* 消息出现动画 */
@keyframes messageAppear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 用户消息样式 */
.user-message {
    background: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

/* AI消息样式 */
.ai-message {
    background: white;
    border: 1px solid #e9ecef;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 确保代码块在AI消息中正确显示 */
.ai-message .code-block-container {
    margin: 10px 0;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
}

.ai-message .code-header {
    background: #f6f8fa;
    padding: 8px 12px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
}

.ai-message .code-block {
    margin: 0;
    padding: 16px;
    background: #fafbfc;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.45;
}

.ai-message .table-container {
    margin: 10px 0;
    overflow-x: auto;
}

.ai-message .word-style-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ai-message .word-style-table th,
.ai-message .word-style-table td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.ai-message .word-style-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.ai-message .math-formula-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
}

.ai-message .math-formula-inline {
    background: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
}

/* 工程元素样式 */
.ai-message .param-description {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin: 10px 0;
}

.ai-message .engineering-tip {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px 0;
}

.ai-message .engineering-note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px 0;
}

/* 文本样式 */
.ai-message .content-heading {
    margin: 15px 0 10px 0;
    color: #2c3e50;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
}

.ai-message .content-paragraph {
    line-height: 1.6;
    margin: 8px 0;
}

.ai-message .engineering-quote {
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    padding: 10px 15px;
    margin: 10px 0;
    font-style: italic;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 聊天输入区域容器 */
.ai-chat-input-container {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

/* 聊天输入区域 */
.ai-chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

/* 输入文本框样式 */
.ai-chat-input textarea {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 12px 18px;
    resize: none;
    height: 50px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

/* 输入框获取焦点样式 */
.ai-chat-input textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 发送按钮样式 */
.ai-chat-input button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

/* 发送按钮悬停效果 */
.ai-chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

/* 发送按钮禁用状态 */
.ai-chat-input button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 打字指示器样式 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* 设置面板样式 */
.settings-panel {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

/* 设置行样式 */
.settings-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

/* 设置标签样式 */
.settings-label {
    width: 100px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

/* 设置控件样式 */
.settings-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 模型状态样式 */
.model-status {
    font-size: 13px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 连接成功状态 */
.status-connected {
    color: #28a745;
}

/* 连接断开状态 */
.status-disconnected {
    color: #dc3545;
}

/* 加载中状态 */
.status-loading {
    color: #856404;
}

/* 准备就绪状态 */
.status-ready {
    color: #17a2b8;
}

/* 配置按钮样式 */
.config-btn {
    background: #3498db;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 配置按钮悬停效果 */
.config-btn:hover {
    background: #2980b9;
}

/* 建议标签区域 */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* 单个建议标签样式 */
.suggestion-chip {
    background: #e9ecef;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
}

/* 建议标签悬停效果 */
.suggestion-chip:hover {
    background: #dee2e6;
    transform: translateY(-1px);
}

/* ===== 优化后的表格样式 ===== */
.engineering-table {
    margin: 15px 0;
    border-collapse: collapse;
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    line-height: 1.4;
}

.engineering-table th {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    font-size: 12px;
    white-space: nowrap;
}

.engineering-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #ecf0f1;
    transition: all 0.2s ease;
    vertical-align: top;
}

.engineering-table tr:hover td {
    background: #f8f9fa;
}

.engineering-table tr:last-child td {
    border-bottom: none;
}

/* 表格容器 */
.table-container {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    background: white;
    position: relative;
    border: 1px solid #e9ecef;
}

.table-container::before {
    content: '数据表格';
    position: absolute;
    top: -8px;
    left: 15px;
    background: #3498db;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    z-index: 2;
}

/* 参数表格特殊样式 */
.parameter-table {
    border-left: 3px solid #27ae60;
}

.parameter-table th {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* 结果表格特殊样式 */
.result-table {
    border-left: 3px solid #e74c3c;
}

.result-table th {
    background: linear-gradient(135deg, #e74c3c, #e67e22);
}

/* 响应式表格 */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
    }
    
    .engineering-table {
        min-width: 400px;
        font-size: 12px;
    }
    
    .engineering-table th,
    .engineering-table td {
        padding: 8px 6px;
    }
}

/* ===== 优化后的数学公式样式 ===== */
.math-formula-block {
    display: block;
    margin: 15px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #3498db;
    text-align: center;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Cambria Math', 'Times New Roman', serif;
    position: relative;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.math-formula-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 数学公式块标签 */
.math-formula-block::before {
    content: '公式';
    position: absolute;
    top: -8px;
    left: 15px;
    background: #3498db;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

/* 工程公式特殊样式 */
.engineering-formula {
    border-left: 4px solid #e74c3c;
    background: linear-gradient(135deg, #fff5f5 0%, #ffeaea 100%);
}

.engineering-formula::before {
    content: '工程公式';
    background: #e74c3c;
}

.physics-formula {
    border-left: 4px solid #9b59b6;
    background: linear-gradient(135deg, #f8f5ff 0%, #f0ebff 100%);
}

.physics-formula::before {
    content: '物理公式';
    background: #9b59b6;
}

.chemistry-formula {
    border-left: 4px solid #2ecc71;
    background: linear-gradient(135deg, #f0fff5 0%, #e8ffef 100%);
}

.chemistry-formula::before {
    content: '化学公式';
    background: #2ecc71;
}

/* 公式编号系统 */
.formula-number {
    position: absolute;
    top: -8px;
    right: 15px;
    background: #34495e;
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-family: monospace;
}

/* 行内数学公式样式 */
.math-formula-inline {
    display: inline;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Cambria Math', 'Times New Roman', serif;
    border: 1px solid #dee2e6;
    margin: 0 2px;
    font-size: 0.9em;
    color: #2c3e50;
    line-height: 1.2;
}

/* ===== 计算步骤样式 ===== */
.calculation-steps {
    margin: 15px 0;
    padding: 18px;
    background: linear-gradient(135deg, #fff9f0, #fff3e0);
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    position: relative;
}

.calculation-steps::before {
    content: '计算步骤';
    position: absolute;
    top: -8px;
    left: 15px;
    background: #f39c12;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.calculation-step {
    margin: 10px 0;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #f39c12;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    line-height: 1.5;
}

.calculation-step:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.step-number {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #f39c12;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 11px;
    font-weight: bold;
    margin-right: 8px;
}

/* ===== 文字内容优化 ===== */
.ai-message {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
}

.ai-message p {
    margin: 8px 0;
    line-height: 1.6;
}

.ai-message ul, .ai-message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message li {
    margin: 4px 0;
    line-height: 1.5;
}

.ai-message strong {
    color: #2c3e50;
    font-weight: 600;
}

.ai-message em {
    color: #7f8c8d;
    font-style: italic;
}

/* 代码块样式 */
.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    overflow-x: auto;
    margin: 10px 0;
    border-left: 3px solid #e74c3c;
}

.inline-code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    color: #e74c3c;
    border: 1px solid #e5e7eb;
}

/* 引用块样式 */
.quote-block {
    margin: 15px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 4px solid #95a5a6;
    border-radius: 6px;
    position: relative;
    font-style: italic;
    color: #2c3e50;
    line-height: 1.6;
}

.quote-block::before {
    content: '"';
    font-size: 36px;
    color: #bdc3c7;
    position: absolute;
    top: 8px;
    left: 12px;
    font-family: serif;
}

.quote-source {
    text-align: right;
    font-style: normal;
    color: #7f8c8d;
    margin-top: 8px;
    font-size: 12px;
}

/* 警告和提示框 */
.alert-box {
    margin: 15px 0;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid;
    line-height: 1.6;
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-left-color: #2196f3;
    color: #0d47a1;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-left-color: #ff9800;
    color: #e65100;
}

.alert-success {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border-left-color: #4caf50;
    color: #1b5e20;
}

.alert-danger {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-left-color: #f44336;
    color: #b71c1c;
}

/* 单位标注样式 */
.unit {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-left: 2px;
}

/* 数值高亮 */
.value-highlight {
    background: linear-gradient(135deg, #fff9c4, #fff59d);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: #f57f17;
}

/* 参数说明样式 */
.param-description {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 3px solid #3498db;
    font-size: 13px;
    line-height: 1.5;
}

.param-item {
    display: flex;
    margin: 6px 0;
    align-items: flex-start;
}

.param-name {
    font-weight: 600;
    color: #2c3e50;
    min-width: 80px;
    flex-shrink: 0;
}

.param-desc {
    color: #5a6c7d;
    flex: 1;
}

/* ===== 工程计算专用样式 ===== */
.engineering-note {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #90caf9;
    border-radius: 6px;
    padding: 12px 15px;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #1565c0;
}

.engineering-note::before {
    content: '💡 工程提示';
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
}

.calculation-result {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border: 1px solid #81c784;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.calculation-result .result-value {
    font-size: 18px;
    font-weight: 700;
    color: #2e7d32;
    margin: 5px 0;
}

.calculation-result .result-unit {
    font-size: 14px;
    color: #7f8c8d;
    margin-left: 5px;
}

/* ===== 响应式优化 ===== */
@media (max-width: 768px) {
    .ai-chat-container {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }

    .ai-assistant {
        bottom: 20px;
        right: 20px;
    }
    
    .message {
        max-width: 90%;
        font-size: 13px;
        line-height: 1.5;
    }
    
    .math-formula-block {
        padding: 15px;
        margin: 12px 0;
        font-size: 13px;
    }
    
    .engineering-table {
        font-size: 11px;
    }
    
    .calculation-steps {
        padding: 12px;
    }
    
    .ai-message p {
        margin: 6px 0;
        line-height: 1.5;
    }
}

/* 打印优化 */
@media print {
    .math-formula-block,
    .engineering-table,
    .calculation-steps {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .ai-chat-messages {
        background: #1a1a1a;
    }
    
    .ai-message {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #404040;
    }
    
    .math-formula-block {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .engineering-table {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .engineering-table th {
        background: #404040;
        color: #e0e0e0;
    }
    
    .engineering-table td {
        border-color: #404040;
    }
}

/* 滚动条优化 */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== 右侧面板模式样式 ===== */
.right-panel-mode {
    background: white;
    min-height: 100vh;
}

.right-panel-mode .ai-chat-container {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 100vh;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    border: none;
    display: flex !important;
    flex-direction: column;
}

.right-panel-mode .ai-chat-messages {
    flex: 1;
    height: auto;
    min-height: 400px;
    max-height: none;
}

.right-panel-mode .ai-chat-header {
    background: linear-gradient(135deg, #2c3e50, #1a2530);
    padding: 15px 25px;
    flex-shrink: 0;
}

.right-panel-mode .settings-panel {
    padding: 15px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.right-panel-mode .ai-chat-input-container {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

/* 侧边栏AI入口样式 */
.ai-sidebar-entry {
    border-left: 3px solid #3498db;
    transition: all 0.3s ease;
}

.ai-sidebar-entry:hover {
    background: #e3f2fd !important;
    transform: translateX(3px);
}

.ai-quick-access {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* 返回按钮样式 */
.back-to-home {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-right: 8px;
}

.back-to-home:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

/* 主页AI助手小图标 */
.ai-mini-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
}

.ai-mini-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.6);
    color: white;
    text-decoration: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .right-panel-mode .ai-chat-header {
        padding: 12px 15px;
    }
    
    .right-panel-mode .settings-panel {
        padding: 10px 15px;
    }
    
    .right-panel-mode .ai-chat-input-container {
        padding: 15px;
    }
    
    .ai-mini-icon {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

/* ===== 右侧面板模式样式 ===== */
.ai-right-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e9ecef;
}

.ai-right-panel.open {
    right: 0;
}

/* 调整主内容区，为AI面板留出空间 */
.content-area {
    transition: margin-right 0.3s ease;
}

.content-area.ai-panel-open {
    margin-right: 400px;
}

/* AI面板头部 */
.ai-panel-header {
    background: linear-gradient(135deg, #2c3e50, #1a2530);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #34495e;
    flex-shrink: 0;
}

.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.ai-panel-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-panel-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* AI面板内容区域 */
.ai-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 侧边栏AI入口样式 */
.ai-sidebar-entry {
    border-left: 3px solid #3498db;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.ai-sidebar-entry:hover {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb) !important;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

/* AI助手小图标 */
.ai-mini-icon {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 24px;
}

.ai-mini-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.6);
    color: white;
    text-decoration: none;
}

/* 脉冲动画效果 */
.ai-mini-icon.pulse {
    animation: pulse 2s infinite;
}

/* 脉冲动画关键帧 */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

/* 调整AI聊天消息区域高度 */
.ai-right-panel .ai-chat-messages {
    flex: 1;
    height: auto;
    max-height: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .ai-right-panel {
        width: 100%;
        right: -100%;
    }
    
    .content-area.ai-panel-open {
        margin-right: 0;
    }
    
    .ai-right-panel.open {
        right: 0;
    }
    
    .ai-mini-icon {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* 设置面板在右侧面板中的样式调整 */
.ai-right-panel .settings-panel {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

/* 聊天输入区域在右侧面板中的样式调整 */
.ai-right-panel .ai-chat-input-container {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

/* ===== 工程计算专用样式 ===== */
.engineering-title {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    margin: 20px 0 15px 0;
    font-size: 1.3em;
    font-weight: 600;
}

.engineering-subtitle {
    color: #34495e;
    margin: 18px 0 12px 0;
    font-size: 1.1em;
    font-weight: 600;
    border-left: 4px solid #3498db;
    padding-left: 12px;
}

/* 计算步骤容器 */
.calculation-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    border-left: 4px solid #3498db;
}

.calculation-step {
    margin: 12px 0;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.step-number {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    margin-right: 10px;
    font-weight: bold;
    font-size: 0.9em;
}

/* 参数表格特殊样式 */
.parameter-table {
    border-left: 3px solid #27ae60;
}

.parameter-table th {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* 结果修正区域 */
.result-correction {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #ffc107;
}

/* 简化公式区域 */
.simplified-formula {
    background: linear-gradient(135deg, #d4edda, #c8e6c9);
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
}

/* 工程提示增强样式 */
.engineering-note {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #2196f3;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #2196f3;
    position: relative;
}

.engineering-note::before {
    content: '💡 工程提示';
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #1976d2;
}

/* 数值高亮 */
.value-highlight {
    background: linear-gradient(135deg, #fff9c4, #fff59d);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #f57f17;
    border: 1px solid #ffd54f;
}

/* 单位样式增强 */
.unit {
    font-size: 0.85em;
    color: #7f8c8d;
    margin-left: 2px;
    font-weight: 500;
}

/* 参数说明增强 */
.param-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #6c757d;
}

.param-item {
    display: flex;
    margin: 8px 0;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.param-item:last-child {
    border-bottom: none;
}

.param-name {
    font-weight: 600;
    color: #2c3e50;
    min-width: 120px;
    flex-shrink: 0;
}

.param-symbol {
    font-weight: 600;
    color: #e74c3c;
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.param-value {
    color: #2c3e50;
    flex: 1;
    text-align: center;
}

.param-unit {
    color: #7f8c8d;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
    font-size: 0.9em;
}