/* ============================================================
 * X-GORB Chat（迅时通）样式表
 * 微信/QQ 风格 · 支持深色模式 · 移动端适配
 * ============================================================ */

/* ===== 亮色模式（默认） ===== */
:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --primary-light: #e7f8ee;
    --bg: #ededed;
    --bg-white: #ffffff;
    --bg-sidebar: #f7f7f7;
    --bg-chat: #f5f5f5;
    --text: #1a1a1a;
    --text-secondary: #888888;
    --text-light: #b2b2b2;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --message-mine: #95ec69;
    --message-mine-text: #1a1a1a;
    --message-friend: #ffffff;
    --success: #07c160;
    --danger: #fa5151;
    --warning: #f59e0b;
    --radius: 4px;
    --radius-sm: 4px;
    --radius-lg: 8px;
    --shadow: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --sidebar-width: 320px;
    --header-height: 56px;
    --avatar-size: 40px;
    --avatar-radius: 4px;
    --msg-avatar-size: 36px;
}

/* ===== 深色模式 ===== */
.dark-mode {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --primary-light: #1a3a28;
    --bg: #1a1a1a;
    --bg-white: #2b2b2b;
    --bg-sidebar: #232323;
    --bg-chat: #1e1e1e;
    --text: #e0e0e0;
    --text-secondary: #999999;
    --text-light: #666666;
    --border: #3a3a3a;
    --border-light: #333333;
    --message-mine: #2b5e3f;
    --message-mine-text: #e0e0e0;
    --message-friend: #2b2b2b;
    --success: #07c160;
    --danger: #fa5151;
    --warning: #f59e0b;
    --shadow: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, color 0.2s;
}

.dark-mode {
    color-scheme: dark;
}

/* ==================== 登录页 ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 100%;
    animation: fadeInUp 0.5s ease;
}

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

.login-logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-login-xgorb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
}

.btn-login-xgorb:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.8;
}

/* ==================== 聊天主界面 ==================== */
.chat-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 10px 12px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--header-height);
}

.current-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

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

.current-user-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current-user-status {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(34,197,94,0.2);
}

.sidebar-actions {
    display: flex;
    gap: 2px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.icon-btn:active {
    background: rgba(0,0,0,0.08);
}

/* ===== 搜索栏 ===== */
.sidebar-search {
    padding: 8px 12px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.sidebar-search input {
    width: 100%;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg-sidebar);
    color: var(--text);
}

.sidebar-search input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
}

/* ===== 好友列表 ===== */
.friend-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: var(--bg-white);
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 12px;
    position: relative;
    border-bottom: 1px solid var(--border-light);
}

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

.friend-item.active {
    background: var(--primary-light);
}

.friend-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.friend-avatar-wrap .online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    border: 2px solid var(--bg-white);
}

.friend-item.active .online-dot {
    border-color: var(--primary-light);
}

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

.friend-name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-last-msg {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.friend-meta {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    align-self: flex-start;
    margin-top: 2px;
}

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

.unread-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 4px;
}

.empty-hint {
    font-size: 13px;
}

/* ===== 头像（微信风格：方角） ===== */
.avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: var(--avatar-radius);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--border);
}

/* ===== 聊天区域 ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-chat);
    position: relative;
}

.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
    color: var(--text-secondary);
}

.welcome-content h2 {
    margin-top: 16px;
    font-size: 22px;
}

.welcome-content p {
    margin-top: 8px;
    font-size: 14px;
}

.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ===== 聊天头部 ===== */
.chat-header {
    height: var(--header-height);
    padding: 0 12px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 8px;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.chat-friend-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-friend-name {
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-friend-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 移动端返回按钮（默认隐藏） */
.mobile-back-btn {
    display: none;
    padding: 6px;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== 消息列表 ===== */
.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-time-divider {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    margin: 12px 0 8px;
    padding: 2px 10px;
    background: rgba(0,0,0,0.06);
    border-radius: 4px;
    align-self: center;
}

.dark-mode .message-time-divider {
    background: rgba(255,255,255,0.08);
}

/* ===== 消息气泡（微信风格） ===== */
.message {
    display: flex;
    gap: 8px;
    max-width: 72%;
    align-items: flex-start;
    margin-bottom: 6px;
    animation: messageIn 0.2s ease;
}

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

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

.message .msg-avatar {
    width: var(--msg-avatar-size);
    height: var(--msg-avatar-size);
    border-radius: var(--avatar-radius);
    flex-shrink: 0;
    object-fit: cover;
    background: var(--border);
}

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

.message.mine .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    max-width: 100%;
}

.message:not(.mine) .message-bubble {
    background: var(--message-friend);
    box-shadow: var(--shadow);
    border-top-left-radius: 0;
}

/* 左侧气泡三角 */
.message:not(.mine) .message-bubble::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 6px 0;
    border-color: transparent var(--message-friend) transparent transparent;
}

.message.mine .message-bubble {
    background: var(--message-mine);
    color: var(--message-mine-text);
    border-top-right-radius: 0;
}

/* 右侧气泡三角 */
.message.mine .message-bubble::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent var(--message-mine);
}

