/* 基础样式 */
:root {
    --primary-color: #3a86ff;
    --primary-dark: #2a70db;
    --primary-light: #7aacff;
    --sidebar-bg: #2a3b4c;
    --sidebar-bg-dark: #1e2a36;
    --text-light: #ffffff;
    --text-dark: #2d3748;
    --text-gray: #718096;
    --bg-light: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    --bg-gradient-dark: linear-gradient(135deg, #1e293b 0%, #1f2937 100%);
    --border-color: #e2e8f0;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 15px 40px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 10px 25px rgba(58, 134, 255, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-normal: all 0.3s ease;
    --transition-fast: all 0.2s ease;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 15px;
    --font-size-lg: 18px;
    --font-size-xl: 22px;
    --space-xs: 5px;
    --space-sm: 10px;
    --space-md: 15px;
    --space-lg: 20px;
    --space-xl: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background: var(--bg-gradient);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* 主容器 */
.chat-container {
    display: flex;
    width: 950px;
    height: 650px;
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    transition: var(--transition-normal);
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    position: relative;
    z-index: 10;
}

.sidebar-header {
    margin-bottom: var(--space-xl);
    text-align: center;
}

.sidebar-header h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-sm);
    font-weight: 700;
    position: relative;
    display: inline-block;
}

.sidebar-header h2:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.sidebar-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    margin-top: var(--space-md);
}

.module-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    padding-right: var(--space-xs);
}

.module-list::-webkit-scrollbar {
    width: 4px;
}

.module-list::-webkit-scrollbar-track {
    background: transparent;
}

.module-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.module-item {
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.module-item i {
    margin-right: var(--space-md);
    font-size: var(--font-size-md);
    width: 20px;
    text-align: center;
    transition: var(--transition-fast);
}

.module-item:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background-color: var(--primary-color);
    transform: scaleY(0);
    transition: var(--transition-fast);
}

.module-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.module-item:hover:before {
    transform: scaleY(1);
}

.module-item.active {
    background-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(58, 134, 255, 0.3);
}

.module-item.active:before {
    transform: scaleY(1);
}

.module-item span {
    font-size: var(--font-size-md);
    transition: var(--transition-fast);
}

.user-profile {
    margin-top: auto;
    padding: var(--space-xl) 0 var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    position: relative;
}

.user-profile .avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #5a67d8);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: var(--space-md);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition-normal);
}

.user-profile .avatar:hover {
    transform: scale(1.05);
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    font-size: var(--font-size-md);
    margin-bottom: 2px;
}

.user-status {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
}

.user-status:before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4caf50;
    border-radius: 50%;
    margin-right: 5px;
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    position: relative;
}

.chat-header {
    padding: var(--space-lg) var(--space-xl);
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 5;
}

.chat-header-left {
    display: flex;
    align-items: center;
}

.chat-header-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-light);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: var(--space-md);
    color: var(--text-light);
}

#module-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-dark);
}

.chat-header-right {
    display: flex;
    gap: var(--space-md);
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-gray);
}

.header-btn:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.chat-messages {
    flex: 1;
    padding: var(--space-xl) var(--space-xl);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    position: relative;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 5px;
}

.message {
    max-width: 80%;
    padding: var(--space-lg) var(--space-lg);
    border-radius: var(--radius-md);
    position: relative;
    animation: fadeIn 0.3s ease;
    transition: var(--transition-normal);
}

.user-message {
    background-color: var(--primary-color);
    color: var(--text-light);
    align-self: flex-end;
    margin-left: auto;
    box-shadow: 0 4px 15px rgba(58, 134, 255, 0.2);
}

.user-message::after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 15px;
    width: 0;
    height: 0;
    border-left: 10px solid var(--primary-color);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

.bot-message {
    background-color: var(--bg-light);
    color: var(--text-dark);
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}

.bot-message::after {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 15px;
    width: 0;
    height: 0;
    border-right: 10px solid var(--bg-light);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

.system-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    align-self: center;
    margin: var(--space-md) auto;
    text-align: center;
    max-width: 70%;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
    animation: pulseAnimation 2s ease-in-out;
}

.message-content {
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-md);
    line-height: 1.6;
}

.message-meta {
    font-size: var(--font-size-xs);
    display: flex;
    justify-content: space-between;
    opacity: 0.7;
}

.input-area {
    padding: var(--space-xl);
    border-top: 1px solid var(--border-color);
    background-color: #fff;
    position: relative;
    z-index: 5;
}

.input-wrapper {
    display: flex;
    gap: var(--space-sm);
    position: relative;
}

