/* Galapure AI页面样式 - 允许滚动但隐藏滚动条 */
body {
    overflow-y: scroll;
}

/* 隐藏滚动条 - Webkit浏览器 */
body::-webkit-scrollbar {
    display: none;
}

/* 隐藏滚动条 - Firefox */
body {
    scrollbar-width: none;
}

/* 隐藏滚动条 - IE/Edge */
body {
    -ms-overflow-style: none;
}

.lingning-container {
    display: flex;
    width: 100%;
    height: calc(100vh - 78px); /* 扣除导航栏高度 */
    height: calc(100dvh - 78px); /* 适配移动端/iPad动态高度 */
    min-height: 0;
    max-height: none;
    background: #f5f5f5;
    margin: 0; /* 去掉边距 */
    border-radius: 0; /* 去掉圆角 */
    border: none; /* 去掉边框 */
    overflow: hidden;
    transition: height 0.3s ease;
}

body.header-hidden .lingning-container {
    height: 100vh;
    height: 100dvh;
}

body.header-hidden .main-header {
    display: none;
}

/* 顶部导航栏切换按钮 */
.header-toggle-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.header-toggle-btn:hover {
    background: rgba(0,0,0,0.05);
}

.lingning-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff; /* 改为白色 */
    min-height: 0; /* 关键：允许flex收缩 */
    position: relative; /* 为绝对定位的 header 提供参考 */
}

/* 顶部标题栏 */
.chat-header-bar {
    height: 54px; /* 固定高度，方便计算 */
    padding: 0 24px; /* 垂直居中由 flex 处理 */
    background: rgba(255, 255, 255, 0.7); /* iOS 风格半透明 */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(242, 242, 242, 0.8);
    display: flex;
    align-items: center;
    z-index: 10;
    position: absolute; /* 悬浮在内容之上 */
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
}

.chat-container {
    flex: 1 1 auto; /* 允许收缩和增长 */
    overflow-y: auto;
    padding: 0; /* 移除容器内边距，由子元素控制，确保内容能滚到Header下方 */
    display: flex;
    flex-direction: column;
    min-height: 0; /* 允许flex子项正确收缩 */
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px;
    padding-top: 74px; /* Header高度 54 + 20px 间距 */
    padding-bottom: 140px; /* 输入框预留 */
    width: 100%;
    box-sizing: border-box;
}

.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: 74px;
    padding-bottom: 140px;
    color: #8e8e93;
    min-height: 100%; /* 确保高度占满 */
    box-sizing: border-box;
}

/* 侧边栏样式 */
.lingning-sidebar {
    width: 280px; /* 减少20px */
    background: #F9F9F9; /* 改为 #F9F9F9 */
    border-right: 1px solid #F2F2F2;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #F2F2F2;
}

/* 侧边栏工具栏 */
.sidebar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 侧边栏搜索框调整 */
.search-chat-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 12px; /* 按比例缩放（36px:12px ≈ 60px:24px） */
    padding: 0 10px; /* 去掉垂直 padding，用 height 控制 */
    height: 36px; /* 与按钮高度一致 */
    transition: background 0.2s;
    box-sizing: border-box;
}

/* 搜索弹窗样式 */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2); /* 仅遮罩颜色，去掉模糊 */
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 100px;
}

.search-modal.show {
    display: flex;
}

.search-modal-content {
    background: #fff;
    width: 600px;
    max-width: 90%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.search-modal-header {
    padding: 16px;
    border-bottom: 1px solid #F2F2F2;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-search-input {
    border: none;
    outline: none;
    font-size: 16px;
    flex: 1;
    color: #333;
    background: transparent;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.search-modal-body {
    padding: 10px 0;
    max-height: 60vh;
    overflow-y: auto;
}

.search-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover {
    background: #f5f5f5;
}

.search-divider {
    padding: 8px 20px;
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.search-chat-wrapper:focus-within {
    background: #fff;
    box-shadow: 0 0 0 1px #e0e0e0;
}

.search-icon {
    color: #999;
    flex-shrink: 0;
}

.chat-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
    color: #333;
}

.chat-search-input::placeholder {
    color: #999;
}

.new-chat-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #F2F2F2;
    border-radius: 12px; /* 按比例缩放（36px:12px ≈ 60px:24px） */
    background: transparent;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    flex-shrink: 0;
}

.new-chat-icon-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* 已废弃的旧按钮样式，保留以防万一，或者直接删除 */
.new-chat-btn {
    display: none;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* ... */

.welcome-content h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 16px;
    font-weight: 600;
    /* 图标对齐已经在 HTML inline style 中处理 */
}

.welcome-content p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    max-width: 800px; /* 增加宽度以容纳更长文本 */
    margin: 0 auto;
    white-space: nowrap; /* 尝试一行显示 */
}

