/* 引入 MiSans 字体 */
@import url('https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Bold.min.css');
@import url('https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Light.min.css');

:root {
    --body-bg: #F7FBFF;
    --card-bg: #FFFFFF;
    --toggle-bg: #FFFFFF;
    --text-primary: #1C529B;
    --text-secondary: #333;
    --text-tertiary: #555;
    --text-placeholder: #AEB8C9;
    --text-description: #b1b1b1;
    --param-text: #878787;
    --active-item-bg: #F1F1F1;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --input-shadow: rgba(0, 0, 0, 0.07);
    --toggle-shadow: rgba(0, 0, 0, 0.1);
}
:root.dark-mode {
    --body-bg: #111827;
    --card-bg: #1F2937;
    --toggle-bg: #374151;
    --text-primary: #A5C9FF;
    --text-secondary: #F3F4F6;
    --text-tertiary: #D1D5DB;
    --text-placeholder: #9CA3AF;
    --text-description: #9CA3AF;
    --param-text: #9CA3AF;
    --active-item-bg: #374151;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --input-shadow: rgba(0, 0, 0, 0.2);
    --toggle-shadow: rgba(0, 0, 0, 0.25);
}

#saved-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 18px;
    padding: 20px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
}
#saved-dialog.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
.dark-mode #saved-dialog {
    background: var(--card-bg);
    color: var(--text-secondary);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: var(--body-bg);
    height: 100vh;
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s ease;
}

#guokeLogo{
    width: 100px;
}

#backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
}
#backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-toggle-btn, .theme-toggle-btn {
    position: fixed;
    top: 40px;
    z-index: 1001;
    background: var(--toggle-bg);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 12px var(--toggle-shadow);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
}
.sidebar-toggle-btn { left: 40px; }
.theme-toggle-btn { right: 40px; }

.sidebar-toggle-btn:hover, .theme-toggle-btn:hover {
    transform: scale(1.1);
}

.sidebar-toggle-btn i, .theme-toggle-btn i {
    font-size: 24px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}
.theme-toggle-btn .ri-moon-clear-line { display: none; }
.dark-mode .theme-toggle-btn .ri-moon-clear-line { display: block; }
.dark-mode .theme-toggle-btn .ri-sun-line { display: none; }

.sidebar {
    width: 328px;
    height: 740px;
    background-color: var(--card-bg);
    padding: 40px 20px;
    box-sizing: border-box;
    border-radius: 24px;
    box-shadow: 0 10px 40px var(--shadow-color);
    position: fixed;
    top: 50%;
    left: 5%;
    transform: translateY(-50%);
    z-index: 1000;
    transition: transform 0.4s ease-in-out, background-color 0.3s ease;
}

.sidebar.sidebar-hidden {
    transform: translateY(-50%) translateX(-120%);
}

.sidebar h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 0;
    margin-bottom: 30px;
    padding-left: 15px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li a {
    display: block;
    text-decoration: none;
    color: var(--text-tertiary);
    padding: 12px 15px;
    border-radius: 10px;
    margin: 0 10px 10px;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar ul li.active a {
    background-color: var(--active-item-bg);
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar ul li a:hover {
    background-color: var(--active-item-bg);
}

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 1300px;
    height: 100%;
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0 60px;
}

.input-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    z-index: 2; /* 确保输入框在按钮之上 */
}

.input-container input {
    width: 100%;
    padding: 18px 60px 18px 70px; 
    border: none;
    border-radius: 33px;
    font-size: 16px;
    background-color: var(--card-bg);
    color: var(--text-secondary);
    box-shadow: 4px 3px 45px 5px var(--input-shadow);
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, padding-left 0.3s ease;
}

.input-container input:focus {
    outline: none;
}

.input-container input::placeholder {
    color: var(--text-placeholder);
}

/* 帮助按钮相关 */
.help-container {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.help-btn {
    background: var(--toggle-bg);
    border: none;
    border-radius: 50%;
    width: 44px; 
    height: 44px;
    box-shadow: 0 2px 8px var(--toggle-shadow);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    padding: 0;
}

.help-btn:hover {
    transform: scale(1.1);
}

.help-btn i {
    font-size: 22px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.help-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 320px;
    background-color: var(--card-bg);
    color: var(--text-secondary);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.help-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: var(--card-bg) transparent transparent transparent;
    transition: border-color 0.3s ease;
}

.help-btn:hover + .help-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.help-tooltip h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.help-tooltip p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'MiSans Light', sans-serif;
}

