/**
 * 嘉哲企服官网 UI v3.9.0
 * 深色专业 + 简洁清爽 + 卡片式布局 + 丝滑动画
 * 创建时间：2026-03-29
 */

/* ========== CSS 变量 ========== */
:root {
    /* 颜色系统 */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border: #334155;
    --border-light: #475569;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* 动画曲线 */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* 尺寸 */
    --sidebar-width: 220px;
    --content-max-width: 1200px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.3);
}

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== 统一侧边栏 ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1000;
    animation: slideIn 0.4s var(--ease-smooth);
}

@keyframes slideIn {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 新对话按钮 */
.new-conversation-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 1.25rem;
    transition: all 0.3s var(--ease-smooth);
    box-shadow: var(--shadow-md);
}

.new-conversation-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 24px rgba(14, 165, 233, 0.4);
}

.new-conversation-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* 导航链接 */
.sidebar-nav {
    margin-bottom: 1rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.375rem;
    transition: all 0.3s var(--ease-smooth);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav a.coming-soon {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.sidebar-nav a.coming-soon:hover {
    background: transparent;
    border-left: none;
    padding-left: 1rem;
}

/* 对话记录列表 */
.conversation-section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.conversation-section-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.conversation-list {
    max-height: 250px;
    overflow-y: auto;
}

.conversation-list::-webkit-scrollbar {
    width: 6px;
}

.conversation-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary); // ✅ 悬停深灰色
}

.conversation-item {
    padding: 0.625rem 0.875rem;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s var(--ease-smooth);
    opacity: 0;
    animation: listItemEnter 0.3s var(--ease-smooth) forwards;
}

@keyframes listItemEnter {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.conversation-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.conversation-item.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(2, 132, 199, 0.1));
    color: var(--primary-light);
}

/* 侧边栏底部 */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* 主内容区底部（分割线 + 公司名称 + 页面名称） */
.main-content-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    text-align: center;
}

.footer-divider {
    height: 1px;
    background: var(--border);
    width: 200px;
    margin: 0 auto 0.75rem;
}

.footer-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-footer a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.375rem;
    transition: all 0.3s var(--ease-smooth);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ========== 主内容区 ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
}

.page-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 2rem;
    animation: pageFadeIn 0.5s var(--ease-smooth);
}

@keyframes pageFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 卡片样式 ========== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: all 0.4s var(--ease-smooth);
}

.card:hover {
    border-color: var(--text-secondary); // ✅ 灰色文字
    box-shadow: 
        var(--shadow-lg),
        0 0 0 1px rgba(14, 165, 233, 0.1);
    transform: translateY(-2px);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.card-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 24px rgba(14, 165, 233, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
    transform: translateY(-2px);
}

/* ========== 输入框样式 ========== */
.input-box {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s var(--ease-smooth);
}

.input-box:focus {
    outline: none;
    border-color: var(--text-secondary); // ✅ 灰色文字
    box-shadow: 
        0 0 0 3px rgba(14, 165, 233, 0.15),
        var(--shadow-md);
    transform: translateY(-1px);
}

.input-box::placeholder {
    color: var(--text-muted);
}

/* ========== 对话气泡 ========== */
.message {
    display: flex !important;
    gap: 14px;
    animation: messageEnter 0.5s var(--ease-elastic);
    align-items: flex-start !important;
    margin-bottom: 1.25rem;
    width: 100% !important;
    max-width: 900px !important;
}

/* ✅ 用户消息整体右对齐（从右向左延伸） */
.user-message {
    flex-direction: row-reverse !important;
    justify-content: flex-start !important;
    margin-left: auto !important;
    width: fit-content !important;
    max-width: 100% !important;
}

/* ✅ AI 消息左对齐，固定宽度 */
.ai-message {
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 900px !important;
}

@keyframes messageEnter {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    60% {
        transform: translateY(-4px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.ai-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    background-image: url('/logo-new.png');
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(14, 165, 233, 0.4);
}

.message-content {
    flex: 1;
    max-width: 900px !important;
    width: 900px !important;
}

.user-message .message-content {
    flex: 0 0 auto !important;
    max-width: calc(100% - 60px);
}

.message-text {
    padding: 14px 18px;
    border-radius: 14px;
    line-height: 1.7;
    font-size: 13px !important;
    box-shadow: var(--shadow-sm);
    width: 100% !important;
    max-width: 100% !important;
}

.user-message .message-text {
    display: inline-block !important;
    max-width: none !important;
    width: auto !important;
}

.user-message .message-text .user-text {
    display: inline-block !important;
    white-space: nowrap !important;
    width: auto !important;
}

.user-text {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(2, 132, 199, 0.2));
    border: 1px solid rgba(14, 165, 233, 0.4);
    color: var(--text-primary);
    display: inline-block !important;
    white-space: nowrap !important;
    width: auto !important;
}

.ai-text {
    background: #000000;
    border: 1px solid var(--border);
    color: var(--text-primary);
    display: block !important;
    position: relative !important;
    width: 700px !important;
    min-width: 700px !important;
    max-width: 700px !important;
}

/* 下载按钮 */
.download-btn {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 12px;
    position: absolute !important;
    right: 8px !important;
    bottom: -40px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    font-weight: 600;
    z-index: 10;
}

/* AI 文本底部留白（给下载按钮空间） */
.ai-text {
    padding-bottom: 45px !important;
}

.download-btn:hover {
    background: var(--text-secondary);
    color: white;
    transform: translateY(-1px);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* ========== 加载动画 ========== */
.thinking-container {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 14px 18px;
}

.thinking-dot {
    width: 10px;
    height: 10px;
    background: var(--text-secondary); // ✅ 悬停深灰色
    border-radius: 50%;
    animation: thinkingPulse 1.4s var(--ease-smooth) infinite;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* ========== 响应式设计 ========== */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 200px;
    }
    
    .page-container {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease-smooth);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 999;
        background: var(--text-secondary); // ✅ 悬停深灰色
        color: white;
        border: none;
        padding: 0.75rem;
        border-radius: 8px;
        cursor: pointer;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        animation: fadeIn 0.3s ease-out;
    }
    
    .sidebar-overlay.mobile-open {
        display: block;
    }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ========== 工具类 ========== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-primary-brand { color: var(--text-secondary); // ✅ 灰色文字 }

.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-tertiary { background: var(--bg-tertiary); }

.border-primary { border-color: var(--text-secondary); // ✅ 灰色文字 }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ========== 用户菜单（Kimi 风格）========== */
.user-menu-container {
    position: relative;
    width: 100%;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.user-menu-trigger:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.user-menu-trigger .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu-trigger .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.user-menu-trigger .username {
    font-weight: 500;
    max-width: 80px; /* 🔴 变窄 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-trigger .menu-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    color: var(--text-muted);
}

.user-menu-trigger.active .menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s var(--ease-smooth);
    z-index: 1000;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    cursor: pointer;
}

.user-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.user-menu-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* 未登录登录按钮 - 黑色底纹灰色字体（无渐变） */
.login-btn-simple {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem !important;
    background: #1a202c !important;
    color: #a0aec0 !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 0 !important;
}

.login-btn-simple:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    background: #2d3748 !important;
    color: #cbd5e0 !important;
}