.chat-history-item {
    position: relative;
    padding: 5px 16px; /* 进一步减小 padding */
    margin-bottom: 4px;
    border-radius: 12px; /* 按比例缩放，与输入框比例一致 */
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 8px; /* 左侧留出距离 */
    margin-right: 8px; /* 右侧留出距离 */
    padding-left: 26px; /* 预留与账单图标相同的缩进，使文本左对齐更一致 */
}

/* 笔直的分隔线 - 已移除 */
.chat-history-item::after {
    display: none;
}

.chat-history-item:hover {
    background: #f0f0f0;
}

.chat-history-item.active {
    background: #EFEFEF;
}

.chat-history-item.active .chat-history-content,
.chat-history-item:hover .chat-history-content {
    color: #0D0D0D;
}

.chat-history-content {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-delete-btn {
    display: block;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-delete-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.delete-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
}

.delete-menu.show {
    display: block;
}

.delete-option {
    padding: 8px 16px;
    font-size: 14px;
    color: #ff4757;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-option:hover {
    background: #fff5f5;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #ECECEC;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.user-points {
    font-size: 12px;
    color: #666;
}

/* 主聊天区域 */
.lingning-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff; /* 改为白色 */
    min-height: 0; /* 关键：允许flex收缩 */
}

/* 欢迎界面 */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1; /* 使用flex而非height:100%，更灵活 */
    min-height: 400px; /* 设置最小高度确保居中 */
    text-align: center;
}

.welcome-content {
    max-width: 500px;
}

.welcome-icon {
    margin-bottom: 20px;
}

.ai-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.welcome-content h1 {
    font-size: 32px;
    color: #333;
    margin-bottom: 16px;
}

.welcome-content h1 #welcomeText {
    color: #0D0D0D;
}

.welcome-content p {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.feature-item span {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.cost-info {
    padding: 16px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    display: none; /* 隐藏积分信息 */
}

.cost-info p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

/* 聊天消息区域 */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    margin-bottom: 16px;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message.user .message-content {
    max-width: 500px; /* 限制用户消息最大宽度 */
    background: #E4F2FF;
    color: #00284D;
    border-top-right-radius: 4px; /* 右上角改为直角（小圆角） */
    border-bottom-right-radius: 18px; /* 右下角恢复大圆角 */
}

.message.assistant .message-content {
    background: transparent; /* 透明背景 */
    color: #333;
    padding-left: 0; /* 移除左内边距，使其与头像对齐 */
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.message.user .message-time {
    text-align: right;
    color: rgba(0, 40, 77, 0.6);
}

.message.assistant .message-time {
    text-align: left;
    padding-left: 0;
}

/* 消息文本样式 */
.message-text {
    word-wrap: break-word;
    line-height: 1.6;
}

/* AI消息中的链接样式 */
.message.assistant .message-text a {
    color: #007AFF;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 122, 255, 0.3);
    transition: all 0.2s;
}

.message.assistant .message-text a:hover {
    border-bottom-color: #007AFF;
    background: rgba(0, 122, 255, 0.05);
    padding: 0 2px;
}

/* 用户消息中的链接 */
.message.user .message-text a {
    color: #0051D5;
    text-decoration: underline;
}

/* 代码样式 */
.message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.message.user .message-text code {
    background: rgba(255, 255, 255, 0.5);
    color: #00284D;
}

/* 粗体 */
.message-text strong {
    font-weight: 600;
}

/* 斜体强制改为正常 */
.message-text em {
    font-style: normal;
}

/* 加载动画 - 呼吸球 */
.loading-sphere {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FD5BA9, #FF4D5A, #FEBF69);
    animation: breathe 1.5s infinite ease-in-out;
    margin: 2px 0;
    filter: blur(1px);
}

@keyframes breathe {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; filter: blur(3px); }
    100% { transform: scale(0.8); opacity: 0.6; }
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.header-version {
    color: #999;
    font-weight: normal;
    margin-left: 4px;
}

/* AI消息操作栏 */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    opacity: 1; /* 改为常驻显示 */
    transition: opacity 0.2s;
}

.message.assistant:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none; /* 移除边框 */
    cursor: pointer;
    color: #999;
    padding: 6px; /* 增大尺寸 */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.action-btn svg {
    width: 16px; /* 增大图标尺寸 */
    height: 16px;
}

/* 输入区域外层容器 - iOS 风格高斯模糊背景 - 悬浮底部 */
.chat-input-container {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 12px 100px 15px 100px; /* 左右间距改为 100px */
    position: absolute; /* 绝对定位，悬浮底部 */
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5; /* 层级设置 */
    box-sizing: border-box;
}

/* 渐进式模糊背景层 */
.chat-input-container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    /* 上方40%区域进行模糊过渡，下方60%保持完全模糊 */
    mask-image: linear-gradient(to bottom, transparent 0%, black 40%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40%, black 100%);
    pointer-events: none;
}

/* AI 提示文本 */
.image-gen-hint {
    color: #0584FF;
    font-size: 14px;
    margin-top: 8px;
}

.ai-disclaimer {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    position: relative;
    z-index: 2;
}

/* 输入框 - 不透明白色背景 */
.chat-input-wrapper {
    background: #ffffff; /* 不透明白色 */
    border: 1px solid #D6D6D6; /* 实心边框 */
    border-radius: 24px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #0285FF;
    box-shadow: 0 4px 16px rgba(2, 133, 255, 0.15);
}

#chatInput {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 16px;
    line-height: 1.5;
    min-height: 24px;
    max-height: 200px;
    padding: 4px 0;
    font-family: inherit;
    color: #333;
    /* 隐藏滚动条 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#chatInput::-webkit-scrollbar {
    display: none;
}

/* 文件预览区域 */
.file-preview-container {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 4px; /* 滚动条空间 */
}

.file-preview-container::-webkit-scrollbar {
    height: 4px;
}

.file-preview-container::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 2px;
}

