/* 清空旧样式，添加新样式 */

/* 基础重置和页面布局 */
body {
    background: linear-gradient(135deg, #f5f7ff 0%, #f0f2fa 100%);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.demo-slide {
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100vh;
    background: transparent;
    align-items: center; /* 居中演示区域 */
}

.demo-slide .slide-title {
    text-align: center;
    margin-bottom: 20px;
    color: #1a237e;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
}

.demo-slide .slide-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 3px;
    background: linear-gradient(90deg, #3f51b5, #7986cb);
    border-radius: 2px;
}

/* 手机模拟框样式 */
.demo-area {
    background-color: #222; /* 手机边框颜色 */
    border-radius: 40px; /* 手机圆角 */
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    padding: 10px; /* 手机边框厚度 */
    max-width: 780px; /* 手机宽度 */
    width: 100%;
    height: 750px; /* 手机高度 */
    margin: 10px 0; /* 上下边距 */
    display: flex;  
    flex-direction: column;
    position: relative;
}

.mobile-inner-frame {
    background-color: #fff; /* 手机屏幕背景 */
    border-radius: 30px; /* 屏幕圆角 */
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.mobile-status-bar {
    color: #333; /* 状态栏文字颜色 */
    display: flex;
    justify-content: space-between;
    padding: 8px 20px 5px 20px;
    font-size: 0.8rem;
    position: absolute; /* 浮动在屏幕顶部 */
    top: 5px;
    left: 0;
    right: 0;
    z-index: 10;
}

.mobile-notch {
    background-color: #222; /* 刘海颜色 */
    border-radius: 0 0 15px 15px;
    height: 25px;
    margin: 0 auto;
    width: 150px;
    position: absolute;
    top: 10px; /* 刘海位置 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

/* 聊天头部 */
.chat-header {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    padding: 15px 15px 12px 15px;
    display: flex;
    align-items: center;
    color: white;
    border-radius: 28px 28px 0 0; /* 顶部圆角配合屏幕 */
    margin-top: 30px; /* 为状态栏和刘海留出空间 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-header-icon {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 1.2rem;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-weight: 600;
    font-size: 1rem;
}

.chat-header-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 聊天消息区域 */
.demo-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f5f7ff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demo-messages::-webkit-scrollbar {
    width: 5px;
}

.demo-messages::-webkit-scrollbar-track {
    background: transparent;
}

.demo-messages::-webkit-scrollbar-thumb {
    background: rgba(63, 81, 181, 0.2);
    border-radius: 3px;
}

/* 消息气泡 */
.message {
    max-width: 85%;
    padding: 12px 15px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.4s ease-out;
    word-wrap: break-word;
}

.message-user {
    background: linear-gradient(135deg, #3949ab, #5c6bc0);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-bot {
    background-color: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.message-toolcall {
    align-self: flex-start;
    width: 90%;
    padding: 0; /* Toolcall card has its own padding */
    background: none;
    box-shadow: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 卡片通用样式 */
.message-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0,0,0,0.05);
}

.message-card-header {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
}

.message-card-icon {
    margin-right: 10px;
    font-size: 1.1rem;
}

.message-card-title {
    font-weight: 500;
    font-size: 0.95rem;
}

.message-card-content {
    padding: 15px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.message-card-content p {
    margin-bottom: 10px;
}

.message-card-content ul {
    padding-left: 20px;
    margin: 5px 0 10px 0;
}

.message-card-content li {
    margin-bottom: 5px;
}

/* 卡片内账户信息 */
.card-account {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.03);
    margin-bottom: 10px;
    border: 1px solid rgba(0,0,0,0.04);
}

.card-account-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.card-account-info {
    flex: 1;
    font-size: 0.8rem;
    line-height: 1.4;
}

.card-account-info strong {
    font-size: 0.85rem;
    color: #333;
}

/* 卡片内徽章 */
.card-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 4px 0;
}

.badge-danger {
    background-color: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.badge-success {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.badge-warning {
    background-color: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

/* 卡片内操作区 */
.card-actions {
    margin-top: 15px;
}

.account-input, .password-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.password-btn-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.card-btn {
    flex: 1; /* 让按钮平分空间 */
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-align: center;
}

.card-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.card-btn:active {
    transform: translateY(0);
    opacity: 1;
}

.card-btn-primary {
    background: linear-gradient(135deg, #3949ab, #5c6bc0);
    color: white;
}

.card-btn-secondary {
    background-color: rgba(0, 0, 0, 0.08);
    color: #333;
}

/* 工具调用卡片 */
.toolcall-card {
    background-color: #f8f9ff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(63, 81, 181, 0.1);
}

.toolcall-header {
    background-color: #e8eaf6;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #3f51b5;
    font-weight: 500;
}

.toolcall-icon {
    margin-right: 8px;
}

.toolcall-body {
    padding: 15px;
    font-size: 0.85rem;
    color: #555;
}

/* 加载点动画 */
.progress-dots {
    display: inline-flex; /* 改为inline-flex */
    align-items: center;
    margin-left: 5px; /* 与文字间距 */
}

.progress-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #3f51b5;
    margin: 0 2px;
    animation: dot-pulse 1.4s infinite ease-in-out;
}

.progress-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.progress-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.progress-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* 还款计划卡片 */
.payment-plan {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(0,0,0,0.04);
}

.payment-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.8rem;
    color: #444;
}

.payment-item div:last-child {
    font-weight: 500;
}

/* SVG 图表容器 */
.chart-container {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 1rem;
    margin: 0.75rem 0;
    height: 200px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(63, 81, 181, 0.1);
}

/* 输入区域 */
.demo-input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    background-color: #f8f9ff;
    border-radius: 0 0 28px 28px; /* 底部圆角配合屏幕 */
}

#demo-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-right: 10px;
    outline: none;
    transition: border-color 0.2s ease;
}

#demo-input:focus {
    border-color: #3f51b5;
}

#demo-send {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3949ab, #5c6bc0);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

#demo-send:hover {
    opacity: 0.9;
    transform: scale(1.03);
}

#demo-send:active {
    transform: scale(1);
    opacity: 1;
}

#demo-send:disabled {
    background: #c5cae9;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

/* 分页按钮适应新布局 */
.pagination {
    width: 100%;
    max-width: 800px; /* 可根据需要调整 */
    margin-top: 20px;
    padding: 0 20px; /* 增加左右内边距 */
    box-sizing: border-box;
}

/* 加载提示 */
.loading-initial {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* 特定卡片标题颜色 */
.message-card-header.secure-auth {
    background: linear-gradient(135deg, #c62828, #e57373); /* 红色系 */
}
.message-card-header.credit-info {
    background: linear-gradient(135deg, #0d47a1, #42a5f5); /* 蓝色系 */
}
.message-card-header.debit-info {
    background: linear-gradient(135deg, #1b5e20, #66bb6a); /* 绿色系 */
}
.message-card-header.repay-plan {
    background: linear-gradient(135deg, #ff6f00, #ffb74d); /* 橙色系 */
}
.message-card-header.success {
    background: linear-gradient(135deg, #1b5e20, #4caf50); /* 绿色系 */
}
.message-card-header.market-query {
    background: linear-gradient(135deg, #4a148c, #ab47bc); /* 紫色系 */
}
.message-card-header.market-analysis {
    background: linear-gradient(135deg, #01579b, #29b6f6); /* 青蓝色系 */
}
.message-card-header.product-compare {
    background: linear-gradient(135deg, #311b92, #7e57c2); /* 深紫色系 */
}
.message-card-header.invest-plan {
    background: linear-gradient(135deg, #004d40, #26a69a); /* 青绿色系 */
}
.message-card-header.sector-analysis {
    background: linear-gradient(135deg, #bf360c, #ff8a65); /* 深橙色系 */
}

/* 特殊图标背景 */
.card-account-icon.money {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}
.card-account-icon.portfolio {
    background: rgba(16, 185, 129, 0.15); 
    color: #10b981;
}
.card-account-icon.tech {
    background: rgba(99, 102, 241, 0.15); 
    color: #6366f1;
}
.card-account-icon.energy {
    background: rgba(168, 85, 247, 0.15); 
    color: #a855f7;
}
.card-account-icon.currency {
    background: rgba(59, 130, 246, 0.15); 
    color: #3b82f6;
}

/* 新增：左右分栏布局 */
.demo-layout {
    display: flex;
    gap: 25px; /* 左右间距 */
    width: 100%;
    max-width: 1000px; /* 限制最大宽度 */
    margin: 0 auto; /* 整体居中 */
    align-items: flex-start; /* 顶部对齐 */
}

.demo-area-container {
    flex: 0 0 480px; /* 左侧固定宽度，与手机宽度匹配 */
}

.raw-data-container {
    flex: 1; /* 右侧占据剩余空间 */
    background-color: #f8f9ff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    padding: 15px 20px;
    height: 750px; /* 与手机模拟等高 */
    display: flex;
    flex-direction: column;
}

.raw-data-title {
    font-size: 1.1rem;
    color: #3f51b5;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
}

.raw-data-display {
    flex: 1;
    background-color: #2d2d2d; /* 深色背景 */
    color: #d4d4d4; /* 浅色文字 */
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
    white-space: pre-wrap; /* 保留换行和空格 */
    word-wrap: break-word;
}

.raw-data-display::-webkit-scrollbar {
    width: 6px;
}

.raw-data-display::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.raw-data-display::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* 原始数据块样式 */
.data-chunk {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
}
.data-chunk:last-child {
     border-bottom: none;
     margin-bottom: 0;
}

.data-chunk.user {
    color: #9cdcfe; /* 蓝色，表示用户输入 */
}

.data-chunk.bot_text {
    color: #ce9178; /* 橙色，表示机器人文本 */
}

.data-chunk.bot_card {
    color: #dcdcaa; /* 黄色，表示机器人卡片 */
}

.data-chunk.tool_call {
    color: #c586c0; /* 紫色，表示工具调用 */
}

.data-chunk.initial-prompt {
    color: #888;
    font-style: italic;
}

/* 分页按钮调整 */
.pagination {
    margin-top: 25px; /* 增加上方间距 */
}

/* 响应式调整，小屏幕下堆叠 */
@media (max-width: 900px) {
    .demo-layout {
        flex-direction: column;
        align-items: center; /* 居中 */
        max-width: 500px; /* 限制宽度 */
    }
    .demo-area-container {
        flex: 0 0 auto; /* 恢复自动高度 */
        margin-bottom: 20px;
    }
    .raw-data-container {
        height: 400px; /* 减小高度 */
        width: 100%;
    }
}
