/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #4a90e2;
    --light-blue: #f0f7ff;
    --border-blue: #d1e3ff;
    --text-color: #333;
    --text-light: #666;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-blue);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 个人信息部分 */
.profile-section {
    text-align: center;
    margin-bottom: 40px;
}

.avatar-container {
    margin-top: 3cm;
    text-align: center;
    margin-bottom: 2rem;
}

.avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.2);
    transition: transform 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
}

.greeting {
    margin-bottom: 30px;
    font-size: 1.2em;
    color: var(--primary-blue);
    font-style: italic;
    line-height: 1.8;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.photos-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.photo-item {
    position: relative;
    width: 300px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.2);
}

.photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-description {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(74, 144, 226, 0.8);
    color: white;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item:hover .photo {
    transform: scale(1.1);
}

.photo-item:hover .photo-description {
    opacity: 1;
}

/* 文章部分 */
.articles-section {
    margin-bottom: 40px;
}

.article {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.1);
    border-left: 4px solid var(--primary-blue);
}

.article-title {
    color: var(--primary-blue);
    margin-bottom: 10px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.article-title:hover {
    color: #2c3e50;
}

.article-date {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 15px;
}

.article-summary {
    background-color: var(--light-blue);
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid var(--primary-blue);
    font-size: 0.95em;
    color: var(--text-light);
}

.article-content {
    display: none;
    padding-top: 15px;
}

.article.active .article-content {
    display: block;
}

/* 聊天部分 */
.chat-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.1);
    margin-bottom: 40px;
    padding: 20px;
    width: 60%;
    margin-left: auto;
    margin-right: auto;
}

.chat-section h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    text-align: center;
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid var(--border-blue);
    border-radius: 8px;
    background: var(--light-blue);
}

.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    max-width: 85%;
    position: relative;
}

.message .timestamp {
    font-size: 0.8em;
    color: var(--text-light);
    margin-top: 5px;
    text-align: right;
}

.user-message {
    background: var(--primary-blue);
    color: white;
    margin-left: auto;
}

.system-message {
    background: #e6f3ff;  /* 浅蓝色背景 */
    color: var(--text-color);
    margin-right: auto;
    border: 1px solid var(--border-blue);
}

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

#userInput {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-blue);
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

#userInput:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.chat-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.chat-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

#sendMessage {
    background: var(--primary-blue);
    color: white;
}

#sendMessage:hover {
    background: #357abd;
}

#clearChat {
    background: #e74c3c;
    color: white;
}

#clearChat:hover {
    background: #c0392b;
}

.loading-indicator {
    text-align: center;
    color: var(--text-light);
    padding: 10px;
    background: var(--light-blue);
    border-radius: 6px;
    display: none;
}

.loading-indicator span {
    display: inline-block;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 页脚样式 */
footer {
    background-color: var(--light-blue);
    padding: 30px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-blue);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-content p {
    margin: 8px 0;
    font-size: 0.9em;
    color: var(--text-light);
    line-height: 1.6;
}

.footer-content .copyright {
    font-size: 0.85em;
    margin-top: 15px;
}

.footer-content .philosophy {
    font-size: 0.9em;
    color: var(--primary-blue);
    margin: 10px 0;
    font-weight: 500;
}

.footer-content .contact-info {
    font-size: 0.85em;
    margin: 10px 0;
}

.footer-content .certification {
    font-size: 0.85em;
    margin-top: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .avatar {
        width: 150px;
        height: 150px;
    }

    .greeting {
        font-size: 1em;
    }

    .photo-item {
        width: 100%;
        height: 200px;
    }

    /* 改进聊天区域的移动端样式 */
    .chat-section {
        width: 100%;
        padding: 15px 10px;
        margin-bottom: 20px;
    }

    .chat-messages {
        height: 60vh; /* 使用视口高度而不是固定像素 */
        max-height: 350px;
        padding: 10px;
    }
    
    .message {
        max-width: 92%;
        padding: 10px;
        margin-bottom: 10px;
    }

    .message .timestamp {
        font-size: 0.75em;
    }
    
    .chat-input-container {
        gap: 8px;
    }
    
    #userInput {
        padding: 10px;
        font-size: 16px; /* 防止iOS上自动缩放 */
        max-height: 100px;
        min-height: 60px;
    }
    
    .chat-buttons {
        flex-direction: row; /* 在小屏幕上保持水平排列，但占满宽度 */
    }
    
    .chat-buttons button {
        flex: 1;
        padding: 12px 10px;
        font-size: 0.95em;
    }
    
    .footer-content {
        padding: 0 15px;
    }
    
    .footer-content p {
        font-size: 0.85em;
    }
    
    .footer-content .philosophy {
        font-size: 0.85em;
    }
    
    .footer-content .contact-info,
    .footer-content .certification {
        font-size: 0.8em;
    }
}

/* 超小屏幕设备的额外调整 */
@media (max-width: 480px) {
    .chat-section {
        padding: 10px 8px;
    }

    .chat-messages {
        height: 55vh;
    }

    .message {
        max-width: 95%;
        padding: 8px 10px;
    }

    .chat-buttons button {
        padding: 10px 8px;
    }
    
    #userInput {
        padding: 8px;
    }
}