/* ==========================================================================
 * 星潮阁 H5 全站统一主题样式（单一入口）
 * 文件：public/assets/css/theme.css
 * 规范版本：2026-09-06
 *
 * 说明：本文件是全站唯一的前端样式基准，包含：
 *   1. 字体族（系统无衬线）+ 抗锯齿
 *   2. 主色 / 配色 / 文字色（CSS 变量）
 *   3. 严格 4 档字号（18/16/14/12，整数 px）
 *   4. 严格 2 档字重（500/400，禁止 300/600/800/bold）
 *   5. 通用组件（按钮/卡片/标签/输入框/底部导航/搜索栏等）
 *   6. 字号字重兜底映射
 *
 * 使用：所有 H5 页面 <head> 必须引入本文件（放在其它样式之后，保证覆盖）。
 * 升级：修改主色/字号/字重只需改本文件顶部变量，全站同步生效。
 * ========================================================================== */

/* ===== 1. 全局字体族 + 抗锯齿（必须，禁止局部绕过） ===== */
* {
    font-family: -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-weight: 400;
    color: var(--diy-text);
}

/* 图标字体兜底：全站 `* { font-family: 系统字体 }` 会覆盖 FA 图标字族，
   导致 `fas` 图标渲染成方框。这里把图标类字体族提权恢复。 */
.fas, .far, .fab, .fal, .fad, .fa, .fa-solid, .fa-regular, .fa-brands,
.fa[class*="fa-"], .fas[class*="fa-"], .far[class*="fa-"], .fab[class*="fa-"] {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands", inherit;
    font-style: normal;
    font-weight: 900;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.fab, .fa-brands { font-family: "Font Awesome 5 Brands", "Font Awesome 5 Free"; font-weight: 400; }
.far, .fa-regular { font-weight: 400; }

/* ===== 2. 主题令牌区（颜色 / 文字 / 边框色的唯一来源） =====
 * 切换主题：后台「主题风格」→ 选一套 → 应用。
 * 6 套可选：violet 紫韵 / ink 墨蓝 / sunset 暖橙 / jade 青绿 / rose 胭脂 / night 曜夜
 * 也可直接替换下方标记区内的变量值。
 * ====================================================================== */
/* @TOKENS:BEGIN —— 主题令牌区，由后台「主题风格」自动重写，请勿手改 */
:root {
    /* ---------------- 品牌主色族（7 档） ---------------- */
    --diy-primary:      #8B5CF6;
    --diy-primary-dark: #7C3AED;
    --diy-primary-deep: #6D28D9;
    --diy-primary-light:#A78BFA;
    --diy-primary-pale: #C9C0FF;
    --diy-primary-soft: #F3EDFF;
    --diy-primary-softer:#FAF8FF;
    --diy-primary-rgb:  139,92,246;
    --diy-primary-dark-rgb: 124,58,237;

    /* ---------------- 语义色（固定语义，禁改用途） ---------------- */
    --diy-success: #10B981;
    --diy-warning: #F59E0B;
    --diy-danger:  #F43F5E;
    --diy-info:    #3B82F6;
    --diy-accent:  #F472B6;
    --diy-rank:    #FFB800;
    --diy-coin:    #FFD700;

    /* ---------------- 文字（4 档，禁 opacity 控深浅） ---------------- */
    --diy-text:   #23223A;
    --diy-text-2: #5C5A72;
    --diy-text-3: #9996A8;
    --diy-text-4: #C0BDCC;

    /* ---------------- 底面 / 卡片 / 分割线 ---------------- */
    --diy-bg:     #F4F3F9;
    --diy-card:   #FFFFFF;
    --diy-border: #ECEBF3;
    /* 吸底导航 / 吸顶栏（半透明 + 毛玻璃，深色主题自动转深） */
    --diy-nav-bg: rgba(255,255,255,.94);
    /* 遮罩层 */
    --diy-mask:   rgba(0,0,0,.45);

    /* ---------------- 阴影（6 档） ---------------- */
    --diy-sh-xs:    0 1px 2px rgba(26,26,26,.04);
    --diy-sh-sm:    0 2px 6px rgba(26,26,26,.05), 0 1px 3px rgba(26,26,26,.04);
    --diy-sh-md:    0 4px 12px rgba(26,26,26,.06), 0 2px 4px rgba(26,26,26,.04);
    --diy-sh-lg:    0 8px 24px rgba(26,26,26,.08), 0 2px 8px rgba(26,26,26,.04);
    --diy-sh-card:  0 2px 8px rgba(26,26,26,.05), 0 8px 16px rgba(26,26,26,.03);
    --diy-sh-float: 0 4px 16px rgba(26,26,26,.07), 0 1px 4px rgba(26,26,26,.03);

    /* ======================================================================
       旧变量族别名 —— 存量模板（126 个）在用，必须保留，勿删
       ====================================================================== */
    --primary:            var(--diy-primary);
    --primary-soft:       var(--diy-primary-light);
    --primary-light:      var(--diy-primary-pale);
    --primary-bg:         var(--diy-primary-soft);
    /* 全站不使用渐变（用户口径），渐变变量保留但一律取纯色 */
    --primary-gradient:        var(--diy-primary);
    --primary-gradient-subtle: var(--diy-primary-soft);

    --orange:          var(--diy-warning);
    --orange-soft:     var(--diy-rank);
    --orange-light:    var(--diy-primary-pale);
    --orange-bg:       var(--diy-primary-softer);
    --orange-gradient: var(--diy-warning);

    --accent-pink: var(--diy-accent);
    --success:     var(--diy-success);

    --bg-body:       var(--diy-bg);
    --bg-white:      var(--diy-card);
    --bg-gray-light: var(--diy-primary-softer);
    --bg-gray-soft:  var(--diy-border);
    --bg-card:       var(--diy-card);

    --text-primary:   var(--diy-text);
    --text-secondary: var(--diy-text-2);
    --text-muted:     var(--diy-text-3);
    --text-purple:    var(--diy-primary);
    --text-orange:    var(--diy-warning);
}
/* @TOKENS:END */

/* ===== 2.1 非颜色变量（阴影 / 圆角 / 边框，不随主题切换） ===== */
:root {
    /* 阴影 — 分层克制，取主题包定义 */
    --shadow-none: none;
    --shadow-xs: var(--diy-sh-xs);
    --shadow-sm: var(--diy-sh-sm);
    --shadow-md: var(--diy-sh-md);
    --shadow-lg: var(--diy-sh-lg);
    --shadow-card: var(--diy-sh-card);
    --shadow-float: var(--diy-sh-float);

    /* 圆角 */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 18px;
    --radius-btn: 6px;

    /* 边框 — 取主题包的 --diy-border，深色主题自动变深 */
    --border-light: 0.5px solid var(--diy-border);
    --border-subtle: 1px solid var(--diy-border);
}

/* ===== 3. 4 档字号（严格使用，禁止其它档位） ===== */
.text-block-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--diy-text);
}
.text-list-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--diy-text);
}
.text-desc {
    font-size: 14px;
    font-weight: 400;
    color: var(--diy-text-2);
}
.text-mini {
    font-size: 12px;
    font-weight: 400;
    color: var(--diy-text-3);
}