.message-image {
    max-width: 240px;
    max-height: 240px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: block;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.message-file-icon {
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.mine .message-file-icon {
    background: rgba(0,0,0,0.08);
}

.message-file-info {
    font-size: 13px;
}

.message-file-name {
    font-weight: 500;
    word-break: break-all;
}

.message-file-size {
    opacity: 0.7;
    font-size: 12px;
}

.message-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message.mine .message-meta {
    justify-content: flex-end;
}

.read-tick {
    color: var(--primary);
}

/* ===== 输入区域 ===== */
.message-input-area {
    padding: 8px 12px 8px;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.typing-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 4px 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.input-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

#messageInput {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s;
    background: var(--bg-sidebar);
    color: var(--text);
}

#messageInput:focus {
    border-color: var(--primary);
    background: var(--bg-white);
}

.btn-send {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

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

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

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

/* ==================== 设置页面 ==================== */
.settings-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-chat);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.settings-section {
    margin-bottom: 12px;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.settings-section-title {
    padding: 8px 16px 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item label {
    font-size: 15px;
    color: var(--text);
    flex-shrink: 0;
}

.settings-value {
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-item input[type="text"] {
    flex: 1;
    max-width: 200px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    text-align: right;
    background: var(--bg-sidebar);
    color: var(--text);
    font-family: inherit;
}

.settings-item input[type="text"]:focus {
    border-color: var(--primary);
    background: var(--bg-white);
}

.settings-save-row {
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
}

/* 开关组件 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.btn-logout-full {
    width: calc(100% - 32px);
    margin: 16px;
    padding: 12px;
    background: var(--bg-white);
    color: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-logout-full:hover {
    background: #fef2f2;
}

.dark-mode .btn-logout-full:hover {
    background: #3a2222;
}

/* ==================== 弹窗 ==================== */
.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 {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.25s ease;
}

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

.modal-sm { width: 360px; }
.modal-lg { width: 640px; }

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    padding: 4px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ===== 搜索框 ===== */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: var(--bg-sidebar);
    color: var(--text);
}

.search-box input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
}

/* ===== 搜索结果 ===== */
.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-hint {
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
    font-size: 14px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    gap: 12px;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: var(--bg-sidebar);
}

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

.search-result-name {
    font-weight: 500;
    font-size: 14px;
}

.search-result-username {
    font-size: 12px;
    color: var(--text-secondary);
}

.dev-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 600;
}

/* ===== 好友申请列表 ===== */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.request-list {
    max-height: 400px;
    overflow-y: auto;
}

.request-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    gap: 12px;
    background: var(--bg-sidebar);
    margin-bottom: 8px;
}

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

.request-name {
    font-weight: 500;
    font-size: 14px;
}

.request-message {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.request-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.request-actions {
    display: flex;
    gap: 6px;
}

.btn-accept, .btn-reject {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-accept {
    background: var(--success);
    color: white;
}

.btn-accept:hover {
    background: #16a34a;
}

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

.btn-reject:hover {
    background: #fef2f2;
    color: var(--danger);
    border-color: var(--danger);
}

/* ===== 好友预览 ===== */
.friend-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-sidebar);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.friend-preview-info {
    flex: 1;
}

.friend-preview-name {
    font-weight: 600;
    font-size: 15px;
}

.friend-preview-username {
    font-size: 13px;
    color: var(--text-secondary);
}

#requestMessage {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    margin-bottom: 16px;
    background: var(--bg-sidebar);
    color: var(--text);
}

#requestMessage:focus {
    border-color: var(--primary);
    background: var(--bg-white);
}

/* ===== 按钮 ===== */
.btn-primary {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

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

.btn-primary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ===== Badge ===== */
.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--text);
    color: var(--bg-white);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.dark-mode .toast {
    background: #e0e0e0;
    color: #1a1a1a;
}

.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--danger); color: white; }
.toast.warning { background: var(--warning); color: white; }

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

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

/* ==================== 移动端响应式 ==================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --avatar-size: 44px;
        --msg-avatar-size: 38px;
    }

    .chat-app {
        position: relative;
        overflow: hidden;
    }

    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        transition: transform 0.25s ease;
        transform: translateX(0);
    }

    .sidebar.slide-out {
        transform: translateX(-100%);
    }

    .chat-area {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 5;
    }

    .chat-area.show-on-mobile {
        z-index: 10;
    }

    .mobile-back-btn {
        display: flex;
    }

    .message {
        max-width: 80%;
    }

    .modal {
        width: 95vw;
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    .message-list {
        padding: 10px 12px;
    }

    .message-bubble {
        font-size: 15px;
        padding: 8px 12px;
    }

    .settings-page {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 15;
    }

    .sidebar-header {
        padding: 8px 10px;
    }

    .current-user-name {
        font-size: 16px;
    }

    .friend-item {
        padding: 12px 14px;
    }

    #messageInput {
        font-size: 16px;
    }
}

/* ==================== 平板适配 ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }
}