.file-preview-item {
    position: relative;
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 8px 12px;
    min-width: 160px;
    max-width: 220px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.file-preview-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.file-preview-thumbnail {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 10px;
    flex-shrink: 0;
}

.file-preview-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-type {
    font-size: 11px;
    color: #999;
}

.file-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #333;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    border: 2px solid #fff;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.file-preview-item:hover .file-remove-btn {
    opacity: 1;
}

/* 上传进度环 */
.upload-progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.progress-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0285FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#chatInput::placeholder {
    color: #999;
}

.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    position: relative;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

/* 消息文件列表样式 */
.message-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
    width: auto;
    min-width: 240px;
    max-width: 80%;
}

.file-card {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E6E6E6;
    border-radius: 12px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

.file-card:hover {
    border-color: #D0D0D0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.file-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

/* PDF图标背景色 - 红色 */
.file-card-icon.pdf {
    background: #E74C3C;
}
/* 图片图标背景色 - 蓝色 */
.file-card-icon.image {
    background: #0285FF;
}

.file-card-info {
    flex: 1;
    overflow: hidden;
    text-align: left; /* 强制左对齐 */
}

.file-card-name {
    font-size: 14px;
    color: #0D0D0D;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-card-type {
    font-size: 12px;
    color: #666;
}

/* 工具栏样式 */
.chat-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}

.left-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.right-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-info {
    display: flex;
    align-items: center;
}

.tool-group {
    position: relative;
    display: flex;
    align-items: center;
}

.tool-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px; /* Modified padding to work with fixed height */
    height: 32px;    /* Fixed height */
    background: transparent;
    border: none;
    border-radius: 16px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.tool-btn.active {
    color: #0285FF;
    background: rgba(2, 133, 255, 0.08);
}

/* 加号按钮特殊样式 */
.plus-btn {
    padding: 6px;
    border-radius: 50%;
}

.plus-btn svg {
    width: 20px;
    height: 20px;
}

/* 思考按钮样式 */
.reasoning-btn span {
    font-weight: 500;
}

.chevron-down {
    width: 10px;
    height: 10px;
    margin-left: 2px;
    opacity: 0.6;
}

/* 发送按钮样式 */
.send-btn {
    background: #0285FF; /* 新的高亮蓝色 */
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover:not(:disabled) {
    background: #0069d9;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
}

.send-icon {
    width: 16px;
    height: 16px;
}

/* 下拉菜单样式 */
.tool-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 150px;
    padding: 4px;
    /* 动画 */
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease-out;
}

.tool-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.tool-option, .reasoning-option, .style-option, .ratio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #0D0D0D;
    font-size: 14px;
    transition: background 0.2s;
}

