* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录页面样式 */
.login-page {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    align-items: center;
    justify-content: center;
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: white;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.login-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.login-header h1 {
    font-size: 2.2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.login-header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.login-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 42vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    max-width: 480px;
    margin: 0 auto;
    margin-top: 5rem;
}

.login-form {
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.login-form h2 {
    color: #333;
    margin-bottom: 2rem;
    font-weight: 500;
    font-size: 1.5rem;
}

.login-message {
    color: #2fcf2a;
    margin-top: 1rem;
    padding: 10px;
    background: rgba(177, 218, 123, 0.1);
    border-radius: 8px;
    display: none;
}

.login-form-group {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
    font-size: 1.1rem
}

.login-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.login-form-group input:focus {
    outline: none;
    border-color: #2b6cb0;
    background: white;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #2c5282, #2b6cb0);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 2rem;
}

.login-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.reglog-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #484b4e, #37424e);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 2rem;
}

.reglog-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 5px 15px rgba(69, 77, 116, 0.4);
}

.login-error-message {
    color: #e74c3c;
    margin-top: 1rem;
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    display: none;
}

/* 登录/注册页布局修复：保持原有渐变背景和表单，只恢复品牌区的纵向居中排版。 */
.login-container,
.register-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-header,
.register-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.brand-row h1 {
    margin: 0;
    color: #fff;
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1;
}

.brand-subtitle {
    margin: 0.25rem 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    text-align: center;
}

.login-logo,
.register-logo {
    margin-right: 0;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
}

.disclaimer {
    position: absolute;
    bottom: 1rem;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8rem;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .brand-row { gap: 0.65rem; }
    .brand-row h1 { font-size: 1.9rem; }
    .brand-subtitle { font-size: 0.85rem; }
    .login-content,
    .register-content { margin-top: 2rem; min-height: auto; }
}

