/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS变量定义 */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #ffd200 0%, #f7931e 100%);
    --danger-gradient: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    
    --bg-primary: #0f0f23;
    --bg-secondary: #16213e;
    --bg-tertiary: #1a1a2e;
    --bg-glass: rgba(255, 255, 255, 0.1);
    
    --text-primary: #ffffff;
    --text-secondary: #b8c1ec;
    --text-muted: #7c8db5;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-primary: 0 20px 40px rgba(0, 0, 0, 0.3);
    --shadow-secondary: 0 8px 32px rgba(0, 0, 0, 0.2);
    
    --border-radius: 16px;
    --border-radius-small: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全局字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* 背景动画 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(76, 175, 254, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundFloat 20s ease-in-out infinite;
}

@keyframes backgroundFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(1deg); }
    66% { transform: translateY(-10px) rotate(-1deg); }
}

/* 主容器 */
.container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header"
        "sidebar main"
        "sidebar input";
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.session-sidebar { 
    grid-area: sidebar;
}
.header { 
    grid-area: header;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}
.main-content { 
    grid-area: main;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}
.input-container { 
    grid-area: input;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* 会话侧边栏 - 悬停展开设计 */
.session-sidebar {
    width: 50px;  /* 默认窄条 */
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* 悬停展开 */
.session-sidebar:hover {
    width: 260px;
}

/* 窄条状态内容 */
.sidebar-collapsed {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 16px;
    z-index: 2;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

/* 悬停时隐藏窄条 */
.session-sidebar:hover .sidebar-collapsed {
    opacity: 0;
    pointer-events: none;
}

/* 展开状态内容 */
.sidebar-expanded {
    position: absolute;
    top: 0;
    left: 0;
    width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
    background: var(--bg-secondary);
}

/* 悬停时显示展开内容 */
.session-sidebar:hover .sidebar-expanded {
    opacity: 1;
    pointer-events: auto;
}

/* 窄条按钮样式 */
.sidebar-toggle,
.new-session-icon {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-toggle:hover,
.new-session-icon:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* 会话数量徽章 */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* 展开状态样式 */
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* 滚动条样式 */
.sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 新建会话按钮 - 醒目设计 */
.new-session-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4), 
                0 0 0 0 rgba(124, 58, 237, 0.4);
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
}

.new-session-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.new-session-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.5),
                0 0 20px rgba(236, 72, 153, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.new-session-btn:hover::before {
    left: 100%;
}

.new-session-btn:active {
    transform: translateY(0) scale(0.98);
}

.new-session-btn i {
    font-size: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* 会话列表 */
.session-list {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.session-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.session-item:hover {
    background: var(--bg-tertiary);
    border-left-color: var(--primary-color);
    transform: translateX(2px);
}

.session-item.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(240, 147, 251, 0.15));
    border-left-color: var(--primary-color);
}

.session-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-title i {
    font-size: 12px;
    opacity: 0.6;
}

.session-item.active .session-title {
    color: var(--primary-color);
    font-weight: 600;
}

.session-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.empty-sessions {
    text-align: center;
    padding: 20px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.empty-sessions i {
    display: block;
    font-size: 32px;
    opacity: 0.3;
    margin-bottom: 8px;
}

.empty-sessions p {
    margin: 4px 0;
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

/* 侧边栏遮罩层（移动端） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* 顶部导航 */
.header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 80px;
    padding-right: 120px; /* 预留登录按钮空间，避免重叠 */
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-right: auto;
}

.logo-img {
    height: 60px;
    width: auto;
    border-radius: 12px;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 仅显示状态圆点，隐藏文字，并与登录按钮保持间距 */
.status span { display: none; }
.status { margin-right: 12px; }

.status-dot {
    color: #10b981;
    animation: pulse 2s infinite;
}

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

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 让页面滚动，不在聊天容器内滚动 */
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
}

/* 消息本身不要高度限制 */
.message {
    min-height: auto;
    height: auto;
}

.message-content {
    min-height: auto;
    height: auto;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 消息样式 */
.message {
    display: flex;
    gap: 16px;
    animation: messageSlideIn 0.5s ease-out;
}

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

.message-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-secondary);
    flex-shrink: 0;
}

.message-avatar i {
    font-size: 1.2rem;
    color: white;
}

.message-content {
    flex: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-secondary);
    max-width: 100%;
    height: auto; /* 强制自动高度 */
    max-height: none; /* 移除最大高度限制 */
    overflow: visible; /* 不要滚动条，让内容自然显示 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text {
    height: auto;
    max-height: none;
    overflow: visible;
}

.message-text h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: auto;
    max-height: none;
}

.message-text h3 i {
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.message-text p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.help-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
    text-align: right;
}

/* 功能网格 */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 16px 0;
    width: 100%;
    max-width: 100%;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 0.875rem;
    transition: var(--transition);
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.feature-item i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 示例查询 */
.example-queries {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-secondary);
}

.example-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.example-title i {
    background: var(--warning-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.example-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.example-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.example-btn:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-secondary);
}

.example-btn i {
    font-size: 1rem;
}

/* 分析进度对话框 */
.analysis-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-primary);
    z-index: 1000;
    display: none;
    animation: modalSlideIn 0.5s ease-out;
}