.tool-option:hover, .reasoning-option:hover, .style-option:hover, .ratio-option:hover {
    background: #f5f5f5;
}

.tool-option.active, .reasoning-option.selected, .style-option.selected, .ratio-option.selected {
    color: #0285FF;
    background: rgba(2, 133, 255, 0.08);
}

.option-check {
    margin-left: auto;
    color: #0285FF;
    opacity: 0;
}

.tool-option.active .option-check,
.reasoning-option.selected .option-check,
.style-option.selected .option-check,
.ratio-option.selected .option-check {
    opacity: 1;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px; /* 进一步减少间距 */
    font-size: 12px;
    color: #666;
}

.char-count {
    color: #999;
}

.cost-reminder {
    color: #333;
}

/* 积分不足模态框 */
.insufficient-points-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.insufficient-points-modal.show {
    display: flex;
}

.insufficient-points-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
}

.insufficient-points-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.insufficient-points-content h2 {
    margin-bottom: 16px;
    color: #333;
}

.insufficient-points-content p {
    margin-bottom: 12px;
    color: #666;
}

.insufficient-points-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 16px;
    transition: background-color 0.2s;
}

.insufficient-points-btn:hover {
    background: #0051D5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .lingning-container {
        margin: 5px 10px 10px 10px;
        min-height: calc(100vh - 160px); /* 增加15px空间 */
        max-height: calc(100vh - 160px);
    }
    
    .lingning-sidebar {
        width: 250px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    #chatInput {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .lingning-container {
        flex-direction: column;
        margin: 5px 5px 10px 5px;
        min-height: calc(100vh - 165px); /* 增加15px空间 */
        max-height: calc(100vh - 165px);
    }
    
    .welcome-screen {
        min-height: 300px; /* 小屏幕上减少最小高度 */
    }
    
    .lingning-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .chat-container {
        padding: 10px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .chat-input-box {
        padding: 8px 12px;
        min-height: 44px;
    }
    
    #chatInput {
        font-size: 16px;
        min-height: 20px;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
    }
}

.gradient-avatar-frame {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px auto;
    /* 呼吸效果的彩色阴影 - Tron红色系 */
    animation: breathing-shadow 4s ease-in-out infinite;
}

@keyframes breathing-shadow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 82, 82, 0.5),
                    0 0 40px rgba(255, 82, 82, 0.3);
    }
    25% {
        box-shadow: 0 0 20px rgba(255, 77, 90, 0.5),
                    0 0 40px rgba(255, 77, 90, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 138, 101, 0.5),
                    0 0 40px rgba(255, 138, 101, 0.3);
    }
    75% {
        box-shadow: 0 0 20px rgba(252, 92, 125, 0.5),
                    0 0 40px rgba(252, 92, 125, 0.3);
    }
}

.gradient-avatar-frame::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(45deg, #ff5252, #ff6b35, #ff8a65, #fc5c7d);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: gradient-rotate 8s linear infinite;
}

.gradient-avatar-frame .ai-icon {
    position: relative;
    z-index: 2;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: block;
}

/* 移除内白圈 */
.gradient-avatar-frame::after {
    display: none;
}

@keyframes gradient-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 
/* =========================================
   Markdown 内容样式增强 (仿 Poe/GitHub)
   ========================================= */

.message-text {
    line-height: 1.6;
    font-size: 15px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    min-width: 0;
    max-width: 100%;
}

/* 图片自适应 */
.message-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 段落间距 */
.message-text p {
    margin-bottom: 1em;
}
.message-text p:last-child {
    margin-bottom: 0;
}

/* 标题样式 */
.message-text h1, .message-text h2, .message-text h3, 
.message-text h4, .message-text h5, .message-text h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.3;
    color: #1a1a1a;
}
.message-text h1 { font-size: 1.6em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.message-text h2 { font-size: 1.4em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.message-text h3 { font-size: 1.25em; }
.message-text h4 { font-size: 1.1em; }

/* 列表样式 */
.message-text ul, .message-text ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}
.message-text li {
    margin-bottom: 0.25em;
}

/* 代码块样式 - 使用 Wrapper 结构 */
.code-block-wrapper {
    margin: 1em 0;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    overflow: hidden; /* 关键：限制内部溢出 */
    max-width: 100%; /* 确保包裹器不超出父容器 */
    background-color: #f6f8fa;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
    font-size: 12px;
    color: #666;
    user-select: none;
}

.code-lang {
    font-weight: 600;
    text-transform: uppercase;
}

.code-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.code-copy-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}

