/* --- 基础和 iframe 友好设置 --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5; /* 背景色保留，iframe外也好看 */
}

/* --- 聊天容器：核心改动，使其可嵌入 --- */
.chat-container {
    /* 移除了 display:flex, justify-content 等 body 布局依赖 */
    position: relative; /* 为了定位“新对话”按钮 */
    width: 100%;
    height: 100%;
    max-width: 600px;  /* 你仍然可以限制最大宽度 */
    margin: auto;      /* 在非 iframe 环境下居中 */
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- 新对话按钮：重新定位 --- */
#new-chat-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10; /* 确保在 header 上方 */
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 28px;
    text-align: center;
    transition: background-color 0.3s, transform 0.3s;
}

#new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* --- Header 和其他样式微调 --- */
.chat-header {
    background-color: #00529B;
    color: white;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0; /* 防止 header 在 flex 布局中被压缩 */
}

.chat-header h1 {
    margin: 0;
    font-size: 1.5em;
    padding-right: 30px; /* 给“新对话”按钮留出空间 */
}
.chat-header p {
    margin: 5px 0 0;
    font-size: 0.9em;
    opacity: 0.9;
}

/* ... 以下是你原来的其他 CSS，它们大部分可以保持不变 ... */
.chat-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 15px;
    line-height: 1.5;
    word-wrap: break-word; /* 防止长单词溢出 */
}

.user-message {
    background-color: #F38020;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.bot-thinking {
    font-style: italic;
    color: #888;
}

.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
    flex-shrink: 0; /* 防止输入框在 flex 布局中被压缩 */
}

#user-input {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    border-color: #00529B;
}

#send-btn {
    background-color: #00529B;
    color: white;
    border: none;
    padding: 0 20px;
    margin-left: 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

#send-btn:hover {
    background-color: #003d73;
}

.prompt-starters {
    padding: 15px 20px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.prompt-starter-btn {
    background-color: #f0f2f5;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 8px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.prompt-starter-btn:hover {
    background-color: #e9e9eb;
    border-color: #ccc;
}