/* ================= 极简现代 UI 样式 ================= */
:root { --bg-color: #f0f2f5; --surface-color: #ffffff; --primary-color: #2563eb; --primary-hover: #1d4ed8; --text-main: #1f2937; --text-muted: #6b7280; --border-color: #e5e7eb; }



html { height: -webkit-fill-available; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-color); color: var(--text-main); margin: 0; display: flex; flex-direction: column; height: 100vh; min-height: -webkit-fill-available; overflow: hidden; position: fixed; width: 100%; top: 0; left: 0; }






header { background: var(--bg-color); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: none; box-shadow: none; z-index: 100; flex-shrink: 0; }




.header-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.logo { font-size: 18px; font-weight: bold; color: var(--primary-color); white-space: nowrap; }
select { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-color); outline: none; background: #f9fafb; font-size: 14px; max-width: 150px; text-overflow: ellipsis; }

.header-right { position: relative; }
.avatar-btn { background: var(--primary-color); color: white; border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 16px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.dropdown-menu { display: none; position: absolute; right: 0; top: 45px; width: 220px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); overflow: hidden; z-index: 200; }
.dropdown-menu.show { display: block; }
.dropdown-header { padding: 15px; border-bottom: 1px solid var(--border-color); background: #f9fafb; font-weight: bold; color: var(--text-main); text-align: center; }
.menu-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid var(--border-color); font-size: 14px; color: var(--text-main); }
.menu-btn { background: none; border: none; padding: 12px 15px; width: 100%; text-align: left; font-size: 14px; cursor: pointer; color: var(--text-main); transition: 0.2s; }
.menu-btn:hover { background: #f3f4f6; }
.menu-btn.danger { color: #ef4444; border-top: 1px solid var(--border-color); }

.primary-btn { background: var(--primary-color); color: white; border: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.primary-btn:hover { background: var(--primary-hover); }




main { flex: 1; overflow-y: auto; padding-top: 15px; padding-bottom: 140px; padding-left: calc(max(15px, 50vw - 400px)); padding-right: calc(max(15px, 50vw - 400px)); display: flex; flex-direction: column; gap: 15px; scroll-behavior: smooth; box-sizing: border-box; }
.message { width: 100%; line-height: 1.6; font-size: 15px; word-break: break-word; display: block; }
.message.ai { color: var(--text-main); padding: 15px 10px 30px 10px; border-bottom: 1px solid var(--border-color); }
.message.user { background: #e5e7eb; color: var(--text-main); border-radius: 20px; padding: 12px 20px; width: fit-content; max-width: 75%; margin-left: auto; margin-right: 0; margin-top: 20px; font-weight: normal; border-bottom: none; white-space: pre-wrap; }



/* 底部改成透明悬浮 */
footer { background: transparent; padding: 0 15px 30px 15px; display: flex; justify-content: center; position: fixed; bottom: 0; left: 0; right: 0; pointer-events: none; z-index: 50; }

/* 悬浮胶囊样式（带高级阴影和边框） */
.input-container { background: #ffffff; border-radius: 32px; padding: 12px 24px; display: flex; flex-direction: column; width: 100%; max-width: 800px; transition: 0.3s; box-shadow: 0 4px 24px rgba(0,0,0,0.08); border: 1px solid #e5e7eb; pointer-events: auto; }
.input-container:focus-within { box-shadow: 0 8px 32px rgba(0,0,0,0.12); border-color: #d1d5db; }

/* 输入文字的地方微调 */
textarea { background: transparent; border: none; font-size: 16px; outline: none; resize: none; max-height: 200px; font-family: inherit; width: 100%; padding: 8px 0; line-height: 1.5; overflow-y: auto; margin-bottom: 0; }

/* 右下角的区域：靠右对齐 */
.action-area { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

/* 底部模型选择器的样式 */
.bottom-select { background: transparent; border: none; font-size: 13px; color: var(--text-muted); cursor: pointer; outline: none; padding: 6px; border-radius: 8px; transition: 0.2s; }
.bottom-select:hover { background: #d1d5db; color: #111827; }

/* 发送按钮变成圆形小按钮 */
.send-btn { background: #374151; color: white; border: none; height: 36px; width: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: 0.2s; }
.send-btn:hover { background: var(--primary-color); }




/* 专门照顾手机屏幕：打造类似 Gemini 的原生 App 体验 */
@media (max-width: 600px) {
    main { padding-bottom: 180px; }
    footer { padding: 10px 15px; padding-bottom: calc(15px + env(safe-area-inset-bottom)); background: var(--bg-color); }
    .input-container { border-radius: 28px; padding: 8px 16px; box-shadow: 0 2px 15px rgba(0,0,0,0.08); border: 1px solid #e5e7eb; }
    textarea { font-size: 16px; max-height: 100px; margin-bottom: 0; }
}



.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal-box { background: var(--surface-color); padding: 20px; border-radius: 12px; width: 90%; max-width: 340px; box-shadow: 0 10px 15px rgba(0,0,0,0.1); }

input.auth-input { width: 100%; padding: 10px; margin: 8px 0 15px 0; border: 1px solid var(--border-color); border-radius: 6px; box-sizing: border-box; outline: none;}
input.auth-input:focus { border-color: var(--primary-color); }

#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #10b981; color: white; padding: 10px 20px; border-radius: 8px; font-size: 14px; display: none; z-index: 9999999; }
#toast.error { background: #ef4444; }
.hidden { display: none !important; }

.pay-method-box { border: 1px solid var(--border-color); padding: 10px; border-radius: 8px; margin-bottom: 15px; text-align: left; background: #f9fafb; }
.pay-method-box label { display: block; padding: 6px 0; cursor: pointer; font-size: 13px; }

/* 后台表格样式 */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.admin-table th, .admin-table td { border: 1px solid var(--border-color); padding: 8px; text-align: left; }
.admin-table th { background: #f9fafb; }

/* --- 下面是专门给 AI 回复内容做的精美排版规则 --- */
/* 让大标题字变大、加粗 */
.message.ai h1 { font-size: 24px; font-weight: bold; margin-top: 20px; margin-bottom: 12px; color: #111827; }
/* 让中标题字稍微大一点、加粗 */
.message.ai h2 { font-size: 20px; font-weight: bold; margin-top: 20px; margin-bottom: 12px; color: #1f2937; }
/* 让小标题字也加粗 */
.message.ai h3 { font-size: 18px; font-weight: bold; margin-top: 16px; margin-bottom: 8px; }
/* 让 AI 觉得重点的字（加粗的字）变得非常显眼 */
.message.ai strong { font-weight: bold; color: #000000; font-size: 16px; }
/* 让普通段落之间有呼吸感 */
.message.ai p { margin-bottom: 16px; line-height: 1.7; }
/* 让列表（带黑点或数字的排版）对齐且好看 */
.message.ai ul, .message.ai ol { margin-bottom: 16px; padding-left: 24px; line-height: 1.7; }
/* 让一小句代码有灰色的背景色和红色字体，像专家的样子 */
.message.ai code { background-color: #f3f4f6; padding: 3px 6px; border-radius: 4px; color: #ef4444; font-family: monospace; font-size: 14px; }
/* 让大段的代码框变成深色且有圆角 */
.message.ai pre { background-color: #f8fafc; padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 16px; border: 1px solid #e2e8f0; }
.message.ai pre code { background-color: transparent; padding: 0; color: #333; font-size: 14px; }




/* --- 后台管理界面的 Tab 分类样式 --- */
.admin-tabs { display: flex; gap: 10px; border-bottom: 2px solid var(--border-color); margin-bottom: 15px; flex-shrink: 0;}
.admin-tab { background: transparent; border: none; padding: 10px 15px; font-size: 15px; cursor: pointer; color: var(--text-muted); font-weight: bold; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: 0.2s; }
.admin-tab:hover { color: var(--primary-color); }
.admin-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }



/* ================= 输入框加号与悬浮菜单样式 ================= */
.chat-action-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px; /* 根据你的输入框调整间距 */
}

/* 加号按钮本身 */
/* 加号按钮本身 (Gemini 超薄风格) */
#plus-btn {
    background: transparent;
    border: none;
    font-size: 28px; /* 字号稍微调大 */
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 300; /* 核心：300字重让它变得极细、极简 */
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#plus-btn:hover {
    color: #2563eb; /* 鼠标放上去变蓝 */
    background-color: #f3f4f6;
}

/* 隐藏的悬浮菜单 */
.chat-actions-menu {
    position: absolute;
    bottom: 120%; /* 让菜单在加号的正上方弹出来 */
    left: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 160px;
    z-index: 1000;
    padding: 8px;
    
    /* 核心：默认完全隐藏，不仅看不见，也点不到 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 当加上 show 这个词时，菜单优雅浮现 */
.chat-actions-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 菜单里的选项按钮 */
.action-item {
    padding: 10px 12px;
    cursor: pointer;
    color: #ef4444; /* 红色警告色 */
    font-size: 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.action-item:hover {
    background-color: #fef2f2; /* 鼠标放上去有浅红色背景 */
}

/* ================= 🚀 创作工作台手机端极致适配 ================= */
@media (max-width: 768px) {
    #dev-left-panel {
        position: absolute !important; /* 绝对定位，变成悬浮窗，不挤压右边 */
        height: 100%;
        z-index: 10005;
        max-width: 85vw !important; /* 留出15%的缝隙让你能看到后面的程序 */
        box-shadow: 5px 0 20px rgba(0,0,0,0.5); /* 加上阴影，看起来更立体 */
    }
}




/* ================= 新增：AI 回复加载呼吸动画 ================= */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #2563eb; /* 使用了你的主题蓝色 */
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text-info {
    font-size: 13px;
    color: #6b7280;
    margin-left: 12px;
}



/* ================= 新增：AI 消息底部高级操作栏 ================= */
.msg-content-body {
    /* 保证内容和下面的按钮有一点呼吸空间 */
    margin-bottom: 12px; 
}

.msg-action-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
}

.action-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    padding: 6px;
}

.action-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.action-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 隐藏的更多信息悬浮菜单 */
.more-menu-wrapper {
    position: relative;
}

.msg-more-menu {
    display: none;
    position: absolute;
    bottom: 110%; /* 在三个点上方弹出 */
    left: 0;
    margin-bottom: 5px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 10px 15px;
    white-space: nowrap;
    z-index: 100;
    font-size: 12px;
    color: #6b7280;
}

.msg-more-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ================= 🚀 Gemini 风格：底部模型抽屉 & 触发器样式 ================= */

/* 1. 底部触发按钮（圆润、有质感） */
.gemini-model-trigger {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.gemini-model-trigger:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* 2. 全屏黑色毛玻璃遮罩 */
.gemini-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px); /* 高级毛玻璃效果 */
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000008;
    display: flex;
    align-items: flex-end; /* 让面板贴在最底部 */
    
    /* 默认隐藏，带渐变动画 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}


/* 3. 白色底部抽屉面板 (完美适配手机与 iPad) */
.gemini-sheet-panel {
    width: 100%;
    max-width: 500px; /* 🚀 核心补丁：无论屏幕多宽，面板最宽不超过 500px */
    margin: 0 auto;   /* 🚀 核心补丁：在 iPad 等宽屏幕上，让面板永远居中显示 */
    background: #ffffff;
    border-radius: 20px 20px 0 0; 
    padding-bottom: env(safe-area-inset-bottom); /* 苹果 iOS 底部黑条防遮挡保护 */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1); 
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

/* 🚀 高级补丁：针对极其宽泛的屏幕（比如直接用电脑浏览器打开） */
@media (min-width: 600px) {
    .gemini-sheet-panel {
        /* 在大屏幕上，把底部的角也变圆，看起来像一个真正的悬浮卡片 */
        border-radius: 20px;
        margin-bottom: 20px; 
    }
}

/* 当加上 show 这个词时，面板飞上来，背景变黑 */
.gemini-sheet-overlay.show {
    opacity: 1;
    visibility: visible;
}
.gemini-sheet-overlay.show .gemini-sheet-panel {
    transform: translateY(0);
}

/* 4. 面板头部 */
.gemini-sheet-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.gemini-sheet-close {
    background: #f3f4f6;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 5. 面板里的模型列表容器 */
.gemini-sheet-content {
    padding: 10px 15px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px; /* 卡片之间的间距 */
}

/* 6. 单个模型卡片选项 */
.gemini-model-item {
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}
.gemini-model-item:hover {
    background: #f3f4f6;
}

/* 被选中的卡片样式（蓝框、蓝底、加粗） */
.gemini-model-item.active {
    background: #eff6ff;
    border-color: #3b82f6;
}
.gemini-model-item.active .model-name {
    color: #1d4ed8;
    font-weight: bold;
}
.gemini-model-item.active .model-check {
    display: block; /* 选中时显示对勾 */
}

.model-name { font-size: 15px; color: #374151; transition: 0.2s; }
.model-check { display: none; color: #3b82f6; font-size: 16px; font-weight: bold; }


/* 让按钮里的文字变窄，超出部分自动变成省略号 (...) */
#model-trigger-text {
    max-width: 90px; /* 控制文字显示的最大宽度，刚好能显示 gpt-4o 等前缀 */
    white-space: nowrap; /* 不准换行 */
    overflow: hidden; /* 超出的部分隐藏掉 */
    text-overflow: ellipsis; /* 隐藏的部分用省略号代替 */
    display: inline-block;
    vertical-align: middle;
}


/* ================= 🚀 模型卡片：测试与收藏按钮样式 ================= */

/* 包裹两个小按钮的容器 */
.model-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* 按钮之间的间距 */
}

/* ⚡测试 和 ⭐收藏 小按钮的样式 */
.model-action-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}
.model-action-btn:hover {
    background: #e5e7eb; /* 点击或悬浮时有浅灰色背景 */
}

/* 正在测试时的转圈圈动画 */
.spin-loader {
    width: 14px; 
    height: 14px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6; /* 蓝色的转圈条 */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { 
    to { transform: rotate(360deg); } 
}