.message-text pre {
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 16px !important;
    background: transparent !important;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    /* 保留默认 white-space: pre 或 pre-wrap 根据需要，这里使用 pre 以支持滚动 */
}

.message-text code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-text pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

/* 引用块样式 */
.message-text blockquote {
    margin: 1em 0;
    padding-left: 1em;
    border-left: 4px solid #dfe2e5;
    color: #6a737d;
}

/* 表格样式 (关键) */
.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 0.95em;
    display: block; /* 让表格在小屏下可滚动 */
    overflow-x: auto;
}

.message-text table th,
.message-text table td {
    border: 1px solid #dfe2e5;
    padding: 8px 12px;
    line-height: 1.5;
}

.message-text table th {
    background-color: #f6f8fa;
    font-weight: 600;
    text-align: left;
}

.message-text table tr:nth-child(2n) {
    background-color: #fcfcfc;
}

/* 链接样式 */
.message-text a {
    color: #0969da;
    text-decoration: none;
}
.message-text a:hover {
    text-decoration: underline;
}

/* 分割线 */
.message-text hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

/* 修复 Flex 布局下的内容溢出问题 */
.message-content {
    min-width: 0;
    max-width: 90%; /* 保持原有的最大宽度限制，但确保 Flex 收缩生效 */
}

/* 引用来源样式 */
.message-sources {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 12px;
}

.sources-title {
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.source-link {
    background: #f5f5f5;
    color: #0969da;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-link:hover {
    background: #eef;
    text-decoration: underline;
}

.source-num {
    color: #666;
    margin-right: 4px;
    font-weight: bold;
    flex-shrink: 0;
}

/* === 修正版布局保护补丁 (Grid方案) === */

/* 确保主容器不横向滚动 */
.chat-messages {
    max-width: 100%;
    overflow-x: hidden;
}

/* 消息内容气泡 */
.message-content {
    min-width: 0;
    max-width: 90%;
    width: fit-content;
    /* 关键：移除 overflow 以显示球体阴影 */
    overflow: visible;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 文本区域：使用 Grid 布局强制限制子元素宽度 */
.message-text {
    display: grid;
    grid-template-columns: minmax(0, 1fr); /* 强制单列，允许收缩到 0 */
    width: 100%;
}

/* 代码块包裹器 */
.code-block-wrapper {
    width: 100%;
    min-width: 0;
}

.code-header {
    width: 100%;
    box-sizing: border-box;
}

.message-text pre {
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    white-space: pre; 
}

/* 修复球体遮挡 */
.loading-sphere {
    margin: 10px;
    position: relative;
    z-index: 1;
}

/* 增加用户消息与右侧的间距 */
.message.user .message-content {
    margin-right: 5px;
}

/* 用户上传文件列表右侧间距 */
.message.user .message-files {
    margin-right: 5px;
}

/* Image Generation Mode Indicator */
.image-mode-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(2, 133, 255, 0.08);
    border-radius: 16px;
    color: #0285FF;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
    user-select: none;
}

.image-mode-indicator:hover {
    background: rgba(2, 133, 255, 0.15);
}

.image-mode-indicator:hover .icon-std {
    display: none;
}

.image-mode-indicator:hover .icon-close {
    display: block !important;
    color: #0285FF;
}

.image-mode-indicator .indicator-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.image-mode-indicator svg {
    width: 16px;
    height: 16px;
}

/* Web Search Mode Indicator */
.websearch-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(2, 133, 255, 0.08);
    border-radius: 16px;
    color: #0285FF;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
    user-select: none;
}

.websearch-indicator:hover {
    background: rgba(2, 133, 255, 0.15);
}

.websearch-indicator:hover .icon-std {
    display: none;
}

.websearch-indicator:hover .icon-close {
    display: block !important;
    color: #0285FF;
}

.websearch-indicator .indicator-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.websearch-indicator svg {
    width: 16px;
    height: 16px;
}

/* Style & Ratio button labels */
.style-btn span,
.ratio-btn span {
    font-weight: 500;
}