/* ===== 4. 全局基础（安全：不 reset 各页面已有布局，仅统一字体/颜色基调） ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: .01em;
}

a { color: var(--text-primary); text-decoration: none; }

img { max-width:100%; }

/* ===== 5. 通用组件 ===== */

/* 顶部导航 */
.v5-header {
    background: var(--bg-white);
    padding: 10px 14px;
    position: sticky; top: 0; z-index: 100;
    border-bottom: var(--border-subtle);
    display: flex; align-items: center; gap: 10px;
    height: 48px;
}
.v5-header-back {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-gray-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 14px;
    flex-shrink: 0;
}
.v5-header-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: .02em;
}
.v5-header-action {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
}

/* 通用卡片 */
.v5-card {
    background: var(--bg-white);
    margin: 0 14px 12px;
    border-radius: var(--radius-lg);
    padding: 16px 14px;
    box-shadow: var(--shadow-sm);
}
.v5-card-spacious {
    padding: 20px 16px;
    box-shadow: var(--shadow-card);
}

/* 通用按钮 */
.v5-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 10px 18px; border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    border: none; outline: none;
    cursor: pointer; transition: all .2s;
    letter-spacing: .01em;
}
.v5-btn-primary { background: var(--primary); color: #fff; }
.v5-btn-primary:active { background: var(--primary-soft); transform: scale(.98); }
.v5-btn-ghost { background: var(--bg-gray-light); color: var(--text-secondary); }
.v5-btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-xs); font-weight: 500; }
.v5-btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 3px; font-weight: 500; }

/* 输入框 */
.v5-input {
    width: 100%; padding: 10px 14px;
    background: var(--bg-gray-light);
    border: var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    outline: none;
    transition: border-color .2s;
}
.v5-input:focus { border-color: var(--primary-soft); }
.v5-input::placeholder { color: var(--text-muted); }

/* 标签 Badge */
.v5-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 500;
}
.v5-badge-purple { background: var(--primary-bg); color: var(--text-purple); }
.v5-badge-orange { background: var(--orange-bg); color: var(--text-orange); }
.v5-badge-gray   { background: var(--bg-gray-light); color: var(--text-secondary); }