#user-input {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-light);
    font-size: var(--font-size-md);
    resize: none;
    outline: none;
    transition: var(--transition-fast);
}

#user-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.1);
}

#send-btn {
    padding: 16px 25px;
    border: none;
    border-radius: var(--radius-sm);
    background-color: var(--primary-color);
    color: var(--text-light);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

#send-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

#send-btn:active {
    transform: translateY(0);
}

.send-icon {
    transition: var(--transition-fast);
}

#send-btn:hover .send-icon {
    transform: translateX(3px);
}

/* 猜你想问功能 */
.suggestions {
    margin-top: var(--space-md);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    animation: fadeIn 0.5s ease;
}

.suggestion-item {
    padding: 8px 16px;
    background-color: rgba(58, 134, 255, 0.1);
    color: var(--primary-color);
    border-radius: 30px;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid rgba(58, 134, 255, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.suggestion-item:hover {
    background-color: var(--primary-color);
    color: var(--text-light);
    transform: translateY(-2px);
}

/* 面板样式 */
.panel {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 300px;
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--space-lg);
    z-index: 100;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition-normal);
}

.panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.panel h3 {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-md);
    color: var(--text-dark);
}

.panel-item {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.panel-item:hover {
    background-color: var(--bg-light);
}

.panel-item:last-child {
    border-bottom: none;
}

.setting-item {
    margin-bottom: var(--space-md);
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--text-dark);
}

.setting-item select,
.setting-item input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    outline: none;
    transition: var(--transition-fast);
}

.setting-item select:focus,
.setting-item input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.1);
}

.panel-btn {
    display: block;
    width: 100%;
    padding: var(--space-md);
    margin-top: var(--space-md);
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.panel-btn:hover {
    background-color: var(--primary-dark);
}

/* 动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseAnimation {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.3);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(46, 125, 50, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0);
    }
}

@keyframes typing {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

.typing-indicator span {
    animation: typing 1.4s infinite;
    animation-fill-mode: both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: .2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* 手机适配 */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding: var(--space-md);
    }

    .chat-container {
        width: 100%;
        height: calc(100vh - var(--space-lg) * 2);
        border-radius: var(--radius-md);
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 70px;
        padding: 0 var(--space-lg);
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .sidebar.expanded {
        height: 100%;
        flex-direction: column;
        align-items: flex-start;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }

    .sidebar-header {
        margin-bottom: 0;
        text-align: left;
    }

    .sidebar-header h2 {
        font-size: var(--font-size-lg);
    }

    .sidebar-header p {
        display: none;
    }

    .module-list {
        display: none;
        width: 100%;
    }
    
    .sidebar.expanded .module-list {
        display: block;
    }

    .user-profile {
        padding: 0;
        border-top: none;
        margin-top: 0;
    }
    
    .sidebar.expanded .user-profile {
        margin-top: auto;
        padding: var(--space-xl) 0 var(--space-lg);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .user-info {
        display: none;
    }
    
    .sidebar.expanded .user-info {
        display: block;
    }
    
    .module-actions {
        display: none;
    }
    
    .sidebar.expanded .module-actions {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
        color: white;
        font-size: 24px;
        background: none;
        border: none;
        cursor: pointer;
    }
    
    .sidebar:not(.expanded) .sidebar-header h2:after {
        display: none;
    }

    .chat-messages {
        padding: var(--space-md);
    }

    .message {
        max-width: 90%;
    }

    .input-area {
        padding: var(--space-md);
    }

    #user-input {
        padding: 12px 15px;
    }

    #send-btn {
        padding: 12px 15px;
    }

    .panel {
        top: 60px;
        right: 10px;
        width: calc(100% - 20px);
        max-width: 300px;
    }
}

/* 深色主题 */
body.dark-theme {
    background: var(--bg-gradient-dark);
}