/* Image Generation Loading & Result */
.image-gen-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 400px !important;
    margin: 10px 0;
}

.image-gen-status-text {
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
    font-weight: 500;
}

.image-gen-placeholder {
    width: 200px;
    height: 200px;
    background: #F7F7F8;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-gen-spinner-box {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.image-gen-icon {
    color: #333;
    width: 24px;
    height: 24px;
    z-index: 2;
}

.image-gen-spinner-ring {
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border: 2px solid transparent;
    border-bottom-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.image-gen-result {
    width: 100%;
    max-width: 400px !important;
    height: auto;
    border-radius: 16px;
    display: block;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==== iPad及移动端适配补充 ==== */

@media (max-width: 1024px) {
    .lingning-sidebar {
        width: 240px; /* 稍微缩窄 */
    }
    /* 确保内容区有足够的底部空间 */
    .chat-messages, .welcome-screen {
        padding-bottom: 160px;
    }
}

/* ============================================
   移动端 Galapure 全面适配 (ChatGPT 风格)
   ============================================ */
@media (max-width: 768px) {
    /* 主容器 - 全屏高度 */
    .lingning-container {
        margin: 0;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        position: relative;
    }

    /* ====== 侧边栏抽屉模式 ====== */
    .lingning-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        background: #fff;
    }

    .lingning-sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,0.15);
    }

    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    /* 侧边栏头部 */
    .sidebar-header {
        padding: 16px;
        border-bottom: 1px solid #f0f0f0;
    }

    .search-chat-wrapper {
        height: 44px;
        border-radius: 22px;
        background: #f5f5f5;
    }

    .new-chat-icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 22px;
    }

    /* 侧边栏内容 */
    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chat-history-item {
        padding: 14px 16px;
        margin: 4px 12px;
        border-radius: 12px;
    }

    /* 侧边栏底部用户信息 */
    .sidebar-footer {
        padding: 16px;
        border-top: 1px solid #f0f0f0;
    }

    .user-info {
        gap: 12px;
    }

    .user-avatar-small {
        width: 40px;
        height: 40px;
    }

    .user-name {
        font-size: 15px;
        font-weight: 600;
    }

    /* ====== 主区域 ====== */
    .lingning-main {
        width: 100%;
        height: 100%;
    }

    /* 顶部标题栏 - 移动端样式 */
    .chat-header-bar {
        height: 56px;
        padding: 0 16px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    /* 移动端汉堡菜单按钮 */
    .mobile-menu-btn {
        display: flex !important;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        cursor: pointer;
        border-radius: 20px;
        margin-right: 8px;
        color: #333;
    }

    .mobile-menu-btn:active {
        background: rgba(0,0,0,0.05);
    }

    /* 隐藏桌面端的 header toggle 按钮 */
    .header-toggle-btn {
        display: none;
    }

    .header-title {
        font-size: 17px;
    }

    /* ====== 聊天容器 ====== */
    .chat-container {
        padding-top: 56px; /* 为固定顶栏留空间 */
    }

    .chat-messages {
        padding: 16px;
        padding-top: 72px;
        padding-bottom: 160px;
        gap: 20px;
    }

    .welcome-screen {
        padding: 20px 16px;
        padding-top: 72px;
        padding-bottom: 160px;
        min-height: auto;
    }

    .welcome-content {
        max-width: 100%;
    }

    #welcomeTitle {
        font-size: 24px !important;
        gap: 8px !important;
    }

    #welcomeTitle svg {
        width: 32px !important;
        height: 32px !important;
    }

    .welcome-content p {
        font-size: 15px;
        line-height: 1.5;
        white-space: normal;
    }

    /* ====== 消息样式 ====== */
    .message {
        margin-bottom: 16px;
    }

    .message-content {
        max-width: 90%;
        padding: 12px 14px;
        font-size: 15px;
        line-height: 1.6;
    }

    .message.user .message-content {
        max-width: 85%;
        border-radius: 20px 20px 4px 20px;
    }

    .message.assistant .message-content {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .message-text {
        font-size: 15px;
        line-height: 1.65;
    }

    /* 消息操作按钮 - 常驻显示 */
    .message-actions {
        opacity: 1;
        margin-top: 8px;
        gap: 4px;
    }

    .action-btn {
        padding: 8px;
        color: #999;
    }

    .action-btn svg {
        width: 18px;
        height: 18px;
    }

    /* ====== 输入区域 - ChatGPT 移动端风格 ====== */
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: #fff;
        z-index: 50;
    }

    .chat-input-container::before {
        display: none; /* 移除渐变模糊背景 */
    }

    .chat-input-wrapper {
        border-radius: 26px;
        padding: 8px 12px;
        border: 1px solid #e5e5e5;
        box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    }

    #chatInput {
        font-size: 16px;
        min-height: 24px;
        max-height: 120px;
        padding: 4px 0;
    }

    #chatInput::placeholder {
        color: #999;
    }

    /* 工具栏简化 */
    .chat-toolbar {
        padding-top: 6px;
    }

    .left-tools {
        gap: 4px;
    }

    /* 加号按钮 */
    .plus-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .plus-btn svg {
        width: 22px;
        height: 22px;
    }

    /* 思考按钮 */
    .reasoning-btn {
        padding: 0 10px;
        height: 36px;
        font-size: 14px;
    }

    .reasoning-btn svg:first-child {
        width: 16px;
        height: 16px;
    }

    .reasoning-btn span {
        font-size: 14px;
    }

    /* 隐藏下拉箭头 */
    .reasoning-btn .chevron-down {
        display: none;
    }

    /* 模式指示器 */
    .image-mode-indicator,
    .websearch-indicator {
        padding: 6px 10px;
        font-size: 13px;
        margin-left: 4px;
    }

    /* 风格/比例选择器 - 移动端隐藏下拉箭头 */
    .style-btn .chevron-down,
    .ratio-btn .chevron-down {
        display: none;
    }

    .style-btn,
    .ratio-btn {
        padding: 0 10px;
        height: 36px;
        font-size: 14px;
    }

    /* 右侧工具 */
    .right-tools {
        gap: 8px;
    }

    /* 字数统计 */
    .char-count {
        display: none; /* 移动端隐藏字数统计 */
    }

    /* 发送按钮 */
    .send-btn {
        width: 36px;
        height: 36px;
        background: #0285FF;
    }

    .send-btn:disabled {
        background: #e0e0e0;
    }

    /* AI 提示文字 */
    .ai-disclaimer {
        display: none; /* 移动端隐藏提示 */
    }

    /* 下拉菜单适配 */
    .tool-dropdown {
        min-width: 180px;
        max-height: 60vh;
        overflow-y: auto;
    }

    .tool-option,
    .reasoning-option,
    .style-option,
    .ratio-option {
        padding: 14px 16px;
        font-size: 15px;
    }

    /* ====== 文件预览 ====== */
    .file-preview-container {
        gap: 8px;
        margin-bottom: 8px;
    }

    .file-preview-item {
        min-width: 140px;
        max-width: 180px;
        padding: 8px 10px;
    }

    /* ====== 代码块 ====== */
    .code-block-wrapper {
        border-radius: 12px;
        margin: 12px 0;
    }

    .code-header {
        padding: 10px 14px;
        font-size: 12px;
    }

    .message-text pre {
        padding: 14px !important;
        font-size: 13px;
    }

    /* ====== 搜索弹窗 ====== */
    .search-modal {
        padding-top: 60px;
        align-items: flex-start;
    }

    .search-modal-content {
        width: 95%;
        max-width: none;
        border-radius: 16px;
    }

    .search-modal-header {
        padding: 14px 16px;
    }

    .modal-search-input {
        font-size: 16px;
    }

    /* ====== 账单模态框 ====== */
    .billing-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }

    .billing-header {
        padding: 16px;
    }

    .billing-body {
        padding: 16px;
    }

    .billing-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-card {
        padding: 16px;
    }

    .summary-card .value {
        font-size: 20px;
    }

    .billing-table {
        font-size: 13px;
    }

    .billing-table th,
    .billing-table td {
        padding: 10px 8px;
    }

    /* ====== 支付模态框 ====== */
    .payment-content {
        width: 95%;
        border-radius: 16px;
    }

    /* ====== 积分不足模态框 ====== */
    .insufficient-points-content {
        width: 90%;
        border-radius: 16px;
        padding: 24px 20px;
    }
}