/* 恢复原登录页使用的背景资源；工作区仍继续使用本文件中的新增样式。 */
body {
    background-image: url('/uploads/assets/background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.login-page,
.register-page {
    background: transparent;
    backdrop-filter: blur(5px);
}

/* Final precedence for both auth pages: these rules intentionally come last so
   legacy chat styles cannot override the original auth presentation. */
.login-page .login-header,
.register-page .register-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
    margin-bottom: 1.5rem;
}
.login-page .brand-row,
.register-page .brand-row { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 0.25rem; }
.login-page .login-logo,
.register-page .register-logo { width: 54px; height: 54px; flex: 0 0 54px; margin: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.login-page .brand-row h1,
.register-page .brand-row h1 { margin: 0; color: #000; font-size: 2.8rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.login-page .brand-subtitle,
.register-page .brand-subtitle { margin: 0.4rem 0 0; color: rgba(60, 60, 67, 0.72); font-size: 1rem; font-weight: 400; text-align: center; }
.login-page .login-content,
.register-page .register-content { width: 100%; max-width: 440px; min-height: 0; margin: 0 auto; padding: 3rem; background: rgba(240, 240, 240, 0.6); border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 25px; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.5); backdrop-filter: blur(50px) saturate(180%); -webkit-backdrop-filter: blur(50px) saturate(180%); }
.login-page .login-form,
.register-page .register-form { width: 100%; max-width: 350px; }
.login-page .login-form-group,
.register-page .register-form-group { margin: 0 0 1.25rem; }
.login-page .login-form-group input,
.register-page .register-form-group input { width: 100%; height: 50px; padding: 0 20px; color: #000; background: rgba(120, 120, 128, 0.08); border: 0; border-radius: 25px; }
.login-page .login-btn,
.register-page .register-btn { width: 100%; height: 50px; margin-top: 1.5rem; padding: 0; background: #000; color: #fff; border-radius: 25px; box-shadow: none; }
.login-page .secondary-action,
.register-page .secondary-action { margin: 1.1rem 0 0; color: #86868b; text-align: center; font-size: 0.95rem; }
.login-page .disclaimer,
.register-page .disclaimer { position: absolute; bottom: 1rem; width: 100%; color: rgba(60, 60, 67, 0.42); text-align: center; font-size: 0.85rem; line-height: 1.5; }

/* Login/register visual baseline restored from the original uploads/assets design. */
.login-page,
.register-page {
    padding-bottom: 20vh;
}

.login-container,
.register-container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
}

.login-header,
.register-header {
    margin-bottom: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #1d1d1f;
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.login-logo,
.register-logo {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.brand-row h1 {
    margin: 0;
    color: #000;
    font-size: 2.8rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1;
}

.brand-subtitle {
    margin: 0.4rem 0 0;
    color: rgba(60, 60, 67, 0.72);
    font-size: 1rem;
    font-weight: 400;
    text-align: center;
}

.login-content,
.register-content {
    width: 100%;
    max-width: 440px;
    min-height: 0;
    margin: 0 auto;
    padding: 3rem;
    background: rgba(240, 240, 240, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 25px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(50px) saturate(180%);
    -webkit-backdrop-filter: blur(50px) saturate(180%);
}

.login-form,
.register-form {
    width: 100%;
    max-width: 350px;
}

.login-form-group,
.register-form-group {
    margin: 0 0 1.25rem;
}

.login-form-group input,
.register-form-group input {
    width: 100%;
    height: 50px;
    padding: 0 20px;
    color: #000;
    background: rgba(120, 120, 128, 0.08);
    border: 0;
    border-radius: 25px;
}

.login-form-group input:focus,
.register-form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px #0071e3;
}

.login-btn,
.register-btn {
    width: 100%;
    height: 50px;
    margin-top: 1.5rem;
    padding: 0;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: none;
}

.login-btn:hover,
.register-btn:hover {
    transform: none;
    background: rgba(0, 0, 0, 0.85);
    box-shadow: none;
}

.secondary-action {
    margin: 1.1rem 0 0;
    color: #86868b;
    text-align: center;
    font-size: 0.95rem;
}

.secondary-action a {
    color: #0071e3;
    text-decoration: none;
    font-weight: 500;
}

.disclaimer {
    position: absolute;
    bottom: 1rem;
    width: 100%;
    color: rgba(60, 60, 67, 0.42);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* 注册页面样式 */
.register-page {
    align-items: center;
    justify-content: center;
    display: none;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.register-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

.register-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: white;
}

.register-logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.register-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.register-header h1 {
    font-size: 2.2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.register-header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.register-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    max-width: 480px;
    margin: 0 auto;
    margin-top: 5rem;
}

.register-form {
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.register-form h2 {
    color: #333;
    margin-bottom: 2rem;
    font-weight: 500;
    font-size: 1.5rem;
}

.register-form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.register-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
    font-size: 1.1rem
}

.register-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.register-form-group input:focus {
    outline: none;
    border-color: #2b6cb0;
    background: white;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.register-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #2c5282, #2b6cb0);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.register-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.register-error-message {
    color: #e74c3c;
    margin-top: 1rem;
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    display: none;
}

/* 聊天页面样式 */
.chat-container {
    display: none;
    width: 100vw;
    height: 100vh;
    background: white;
}

.chat-layout {
    display: flex;
    height: 100vh;
}

/* 侧边栏历史消息 */
.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 14px 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: #e9ecef;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.history-item:hover {
    background: #e9ecef;
}

.history-item.active {
    background: #2b6cb0;
    color: white;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-preview {
    font-size: 0.8rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item.active .history-preview {
    color: rgba(255, 255, 255, 0.8);
}

/* 主聊天区域 */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

/* 顶部导航栏 */
.top-nav {
    background: white;
    border-bottom: 2px solid #e9ecef;
    padding: 11px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.sidebar-toggle-main {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 8px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.sidebar-toggle-main:hover {
    background: #f8f9fa;
}

.file-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 5px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}
.file-panel-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}
.file-panel-toggle:hover,
.file-panel-toggle:focus-visible {
    background: #f8f9fa;
    color: #52606d;
}
.file-panel-toggle:focus-visible {
    outline: 2px solid #79d7c7;
    outline-offset: 2px;
}

.nav-bottom {
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 20px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(45deg, #2c5282, #2b6cb0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.user-avatar img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logout-btn {
    padding: 6px 12px;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.logout-btn:hover {
    background: #f8f9fa;
    border-color: #999;
}

.chat-content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden; /* Prevent content from overflowing */
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafbfc;
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(45deg, #2c5282, #2b6cb0);
    color: white;
}

.message.bot .message-avatar {
    background: #e9ecef;
}

.message-content {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(45deg, #2c5282, #2b6cb0);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.user .message-content em {
    font-style: italic;
    color: bisque;
    font-size: 0.8rem;
}

.message.bot .message-content {
    background: white;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 6px;
    color: #333;
}

.typing-indicator {
    display: none;
    padding: 12px 18px;
    color: #666;
    font-style: italic;
}

/* 输入区域 */
.chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 10px 18px;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    resize: none;
    max-height: 120px;
}

.message-input:focus {
    border-color: #2b6cb0;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(45deg, #2c5282, #2b6cb0);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        z-index: 1000;
        height: 100%;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .nav-buttons {
        flex-wrap: wrap;
        gap: 5px;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .user-info span {
        display: none;
    }

    .chat-messages {
        padding: 15px;
    }

    .message-content {
        max-width: 85%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 新建聊天按钮 */
.new-chat-btn {
    margin: 15px;
    padding: 10px 15px;
    background: #2b6cb0;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.new-chat-btn:hover {
    background: #5a6fd8;
}

/* 流式输出光标动画 */
.streaming-cursor {
    animation: blink 1s infinite;
    color: #000000;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* 确保消息内容平滑滚动 */
.chat-messages {
    scroll-behavior: smooth;
}

/* 流式消息特殊样式 */
.message.streaming .message-content {
    border-bottom: 2px solid rgba(125, 127, 132, 0.3);
    transition: all 0.1s ease;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.scheduled {
    background: #ffc107;
    color: #212529;
}

.status-badge.completed {
    background: #28a745;
    color: white;
}

.status-badge.cancelled {
    background: #dc3545;
    color: white;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.message-content {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* 为 markdown 内容添加特殊样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 8px 0 4px 0;
    font-weight: 600;
}

.message-content h1 { font-size: 1.3em; }
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }
.message-content h4 { font-size: 1.05em; }

.message-content strong {
    font-weight: 600;
    color: inherit;
}

.message-content em {
    font-style: italic;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 2px 0;
}

.message-content p {
    margin: 6px 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 8px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content blockquote {
    border-left: 3px solid #ccc;
    margin: 8px 0;
    padding-left: 12px;
    color: #666;
    font-style: italic;
}

/* 为用户消息中的 markdown 元素提供对比色 */
.message.user .message-content code {
    background: rgba(255, 255, 255, 0.2);
}

.message.user .message-content pre {
    background: rgba(255, 255, 255, 0.15);
}

.message.user .message-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.8);
}

/* 为 bot 消息中的表格添加样式 */
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 0.9em;
}

.message-content th,
.message-content td {
    border: 1px solid #ddd;
    padding: 4px 8px;
    text-align: left;
}

.message-content th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* 聊天内容包装器 */
.chat-content-wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    transition: all 0.3s ease;
}

/* 分子结构面板样式 */
.molecular-panel {
    width: 400px;
    background: white;
    border-left: 1px solid #e9ecef;
    flex-direction: column;
    transition: all 0.3s ease;
}

.molecular-panel.collapsed {
    width: 0;
    overflow: hidden;
}

.molecular-panel-header {
    padding: 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.molecular-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.close-molecular-panel {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.close-molecular-panel:hover {
    background: #e9ecef;
}

.molecular-panel-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.molecular-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.molecular-info h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #333;
}

.molecular-info p {
    margin: 5px 0;
    font-size: 0.85rem;
    color: #666;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .molecular-panel {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .molecular-panel {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        width: 90%;
        z-index: 1001;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    }
}

/* 控制按钮 */
.molecular-controls {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    background: #f8f9fa;
}

.control-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #f8f9fa;
    border-color: #999;
}

/* 调整大小手柄 */
.resize-handle {
    width: 2px;
    background: #e9ecef;
    cursor: col-resize;
    position: relative;
    transition: background-color 0.2s ease;
}

.resize-handle:hover {
    background: #2b6cb0;
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 40px;
    background: transparent;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .molecular-panel {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 100vw;
        max-width: 100vw;
        z-index: 1001;
        border-left: none;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    }
    
    .resize-handle {
        display: none !important;
    }
    
    .chat-area {
        min-width: auto;
    }
}

/* 面板显示状态调整 */
.chat-content-wrapper.panel-open .chat-area {
    /* 当面板打开时，聊天区域可以调整 */
}

/* 分子文件列表样式 */
.file-list {
    margin: 10px 0;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin: 5px 10px;
    font-size: 0.8rem;
}

.remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

.controls .control-btn {
    flex: 1;
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* 原聊天界面上的科研文件工作区 */
.file-workbench-panel {
    width: 430px;
    min-width: 360px;
    display: none;
    background: #ffffff;
    border-left: 1px solid #e2e6ea;
    color: #25313a;
}

.file-workbench-panel .molecular-panel-header {
    padding: 10px 16px;
    background: #ffffff;
    border-bottom: 2px solid #e6eaee;
}

.file-workbench-panel .molecular-panel-header h3 { color: #25313a; margin-bottom: 2px; }
.file-workbench-subtitle { color: #7b8791; font-size: 11px; }
.file-workbench-panel .close-molecular-panel { color: #687580; }
.file-workbench-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.file-workbench-tree { padding: 12px 12px 8px; border-bottom: 1px solid #e6eaee; max-height: 245px; overflow-y: auto; background: #fbfcfd; }
.file-workbench-section-title { color: #67747f; font-size: 11px; margin: 2px 4px 8px; display: flex; justify-content: space-between; }
.file-workbench-section-title.secondary { margin-top: 13px; }
.file-workbench-empty { color: #87939c; font-size: 11px; line-height: 1.6; padding: 12px 8px 14px; text-align: center; }
.workbench-file { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 9px; margin: 2px 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #51606c; text-align: left; cursor: pointer; font: inherit; }
.workbench-file:hover { background: #f0f6f7; color: #1f343b; }
.workbench-file.active { background: #e8f5f3; border-color: #b8dfd9; color: #1c4e4b; box-shadow: inset 3px 0 #2e9f91; }
.workbench-file span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workbench-file small { margin-left: auto; color: #87939c; font-size: 10px; }
.workbench-file-icon { width: 18px; text-align: center; flex: 0 0 18px; }
.workbench-file-icon.file { color: #93a1aa; }.workbench-file-icon.md { color: #77bbff; }.workbench-file-icon.pdf { color: #ff7777; }.workbench-file-icon.pdb { color: #73dfb8; }.workbench-file-icon.mol { color: #c7a6ff; }
.file-preview-header { display: flex; align-items: center; gap: 8px; padding: 12px 15px; border-bottom: 1px solid #e6eaee; color: #25313a; background: #fff; }
.file-preview-header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-preview-header > span:last-child { margin-left: auto; color: #7b8791; font-size: 10px; }
.file-preview-body { flex: 1; min-height: 185px; overflow: auto; padding: 15px; background: #f5f7f9; }
.file-preview-hint { color: #7b8791; font-size: 11px; }
.structure-preview-status { display: block; min-height: 16px; }
.structure-preview-status.loading { color: #3e7f83; }
.structure-preview-status.ready { color: #2e806b; }
.structure-preview-status.error { color: #b04e4e; }
.file-preview-document { background: #f7f8fa; color: #25313a; border-radius: 4px; padding: 18px; min-height: 100%; font-size: 12px; line-height: 1.6; }
.file-preview-document h4 { margin: 0 0 12px; font-size: 16px; }.file-preview-document h5 { margin: 16px 0 6px; font-size: 12px; }
.file-preview-document pre { background: #e8edf0; padding: 8px; border-radius: 4px; overflow: auto; font-size: 10px; }
.file-preview-pdf { background: #f5f0e8; color: #31343a; border-radius: 4px; padding: 22px; min-height: 100%; font-family: Georgia, serif; }
.file-preview-pdf h4 { font-size: 17px; line-height: 1.2; text-transform: uppercase; font-weight: 500; }.file-preview-pdf p { font-size: 10px; line-height: 1.55; text-align: justify; }
.file-preview-pdf-frame { display: block; width: 100%; height: 100%; min-height: 420px; border: 0; border-radius: 4px; background: #fff; }
.molecular-viewer-canvas { display: none; flex: 1 1 auto; width: auto; min-width: 0; min-height: 260px; height: auto; margin: 0 15px 15px; border: 1px solid #34414a; border-radius: 5px; background: #0d151a; overflow: hidden; position: relative; }
.molecular-viewer-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.file-workbench-panel .molecular-info { flex: 0 0 auto; }
.structure-controls { display: flex; gap: 8px; padding: 0 15px 12px; background: #fff; }
.structure-controls[hidden] { display: none; }
.file-workbench-panel .molecular-info { padding: 10px 15px; margin: 0; border: 0; border-radius: 0; background: #fff; color: #7b8791; font-size: 11px; }
.file-workbench-panel .molecular-info .file-list { margin: 0; }.file-workbench-panel .molecular-info h4 { color: #cbd5dc; }

@media (max-width: 1200px) { .file-workbench-panel { width: 370px; min-width: 320px; } }
@media (max-width: 850px) { .file-workbench-panel { position: absolute; z-index: 20; right: 0; top: 0; bottom: 0; width: min(90vw, 430px); } }

/* Keep the original login/register background assets after all page styles. */
body {
    background-image: url('/uploads/assets/background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.login-page,
.register-page {
    background: transparent;
    backdrop-filter: blur(5px);
}

/* Auth page precedence: keep these selectors after the legacy chat rules. */
.login-page .login-header,
.register-page .register-header { flex-direction: column; text-align: center; align-items: center; margin-bottom: 1.5rem; }
.login-page .brand-row,
.register-page .brand-row { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 0.25rem; }
.login-page .login-logo,
.register-page .register-logo { width: 54px; height: 54px; flex: 0 0 54px; margin: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.login-page .brand-row h1,
.register-page .brand-row h1 { margin: 0; color: #000; font-size: 2.8rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.login-page .brand-subtitle,
.register-page .brand-subtitle { margin: 0.4rem 0 0; color: rgba(60, 60, 67, 0.72); font-size: 1rem; font-weight: 400; text-align: center; }
.login-page .login-content,
.register-page .register-content { width: 100%; max-width: 440px; min-height: 0; margin: 0 auto; padding: 3rem; background: rgba(240, 240, 240, 0.6); border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 25px; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.5); backdrop-filter: blur(50px) saturate(180%); -webkit-backdrop-filter: blur(50px) saturate(180%); }
.login-page .login-form,
.register-page .register-form { width: 100%; max-width: 350px; }
.login-page .login-form-group,
.register-page .register-form-group { margin: 0 0 1.25rem; }
.login-page .login-form-group input,
.register-page .register-form-group input { width: 100%; height: 50px; padding: 0 20px; color: #000; background: rgba(120, 120, 128, 0.08); border: 0; border-radius: 25px; }
.login-page .login-btn,
.register-page .register-btn { width: 100%; height: 50px; margin-top: 1.5rem; padding: 0; background: #000; color: #fff; border-radius: 25px; box-shadow: none; }
.login-page .secondary-action,
.register-page .secondary-action { margin: 1.1rem 0 0; color: #86868b; text-align: center; font-size: 0.95rem; }
.login-page .disclaimer,
.register-page .disclaimer { position: absolute; bottom: 1rem; width: 100%; color: rgba(60, 60, 67, 0.42); text-align: center; font-size: 0.85rem; line-height: 1.5; }