body.dark-theme .chat-container {
    background-color: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .chat-area {
    background-color: var(--sidebar-bg-dark);
}

body.dark-theme .chat-header {
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme #module-title {
    color: var(--text-light);
}

body.dark-theme .header-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme .header-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .bot-message {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme .bot-message::after {
    border-right-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .system-message {
    background-color: rgba(46, 125, 50, 0.2);
    color: #81c784;
}

body.dark-theme .input-area {
    background-color: var(--sidebar-bg-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme #user-input {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme .suggestion-item {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-theme .panel {
    background-color: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .panel h3 {
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .panel-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .panel-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .setting-item label {
    color: var(--text-light);
}

body.dark-theme .setting-item select,
body.dark-theme .setting-item input {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

/* 加载动画 */
.loading-message {
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
}

/* 字体大小 */
body.font-small .message-content {
    font-size: 14px;
}

body.font-large .message-content {
    font-size: 17px;
}

/* 页面加载动画 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite ease-in-out;
    color: var(--primary-color);
    font-size: 50px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-dark);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

/* Markdown内容样式优化 */
.markdown-content {
    width: 100%;
    line-height: 1.6;
    font-size: 14px;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    margin-top: 16px;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-dark);
}

.markdown-content h1 {
    font-size: 1.7em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.markdown-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.markdown-content h3 {
    font-size: 1.3em;
}

.markdown-content h4 {
    font-size: 1.1em;
}

.markdown-content a {
    color: var(--link-color);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content blockquote {
    padding: 0 16px;
    color: var(--text-gray);
    border-left: 4px solid var(--border-color);
    margin: 10px 0;
}

.markdown-content code {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: var(--bg-light);
    border-radius: 3px;
}

.markdown-content pre {
    padding: 12px 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 16px;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    margin: 0;
    font-size: 100%;
    word-break: normal;
    white-space: pre;
    border: 0;
}

.markdown-content img {
    max-width: 100%;
    box-sizing: content-box;
    background-color: var(--bg-white);
    border-radius: 6px;
}

.markdown-content table {
    border-spacing: 0;
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.markdown-content table th {
    font-weight: 600;
    border: 1px solid var(--border-color);
    padding: 6px 13px;
    background-color: var(--bg-light);
}

.markdown-content table td {
    border: 1px solid var(--border-color);
    padding: 6px 13px;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 2em;
    margin-bottom: 16px;
}

.markdown-content li + li {
    margin-top: 0.25em;
}

/* 分享导出功能样式 */
.export-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-white);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 20px;
    z-index: 1000;
    width: 350px;
    max-width: 90%;
    display: none;
}

.export-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-panel {
    cursor: pointer;
    font-size: 20px;
    color: var(--text-gray);
}

.close-panel:hover {
    color: var(--text-dark);
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    background-color: var(--bg-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: var(--text-dark);
}

.export-btn:hover {
    background-color: var(--primary-light);
}

.export-btn i {
    font-size: 16px;
    color: var(--primary-color);
}

/* 添加到Chat Header右侧按钮组 */
.export-share-btn {
    position: relative;
}

.share-options {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 0;
    width: 200px;
    display: none;
    z-index: 100;
}

.share-option {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.share-option:hover {
    background-color: var(--bg-light);
}

.share-option i {
    font-size: 16px;
    color: var(--primary-color);
}

/* 复制成功提示 */
.copy-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* 二维码显示 */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.qr-code {
    width: 150px;
    height: 150px;
    margin-bottom: 10px;
}

.qr-hint {
    font-size: 12px;
    color: var(--text-gray);
}

/* 为消息添加复制按钮 */
.message-content {
    position: relative;
}

.copy-message {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

.message-content:hover .copy-message {
    opacity: 1;
}

/* 代码块复制按钮 */
.code-block {
    position: relative;
    padding: 10px;
    margin: 15px 0;
    border-radius: 6px;
    background-color: var(--bg-light);
    overflow: hidden;
}

.copy-code-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-gray);
    font-size: 14px;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--primary-color);
}

/* 表格样式增强 */
.table-wrapper {
    overflow-x: auto;
    margin: 15px 0;
}

.md-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
}

.md-table th,
.md-table td {
    border: 1px solid var(--border-color);
    padding: 8px 15px;
}

.md-table th {
    background-color: var(--bg-light);
    font-weight: 600;
}

.md-table tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.md-table tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 语音输入按钮 */
#voice-input-btn {
    position: absolute;
    right: 100px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-gray);
}

#voice-input-btn:hover {
    background-color: var(--primary-light);
    color: white;
}

#voice-input-btn.recording {
    animation: pulse-recording 1.5s infinite;
    background-color: #ff4d4f;
    color: white;
}

@keyframes pulse-recording {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
    100% { transform: translateY(-50%) scale(1); }
}

/* 输入工具栏 */
.input-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
}

.auto-scroll-toggle {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-gray);
}

.auto-scroll-toggle input {
    margin-right: 5px;
}

.quick-replies {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    max-width: 70%;
    padding-bottom: 5px;
}

.quick-replies::-webkit-scrollbar {
    height: 4px;
}

.quick-replies::-webkit-scrollbar-track {
    background: transparent;
}