/* 修复 iPad/移动端导航栏列表样式问题 (移除黑点) */
.main-nav ul {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

/* 在触摸设备上隐藏导航高亮块，防止错位 */
@media (hover: none) and (pointer: coarse) {
    .nav-highlight {
        display: none !important;
    }
}

/* Thinking Indicator Animation */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.thinking-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #A5D8FF 0%, #4DA3FF 33%, #0285FF 66%, #0051D5 100%);
    -webkit-mask: url('images/icons8-analyze.apng') center/contain no-repeat;
    mask: url('images/icons8-analyze.apng') center/contain no-repeat;
}

.thinking-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* === 账单与费用样式 === */

/* 侧边栏菜单 */
.sidebar-menu {
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #F2F2F2;
}

.sidebar-menu-item {
    width: 100%;
    margin: 0; /* 与容器完全贴合 */
    padding: 10px 16px;
    border-radius: 0; /* 改为直角框 */
    display: flex;
    align-items: center;
    gap: 12px; /* 稍微加大间距以匹配视觉 */
    background: transparent;
    border: none;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    text-align: left;
}

.sidebar-menu-item:hover {
    background: #f0f0f0;
}
.sidebar-menu-item svg {
    color: #666;
    flex-shrink: 0;
    display: block; /* 避免 inline SVG 影响垂直对齐 */
}

