/* --- 1. 基础重置与变量 --- */
:root {
    --primary-color: #07C160;
    --primary-dark: #06AD56;
    --primary-light: #E8F5E9;
    --sidebar-bg: #2E2E2E;
    --chat-bg: #F5F5F5;
    --bubble-sent: #95EC69;
    --bubble-received: #FFFFFF;
    --border-color: #E5E5E5;
    --text-main: #1F1F1F;
    --text-secondary: #666666;
    --text-light: #999999;
    --sidebar-width: 360px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 6px;
    --radius-full: 50%;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--chat-bg);
    height: 100vh; 
    overflow: hidden; 
    color: var(--text-main);
}

/* --- 2. 登录注册页面 --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #E8E8E8 0%, #D0D0D0 100%);
}

.auth-card {
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.auth-header h1 {
    font-size: 28px;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 600;
}

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

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    background: #F0F0F0;
    border-radius: var(--radius-md);
    padding: 3px;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.tab-btn.active {
    background: #FFFFFF;
    color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #D9D9D9;
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.3s;
    outline: none;
    background: #FFFFFF;
    color: var(--text-main);
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.2);
}

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

.form-group.error input {
    border-color: var(--error-color);
}

.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

.form-group.error .error-message {
    display: block;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.auth-btn:hover {
    background: var(--primary-dark);
}

.auth-btn:active {
    transform: scale(0.98);
}

.auth-btn:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #E5E5E5;
}

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

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.success-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.success-toast.show {
    opacity: 1;
}

/* --- 3. 布局容器 --- */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    background-color: var(--chat-bg);
}

/* --- 4. 左侧侧边栏 --- */
.sidebar {
    width: var(--sidebar-width);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F5F5F5;
    height: 56px;
}

.user-info {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: linear-gradient(135deg, #07C160 0%, #06AD56 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin-right: 10px;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.logout-btn {
    padding: 6px 12px;
    background: #F5F5F5;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #E5E5E5;
    color: var(--text-main);
}

.search-bar {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    background: #F5F5F5;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid #E5E5E5;
    background: #FFFFFF;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-main);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.new-chat-btn {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    padding: 10px;
    background: var(--primary-color);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
}

body.dark-theme .new-chat-btn {
    background: #07C160;
}

body.dark-theme .new-chat-btn:hover {
    background: #06AD56;
}

.contact-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #F0F0F0;
}

.contact-item:hover {
    background: #F5F5F5;
}

.contact-item.active {
    background: #C9C9C9;
}

.contact-item .avatar {
    width: 45px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
    background: #E8E8E8;
}

.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 15px; font-weight: 500; margin-bottom: 3px; color: var(--text-main); }
.last-msg { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-time { font-size: 11px; color: var(--text-light); }

/* --- 5. 右侧聊天区域 --- */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
}

.chat-header {
    padding: 16px 20px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #F5F5F5;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.action-btn:hover {
    background: #E5E5E5;
    color: var(--text-main);
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-image: 
        linear-gradient(#f5f5f5 1px, transparent 1px), 
        linear-gradient(90deg, #f5f5f5 1px, transparent 1px);
    background-size: 20px 20px;
}

/* 消息气泡样式 */
.message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
    animation: messageFadeIn 0.3s ease;
}

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.message.received .avatar {
    margin-right: 10px;
}

.message.self .avatar {
    margin-left: 10px;
}

@keyframes messageFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.self {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 60%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.received .message-content {
    background: var(--bubble-received);
    color: var(--text-main);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 0;
}

.message.self .message-content {
    background: var(--bubble-sent);
    color: #000000;
    border-radius: var(--radius-md) var(--radius-md) 0 var(--radius-md);
}

/* 小三角箭头 */
.message.received .message-content::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 10px;
    width: 0; height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid var(--bubble-received);
}

.message.self .message-content::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 10px;
    width: 0; height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid var(--bubble-sent);
}

/* --- 6. 底部输入框 --- */
.input-area {
    padding: 12px 20px;
    background: #FFFFFF;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    height: 90px;
    position: relative;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.tool-btn:hover {
    color: var(--text-main);
}

.input-box-wrapper {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transition: all 0.2s;
}

.input-box {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 80px;
    overflow-y: auto;
    line-height: 1.5;
    color: var(--text-main);
}

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

.send-btn {
    margin-left: 12px;
    padding: 8px 20px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.send-btn:disabled {
    background: #E9E9E9;
    color: var(--text-light);
    cursor: not-allowed;
}

.send-btn:active {
    transform: scale(0.98);
}

/* --- Emoji选择面板 --- */
.emoji-picker {
    position: relative;
}

.emoji-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 320px;
    max-height: 280px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    overflow: hidden;
    z-index: 100;
    animation: slideUp 0.2s ease;
}

body.dark-theme .emoji-panel {
    background: #222222;
}

.emoji-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #EEEEEE;
}

body.dark-theme .emoji-tabs {
    border-bottom-color: #333333;
}