.quick-replies::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.quick-reply-btn {
    white-space: nowrap;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background-color: var(--bg-light);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply-btn:hover {
    background-color: var(--primary-light);
    color: white;
}

/* 设置中的复选框组 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
}

.checkbox-item input {
    margin-right: 8px;
}

/* 反馈功能 */
.feedback-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 300px;
    padding: 15px;
    z-index: 1000;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feedback-header {
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-dark);
}

.feedback-buttons {
    display: flex;
    gap: 10px;
}

.feedback-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.feedback-btn:hover {
    background-color: var(--bg-gradient);
}

.feedback-btn[data-value="helpful"]:hover {
    background-color: #e6f7e6;
    border-color: #52c41a;
    color: #52c41a;
}

.feedback-btn[data-value="not-helpful"]:hover {
    background-color: #fff1f0;
    border-color: #ff4d4f;
    color: #ff4d4f;
}

.feedback-form {
    margin-top: 10px;
}

#feedback-text {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    height: 80px;
    resize: none;
    margin-bottom: 10px;
    font-size: 13px;
}

#submit-feedback, #cancel-feedback {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-feedback {
    background-color: var(--primary-color);
    color: white;
    border: none;
    margin-right: 5px;
}

#submit-feedback:hover {
    background-color: var(--primary-dark);
}

#cancel-feedback {
    background-color: transparent;
    border: 1px solid var(--border-color);
}

#cancel-feedback:hover {
    background-color: var(--bg-light);
}

/* 深色模式调整 */
body.dark-theme .feedback-container {
    background-color: var(--sidebar-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .feedback-header {
    color: var(--text-light);
}

body.dark-theme .feedback-btn,
body.dark-theme #cancel-feedback {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme #feedback-text {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme .quick-reply-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme .quick-reply-btn:hover {
    background-color: var(--primary-dark);
}

/* 添加语音识别动画 */
.voice-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.voice-wave {
    width: 5px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 5px;
    animation: voice-wave 1s infinite ease-in-out;
}

.voice-wave:nth-child(2) {
    animation-delay: 0.2s;
    height: 35px;
}

.voice-wave:nth-child(3) {
    animation-delay: 0.4s;
    height: 50px;
}

.voice-wave:nth-child(4) {
    animation-delay: 0.6s;
    height: 35px;
}

.voice-wave:nth-child(5) {
    animation-delay: 0.8s;
    height: 20px;
}

@keyframes voice-wave {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.5);
    }
}

