:root {
    --primary: #2979ff;
    --bg: #f5f7fa;
    --glass: rgba(255, 255, 255, 0.9);
}

body { margin: 0; font-family: -apple-system, sans-serif; background: var(--bg); height: 100vh; overflow: hidden; }

/* 登录页样式 */
.auth-container {
    display: flex; justify-content: center; align-items: center; height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.auth-box {
    background: white; padding: 40px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); width: 350px;
}
.auth-box h2 { text-align: center; margin-bottom: 30px; color: #333; }
.input-group { margin-bottom: 20px; }
.input-group input {
    width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box;
}
.btn {
    width: 100%; padding: 12px; border: none; background: var(--primary); color: white; border-radius: 8px; cursor: pointer; font-size: 16px;
}
.btn:hover { opacity: 0.9; }
.link { text-align: center; margin-top: 15px; font-size: 14px; }
.link a { color: var(--primary); text-decoration: none; }

/* 聊天页样式 */
.app-layout { display: flex; height: 100%; }
.sidebar {
    width: 260px; background: #fff; border-right: 1px solid #eee; display: flex; flex-direction: column;
}
.sidebar-header { padding: 20px; font-weight: bold; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.new-chat-btn {
    background: var(--primary); color: white; border: none; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 12px;
}
.history-list { flex: 1; overflow-y: auto; padding: 10px; }
.history-item {
    padding: 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px;
}
.history-item:hover, .history-item.active { background: #f0f7ff; color: var(--primary); }

.chat-area { flex: 1; display: flex; flex-direction: column; background: #fff; }
.chat-header {
    padding: 15px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between;
}
.vip-badge {
    background: gold; color: #856404; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: bold;
}
.msg-container { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }

.message { display: flex; max-width: 80%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: #ddd; display: flex; align-items: center; justify-content: center; margin: 0 10px; flex-shrink: 0;
}
.user .avatar { background: var(--primary); color: white; }
.model .avatar { background: #10a37f; color: white; }
.bubble {
    padding: 12px 16px; border-radius: 12px; line-height: 1.6; font-size: 15px; position: relative;
}
.user .bubble { background: #e3f2fd; color: #333; border-bottom-right-radius: 2px; }
.model .bubble { background: #f7f7f8; color: #333; border-bottom-left-radius: 2px; }

/* Markdown & Code */
pre { background: #282c34; padding: 10px; border-radius: 6px; overflow-x: auto; color: white; }
code { font-family: monospace; }

.input-wrapper { padding: 20px; border-top: 1px solid #eee; display: flex; gap: 10px; }
textarea {
    flex: 1; padding: 12px; border: 1px solid #ddd; border-radius: 8px; resize: none; height: 45px; outline: none;
}
.send-btn { width: 50px; border: none; background: var(--primary); color: white; border-radius: 8px; cursor: pointer; }

/* 支付弹窗 */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center;
}
.modal-content {
    background: white; padding: 30px; border-radius: 16px; text-align: center; width: 320px; position: relative;
}
.pay-options { display: flex; gap: 10px; margin: 20px 0; }
.pay-card {
    flex: 1; border: 1px solid #ddd; padding: 15px 5px; border-radius: 8px; cursor: pointer; transition: 0.3s;
}
.pay-card.selected { border-color: #07c160; background: #e8fbf0; }
.pay-card h3 { margin: 0; font-size: 14px; }
.pay-card p { margin: 5px 0 0; font-weight: bold; color: #e41c1c; }
.wx-btn {
    background: #07c160; color: white; border: none; padding: 12px; width: 100%; border-radius: 6px; font-size: 16px; cursor: pointer;
}
.qr-placeholder {
    width: 200px; height: 200px; background: #f0f0f0; margin: 20px auto; display: flex; align-items: center; justify-content: center; color: #999;
}
/* --- 新增：图片上传相关样式 --- */
.toolbar {
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}

.upload-btn-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    margin-right: 10px;
}

.upload-icon {
    color: #666;
    font-size: 20px;
    padding: 10px;
    cursor: pointer;
    transition: color 0.3s;
}

.upload-icon:hover {
    color: #2979ff;
}

.upload-btn-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* 图片预览区 */
.preview-area {
    padding: 10px 20px;
    background: #fff;
    display: none; /* 默认隐藏 */
    border-bottom: 1px solid #f9f9f9;
}

.preview-item {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-close {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 12px;
    width: 18px;
    height: 18px;
    text-align: center;
    line-height: 18px;
    cursor: pointer;
}

/* 调整原来的输入框区域，去掉上边框，因为toolbar有了 */
.input-wrapper {
    border-top: none;
    padding-top: 5px;
}

/* 消息里的图片样式 */
.bubble img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
    display: block;
}