/* 全局样式 */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* 页眉样式 */
.header {
    background-color: #ffffff;
    padding: 1rem 12.5vw;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

/* 用户信息样式 */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.greeting-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.emoji {
    font-size: 1.2rem;
}

.user-actions {
    position: relative;
}

.user-action-button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #666;
}

.user-icon {
    font-size: 1.2rem;
}

.user-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0.5rem;
    min-width: 120px;
    z-index: 1000;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #f5f5f5;
}

/* 模型选择器样式 */
.chat-controls {
    padding: 0.75rem 12.5vw;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.chat-controls > div {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    min-width: 140px;
}

.right-controls #new-chat-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.right-controls #new-chat-button:hover {
    background-color: #f5f5f5;
    border-color: #007bff;
}

.right-controls #new-chat-button i {
    color: #007bff;
}

.left-controls select:focus {
    outline: none;
    border-color: #007bff;
}

/* 聊天容器样式 */
.chat-container {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    height: calc(100vh - 180px);
    min-height: 0;
}

.text-above-chat {
    text-align: left;
    color: #666;
    margin: 1rem auto;
    padding: 2rem;
    font-size: 2.7rem;
    line-height: 1.3;
    max-width: 75vw;
    transition: all 0.3s ease;
    opacity: 1;
}

.text-above-chat.hidden {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* 聊天历史区域 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    padding-bottom: 200px;
    scroll-behavior: smooth;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

/* 底部固定区域 */
.chat-bottom-area {
    position: fixed;
    bottom: 28px;
    left: 12.5vw;
    right: 12.5vw;
    background: #fff;
    padding: 0.75rem;
       border-radius: 8px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.chat-bottom-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 0.75rem;
}

/* 聊天输入区域 */
.chat-input {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
}

.chat-input textarea {
    flex: 1;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    min-height: 60px;
    height: 60px;
    font-size: 1rem;
    line-height: 1.5;
    box-sizing: border-box;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #007bff;
}

/* 发送/停止按钮样式 */
.send-button {
    min-width: 64px;
    height: 60px;
    flex-shrink: 0;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
       font-size: 1.3rem;
    justify-content: center;
}

.send-button:hover {
    background-color: #0056b3;
}

.send-button.stopping {
    background-color: #dc3545;
}

.send-button.stopping:hover {
    background-color: #c82333;
}

/* 快捷操作按钮 */
.action-buttons {
    display: flex;
    width: 100%;
    padding: 0.5rem 0;
    gap: 12px;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

.action-buttons::-webkit-scrollbar {
    height: 4px;
}

.action-buttons::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.action-buttons::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.action-buttons button {
    flex: 0 0 auto;
    padding: 0.75rem 1.2rem;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    height: 45px;
    min-width: fit-content;
    white-space: nowrap;
}

.action-buttons button:hover {
    background-color: #e9ecef;
    border-color: #007bff;
    color: #007bff;
}

.action-buttons button i {
    font-size: 1.1rem;
}

/* 消息样式 */
.message {
    margin: 0rem 0;
    padding: 1rem;
    word-wrap: break-word;
    white-space: pre-line;
    line-height: 1.5;
    width: fit-content;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 打字机效果 */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

.user-message {
    background-color: #ebf5ff;
    margin-right: 12.5vw;
    margin-left: auto;
    border-radius: 15px 15px 0 15px;
    color: #333;
    align-self: flex-end;
}

.assistant-message {
    margin-right: auto;
    margin-left: 12.5vw;
    border-radius: 15px 15px 15px 0;
    color: #333;
    align-self: flex-start;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* 页脚样式 */
.footer {
    text-align: right;
    padding: 0.3rem;
    background-color: #ffffff;
    border-top: 1px solid #eee;
    height: 10px;
    position: fixed;
    bottom: 5px;
    width: 100%;
    z-index: 99;
    flex-shrink: 0;
}

.footer a {
    color: #999;
    text-decoration: none;
    font-size: 0.7rem;
}

.footer a:hover {
    text-decoration: underline;
}

/* 遮罩层样式 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .header {
        padding: 1rem 5vw;
    }

    .chat-controls {
        padding: 1rem 5vw;
    }

    .chat-bottom-area {
        left: 5vw;
        right: 5vw;
    }

    .chat-container {
        height: calc(100vh - 160px);
    }

    .action-buttons {
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 4px;
    }

    .action-buttons button {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 600px) {
    .chat-container {
        height: calc(100vh - 140px);
    }

    .message {
        max-width: 85%;
    }

    .user-message {
        margin-right: 5vw;
    }

    .assistant-message {
        margin-left: 5vw;
    }

    .chat-input textarea {
        padding: 0.75rem;
        min-height: 50px;
        height: 50px;
    }

    .send-button {
        height: 50px;
    }

    .action-buttons button {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }

    .text-above-chat {
        font-size: 1.8rem;
        line-height: 1;
        max-width: 90vw;
    }
}

/* 滚动条样式 */
.chat-history::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.chat-history::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: #555;
}