.emoji-tab {
    padding: 6px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.emoji-tab:hover {
    background: #F5F5F5;
}

body.dark-theme .emoji-tab:hover {
    background: #333333;
}

.emoji-tab.active {
    background: #E8F5E9;
}

body.dark-theme .emoji-tab.active {
    background: #1B5E20;
}

.emoji-grid {
    max-height: 220px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.emoji-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.emoji-item:hover {
    background: #F5F5F5;
    transform: scale(1.2);
}

body.dark-theme .emoji-item:hover {
    background: #333333;
}

/* --- 7. 空状态 --- */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: #E8E8E8;
    border-radius: var(--radius-full);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    margin-bottom: 16px;
    color: #B0B0B0;
}

.empty-text {
    font-size: 15px;
    color: var(--text-light);
}

/* --- 8. 滚动条美化 --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #C1C1C1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #A8A8A8;
}

/* --- 9. 移动端适配 --- */
@media (max-width: 768px) {
    .sidebar { width: 80px; }
    .sidebar-header .user-name, .logout-btn, .search-bar, .contact-info { display: none; }
    .user-avatar, .contact-item .avatar { margin: 0; width: 40px; height: 40px; }
    .contact-item { justify-content: center; padding: 12px 0; }
    .chat-header { padding: 12px 14px; font-size: 15px; }
    .messages-container { padding: 12px; }
    .message-content { max-width: 75%; padding: 8px 12px; font-size: 13px; }
    .input-area { padding: 10px 12px; }
    .tool-btn { width: 30px; height: 30px; }
    .send-btn { padding: 8px 18px; font-size: 14px; }
}

/* --- 个性化设置面板 --- */
.settings-panel {
    position: absolute;
    right: 20px;
    top: 60px;
    width: 320px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #E5E5E5;
    background: #F8F8F8;
}

.settings-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.settings-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.settings-close:hover {
    background: #E8E8E8;
    color: var(--text-main);
}

.settings-content {
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
}

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

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

.setting-item label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.setting-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.setting-options button {
    padding: 8px 14px;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    background: #FFFFFF;
    color: var(--text-secondary);
}

.setting-options button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.setting-options button.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.color-btn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    padding: 0 !important;
}

.color-btn.active {
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.3);
    transform: scale(1.1);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: #FFF1F0;
    border: 1px solid #FFCCC7;
    border-radius: 6px;
    font-size: 14px;
    color: #FF4D4F;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: #FFCCC7;
    color: #D93026;
}

body.dark-theme .reset-btn {
    background: #3D1F1F;
    border-color: #5C2F2F;
    color: #FF7875;
}

body.dark-theme .reset-btn:hover {
    background: #5C2F2F;
    color: #FF4D4F;
}

/* --- 弹窗样式 --- */
.modal-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;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #EEEEEE;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999999;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #F5F5F5;
    color: #666666;
}

.modal-body {
    padding: 20px;
}

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

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

.form-input {
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid #DDDDDD;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-main);
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.1);
}

.form-textarea {
    height: 80px;
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
}

.avatar-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.avatar-option {
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: #FFFFFF;
}

.avatar-option:hover {
    border-color: var(--primary-color);
}

.avatar-option.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.2);
}

.avatar-preview {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #EEEEEE;
    justify-content: flex-end;
}

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

.btn-primary {
    background: var(--primary-color);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #F5F5F5;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: #EEEEEE;
}

body.dark-theme .modal-content {
    background: #222222;
}

body.dark-theme .modal-header {
    border-bottom-color: #333333;
}

body.dark-theme .modal-header h3 {
    color: #FFFFFF;
}

body.dark-theme .modal-close:hover {
    background: #333333;
}

body.dark-theme .form-group label {
    color: #AAAAAA;
}

body.dark-theme .form-input {
    background: #333333;
    border-color: #444444;
    color: #FFFFFF;
}

body.dark-theme .form-input:focus {
    border-color: var(--primary-color);
}

body.dark-theme .avatar-option {
    background: #222222;
}

body.dark-theme .modal-footer {
    border-top-color: #333333;
}

body.dark-theme .btn-secondary {
    background: #333333;
    color: #AAAAAA;
}

body.dark-theme .btn-secondary:hover {
    background: #444444;
}

.btn-danger {
    background: #FF4D4F;
    color: #FFFFFF;
}

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

body.dark-theme .btn-danger {
    background: #FF4D4F;
}

body.dark-theme .btn-danger:hover {
    background: #D93026;
}

.confirm-modal {
    text-align: center;
    padding: 20px;
}

