/* ===================================================
   Chat 聊天系统 - 公共样式（纯白主题 / 蓝色强调）
   =================================================== */

:root {
    --accent: #2b7fff;
    --accent-hover: #1a6aec;
    --accent-light: #e8f2ff;
    --bg: #ffffff;
    --bg-soft: #fafafa;
    --bg-hover: #f5f7fa;
    --line: #eeeeee;
    --line-strong: #e2e2e2;
    --text: #1a1a1a;
    --text-sub: #8a8a8a;
    --text-light: #b5b5b5;
    --danger: #e5484d;
    --success: #30a46c;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    user-select: none;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

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

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { height: 46px; font-size: 15px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-sub);
}
.input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, .1);
}
.input::placeholder { color: var(--text-light); }
textarea.input {
    height: auto;
    padding: 10px 14px;
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}
select.input { cursor: pointer; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- 提示消息 ---------- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
    line-height: 1.6;
}
.alert.show { display: block; }
.alert-error { background: #fff5f5; color: var(--danger); border: 1px solid #f8d7d8; }
.alert-success { background: #f0faf5; color: var(--success); border: 1px solid #c6ecd8; }
.alert-info { background: var(--accent-light); color: var(--accent); border: 1px solid #cfe3ff; }

/* ---------- 头像 ---------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-md { width: 42px; height: 42px; font-size: 16px; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}
.badge.hidden { display: none; }

/* ---------- 加载 ---------- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
.spinner-dark {
    border-color: rgba(0, 0, 0, .1);
    border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-sub);
    font-size: 13px;
}

/* ---------- 空状态 ---------- */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
}

/* ---------- 模态框 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    max-height: 86vh;
    overflow: auto;
    animation: modalIn .18s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: none; }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--bg-hover); }
.modal-body { padding: 20px; }
.modal-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
}

/* ---------- Toast ---------- */
#toast-wrap {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}
.toast {
    padding: 10px 18px;
    border-radius: var(--radius);
    background: rgba(26, 26, 26, .9);
    color: #fff;
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    animation: toastIn .2s ease;
    max-width: 80vw;
}
.toast.error { background: rgba(229, 72, 77, .95); }
.toast.success { background: rgba(48, 164, 108, .95); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: none; }
}

/* ---------- 通用工具 ---------- */
.hidden { display: none !important; }
.text-sub { color: var(--text-sub); }
.text-light { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.divider { height: 1px; background: var(--line); border: none; margin: 16px 0; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #cfcfcf; }

/* ===================================================
   认证页（登录/注册）
   =================================================== */
.auth-page {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg);
}
.auth-box {
    width: 100%;
    max-width: 380px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 14px;
}
.auth-logo h1 {
    font-size: 21px;
    font-weight: 600;
    margin: 0 0 6px;
}
.auth-logo p {
    color: var(--text-sub);
    font-size: 13px;
    margin: 0;
}
.auth-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 26px 24px;
}
.auth-foot {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-sub);
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 480px) {
    .auth-card { padding: 22px 18px; }
}