/* 底部导航 */
.v5-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    max-width: 428px; margin: 0 auto;
    height: 56px;
    background: var(--bg-white);
    border-top: var(--border-subtle);
    display: flex; z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.v5-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-decoration: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    transition: color .2s;
    letter-spacing: .02em;
}
.v5-nav-item i { font-size: 20px; margin-bottom: 2px; }
.v5-nav-item.active { color: var(--primary); font-weight: 500; }

/* 通用底部导航 .bn（发现/消息/商城等页面使用；与 app.css 首页底部导航完全一致） */
.bn {
    position: fixed; bottom: 0; left: 0; right: 0;
    max-width: 430px; margin: 0 auto; min-height: 56px;
    display: flex; z-index: 100;
    background: var(--diy-nav-bg);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--diy-border);
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    box-sizing: border-box;
}
.bn a {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding-top: 8px; min-height: 48px;
    color: var(--text-muted);
    font-size: 10px; font-weight: 400;
    text-decoration: none;
    transition: color .15s;
}
.bn a i { font-size: 18px; margin-bottom: 3px; color: var(--text-muted); }
.bn a.active { color: var(--primary); font-weight: 500; }
.bn a.active i { color: var(--primary); }

/* 空/加载状态 */
.v5-empty {
    text-align: center; padding: 48px 20px;
    color: var(--text-muted);
}
.v5-empty-icon { font-size: 44px; margin-bottom: 12px; color: var(--text-muted); }
.v5-empty-text { font-size: 12px; }
.v5-loading {
    text-align: center; padding: 20px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* 搜索栏 */
.v5-search-bar {
    display: flex; align-items: center;
    background: var(--bg-gray-light);
    border: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 12px; gap: 8px;
}
.v5-search-bar i { color: var(--text-muted); font-size: 14px; }
.v5-search-bar input {
    flex: 1; border: none; background: transparent; outline: none;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
}
.v5-search-bar input::placeholder { color: var(--text-muted); }

/* ===== 6. 间距工具 ===== */
.v5-section-gap { margin-bottom: 12px; }
.v5-px { padding-left: 14px; padding-right: 14px; }

/* ===== 7. 响应式 ===== */
@media screen and (min-width: 768px) {
    body {
        box-shadow: 0 0 32px rgba(26,26,26,.06);
        overflow-x: hidden;
    }
    .v5-bottom-nav { left: 0; right: 0; margin-left: auto; margin-right: auto; }
}
@media screen and (max-width: 360px) {
    .v5-card { margin: 0 10px 10px; padding: 14px 12px; }
    .v5-header { padding: 8px 10px; }
}

/* ======================================================================
   底部导航全局强制统一（以首页 .bn 为标准，覆盖 .bn/.bottom-nav/.v5-bottom-nav/.bnav/.tabbar）
   !important 压过各页面内联硬编码，保证全站一致
   ====================================================================== */
.bn, .bottom-nav, .v5-bottom-nav, .bnav, .tabbar {
    position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    transform: none !important;
    max-width: 430px !important; margin: 0 auto !important;
    min-height: 56px !important; height: auto !important;
    display: flex !important; z-index: 9999 !important;
    background: var(--diy-nav-bg) !important;
    backdrop-filter: blur(8px) !important; -webkit-backdrop-filter: blur(8px) !important;
    border-top: 1px solid var(--diy-border) !important;
    padding: 0 !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
}
.bn a, .bottom-nav a, .v5-bottom-nav a, .bnav a, .tabbar a {
    flex: 1 !important; min-width: 0 !important;
    display: flex !important; flex-direction: column !important;
    align-items: center !important; justify-content: center !important;
    gap: 0 !important;
    color: var(--diy-text-3) !important; font-size: 10px !important; font-weight: 400 !important;
    text-decoration: none !important;
    padding: 8px 2px 0 !important; min-height: 48px !important;
    letter-spacing: normal !important;
}
.bn a i, .bottom-nav a i, .v5-bottom-nav a i, .bnav a i, .tabbar a i {
    font-size: 18px !important; margin-bottom: 3px !important; color: var(--diy-text-3) !important;
}
.bn a.active, .bottom-nav a.active, .v5-bottom-nav a.active, .bnav a.active, .tabbar a.active {
    color: var(--diy-primary) !important; font-weight: 500 !important;
}
.bn a.active i, .bottom-nav a.active i, .v5-bottom-nav a.active i, .bnav a.active i, .tabbar a.active i {
    color: var(--diy-primary) !important;
}
