/**
 * base.css - 移动端基础样式
 * 重置 + CSS 变量 + 排版 + 页面容器
 */

/* ==================== CSS 变量 ==================== */
:root {
    --ls-primary: #3b82f6;
    --ls-primary-hover: #2563eb;
    --ls-primary-light: rgba(59, 130, 246, 0.1);
    --ls-danger: #ef4444;
    --ls-danger-light: rgba(239, 68, 68, 0.1);
    --ls-success: #10b981;
    --ls-warning: #f59e0b;
    --ls-info: #6366f1;

    --ls-bg: #f7f8fa;
    --ls-bg-card: #ffffff;
    --ls-bg-secondary: #f2f3f5;

    --ls-text: #1a1a1a;
    --ls-text-secondary: #666666;
    --ls-text-tertiary: #999999;
    --ls-text-placeholder: #cccccc;

    --ls-border: #e8e8e8;
    --ls-border-light: #f5f5f5;
    --ls-divider: #f0f0f0;

    --ls-radius: 8px;
    --ls-radius-sm: 4px;
    --ls-radius-lg: 12px;
    --ls-radius-round: 50%;
    --ls-radius-pill: 999px;

    --ls-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --ls-shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --ls-shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.12);

    --ls-navbar-height: 44px;
    --ls-tabbar-height: 50px;
    --ls-safe-top: env(safe-area-inset-top, 0px);
    --ls-safe-bottom: env(safe-area-inset-bottom, 0px);

    --ls-font-xs: 11px;
    --ls-font-sm: 12px;
    --ls-font-base: 14px;
    --ls-font-md: 15px;
    --ls-font-lg: 16px;
    --ls-font-xl: 18px;
    --ls-font-2xl: 20px;
    --ls-font-3xl: 24px;

    --ls-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* 兼容别名：部分页面样式引用了这些变量名 */
    --ls-text-primary: var(--ls-text);
    --ls-bg-body: var(--ls-bg);
    --ls-bg-hover: var(--ls-bg-secondary);
    --ls-radius-md: 6px;
}

/* ==================== 重置 ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: var(--ls-font-base);
    color: var(--ls-text);
    background: var(--ls-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

input,
textarea,
button {
    font: inherit;
    border: none;
    outline: none;
    background: none;
    -webkit-appearance: none;
    appearance: none;
}

button {
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

.ls-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 14px;
    padding: 0 5px;
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    line-height: 14px;
    gap: 3px;
    vertical-align: middle;
    flex-shrink: 0;
}

.ls-mark img {
    max-width: 50px;
    height: 14px;
    width: auto;
    object-fit: contain;
    display: block;
}

.ls-emoji {
    width: 20px;
    height: 20px;
    max-height: 20px;
    vertical-align: -4px;
    padding: 0;
    margin: 0;
    display: inline;
}

/* ==================== SPA 容器 ==================== */
#ls-app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
}

/* ==================== 页面容器 ==================== */
.ls-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    background: var(--ls-bg);
    z-index: 1;
    display: none;
}

.ls-page.ls-page-active {
    display: block;
    z-index: 2;
}

/* 内页滚动容器（由框架自动创建，navbar 被提升到此容器外面） */
.ls-page-scroller {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 2;
}

/* 封面层（被框架提升到 pageEl，与 scroller 同级，下拉刷新不跟随） */
.ls-page-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

/* 首页容器（包含 Tab 内容） */
.ls-page.ls-home-page {
    padding-bottom: calc(var(--ls-tabbar-height) + var(--ls-safe-bottom));
}

/* Tab 内容区域（在 home 页面内部，各自独立滚动） */
.ls-tab-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--ls-bg);
    /* Tab 内容区需要留出导航栏和底部 TabBar 的空间 */
    padding-top: calc(var(--ls-navbar-height) + var(--ls-safe-top));
    padding-bottom: calc(var(--ls-tabbar-height) + var(--ls-safe-bottom));
}

/* 导航栏 disabled 时，不留顶部空间 */
.ls-tab-content.ls-no-navbar {
    padding-top: var(--ls-safe-top);
}

/* 仅当底栏隐藏（单 Tab）时，不留底栏空间 */
.ls-no-tabbar .ls-home-page {
    padding-bottom: 0;
}

.ls-no-tabbar .ls-tab-content {
    padding-bottom: var(--ls-safe-bottom);
}

/* ==================== 通用类 ==================== */

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

.ls-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.ls-empty p,
.ls-empty span {
    font-size: var(--ls-font-md);
    margin: 0;
}

/* 卡片 */
.ls-card {
    background: var(--ls-bg-card);
    border-radius: var(--ls-radius);
    margin: 10px 12px;
    padding: 12px;
}

/* 头像 */
.ls-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--ls-radius-round);
    overflow: visible;
    flex-shrink: 0;
    background: var(--ls-bg-secondary);
}

.ls-avatar>img,
.ls-avatar>a>img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--ls-radius-round);
}

.ls-avatar-sm {
    width: 32px;
    height: 32px;
}

.ls-avatar-lg {
    width: 56px;
    height: 56px;
}

/* 头像认证标识（右下角） */
.ls-avatar .ls-avatar-verify {
    position: absolute;
    bottom: -2px;
    right: -2px;
    line-height: 0;
    display: block;
    z-index: 3;
}

.ls-avatar .ls-avatar-verify img {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    background: #fff;
    display: block;
}

/* 按钮 */
.ls-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--ls-radius);
    font-size: var(--ls-font-base);
    font-weight: 500;
    transition: all var(--ls-transition);
    white-space: nowrap;
}

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

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

.ls-btn-outline {
    border: 1px solid var(--ls-border);
    color: var(--ls-text);
}

.ls-btn-outline:active {
    background: var(--ls-bg-secondary);
}

.ls-btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: var(--ls-font-sm);
}

.ls-btn-block {
    display: flex;
    width: 100%;
}

/* 分割线 */
.ls-divider {
    height: 1px;
    background: var(--ls-divider);
    margin: 0 12px;
}

/* Flex 辅助 */
.ls-flex {
    display: flex;
}

.ls-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ls-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ls-flex-1 {
    flex: 1;
    min-width: 0;
}

/* 文本辅助 */
.ls-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ls-ellipsis-2 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 间距 */
.ls-gap-4 {
    gap: 4px;
}

.ls-gap-8 {
    gap: 8px;
}

.ls-gap-12 {
    gap: 12px;
}

.ls-mt-8 {
    margin-top: 8px;
}

.ls-mt-12 {
    margin-top: 12px;
}

.ls-mb-8 {
    margin-bottom: 8px;
}

.ls-p-12 {
    padding: 12px;
}

/* 图标按钮 */
.ls-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--ls-radius-round);
    font-size: 20px;
    color: var(--ls-text-secondary);
    transition: background var(--ls-transition);
}

.ls-icon-btn:active {
    background: var(--ls-bg-secondary);
}

/* 标签 */
.ls-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--ls-radius-pill);
    font-size: var(--ls-font-xs);
    background: var(--ls-primary-light);
    color: var(--ls-primary);
}

/* 角标 */
.ls-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--ls-radius-pill);
    font-size: 10px;
    background: var(--ls-danger);
    color: #fff;
}

/* 全局未读角标（任意元素加 .ls-unread-badge 即可自动渲染未读数） */
.ls-unread-badge {
    position: relative;
}

.ls-unread-dot {
    position: absolute;
    top: -4px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--ls-radius-pill);
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    background: var(--ls-danger);
    color: #fff;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 10;
}

/* ==================== 超链接 ==================== */
a.hyperlink,
a.ls-at-link {
    color: var(--ls-primary);
}