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

body {
    font-family: 'Georgia', 'Noto Serif SC', 'Songti SC', serif;
    background-color: #F5F1EB;
    color: #4a3728;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 导航栏 ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #A87868;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: -5px;  /* 图片和文字的间距 */
    margin-left: -160px;  /* 负值往左移，自己调数值 */
    font-size: 1.5em;
    font-weight: bold;
    color: #F5F1EB;
    text-decoration: none;
    letter-spacing: 3px;
    font-family: 'Georgia', serif;
}

.logo-img {
    height: 80px;   /* 图片高度，跟导航栏协调 */
    width: auto;
    object-fit: contain;
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 8px;
}

.nav-links a {
    color: #F5F1EB;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(245, 241, 235, 0.2);
    color: #fff;
}

/* ========== 聊天主体 ========== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    margin-top: 64px;
    max-width: 800px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    background: url('./picture/chatbg2.jpg') center/contain no-repeat fixed;
}

/* 聊天头部 */
.chat-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 2px solid #CAA59B;
    gap: 14px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    color: #A87868;
    text-decoration: none;
    font-size: 0.9em;
    letter-spacing: 1px;
    transition: color 0.3s;
    white-space: nowrap;
}

.back-btn:hover {
    color: #B15736;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8ddd4 0%, #d4c5b8 100%);
    border: 2px solid #CAA59B;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3em;
    color: #A87868;
    flex-shrink: 0;
}

.chat-header-info .chat-name {
    font-size: 1.15em;
    font-weight: 700;
    color: #4a3728;
    letter-spacing: 2px;
}

.chat-header-info .chat-desc {
    font-size: 0.8em;
    color: #8b7265;
    letter-spacing: 0.5px;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeIn 0.4s ease;
}

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

.message.bot {
    align-self: flex-start;
}

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

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8ddd4 0%, #d4c5b8 100%);
    border: 2px solid #CAA59B;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
    color: #A87868;
    flex-shrink: 0;
}

.message.user .msg-avatar {
    background: #2C8079;
    border-color: #2C8079;
    color: #F5F1EB;
    font-size: 0.8em;
}

.msg-bubble {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.95em;
    line-height: 1.8;
    letter-spacing: 0.3px;
    position: relative;
}

.message.bot .msg-bubble {
    background: #fff;
    border: 1px solid #e8ddd4;
    border-top-left-radius: 4px;
    color: #4a3728;
}

.message.user .msg-bubble {
    background: #A87868;
    color: #F5F1EB;
    border-top-right-radius: 4px;
}

.msg-time {
    font-size: 0.72em;
    color: #b09a8e;
    margin-top: 6px;
    text-align: right;
}

.message.bot .msg-time {
    text-align: left;
}

/* 提示语 */
.system-msg {
    text-align: center;
    font-size: 0.82em;
    color: #8b7265;
    padding: 8px 16px;
    background: rgba(202, 165, 155, 0.15);
    border-radius: 20px;
    align-self: center;
    letter-spacing: 1px;
}

/* ========== 场景选择 ========== */
.scene-area {
    padding: 0 24px 12px;
}



.scene-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.scene-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #CAA59B;
    border-radius: 20px;
    font-size: 0.82em;
    color: #6b5348;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Georgia', 'Noto Serif SC', serif;
}

.scene-btn:hover {
    background: #e8ddd4;
    border-color: #A87868;
}

.scene-btn.active {
    background: #A87868;
    color: #F5F1EB;
    border-color: #A87868;
}

/* ========== 输入区域 ========== */
.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    background: #fff;
    border-top: 2px solid #CAA59B;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #CAA59B;
    border-radius: 25px;
    font-size: 0.95em;
    background: #F5F1EB;
    color: #4a3728;
    font-family: 'Georgia', 'Noto Serif SC', serif;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #A87868;
    box-shadow: 0 0 0 3px rgba(168, 120, 104, 0.15);
}

.chat-input::placeholder {
    color: #b09a8e;
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #A87868;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #B15736;
    transform: scale(1.05);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: #F5F1EB;
}

/* ========== 打字指示器 ========== */
.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e8ddd4;
    border-radius: 16px;
    border-top-left-radius: 4px;
    margin-left: 52px;
}

.typing-indicator.show {
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #CAA59B;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== 响应式 ========== */
@media (max-width: 700px) {
    .chat-container {
        max-width: 100%;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .message {
        max-width: 88%;
    }

    .chat-input-area {
        padding: 12px 16px;
    }

    .scene-area {
        padding: 0 16px 10px;
    }

    .nav-links a {
        padding: 6px 10px;
        font-size: 0.82em;
    }
}
