/* ============================================================
   中国小程序大集 — 设计系统
   简洁 · 大气 · 移动优先 · SEO 友好
   ============================================================ */

/* ---------- 变量 ---------- */
:root {
    --brand: #e11d2a;
    --brand-dark: #b3141f;
    --brand-soft: #fdecec;
    --gold: #c8a45c;
    --ink: #16161d;
    --ink-2: #43434f;
    --muted: #71717f;
    --line: #ececf0;
    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow: 0 1px 3px rgba(20,20,30,.06);
    --shadow-hover: 0 14px 40px rgba(225,29,42,.10);
    --max: 1200px;
    --header-h: 64px;
}

/* ---------- 重置 ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-soft);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
main { flex: 1; }
.main-content { padding: 32px 0; }

/* ---------- 头部 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; font-weight: 800; font-size: 19px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(225,29,42,.30);
}
.logo-text { font-size: 20px; font-weight: 800; letter-spacing: .5px; color: var(--ink); }
.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav a { font-size: 15px; color: var(--ink-2); font-weight: 500; padding: 6px 2px; position: relative; transition: color .2s; }
.main-nav a:hover, .main-nav a.active { color: var(--brand); }
.main-nav a.active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
    background: var(--brand); border-radius: 2px;
}
.header-user { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 14px; color: var(--ink-2); }

/* 全局搜索框 */
.header-search {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-soft);
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 5px 6px 5px 14px;
    transition: border-color .2s, box-shadow .2s;
    flex: 1 1 220px; max-width: 320px;
}
.header-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(225,29,42,.12); }
.header-search input {
    border: none; outline: none; background: transparent;
    font-size: 14px; color: var(--ink); width: 100%; min-width: 0;
}
.header-search button {
    border: none; background: var(--brand); color: #fff;
    width: 32px; height: 32px; border-radius: 999px; cursor: pointer;
    font-size: 15px; display: flex; align-items: center; justify-content: center;
    flex: none; transition: background .2s;
}
.header-search button:hover { background: var(--brand-dark); }

/* 搜索结果标题区 */
.list-head { margin: 8px 0 22px; }
.list-head h2 { font-size: 22px; font-weight: 800; color: var(--ink); }
.list-head h2 .kw { color: var(--brand); }
.list-head p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.list-head .clear-search { color: var(--brand); font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
    border: 1.5px solid transparent; cursor: pointer; transition: all .22s; white-space: nowrap;
}
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 6px 16px rgba(225,29,42,.30); }
.btn-accent { background: var(--ink); color: #fff; }
.btn-accent:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--brand); }