/* 嵌入聊天消息内的进度卡片（非模态） */
.analysis-progress.embedded {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    z-index: auto;
    box-shadow: none;
    background: transparent;
    border: none;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.progress-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-title i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.progress-title h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.progress-time {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* 分析阶段 */
.analysis-stages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 24px;
}

.stage-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    transition: var(--transition);
}

.stage-item.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
}

.stage-item.completed {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.stage-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stage-item.active .stage-icon {
    background: var(--primary-gradient);
    animation: iconPulse 1.5s infinite;
}

.stage-item.completed .stage-icon {
    background: var(--success-gradient);
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.stage-icon i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.stage-item.active .stage-icon i,
.stage-item.completed .stage-icon i {
    color: white;
}

.stage-info {
    text-align: center;
}

.stage-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.stage-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stage-item.active .stage-status {
    color: #667eea;
}

.stage-item.completed .stage-status {
    color: #10b981;
}

/* 进度条 */
.progress-details {
    padding: 0 24px 24px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* 输入区域 */
.input-container {
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    position: relative;
    z-index: 10;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    align-items: center;
}

#messageInput {
    flex: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    min-height: 56px;
    box-sizing: border-box;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#messageInput::placeholder {
    color: var(--text-muted);
}

#sendButton {
    width: 56px;
    height: 56px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-secondary);
    flex-shrink: 0;
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: 8px;
}

/* 用户消息样式 */
.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: var(--secondary-gradient);
}

