/* 极致简约黑白风格 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    background-color: #ffffff;
    color: #000000;
    overflow: hidden;
}

/* 主容器 - 全屏布局 */
.container {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

/* 顶部栏 */
.header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    flex-shrink: 0;
    height: 60px;
}

.clear-btn {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: #666666;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.clear-btn:hover {
    background-color: #f5f5f5;
}

.clear-btn i {
    font-size: 18px;
}

/* 语音状态指示器 */
.voice-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666666;
}

.voice-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.voice-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #e0e0e0;
    transition: all 0.3s ease;
}

.voice-dot.active {
    background-color: #000000;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 对话区域 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #ffffff;
}

/* 消息样式 */
.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-message {
    align-self: flex-start;
}

/* 头像 */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.user-message .avatar {
    margin-left: 14px;
    margin-right: 0;
    background-color: #000000;
}

.bot-message .avatar {
    margin-right: 14px;
    background-color: #f0f0f0;
}

.avatar i {
    font-size: 16px;
}

.user-message .avatar i {
    color: #ffffff;
}

.bot-message .avatar i {
    color: #666666;
}

/* 消息内容 */
.message-content {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 50px);
}

.message-text {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    max-width: 100%;
}

.user-message .message-text {
    background-color: #000000;
    color: #ffffff;
}

.bot-message .message-text {
    background-color: #f5f5f5;
    color: #000000;
}

.message-time {
    font-size: 12px;
    color: #999999;
    margin-top: 6px;
    padding: 0 6px;
}

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

/* 输入区域 */
.input-container {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    background-color: #ffffff;
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 6px;
}

.input-wrapper:focus-within {
    border-color: #000000;
}

textarea {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    outline: none;
    line-height: 1.5;
    background-color: transparent;
    color: #000000;
}

textarea::placeholder {
    color: #999999;
}

/* 发送按钮 */
.send-btn {
    background-color: #ffffff;
    color: #666666;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 2px;
    transition: all 0.2s ease;
}

.send-btn.active {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
}

.send-btn:disabled {
    background-color: #f5f5f5;
    color: #cccccc;
    border-color: #f0f0f0;
    cursor: not-allowed;
}

.send-btn i {
    font-size: 18px;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background-color: #f5f5f5;
    border-radius: 18px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #666666;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

/* 豆包HTML响应样式 */
.doubao-html-response {
    max-width: 100%;
    overflow-x: auto;
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin: 10px -10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* 图表容器 */
.doubao-html-response .chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

/* 数据表格 */
.doubao-html-response table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 13px;
}

.doubao-html-response th {
    background: #f1f3f5;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.doubao-html-response td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.doubao-html-response tr:hover {
    background-color: #f8f9fa;
}

/* 摘要卡片 */
.doubao-html-response .summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
}

.doubao-html-response .stat-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* K线图样式 */
.doubao-html-response .candlestick-chart {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* 语音识别提示 */
.voice-recognition-info {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 16px 28px;
    border-radius: 24px;
    font-size: 15px;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.voice-recognition-info.show {
    display: flex;
    animation: fadeInUp 0.3s ease-out;
}

.voice-recognition-info i {
    font-size: 18px;
    color: #4CAF50;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 错误提示 */
.error-toast {
    position: fixed;
    top: 40px;
    right: 20px;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

.error-toast.show {
    display: flex;
}

.error-toast i {
    font-size: 16px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 2.5px;
}

/* 响应式 */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
        height: 56px;
    }
    
    .clear-btn {
        width: 36px;
        height: 36px;
    }
    
    .clear-btn i {
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 16px;
        gap: 14px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .avatar {
        width: 32px;
        height: 32px;
    }
    
    .avatar i {
        font-size: 15px;
    }
    
    .message-text {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .input-container {
        padding: 16px;
    }
    
    textarea {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .send-btn {
        width: 44px;
        height: 44px;
    }
    
    .send-btn i {
        font-size: 16px;
    }
    
    .voice-recognition-info {
        bottom: 90px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .doubao-html-response {
        padding: 10px;
        font-size: 12px;
    }
    
    .doubao-html-response .chart-container {
        height: 250px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px 14px;
        height: 52px;
    }
    
    .clear-btn {
        width: 32px;
        height: 32px;
    }
    
    .clear-btn i {
        font-size: 15px;
    }
    
    .chat-messages {
        padding: 14px;
        gap: 12px;
    }
    
    .message {
        max-width: 95%;
    }
    
    .avatar {
        width: 28px;
        height: 28px;
    }
    
    .avatar i {
        font-size: 14px;
    }
    
    .user-message .avatar {
        margin-left: 10px;
    }
    
    .bot-message .avatar {
        margin-right: 10px;
    }
    
    .message-text {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .input-container {
        padding: 14px;
    }
    
    textarea {
        padding: 9px 13px;
        font-size: 14px;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
    }
    
    .send-btn i {
        font-size: 15px;
    }
    
    .voice-status {
        font-size: 12px;
    }
    
    .voice-recognition-info {
        bottom: 80px;
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .doubao-html-response {
        padding: 8px;
        font-size: 11px;
    }
    
    .doubao-html-response .chart-container {
        height: 200px;
    }
    
    .doubao-html-response th,
    .doubao-html-response td {
        padding: 6px 8px;
    }
}