* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 默认浅色主题 - DeepSeek风格 */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #ebebeb;
    --bg-hover: #e0e0e0;
    --bg-tooltip: #1f2937;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.1);
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    /* DeepSeek风格消息颜色 */
    --user-msg-bg: #e8f4fd;
    --user-msg-text: #111827;
    --ai-msg-text: #111827;
}

/* 深色主题 - DeepSeek风格 */
html.dark-theme {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-hover: #2f2f2f;
    --bg-tooltip: #374151;
    --text-primary: #ffffff;
    --text-secondary: #b4b4b4;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-light: rgba(99, 102, 241, 0.1);
    --border: #2f2f2f;
    --border-light: #3f3f3f;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    /* DeepSeek风格消息颜色 */
    --user-msg-bg: #2d2d2d;
    --user-msg-text: #ffffff;
    --ai-msg-text: #ffffff;
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-hover: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.1);
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.2s;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 100%);
}

html.light-theme .auth-page {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header .logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 8px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.auth-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.code-input-group {
    display: flex;
    gap: 12px;
}

.code-input-group input {
    flex: 1;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
}

.btn-primary:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-block {
    width: 100%;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.forgot-link {
    color: var(--text-secondary);
    font-size: 13px;
}

.forgot-link:hover {
    color: var(--accent);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 16px;
    font-size: 13px;
}

.social-login {
    margin-bottom: 24px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.social-btn:hover {
    background: var(--bg-hover);
}

.social-btn.wechat {
    color: #22c55e;
}

.auth-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-footer a {
    color: var(--accent);
}

.link {
    color: var(--accent);
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.mobile-menu-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text-primary);
    display: none;
    transition: all 0.2s;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
}

.mobile-menu-btn.active {
    background: var(--accent);
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 60px;
}

/* 侧边栏顶部 - 名称和切换按钮 */
.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.sidebar-brand {
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
}

/* 侧边栏切换按钮 */
.sidebar-toggle {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* 收起状态隐藏品牌名称 */
.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar.collapsed .sidebar-top {
    justify-content: center;
    padding: 16px 12px;
}

/* 收起状态下隐藏文字 */
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .conversation-title,
.sidebar.collapsed .conversation-time,
.sidebar.collapsed .user-name,
.sidebar.collapsed .chevron {
    display: none;
}

/* 收起状态下隐藏整个对话列表区域 */
.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 12px;
}

.sidebar.collapsed .btn-block {
    padding: 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px;
    margin-top: auto;
    border-top: none;
}

.sidebar.collapsed .user-menu {
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .user-menu-btn {
    padding: 0;
    background: transparent;
    width: auto;
    border-radius: 50%;
}

.sidebar.collapsed .user-menu-btn:hover {
    background: transparent;
    transform: none;
}

.sidebar.collapsed .user-avatar {
    margin: 0;
}

.sidebar.collapsed .user-dropdown {
    left: 60px;
    bottom: 0;
    top: auto;
    right: auto;
    min-width: 120px;
}

.sidebar.collapsed .user-menu.open .user-dropdown {
    display: block;
}

/* 收起状态下调整布局 */
.sidebar.collapsed {
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed .sidebar-top {
    order: 1;
    padding: 12px;
}

.sidebar.collapsed .sidebar-toggle {
    width: 32px;
    height: 32px;
}

.sidebar.collapsed .sidebar-header {
    order: 2;
    padding: 12px;
}

.sidebar.collapsed .btn-block {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    min-width: 36px;
}

.sidebar.collapsed .sidebar-footer {
    order: 3;
}

.sidebar-header {
    padding: 8px 16px 12px;
}

.sidebar-header .btn-primary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.sidebar-header .btn-primary:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.sidebar-header .btn-primary svg {
    transition: transform 0.2s ease;
}

.sidebar-header .btn-primary:hover svg {
    transform: rotate(90deg);
}

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

.sidebar-footer {
    padding: 12px 16px;
}

.sidebar-title {
    padding: 8px 12px 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.conversation-list {
    list-style: none;
}

.conversation-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
}

.conversation-item:hover {
    background: var(--bg-hover);
}

.conversation-item:hover .conversation-menu {
    opacity: 1;
    visibility: visible;
}

.conversation-item.active {
    background: var(--bg-primary);
}

.conversation-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.conversation-item.active .conversation-menu {
    opacity: 1;
    visibility: visible;
}

.conversation-title {
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    color: var(--text-muted);
    font-size: 11px;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

/* 对话菜单样式 */
.conversation-menu {
    position: relative;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.menu-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 110px;
    z-index: 100;
    overflow: hidden;
    padding: 4px;
}

.menu-item {
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    text-align: left;
    border-radius: 4px;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-item svg {
    flex-shrink: 0;
}

/* 删除确认弹窗样式 */
.delete-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.delete-confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.delete-confirm-dialog {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.delete-confirm-overlay.show .delete-confirm-dialog {
    transform: scale(1);
}

.delete-confirm-header {
    margin-bottom: 20px;
}

.delete-confirm-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 16px;
    color: var(--text-primary);
}

.delete-confirm-content {
    margin-bottom: 24px;
}

.delete-confirm-content p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.delete-warning {
    color: #ef4444 !important;
    font-size: 13px;
}

.delete-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.delete-confirm-actions .btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* 重命名对话框样式 */
.rename-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.rename-overlay.show {
    opacity: 1;
    visibility: visible;
}

.rename-dialog {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.rename-overlay.show .rename-dialog {
    transform: scale(1);
}

.rename-header {
    margin-bottom: 16px;
}

.rename-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.rename-content {
    margin-bottom: 20px;
}

.rename-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.rename-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.rename-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.rename-actions .btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

.delete-confirm-actions .btn-outline:hover {
    background: var(--bg-hover);
}

.delete-confirm-actions .btn-danger {
    background: #ef4444;
    color: white;
}

.delete-confirm-actions .btn-danger:hover {
    background: #dc2626;
    margin-top: 4px;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    background: transparent;
    border-radius: 10px;
    color: var(--text-primary);
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
}

.user-menu-btn:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-name {
    flex: 1;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
}

.chevron {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.user-menu.open .chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.user-menu.open .user-dropdown {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 6px;
    margin: 2px 0;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-title {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.welcome-subtitle {
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 40px;
    font-weight: 500;
}

.login-prompt {
    text-align: center;
    margin-top: 40px;
}

.login-prompt p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 24px;
}

.login-prompt .btn {
    margin: 8px;
    padding: 12px 32px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.suggestion-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: all 0.25s ease;
    cursor: pointer;
}

.suggestion-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.suggestion-btn svg {
    color: var(--accent);
    flex-shrink: 0;
}

.messages-container {
    max-width: 800px;
    margin: 0 auto;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 40px;
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.message-content {
    display: flex;
    flex-direction: column;
}

.message.user .message-content {
    align-items: flex-end;
    max-width: 70%;
}

.message.assistant .message-content {
    align-items: flex-start;
    flex: 1;
    max-width: calc(100% - 44px);
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border: none;
    border-radius: 12px;
    width: fit-content;
    max-width: 100%;
}

.message.assistant .message-bubble {
    background: transparent;
    color: var(--ai-msg-text);
    border: none;
    border-radius: 0;
    width: 100%;
}

.message-bubble p {
    margin-bottom: 8px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border-light);
}

.message-bubble code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
}

.message-bubble ul,
.message-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
}

/* 消息功能按钮样式 */
.message-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

/* 最新消息一直显示功能按钮 */
.message:last-child .message-actions {
    opacity: 1;
    visibility: visible;
}

/* 鼠标悬停时显示功能按钮 */
.message:hover .message-actions {
    opacity: 1;
    visibility: visible;
}

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

.message-actions-left {
    display: flex;
    gap: 8px;
}

.message-actions-right {
    display: flex;
}

.action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.action-btn.active {
    color: var(--accent);
}

.action-btn.active:hover {
    background: var(--accent-light);
}

/* 复制成功状态 */
.action-btn.copied {
    color: #10b981;
}

.action-btn.copied:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* 继续生成按钮样式 */
.action-btn.continue-btn {
    width: auto;
    padding: 4px 12px;
    gap: 6px;
    background: var(--accent);
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.action-btn.continue-btn:hover {
    background: var(--accent-hover);
    color: white;
}

.action-btn.continue-btn .btn-text {
    font-size: 13px;
}

/* Tooltip 样式 - 位于按钮下方 */
.action-btn[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 4px 8px;
    background: var(--bg-tooltip);
    color: #ffffff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 10000;
}

.action-btn[data-tooltip]::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 4px solid transparent;
    border-bottom-color: var(--bg-tooltip);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 10000;
}

.action-btn[data-tooltip]:hover::before,
.action-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(8px);
}

.action-btn[data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(6px);
}

/* 思考过程样式 */
.reasoning-section {
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f5f5f5;
    overflow: hidden;
}

.reasoning-section.reasoning-streaming {
    border-color: #d0d0d0;
}

.reasoning-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    background: #e8e8e8;
    color: #888;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.reasoning-section.reasoning-streaming .reasoning-header {
    background: #e0e0e0;
    color: #666;
}

.reasoning-header:hover {
    background: #d8d8d8;
    color: #555;
}

.reasoning-section.reasoning-streaming .reasoning-header:hover {
    background: #d5d5d5;
}

.reasoning-icon {
    transition: transform 0.2s ease;
}

.reasoning-icon.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.reasoning-section.expanded .reasoning-icon:not(.spinning) {
    transform: rotate(90deg);
}

.reasoning-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.reasoning-section.expanded .reasoning-content {
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.3s ease-in;
}

.reasoning-section.reasoning-streaming .reasoning-content {
    max-height: 200px;
    overflow-y: auto;
}

.reasoning-text {
    padding: 10px 12px;
    color: #777;
    font-size: 12px;
    line-height: 1.5;
    border-top: 1px solid #e0e0e0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.reasoning-text p {
    margin: 0 0 8px 0;
}

.reasoning-text p:last-child {
    margin-bottom: 0;
}

.reasoning-text code {
    background: #e8e8e8;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
    color: #555;
}

.reasoning-text pre {
    background: #f0f0f0;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
}

.reasoning-text pre {
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 12px;
}

.reasoning-text code {
    font-family: 'Fira Code', 'Consolas', monospace;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.input-area {
    padding: 20px;
    background: transparent;
}

/* 新的聊天输入框容器 */
.chat-input-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.chat-input {
    width: 100%;
    min-height: 24px;
    max-height: 200px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    outline: none;
}

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

/* 工具栏 */
.chat-input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 模型选择器 */
.model-selector {
    position: relative;
}

.model-select {
    padding: 6px 28px 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s;
}

.model-select:hover {
    border-color: var(--accent);
}

.model-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* 新的发送按钮 */
.send-btn-new {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: 10px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
}

.send-btn-new:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.send-btn-new:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 停止生成按钮样式 */
.send-btn-new.stop-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: pulse-stop 1.5s infinite;
}

.send-btn-new.stop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

@keyframes pulse-stop {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 2px 16px rgba(239, 68, 68, 0.5);
    }
}

/* 旧的样式兼容 */
.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    min-height: 48px;
    max-height: 200px;
    transition: all 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.send-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.send-btn:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.input-footer {
    max-width: 800px;
    margin: 8px auto 0;
    text-align: center;
}

.input-hint {
    color: var(--text-muted);
    font-size: 12px;
}

/* Toast提示框 - 现代化设计 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    z-index: 99999; /* 确保 Toast 在最上层，高于所有弹窗 */
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    justify-content: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 成功提示 - 绿色主题 */
.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.success::before {
    content: '✓';
    font-size: 16px;
    font-weight: bold;
}

/* 错误提示 - 红色主题 */
.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.error::before {
    content: '✕';
    font-size: 16px;
    font-weight: bold;
}

/* 警告提示 - 橙色主题 */
.toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.warning::before {
    content: '⚠';
    font-size: 16px;
    font-weight: bold;
}

/* 信息提示 - 蓝色主题 */
.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.info::before {
    content: 'ℹ';
    font-size: 16px;
    font-weight: bold;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s;
        width: 280px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    /* 移动端禁用收缩功能 */
    .sidebar.collapsed {
        width: 280px;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .suggestions {
        grid-template-columns:1fr;
    }
    
    .auth-container {
        padding: 24px;
        margin: 16px;
    }
    
    .auth-card {
        padding: 24px;
    }
    
    .form-group input {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    .code-input-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .code-input-group input {
        width: 100%;
    }
    
    .send-code-btn {
        width: 100%;
        padding: 14px;
    }
    
    .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .welcome-title {
        font-size: 28px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }
    
    .message-input {
        font-size: 16px;
    }
    
    .chat-input-container {
        padding: 12px;
        border-radius: 12px;
    }
    
    .chat-input {
        font-size: 16px;
    }
    
    .chat-input-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .toolbar-left {
        order: 2;
        width: 100%;
        justify-content: flex-start;
    }
    
    .toolbar-right {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }
    
    .model-select {
        flex: 1;
        font-size: 14px;
    }
    
    .main-content {
        padding-left: 0;
    }
}

.loading {
    display: inline-flex;
    gap: 4px;
}

.loading span {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 750px;
    height: 550px;
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    display: flex;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
}

.modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.settings-sidebar {
    width: 220px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.settings-title {
    padding: 20px 16px 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: left;
}

.settings-tab svg {
    flex-shrink: 0;
}

.settings-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-tab.active {
    background: var(--accent);
    color: white;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.panel-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* 积分余额显示样式 */
.credits-summary-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.credits-summary-item label {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
}

.credits-balance-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.credits-amount-large {
    font-size: 36px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.credits-unit {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

.credits-yuan {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 8px;
}

.credits-summary-item .setting-desc {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
}

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

.setting-select,
.setting-input {
    width: 100%;
    padding: 10px 14px;
    padding-right: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.setting-select:focus,
.setting-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.edit-btn {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-muted);
    background: transparent;
    transition: all 0.2s;
}

.edit-btn:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

.setting-input:disabled + .edit-btn {
    cursor: pointer;
}

.setting-input:not(:disabled) + .edit-btn {
    display: none;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
}

.link {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

.btn-danger {
    background: var(--error);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        flex-direction: column;
    }
    
    .modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .settings-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    
    .settings-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 16px;
        -webkit-overflow-scrolling: touch;
    }
    
    .settings-tab {
        padding: 12px 16px;
        white-space: nowrap;
        font-size: 13px;
    }
    
    .settings-content {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .setting-item {
        margin-bottom: 20px;
    }
    
    .setting-input {
        font-size: 16px;
        padding: 12px;
    }
    
    .setting-select {
        font-size: 16px;
        padding: 12px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }
}