.help-tooltip .usage-tip {
    margin-top: 12px;
    font-size: 13px;
    opacity: 0.9;
}

.send-btn {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg); /* 保持原来的旋转 */
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.send-icon {
    font-size: 24px;
    color: var(--text-placeholder);
    transition: color 0.3s ease;
}
.send-btn:hover .send-icon {
    color: #3B82F6;
}

.description {
    font-size: 17px;
    color: var(--text-description);
    margin-top: 30px;
    margin-bottom: 40px; /* 缩减下方间距，给按钮留空间 */
    font-family: 'MiSans Light', sans-serif;
    transition: color 0.3s ease, font-size 0.3s ease;
    text-align: center;
}

/* =========================================
   主要修改区：按钮组样式
   ========================================= */

.action-buttons {
    display: flex;
    flex-wrap: wrap;        /* 核心修改：允许换行 */
    justify-content: center;/* 居中对齐 */
    gap: 20px;              /* 按钮间距 */
    width: 100%;
    max-width: 1100px;      /* 限制最大宽度 */
    margin: 0 auto;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    border-radius: 20px;
    font-family: 'MiSans', sans-serif;
    font-weight: 700;
    
    /* 动态尺寸调整，以适应5个按钮 */
    font-size: 19px;        /* 字体稍微调小一点点适配 */
    min-width: 220px;       /* 最小宽度减小，防止换行过于突兀 */
    flex: 1 1 220px;        /* Flex 布局自适应 */
    max-width: 300px;       /* 限制最大宽度 */
    min-height: 90px;       /* 高度稍微压扁一点 */
    padding: 15px 20px;
    position: relative;
}

.btn i {
    font-size: 22px;
    margin-right: 10px;
}

