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

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background: #1a1a1a;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 页头样式 */
.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 30px 20px;
    border-radius: 15px;
    border: 1px solid #333;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    color: #b0b0b0;
    font-weight: 400;
}

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

/* 梦境输入区域 */
.dream-input-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.input-container h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.dream-form {
    width: 100%;
}

#dreamContent {
    width: 100%;
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 150px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

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

.analyze-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px 30px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.analyze-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

.loading-spinner {
    display: inline-block;
}

/* 结果展示区域 */
.result-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.result-container h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.analysis-content {
    line-height: 1.8;
    color: #444;
}

.analysis-content h3 {
    color: #667eea;
    margin: 25px 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.analysis-content h4 {
    color: #555;
    margin: 20px 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.analysis-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.analysis-content ul, .analysis-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.analysis-content li {
    margin-bottom: 8px;
}

.analysis-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #666;
}

/* 移除旧的对话交流区域样式 */

/* 移除旧的chat-history样式 */

/* 移除旧的消息样式 */

.message-time {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 5px;
    color: #777;
}

/* 移除旧的输入组样式 */

/* 移除旧的输入框和按钮样式 */

/* 页脚样式 */
.footer {
    margin-top: 20px;
    text-align: center;
    color: #b0b0b0;
}

.footer-content {
    padding: 15px;
    border-radius: 10px;
}

.disclaimer {
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.knowledge-sources {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.source {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #b0b0b0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .dream-input-section,
    .result-section,
    .chat-section {
        padding: 20px;
    }
    
    .knowledge-sources {
        flex-direction: column;
        gap: 10px;
    }
    
    .chat-input-group {
        flex-direction: column;
    }
    
    #chatInput {
        border-radius: 12px;
    }
    
    .send-btn {
        border-radius: 12px;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section,
.chat-section {
    animation: fadeInUp 0.6s ease-out;
}

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

.chat-history::-webkit-scrollbar-track {
    border-radius: 10px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #64b5f6;
    border-radius: 10px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: #42a5f5;
}

/* 聊天界面专用样式 */
.main-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

.chat-container-main {
    flex: 0;
    border-radius: 15px;
    padding: 0;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 600px;
}

.chat-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-history {
    flex: 0;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    max-width: 85%;
    animation: fadeInUp 0.4s ease-out;
}

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

.chat-message.ai-message {
    align-self: flex-start;
}

.ai-avatar, .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ai-avatar {
    border: 2px solid #64b5f6;
    color: #64b5f6;
}

.user-avatar {
    border: 2px solid #66bb6a;
    color: #66bb6a;
}

.user-message .message-content {
    color: #e0e0e0;
    border-left: 3px solid #66bb6a;
    padding-left: 18px;
}

.ai-message .message-content {
    color: #e0e0e0;
}

.welcome-message .message-content {
    color: #e0e0e0;
    border: 2px solid #64b5f6;
    border-radius: 20px;
    padding: 25px;
}

.welcome-message h3 {
    color: #64b5f6;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.welcome-message ul {
    margin: 15px 0;
    padding-left: 20px;
}

.welcome-message .tip {
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border-left: 4px solid #64b5f6;
    font-style: italic;
}

.chat-input-form {
    padding: 20px 30px;
    border-top: 1px solid #333;
}

.input-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    min-height: 50px;
    max-height: 120px;
    padding: 15px 20px;
    border: 2px solid #333;
    border-radius: 25px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: all 0.3s ease;
    overflow-y: auto;
    background: transparent;
    color: #e0e0e0;
}

#chatInput:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.1);
}

#chatInput::placeholder {
    color: #777;
}

.send-btn {
    min-width: 80px;
    height: 50px;
    border: 2px solid #64b5f6;
    color: #64b5f6;
    background: transparent;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    color: #42a5f5;
    border-color: #42a5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 181, 246, 0.2);
}

.send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    max-width: 85%;
    align-self: flex-start;
}

.typing-content {
    padding: 15px 20px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64b5f6;
    animation: typing 1.4s infinite;
}

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

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

.typing-text {
    color: #b0b0b0;
    font-style: italic;
    font-size: 0.9rem;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 消息内容markdown样式 */
.message-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.25;
}

.message-content h1 { font-size: 1.8rem; color: #e0e0e0; }
.message-content h2 { font-size: 1.5rem; color: #e0e0e0; }
.message-content h3 { font-size: 1.3rem; color: #e0e0e0; }
.message-content h4 { font-size: 1.1rem; color: #64b5f6; }
.message-content h5 { font-size: 1rem; color: #b0b0b0; }
.message-content h6 { font-size: 0.9rem; color: #b0b0b0; }

.message-content p {
    margin: 8px 0;
    line-height: 1.7;
    color: #e0e0e0;
}

.message-content ul,
.message-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 6px 0;
    line-height: 1.6;
}

.message-content blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 4px solid #64b5f6;
    border-radius: 4px;
    font-style: italic;
    color: #b0b0b0;
}

.message-content code {
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #f48fb1;
    border: 1px solid #555;
}

.message-content pre {
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid #333;
}

.message-content pre code {
    padding: 0;
    color: #e0e0e0;
    border: none;
}

.message-content strong {
    font-weight: 600;
    color: #e0e0e0;
}

.message-content em {
    font-style: italic;
    color: #b0b0b0;
}

.message-content hr {
    border: none;
    border-top: 2px solid #333;
    margin: 20px 0;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.message-content th,
.message-content td {
    border: 1px solid #555;
    padding: 8px 12px;
    text-align: left;
}

.message-content th {
    font-weight: 600;
    border-bottom: 2px solid #555;
}

/* 响应式设计更新 */
@media (max-width: 768px) {
    .main-content {
        height: calc(100vh - 150px);
    }
    
    .chat-history {
        padding: 20px;
    }
    
    .chat-input-form {
        padding: 15px 20px;
    }
    
    .input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    #chatInput {
        border-radius: 15px;
    }
    
    .send-btn {
        width: 100%;
        border-radius: 15px;
    }
    
    .chat-message {
        max-width: 95%;
    }
}