.confirm-modal .modal-footer {
    justify-content: center;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirm-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

body.dark-theme .confirm-message {
    color: #AAAAAA;
}

/* --- 空状态 --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-text {
    font-size: 14px;
    opacity: 0.5;
}

body.dark-theme .empty-text {
    color: #666666;
}

/* --- 更多选项菜单 --- */
.more-menu {
    position: absolute;
    right: 20px;
    top: 60px;
    width: 180px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

.menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-item:hover {
    background: #F5F5F5;
    color: var(--text-main);
}

body.dark-theme .more-menu {
    background: #222222;
}

body.dark-theme .menu-item {
    color: #AAAAAA;
}

body.dark-theme .menu-item:hover {
    background: #333333;
    color: #FFFFFF;
}

/* --- 深色主题 --- */
body.dark-theme {
    --chat-bg: #1A1A1A;
    --text-main: #FFFFFF;
    --text-secondary: #AAAAAA;
    --text-light: #666666;
    --border-color: #333333;
}

body.dark-theme .sidebar {
    background: #222222;
}

body.dark-theme .sidebar-header {
    background: #2A2A2A;
}

body.dark-theme .search-bar {
    background: #2A2A2A;
}

body.dark-theme .search-input {
    background: #333333;
    border-color: #444444;
    color: #FFFFFF;
}

body.dark-theme .contact-item {
    border-bottom-color: #333333;
}

body.dark-theme .contact-item:hover {
    background: #2A2A2A;
}

body.dark-theme .contact-item.active {
    background: #3A3A3A;
}

body.dark-theme .chat-header {
    background: #222222;
    border-bottom-color: #333333;
}

body.dark-theme .input-area {
    background: #222222;
    border-top-color: #333333;
}

body.dark-theme .input-box {
    background: #333333;
    color: #FFFFFF;
}

body.dark-theme .message.received .message-content {
    background: #2A2A2A;
    color: #FFFFFF;
}

body.dark-theme .message.received .message-content::before {
    border-right-color: #2A2A2A;
}

body.dark-theme .messages-container {
    background-image: 
        linear-gradient(#1A1A1A 1px, transparent 1px), 
        linear-gradient(90deg, #1A1A1A 1px, transparent 1px);
}

body.dark-theme .settings-panel {
    background: #222222;
}

body.dark-theme .settings-header {
    background: #2A2A2A;
    border-bottom-color: #333333;
}

body.dark-theme .action-btn {
    background: #333333;
    color: #AAAAAA;
}

body.dark-theme .action-btn:hover {
    background: #444444;
    color: #FFFFFF;
}

body.dark-theme .logout-btn {
    background: #333333;
    color: #AAAAAA;
}

body.dark-theme .logout-btn:hover {
    background: #444444;
    color: #FFFFFF;
}

body.dark-theme .tool-btn {
    color: #AAAAAA;
}

body.dark-theme .tool-btn:hover {
    color: #FFFFFF;
}

body.dark-theme .setting-options button {
    background: #2A2A2A;
    border-color: #444444;
    color: #AAAAAA;
}

body.dark-theme .setting-options button.active {
    background: rgba(7, 193, 96, 0.2);
    border-color: var(--primary-color);
}

/* --- 字体大小 --- */
body.font-small .message-content {
    font-size: 12px;
}

body.font-large .message-content {
    font-size: 16px;
}

/* --- 气泡样式 --- */
body.bubble-square .message-content {
    border-radius: 4px;
}

body.bubble-square .message.received .message-content {
    border-radius: 4px;
}

body.bubble-square .message.self .message-content {
    border-radius: 4px;
}

body.bubble-pill .message-content {
    border-radius: 20px;
}

body.bubble-pill .message.received .message-content {
    border-radius: 20px 20px 20px 4px;
}

body.bubble-pill .message.self .message-content {
    border-radius: 20px 20px 4px 20px;
}

/* --- 发送按钮颜色 --- */
.send-btn.color-blue {
    background: #1890FF;
}

.send-btn.color-blue:hover {
    background: #096dd9;
}

.send-btn.color-purple {
    background: #722ED1;
}

.send-btn.color-purple:hover {
    background: #531dab;
}

.send-btn.color-orange {
    background: #FA8C16;
}

.send-btn.color-orange:hover {
    background: #d46b08;
}

/* --- 调试控制台 --- */
.debug-console {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 400px;
    max-height: 200px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 0 8px 0 0;
    padding: 10px 12px;
    overflow-y: auto;
    z-index: 1000;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: #00FF00;
}

.debug-console::-webkit-scrollbar {
    width: 4px;
}

.debug-console::-webkit-scrollbar-track {
    background: transparent;
}

.debug-console::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 2px;
}

.debug-line {
    margin-bottom: 4px;
    line-height: 1.4;
    opacity: 0.7;
}

.debug-line.info {
    color: #00FF00;
}

.debug-line.warn {
    color: #FFAA00;
}

.debug-line.error {
    color: #FF5555;
}

.debug-line.time {
    color: #888888;
}

body.dark-theme .debug-btn {
    background: #333333;
    border-color: #444444;
    color: #AAAAAA;
}

body.dark-theme .debug-btn:hover {
    background: #444444;
}

body.dark-theme .debug-btn.active {
    background: #1B5E20;
    border-color: #2E7D32;
    color: #FFFFFF;
}