/* 账单模态框 */
.billing-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

.billing-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.billing-content {
    background: #fff;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.billing-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.billing-header h2 {
    margin: 0;
    margin-right: auto; /* 将右侧元素挤到右边 */
    font-size: 20px;
    color: #333;
}

/* 管理仪表盘按钮 */
.admin-dashboard-btn {
    background: #1890ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-right: 16px; /* 与关闭按钮的间距 */
    transition: background 0.2s;
}

.admin-dashboard-btn:hover {
    background: #40a9ff;
}

.billing-close-btn {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.billing-close-btn:hover {
    color: #333;
}

.billing-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* 账单概览卡片 */
.billing-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.summary-card .label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.summary-card .value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    font-family: 'Monaco', monospace;
}

.summary-card .value.highlight {
    color: #0285FF;
}

/* 账单历史表格 */
.billing-history h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #333;
}

.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.billing-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #eee;
    color: #999;
    font-weight: 500;
}

.billing-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-badge.paid {
    background: #e6fffa;
    color: #00a854;
}

.status-badge.unpaid {
    background: #fff1f0;
    color: #cf1322;
}

/* 管理员视图 */
.billing-users-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.billing-user-item {
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
}

.billing-user-item:hover {
    background: #e6f7ff;
    color: #1890ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.back-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 16px;
}

.pay-btn {
    padding: 4px 12px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.pay-btn:hover {
    background: #40a9ff;
}

.pay-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.loading-spinner, .empty-state, .error-state {
    padding: 40px;
    text-align: center;
    color: #999;
}

/* 支付模态框 */
.payment-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

.payment-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.payment-content {
    background: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    overflow: hidden;
}

.payment-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.payment-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.payment-close-btn {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.payment-close-btn:hover {
    color: #333;
}

.payment-body {
    padding: 24px;
}

.payment-details {
    margin-bottom: 24px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.payment-row.total {
    border-bottom: 2px solid #eee;
    font-weight: 600;
}

.payment-row.balance {
    border-bottom: none;
    color: #666;
}

.payment-label {
    color: #666;
}

.payment-value {
    color: #333;
    font-weight: 500;
}

.payment-value.highlight {
    color: #0285FF;
    font-size: 18px;
}

.payment-actions {
    display: flex;
    gap: 12px;
}

.payment-cancel-btn {
    flex: 1;
    padding: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.payment-cancel-btn:hover {
    background: #e0e0e0;
}

.payment-confirm-btn {
    flex: 2;
    padding: 12px;
    background: linear-gradient(135deg, #0285FF, #40A9FF);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 133, 255, 0.3);
}

.payment-confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.payment-success {
    text-align: center;
    padding: 20px 0;
}

.payment-success .success-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #52c41a, #73d13d);
    color: white;
    font-size: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.payment-success p {
    margin: 0;
    font-size: 16px;
    color: #333;
}

/* 状态按钮样式 */
.status-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn.pay-now {
    background: linear-gradient(135deg, #0285FF, #40A9FF);
    color: white;
}

.status-btn.pay-now:hover {
    background: linear-gradient(135deg, #40A9FF, #69C0FF);
}

.status-btn.view-detail {
    background: #e6fffa;
    color: #00a854;
}

.status-btn.view-detail:hover {
    background: #b7f0de;
}

.status-btn.disabled {
    background: #f5f5f5;
    color: #bfbfbf;
    cursor: not-allowed;
}