.check-icon {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #4CAF50;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 18px;
    color: white;
    border: 3px solid var(--card-bg);
    transition: border-color 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 1. 员工培训 (粉红/红色系) */
.btn-vrp { background: linear-gradient(45deg, #fe988b, #f56f87, #f78a9e); }
.btn-vrp:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(250, 112, 154, 0.3); }

/* 2. 保密信息 (紫/淡粉色系) */
.btn-tcm { background: linear-gradient(45deg, rgba(124, 115, 243, 0.86), rgba(232, 119, 174, 0.86)); }
.btn-tcm:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(122, 136, 255, 0.3); }

/* 3. [新增] 产品信息 (蓝色科技系) */
.btn-pd { background: linear-gradient(45deg, #56ccf2, #2f80ed); }
.btn-pd:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(47, 128, 237, 0.3); }

/* 4. [新增] 专业知识库 (青绿/墨绿色系) */
.btn-kb { background: linear-gradient(45deg, #11998e, #38ef7d); }
.btn-kb:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(56, 239, 125, 0.3); }

/* 5. 敬请期待 (浅色/柔和系) */
.btn-coming-soon { background: linear-gradient(135deg, #cfd9df 0%, #e2ebf0 100%); color: #666; }
/* 如果想要保留原来的多彩但淡一点的风格，可以用下面这行替换上面 */
/* .btn-coming-soon { background: linear-gradient(142deg, rgba(200, 227, 250, 0.6), rgba(230, 36, 144, 0.6)); } */

.btn-coming-soon:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(0,0,0, 0.1); }

/* Toast 提示框 */
#dev-toast {
    position: fixed;
    transform: translateX(-50%) translateY(10px) scale(0.9);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 2000;
    white-space: nowrap;
}
#dev-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}


/* ############################################### */
/* --- 自适应设计 (移动端适配) --- */
/* ############################################### */

@media (max-width: 768px) {
    /* 1. 基础布局调整 */
    body {
        overflow-y: auto; /* 允许垂直滚动 */
    }

    .main-content {
        position: static;
        width: 100%;
        height: auto;
        min-height: 100vh;
        transform: none;
        padding: 80px 20px 40px 20px; /* 增加顶部 padding 避开侧边栏按钮 */
        justify-content: flex-start;
    }

    /* 2. 侧边栏 & 顶部按钮调整 */
    .sidebar-toggle-btn, .theme-toggle-btn {
        top: 20px;
        width: 40px;    /* 按钮缩小一点 */
        height: 40px;
    }
    .sidebar-toggle-btn { left: 20px; }
    .theme-toggle-btn { right: 20px; }

    .sidebar {
        width: 280px;
        height: 100vh;
        border-radius: 0;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }
    .sidebar.sidebar-hidden {
        transform: translateX(-100%);
    }
    .sidebar:not(.sidebar-hidden) {
        transform: translateX(0);
    }
    
    /* 3. 标题区域适配 (替换原来的 h1) */
    .logo-title {
        margin: 20px 0 30px 0; /* 减小间距 */
    }
    .logo-title img {
        max-width: 80%;        /* 图片宽度自适应 */
        margin-bottom: 10px;
    }
    .logo-text-cn {
        font-size: 32px !important; /* 强制覆盖大屏字号 */
    }
    .logo-text-en {
        font-size: 17px !important;
    }

    /* 4. 输入框与帮助按钮 */
    .input-container {
        width: 100%;
        margin-bottom: 20px;
    }
    .input-container input {
        padding: 12px 50px 12px 55px; /* 调整内边距 */
        font-size: 14px;
    }
    .help-container {
        left: 5px;
    }
    .help-btn {
        width: 36px;
        height: 36px;
    }
    .help-btn i { font-size: 18px; }
    
    /* 移动端提示框位置修正，防止超出屏幕 */
    .help-tooltip {
        width: 260px;
        left: 50%;
        transform: translateX(-40%) translateY(10px); /* 微调位置 */
        bottom: 130%; 
    }
    .help-btn:hover + .help-tooltip {
        transform: translateX(-40%) translateY(0);
    }

    .send-btn {
        right: 15px;
    }

    /* 5. 描述文字 */
    .description {
        font-size: 14px;
        margin-top: 10px;
        margin-bottom: 30px;
        padding: 0 10px;
    }

    /* 6. 按钮组核心适配 (重点修改) */
    .action-buttons {
        flex-direction: row; /* 保持行布局，允许换行 */
        flex-wrap: wrap;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    .btn {
        /* 让按钮在手机上一行显示两个 */
        /* calc(50% - 6px) 是为了减去 gap 的一半，确保两个按钮能并排 */
        flex: 1 1 calc(50% - 10px); 
        min-width: auto;       /* 取消最小宽度限制 */
        max-width: none;       /* 取消最大宽度限制 */
        min-height: 70px;      /* 高度稍微减小 */
        font-size: 16px;       /* 字体减小 */
        padding: 10px 15px;
        border-radius: 16px;
    }
    
    /* 如果你想让第5个按钮单独占一行，不需要写额外代码，flex 布局会自动拉伸它 */
    /* 如果你想让所有按钮在极小屏幕(如 iPhone SE)上都变单行，可以用下面的代码： */
    @media (max-width: 360px) {
        .btn {
            flex: 1 1 100%;
        }
    }

    .btn i {
        font-size: 20px;
        margin-right: 8px;
    }
    
    /* 7. 历史记录标题位置 */
    .historyTitle {
        padding-top: 50px; 
    }
}

/* =========================
   新增：用户菜单样式
   ========================= */

/* 用户头像容器 (右上角) */
.user-menu-container {
    position: absolute;
    top: 40px;
    right: 40px; /* 原来是主题按钮的位置，我们把它往左挤一点，或者把头像放最右边 */
    z-index: 1100;
}

/* 调整主题按钮位置，避免重叠 */
.theme-toggle-btn {
    right: 110px !important; /* 给头像腾位置 */
}
@media (max-width: 768px) {
    .theme-toggle-btn { right: 80px !important; }
    .user-menu-container { right: 20px; top: 20px; }
}

.user-avatar-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    box-shadow: 0 4px 12px var(--toggle-shadow);
    background: var(--text-primary);
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.user-avatar-btn:hover {
    transform: scale(1.1);
}

.user-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    width: 180px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}
.user-menu-container:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
    gap: 10px;
}
.dropdown-item:hover {
    background: var(--active-item-bg);
}
.dropdown-item i { font-size: 16px; }

/* 聊天页面的布局微调 */
.chat-main .user-menu-container {
    /* 聊天页面可以不用绝对定位，而是放在 header 里，但为了统一先保持绝对定位 */
    position: fixed;
}
