/* ============================================================
   灵宝智能对话系统 v3.0 - 样式表
   ============================================================
   版权所有 (C) 2026 珠海筑基云人工智能科技有限公司
   作者：筑基云技术团队
   版本：v3.0
   创建日期：2026-07-26
   
   设计说明：
     暗色主题，科技感风格。
     左侧边栏显示智能状态，右侧主对话区域。
     响应式布局，适配手机和桌面。
   ============================================================ */

/* ---- 全局重置 ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #e2e8f0;
    background: #0f172a;
    overflow: hidden;
}

/* ---- 整体布局 ---- */
#app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ---- 左侧边栏 ---- */
#sidebar {
    width: 260px;
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #334155;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
}

.sidebar-section {
    padding: 16px 20px;
    border-bottom: 1px solid #1a2332;
}

.sidebar-section h4 {
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.status-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.3s;
}

.emotion-icon {
    font-size: 18px;
}

.emotion-name {
    font-weight: 500;
}

.emotion-intensity {
    font-size: 10px;
    color: #64748b;
    margin-left: auto;
}

.sidebar-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
    text-align: left;
}

.sidebar-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

.stats-content {
    background: #0f172a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #94a3b8;
}

.stat-item {
    padding: 4px 0;
    border-bottom: 1px solid #1a2332;
}

.stat-item:last-child {
    border-bottom: none;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #475569;
}

/* ---- 主对话区域 ---- */
#main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---- 对话消息区 ---- */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
#chat-container::-webkit-scrollbar {
    width: 6px;
}

#chat-container::-webkit-scrollbar-track {
    background: transparent;
}

#chat-container::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

#chat-container::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ---- 消息气泡 ---- */
.message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

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

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.user-message .msg-avatar {
    background: #3b82f6;
}

.msg-body {
    max-width: 70%;
    margin: 0 12px;
}

.msg-content {
    background: #1e293b;
    border-radius: 12px;
    padding: 12px 16px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user-message .msg-content {
    background: #3b82f6;
    color: white;
}

.msg-meta {
    font-size: 11px;
    color: #475569;
    margin-top: 4px;
    padding: 0 4px;
}

/* 文件附件 */
.msg-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.file-chip {
    background: #334155;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chip-remove {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.chip-remove:hover {
    color: #ef4444;
}

/* ---- 加载动画 ---- */
.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    margin: 0 2px;
    animation: bounce 1.4s infinite both;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ---- 欢迎消息 ---- */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.welcome-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.welcome-title {
    font-size: 22px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
}

.welcome-desc {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 24px;
}

.welcome-tips {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.tip {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
}

/* ---- 主动建议 ---- */
.proactive-suggestion {
    background: #1e3a5f;
    border: 1px solid #3b82f6;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 48px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.suggest-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.suggest-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
    color: #bfdbfe;
}

.suggest-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.suggest-close:hover {
    color: #e2e8f0;
}

/* ---- 上传进度 ---- */
#upload-progress-area {
    padding: 0 20px;
}

.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #1e293b;
    border-radius: 8px;
    margin-bottom: 8px;
}

.upload-name {
    font-size: 12px;
    color: #94a3b8;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    transition: width 0.3s;
}

.upload-percent {
    font-size: 12px;
    color: #3b82f6;
    min-width: 36px;
    text-align: right;
}

/* ---- 文件预览区 ---- */
#file-preview-area {
    padding: 8px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---- 输入区域 ---- */
#input-area {
    padding: 16px 20px;
    border-top: 1px solid #334155;
    background: #1e293b;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.input-tools {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #334155;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #475569;
    color: #e2e8f0;
}

.tool-btn.recording {
    background: #ef4444;
    color: white;
    animation: pulse 1s infinite;
}

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

#message-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 150px;
}

#message-input:focus {
    border-color: #3b82f6;
}

#message-input::placeholder {
    color: #475569;
}

.send-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: #3b82f6;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #2563eb;
}

.send-btn:disabled {
    background: #334155;
    color: #64748b;
    cursor: not-allowed;
}

/* ---- 拖拽上传状态 ---- */
.drag-over {
    border: 2px dashed #3b82f6 !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

/* ---- 响应式布局 ---- */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    .msg-body {
        max-width: 85%;
    }

    .proactive-suggestion {
        margin: 12px 16px;
    }

    .welcome-tips {
        flex-direction: column;
        align-items: center;
    }
}