/* 增强的移动端适配 */
@media (max-width: 768px) {
    /* 优化输入区域 */
    .input-wrapper {
        flex-direction: row;
        position: relative;
    }
    
    #user-input {
        padding-right: 90px; /* 为两个按钮留空间 */
    }
    
    #voice-input-btn {
        right: 55px;
        width: 36px;
        height: 36px;
    }
    
    #send-btn {
        width: 45px;
        padding: 10px;
    }
    
    #send-btn span {
        display: none;
    }
    
    /* 优化工具栏 */
    .input-tools {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .quick-replies {
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 10px;
        width: 100%;
    }
    
    /* 优化反馈容器 */
    .feedback-container {
        width: 90%;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
    
    /* 优化导出面板 */
    .export-panel {
        width: 90%;
        max-width: none;
    }
    
    /* 优化模块选择 */
    .sidebar.expanded .module-item {
        transition: all 0.3s ease;
        transform: translateX(0);
        opacity: 1;
    }
    
    .sidebar:not(.expanded) .module-item {
        transform: translateX(-20px);
        opacity: 0;
        pointer-events: none;
    }
    
    /* 添加一个漂亮的移动端菜单按钮 */
    .mobile-menu-toggle {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle:hover, 
    .mobile-menu-toggle:focus {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    .sidebar.expanded .mobile-menu-toggle i:before {
        content: "\f00d"; /* 变为关闭图标 */
    }
    
    /* 优化消息气泡 */
    .message {
        max-width: 90%;
    }
    
    /* 优化设置面板 */
    .panel {
        width: 90%;
        right: 5%;
        max-width: none;
    }
    
    /* 加强动画效果 */
    .sidebar {
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .sidebar.expanded {
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

/* 特小屏幕设备 (小于 375px) */
@media (max-width: 375px) {
    .chat-header-left h1 {
        font-size: 16px;
    }
    
    .header-btn {
        width: 32px;
        height: 32px;
    }
    
    .chat-header {
        padding: 10px;
    }
    
    .chat-header-right {
        gap: 5px;
    }
    
    .chat-messages {
        padding: 10px;
    }
    
    /* 更紧凑的侧边栏 */
    .sidebar {
        height: 60px;
    }
    
    .sidebar-header h2 {
        font-size: 16px;
    }
    
    .user-profile .avatar {
        width: 40px;
        height: 40px;
    }
}

/* 适配刘海屏和全面屏手机 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .input-area {
            padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
        }
        
        .feedback-container {
            bottom: calc(20px + env(safe-area-inset-bottom));
        }
    }
}

/* 增强暗黑模式下的移动端适配 */
@media (max-width: 768px) {
    body.dark-theme .mobile-menu-toggle {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    body.dark-theme .mobile-menu-toggle:hover, 
    body.dark-theme .mobile-menu-toggle:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* 横屏适配优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-container {
        height: auto;
        min-height: 100vh;
    }
    
    .sidebar.expanded {
        height: auto;
        min-height: 100vh;
    }
    
    .chat-messages {
        max-height: 40vh;
    }
    
    .input-area {
        position: relative;
    }
}

/* 优化移动端字体大小 */
@media (max-width: 768px) {
    :root {
        --font-size-sm: 13px;
        --font-size-md: 14px;
        --font-size-lg: 16px;
    }
    
    .message-content {
        font-size: var(--font-size-sm);
    }
    
    .markdown-content {
        font-size: var(--font-size-sm);
    }
    
    .user-input {
        font-size: var(--font-size-sm);
    }
}

/* 添加新的动画效果 */
@media (max-width: 768px) {
    .sidebar.expanded {
        animation: slideIn 0.3s ease-out;
    }
    
    @keyframes slideIn {
        from {
            transform: translateY(-10px);
            opacity: 0.5;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .module-item {
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    }
    
    .sidebar.expanded .module-item:nth-child(1) { transition-delay: 0.05s; }
    .sidebar.expanded .module-item:nth-child(2) { transition-delay: 0.1s; }
    .sidebar.expanded .module-item:nth-child(3) { transition-delay: 0.15s; }
    .sidebar.expanded .module-item:nth-child(4) { transition-delay: 0.2s; }
    .sidebar.expanded .module-item:nth-child(5) { transition-delay: 0.25s; }
}

/* 软键盘打开时的样式调整 */
body.keyboard-open {
    height: 100% !important;
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

body.keyboard-open .chat-container {
    height: 100%;
    overflow: hidden;
}

body.keyboard-open .chat-messages {
    height: calc(100% - 180px);
    overflow-y: auto;
}

body.keyboard-open .input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-white);
    z-index: 10;
}

/* iOS底部安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body.ios-device .input-area {
        padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
    }
    
    body.ios-device .feedback-container {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* 防止弹性滚动（橡皮筋效果）*/
html, body {
    overscroll-behavior-y: none;
}

body.ios-device {
    -webkit-overflow-scrolling: touch;
}

/* 上下文菜单样式 */
.context-menu {
    position: absolute;
    min-width: 180px;
    background-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 5px 0;
    z-index: 1000;
    display: none;
    border: 1px solid var(--border-color);
}

.context-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.context-menu-item i {
    margin-right: 8px;
    width: 16px;
    color: var(--primary-color);
}

.context-menu-item:hover {
    background-color: var(--bg-light);
}

/* 对话总结面板 */
.summary-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    display: none;
    overflow: hidden;
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-dark);
}

.close-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0 5px;
}

.panel-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

#summary-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

#summary-content {
    display: none;
    line-height: 1.6;
}

.panel-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.panel-footer button {
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.panel-footer button:hover {
    background-color: var(--primary-light);
    color: white;
}

#copy-summary-btn i, #refresh-summary-btn i {
    font-size: 14px;
}

/* 深色模式适配 */
body.dark-theme .context-menu {
    background-color: var(--sidebar-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .context-menu-item {
    color: var(--text-light);
}

body.dark-theme .context-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .summary-panel {
    background-color: var(--sidebar-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .panel-header,
body.dark-theme .panel-footer {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .panel-header h3 {
    color: var(--text-light);
}

body.dark-theme .panel-footer button {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

body.dark-theme .panel-footer button:hover {
    background-color: var(--primary-dark);
}

/* 详细时间戳 */
.message-timestamp {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 5px;
    display: inline-block;
}

/* 翻译按钮和翻译结果 */
.translate-btn {
    font-size: 12px;
    color: var(--text-gray);
    background: none;
    border: none;
    padding: 2px 5px;
    margin-top: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.translate-btn:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.translation-result {
    margin-top: 10px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    font-size: 13px;
    border-left: 2px solid var(--primary-color);
}

body.dark-theme .translation-result {
    background-color: rgba(255, 255, 255, 0.05);
} 