/* ---------- Hero ---------- */
.hero {
    background: radial-gradient(120% 140% at 80% 0%, #ff5a4d 0%, var(--brand) 42%, var(--brand-dark) 100%);
    color: #fff; padding: 72px 0 84px; position: relative; overflow: hidden;
}
.hero::after {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px);
    background-size: 22px 22px; opacity: .5; pointer-events: none;
}
.hero-inner { position: relative; max-width: 760px; }
.hero h1 { font-size: 44px; line-height: 1.2; font-weight: 800; letter-spacing: .5px; }
.hero .hero-sub { font-size: 18px; opacity: .92; margin-top: 16px; }
.hero .hero-cta { margin-top: 30px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn-light { background: #fff; color: var(--brand); }
.hero .btn-light:hover { box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.hero .btn-line { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.hero .btn-line:hover { background: rgba(255,255,255,.12); }

/* ---------- 分类条 ---------- */
.section { padding: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { font-size: 22px; font-weight: 700; }
.section-head .more { font-size: 14px; color: var(--brand); }

.category-bar {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    box-shadow: var(--shadow); margin-bottom: 26px;
}
.category-bar a {
    font-size: 13px; padding: 7px 16px; border-radius: 999px; color: var(--ink-2);
    background: var(--bg-soft); transition: all .2s; white-space: nowrap; font-weight: 500;
}
.category-bar a:hover { background: var(--brand-soft); color: var(--brand); }
.category-bar a.active { background: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(225,29,42,.25); }
.sort-group { margin-left: auto; display: flex; gap: 4px; }
.sort-group a { background: transparent; font-weight: 600; }
.sort-group a.active { background: transparent; color: var(--brand); box-shadow: none; }

/* ---------- 小程序卡片网格 ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.app-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px 22px; box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s, border-color .25s;
    display: flex; flex-direction: column;
}
.app-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: rgba(225,29,42,.18); }
.app-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.app-icon {
    width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.app-title-group { flex: 1; min-width: 0; }
.app-title-group h3 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-title-group .cat-tag { font-size: 11px; color: var(--muted); background: var(--bg-soft); padding: 2px 10px; border-radius: 12px; display: inline-block; margin-top: 4px; }
.badge-recommend { font-size: 11px; color: var(--gold); background: #fbf3e3; padding: 3px 12px; border-radius: 12px; flex-shrink: 0; font-weight: 600; }
.app-card-body { flex: 1; margin-bottom: 14px; }
.app-card-body p { font-size: 14px; color: var(--ink-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-scenario { font-size: 13px; color: var(--muted); margin-top: 8px; }
.app-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }
.app-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.app-stats span { display: inline-flex; align-items: center; gap: 4px; }
.btn-view { font-size: 13px; color: var(--brand); font-weight: 600; padding: 6px 16px; border-radius: 999px; border: 1.5px solid var(--brand); transition: all .2s; }
.btn-view:hover { background: var(--brand); color: #fff; }

/* ---------- 面包屑 ---------- */
.breadcrumb { padding: 18px 0 4px; font-size: 13px; color: var(--muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 8px; color: #c9c9d2; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .current { color: var(--ink-2); }

/* ---------- 详情页 ---------- */
.detail-layout { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.detail-main { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.detail-header { display: flex; align-items: flex-start; gap: 18px; padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-icon { width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; }
.detail-title { flex: 1; }
.detail-title h1 { font-size: 26px; font-weight: 800; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.detail-meta .tag { background: var(--bg-soft); padding: 3px 12px; border-radius: 12px; }
.detail-section { margin-bottom: 26px; }
.detail-section h2 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.detail-section p { font-size: 15px; color: var(--ink-2); line-height: 1.85; }

/* ---------- 应用截屏图 ---------- */
.screenshot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.screenshot-thumb { display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; transition: border-color .2s, box-shadow .2s; }
.screenshot-thumb:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.screenshot-thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
@media (max-width: 768px) {
    .screenshot-grid { grid-template-columns: repeat(2, 1fr); }
}
.qrcode-box { text-align: center; padding: 8px 0; }
.qrcode-box img { width: 200px; height: 200px; margin: 0 auto; border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: #fff; }
.qrcode-tip { font-size: 13px; color: var(--muted); margin: 12px 0; }
.btn-scan { background: var(--brand); color: #fff; border: none; padding: 10px 28px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s; }
.btn-scan:hover { background: var(--brand-dark); }
.interaction-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.interaction-bar button { border: 1.5px solid var(--line); background: #fff; padding: 8px 20px; border-radius: 999px; font-size: 14px; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.interaction-bar button:hover { border-color: var(--brand); color: var(--brand); }
.interaction-bar button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.comment-form textarea { padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; resize: vertical; font-family: inherit; }
.comment-form textarea:focus { outline: none; border-color: var(--brand); }
.btn-comment { background: var(--brand); color: #fff; border: none; padding: 9px 22px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; align-self: flex-start; }
.comment-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment-item p { font-size: 14px; }
.comment-item .time { font-size: 12px; color: #b9b9c4; margin-top: 4px; }

/* ---------- 侧边栏 ---------- */
.detail-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: calc(var(--header-h) + 16px); }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.side-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.related-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.related-item:last-child { border-bottom: none; }
.related-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex-shrink: 0; color: var(--brand); }
.related-name { flex: 1; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-like { font-size: 12px; color: var(--muted); }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 36px; }
.pagination a { padding: 8px 15px; border-radius: 10px; color: var(--ink-2); background: #fff; border: 1px solid var(--line); font-size: 14px; transition: all .2s; }
.pagination a:hover { background: var(--bg-soft); }
.pagination a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 60px; margin-bottom: 14px; }
.empty-state p { font-size: 16px; }
.empty-state a { color: var(--brand); font-weight: 600; }

/* ---------- 表单（开发者/后台） ---------- */
.form-wrap { max-width: 480px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow); }
.form-wrap h2 { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--brand); }
.alert { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--brand-soft); color: var(--brand-dark); }
.alert-success { background: #eafaf0; color: #1a9d4b; }
.field-tip { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 后台表格 ---------- */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { padding: 13px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
.admin-table th { background: var(--bg-soft); font-weight: 700; color: var(--ink-2); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fcfcfd; }
.status-pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.status-0 { background: #fff4e0; color: #b9770a; }
.status-1 { background: #eafaf0; color: #1a9d4b; }
.status-3 { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- 页脚 ---------- */
.site-footer { background: #14141b; color: #c9c9d2; margin-top: 40px; }
.footer-top { display: grid; grid-template-columns: 1.4fr 2fr; gap: 40px; padding: 48px 0 32px; }
.footer-logo { display: flex; align-items: center; gap: 10px; }
.footer-logo .logo-text { color: #fff; }
.footer-slogan { font-size: 14px; margin-top: 12px; max-width: 280px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-col h4 { font-size: 14px; color: #fff; margin-bottom: 14px; font-weight: 700; }
.footer-col a { display: block; font-size: 14px; color: #b6b6c0; padding: 5px 0; transition: color .2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #26262f; padding: 18px 0; font-size: 13px; color: #8a8a96; display: flex; flex-direction: column; gap: 4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-side { position: static; }
    .footer-top { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
    .main-nav { order: 3; width: 100%; gap: 16px; justify-content: flex-start; overflow-x: auto; }
    .header-search { order: 2; width: 100%; max-width: none; flex: 1 1 100%; }
    .hero { padding: 48px 0 56px; }
    .hero h1 { font-size: 32px; }
    .hero .hero-sub { font-size: 16px; }
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
}
@media (max-width: 480px) {
    .hero h1 { font-size: 27px; }
    .app-grid { grid-template-columns: 1fr; }
    .form-wrap { padding: 24px 18px; }
    .detail-main { padding: 22px 18px; }
}