.user-message .message-content {
    background: rgba(240, 147, 251, 0.1);
    border-color: rgba(240, 147, 251, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 移动端容器布局调整 */
    .container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main"
            "input";
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .header,
    .main-content,
    .input-container {
        padding: 0 12px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 聊天容器去除右侧padding */
    .chat-container {
        padding-right: 0;
        padding-left: 0;
    }

    /* 移动端侧边栏固定悬浮 */
    .session-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
    }

    /* 移动端不使用悬停效果 */
    .session-sidebar:hover {
        width: 260px;  /* 保持固定宽度 */
    }

    .session-sidebar.active {
        transform: translateX(0);
    }

    /* 移动端隐藏窄条，始终显示展开内容 */
    .session-sidebar .sidebar-collapsed {
        display: none;
    }

    .session-sidebar .sidebar-expanded {
        opacity: 1;
        pointer-events: auto;
    }

    /* 汉堡菜单显示 */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin-right: 8px;
        background: transparent;
        border: none;
        border-radius: 8px;
        color: var(--text-primary);
        cursor: pointer;
        transition: all 0.2s;
    }

    .menu-toggle:hover {
        background: var(--bg-tertiary);
    }

    /* 顶部与欢迎区收敛 */
    .header {
        height: 60px;
        padding: 0;
        padding-right: 70px; /* 移动端为登录按钮预留空间 */
        padding-left: 0;
    }
    
    /* 消息布局优化 - 关键修复：移除高度限制 */
    .message {
        margin: 12px 8px;
        max-width: 100%;
        overflow-x: hidden;
        display: flex;
        gap: 10px;
        align-items: flex-start;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    /* 普通消息保持原样 */
    .message-avatar {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .message-content {
        flex: 1;
        padding: 16px;
        box-sizing: border-box;
        overflow: visible !important; /* 不要滚动条 */
        overflow-x: visible !important;
        overflow-y: visible !important;
        overflow-wrap: break-word;
        word-wrap: break-word;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    /* 包含分析结果的消息特殊优化 */
    .message:has(.analysis-result) {
        margin: 8px 0;
        gap: 4px;
    }
    
    .message:has(.analysis-result) .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
        margin-top: 5px;
        flex-shrink: 0;
    }
    
    .message:has(.analysis-result) .message-content {
        padding: 4px;
        border-radius: 12px;
        backdrop-filter: blur(10px);
        overflow: visible; /* 让报告卡片自己处理滚动 */
    }
    
    /* 分析结果在移动端的优化 */
    .analysis-result {
        margin: 0;
        border-radius: 10px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    }
    
    .result-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .report-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .toggle-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.813rem;
    }
    
    .toggle-btn i {
        font-size: 0.938rem;
    }
    
    .result-footer {
        padding: 8px 12px;
    }
    
    .features-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin: 16px 0;
        width: 100%;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .feature-item {
        padding: 10px;
        min-width: 0;
        font-size: 0.85rem;
        height: auto !important;
        max-height: none !important;
        white-space: normal;
        overflow: visible !important;
    }
    
    .example-queries {
        display: none !important; /* 移动端隐藏示例按钮节省空间 */
    }
    
    .help-text {
        font-size: 0.8rem !important;
    }
}

/* 超小屏幕优化 - 进一步节省空间 */
@media (max-width: 480px) {
    .container {
        padding: 0;
        width: 100%;
        max-width: 100vw;
    }
    
    .header,
    .main-content,
    .input-container {
        padding: 0 6px;
    }
    
    /* 消息宽度自然撑开 */
    .message-content {
        padding: 10px;
        overflow: visible;
    }
    
    /* 分析结果消息极简模式 */
    .message:has(.analysis-result) {
        margin: 5px 0;
    }
    
    .message:has(.analysis-result) .message-avatar {
        width: 20px;
        height: 20px;
        font-size: 10px;
        margin-top: 3px;
    }
    
    .message:has(.analysis-result) .message-content {
        padding: 2px;
        border-radius: 8px;
        overflow: visible;
    }
    
    .analysis-result {
        border-radius: 8px;
    }
    
    .result-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .report-toggle {
        width: 100%;
    }
    
    .toggle-btn {
        flex: 1;
        padding: 8px 10px;
        font-size: 0.75rem;
        gap: 4px;
    }
    
    .toggle-btn i {
        font-size: 0.875rem;
    }
    
    .result-footer {
        padding: 6px 10px;
    }
    
    /* iframe在超小屏幕的优化 */
    .message-content .report-iframe {
        height: 300px !important;
        border-radius: 4px;
    }
    
    .mobile-fullscreen-btn {
        padding: 6px 10px;
        font-size: 11px;
        top: 6px;
        right: 6px;
    }
    
    /* 全屏模态框在小屏幕的优化 */
    .fullscreen-header {
        padding: 12px 15px;
    }
    
    .fullscreen-header h3 {
        font-size: 16px;
    }
    
    .close-fullscreen {
        padding: 6px 8px;
        font-size: 14px;
    }
}

/* 进度面板在移动端采用更紧凑布局 */
@media (max-width: 768px) {
    .analysis-stages {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }
    .analysis-progress {
        width: 95%;
        margin: 0 auto;
    }
    .progress-header {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    /* 输入栏固定在底部，按钮与输入同一行（图标按钮） */
    .input-container {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    }
    .input-wrapper {
        display: flex;
        flex-direction: row;
        gap: 10px;
        margin-bottom: 0;
        align-items: center;
    }
    #messageInput {
        flex: 1;
        padding: 12px 16px;
        font-size: 0.95rem;
        min-height: 44px;
        border-radius: 12px;
    }
    #sendButton {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 12px;
        flex-shrink: 0;
    }
    .input-hint {
        display: none; /* 节省竖屏空间 */
    }

    /* 为固定输入栏预留空间，避免聊天内容被遮挡 */
    .main-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    .chat-container {
        /* 移动端不在容器内滚动，使用页面滚动 */
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    .analysis-stages {
        grid-template-columns: 1fr;
    }
    
    .stage-item {
        flex-direction: row;
        text-align: left;
        padding: 12px;
    }
    
    .stage-icon {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .stage-icon i {
        font-size: 1rem;
    }
}

/* 分析结果样式增强 */
.analysis-result {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin: 20px 0;
    box-shadow: var(--shadow-secondary);
    overflow: hidden;
    animation: resultSlideIn 0.6s ease-out;
}

@keyframes resultSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.stock-symbol {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.analysis-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* 报告切换按钮样式 */
.report-toggle {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.toggle-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.toggle-btn i {
    font-size: 1rem;
}

.toggle-btn span {
    font-weight: 500;
    white-space: nowrap;
}

/* 决策卡片增强 */
.decision-card {
    background: rgba(255, 255, 255, 0.02);
    padding: 32px;
    margin: 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
}

.decision-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    border-radius: 100px;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    box-shadow: var(--shadow-secondary);
    position: relative;
    overflow: hidden;
}

.decision-badge.buy {
    background: var(--success-gradient);
    color: white;
}

.decision-badge.sell {
    background: var(--danger-gradient);
    color: white;
}

.decision-badge.hold {
    background: var(--warning-gradient);
    color: white;
}

.confidence-meter {
    max-width: 300px;
    margin: 0 auto 24px;
}

.confidence-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.confidence-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 滑动进入动画 */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
} 