* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #e8f5e9;
    font-family: Arial, sans-serif;
}

/* 头部样式 */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 1rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

nav h1 {
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    margin-left: 2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 背景图样式 */
.hero-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-image: url('image/index.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.7;
    z-index: -1;
}

/* 关于我部分 */
#about {
    margin-top: 100vh;
    padding: 4rem 2rem;
    background-color: rgba(232, 245, 233, 0.85);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.about-content {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 1rem;
}

.avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 1rem;
}

/* 修改关于我文本样式 */
.about-text {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex: 1;
}

.info-line {
    display: flex;
    gap: 3rem;
    margin-bottom: 1rem;
}

.info-line p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    flex: 1;
}

.experience {
    margin-top: 1rem;
}

.experience h3 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.project {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid #4CAF50;
}

.project h4 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.project p {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

/* 作品集样式 */
#portfolio {
    padding: 4rem 2rem;
    background-color: rgba(245, 245, 245, 0.85);
    position: relative;
}

.portfolio-items {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    margin-top: 2rem;
}

.portfolio-item {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.portfolio-img {
    width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
}

.portfolio-description {
    flex: 1;
}

.portfolio-description h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.5rem;
}

.portfolio-description p {
    color: #333;
    line-height: 1.6;
}

/* 页脚样式 */
footer {
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
    background-color: rgba(245, 245, 245, 0.85);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.social-icon {
    text-decoration: none;
    color: #333;
    padding: 0.5rem 1rem;
    border: 1px solid #333;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.social-icon:hover {
    background-color: #333;
    color: white;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 300px;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #ccc;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .about-content {
        flex-direction: column;
        text-align: center;
    }

    .nav-links {
        gap: 1rem;
    }

    .portfolio-item {
        flex-direction: column;
        text-align: center;
    }

    .portfolio-img {
        width: 100%;
        height: auto;
    }

    .info-line {
        flex-direction: column;
        gap: 0.5rem;
        text-align: left;
    }
    
    .project {
        text-align: left;
    }

    .avatar {
        margin-top: 0;
        margin-bottom: 2rem;
    }
}

/* AI 聊天区域样式 */
#ai-chat {
    padding: 4rem 2rem;
    background-color: rgba(245, 245, 245, 0.85);
}

.chat-container {
    max-width: 800px;
    margin: 20px auto;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    background: #fff;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.chat-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.user-message {
    margin-left: auto;
    justify-content: flex-end;
}

.ai-message {
    margin-right: auto;
    justify-content: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

textarea#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 0.2s;
}

textarea#user-input:focus {
    outline: none;
    border-color: #6366f1;
}

#send-message {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#send-message:hover {
    transform: scale(1.05);
}

#send-message svg {
    width: 24px;
    height: 24px;
}

.chat-tips {
    text-align: right;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 8px;
    padding: 0 4px;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 加载动画 */
.loading-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

/* 响应式设计补充 */
@media (max-width: 768px) {
    .chat-container {
        margin: 10px;
        height: calc(100vh - 20px);
        display: flex;
        flex-direction: column;
    }

    .chat-messages {
        flex: 1;
        height: auto;
    }

    .message {
        max-width: 90%;
    }

    .chat-input textarea {
        font-size: 16px;
    }
}

/* 在 chat-input 相关样式附近添加 */
.upload-button {
    background: transparent;
    color: #6366f1;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.upload-button:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.upload-button svg {
    width: 24px;
    height: 24px;
}

/* 修改现有的 chat-input 样式以适应新按钮 */
.chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

textarea#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 0.2s;
}

/* 上传按钮提示文字 */
.upload-button-container {
    position: relative;
}

.upload-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.upload-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

.upload-button-container:hover .upload-tooltip {
    opacity: 1;
    visibility: visible;
}

/* 上传文件弹窗 */
.upload-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.upload-modal-content {
    background: white;
    margin: 15% auto;
    padding: 40px;
    border-radius: 16px;
    max-width: 400px;
    text-align: center;
    position: relative;
}

.upload-modal-text {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 20px;
}

.upload-modal-close {
    background: #6366f1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    min-width: 100px;
}

.upload-modal-close:hover {
    background: #4f46e5;
}