/* ==========================================================================
   星选商城 StarPick — 独立站样式（PC / 平板 / H5 全端适配）
   ========================================================================== */
:root {
    /* 品牌主色（独立配色，非电商橙） */
    --brand: #2b5bff;
    --brand-2: #6b8cff;
    --brand-dark: #1a41c9;
    --brand-light: #eef3ff;
    --price: #e02020;
    --price-light: #fff0f0;
    --gold: #f0a020;
    --text: #1f2329;
    --text-2: #5c626b;
    --text-3: #9aa0a8;
    --border: #ebedf0;
    --bg: #f6f7fb;
    --white: #fff;
    --green: #00b578;
    --blue: #2b5bff;
    --radius: 10px;
    --font: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans CN", "Noto Sans SC",
            "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font);
    background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; border: 0; }
ul { margin: 0; padding: 0; list-style: none; }
input, button, textarea, select { font-family: inherit; }

.container { width: 1200px; margin: 0 auto; }
.container::after { content: ''; display: block; clear: both; }

/* ============ 顶栏 ============ */
.topbar { background: linear-gradient(100deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; }
.topbar .container { display: flex; align-items: center; height: 62px; gap: 22px; }
.logo {
    font-size: 23px; font-weight: 800; letter-spacing: 1px; white-space: nowrap;
    display: flex; align-items: baseline; gap: 7px;
}
.logo span { font-size: 12px; font-weight: 500; opacity: .85; letter-spacing: 2px; }
.search-box { flex: 1; display: flex; height: 38px; background: #fff; border-radius: 19px; overflow: hidden; max-width: 560px; }
.search-box input { flex: 1; border: 0; outline: 0; padding: 0 16px; font-size: 14px; color: var(--text); background: transparent; }
.search-box button {
    width: 92px; border: 0; background: var(--brand-dark); color: #fff;
    font-size: 15px; cursor: pointer; font-weight: 600; letter-spacing: 1px;
}
.search-box button:hover { background: #1636a8; }
.top-nav { display: flex; gap: 16px; font-size: 14px; white-space: nowrap; }
.top-nav a:hover { text-decoration: underline; }
.user-area { display: flex; gap: 12px; align-items: center; font-size: 13px; }

.nav-bar { background: #fff; border-bottom: 1px solid var(--border); }
.nav-bar .container { display: flex; gap: 24px; height: 44px; align-items: center; font-size: 14px; overflow-x: auto; }
.nav-bar a { white-space: nowrap; }
.nav-bar a:hover { color: var(--brand); }
.nav-bar a.active { color: var(--brand); font-weight: 600; }

/* ============ 通用 ============ */
.card { background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(20, 30, 60, .05); }
.card-title { font-size: 17px; font-weight: 700; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; }
.card-title small { font-size: 13px; font-weight: 400; color: var(--text-3); }
.row { display: flex; gap: 16px; }
.flex1 { flex: 1; }
.mt10 { margin-top: 10px; } .mt20 { margin-top: 20px; }
.text-brand { color: var(--brand); }
.text-orange { color: var(--brand); }
.text-gray { color: var(--text-3); }
.text-red { color: var(--price); }
.text-green { color: var(--green); }
.right { text-align: right; }
.center { text-align: center; }
.hide { display: none !important; }

.btn {
    display: inline-block; padding: 8px 20px; border: 1px solid var(--border); background: #fff;
    border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text); transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: linear-gradient(100deg, var(--brand), var(--brand-2)); color: #fff; border: 0; font-weight: 600; }
.btn-primary:hover { opacity: .92; color: #fff; }
.btn-lg { padding: 12px 34px; font-size: 16px; border-radius: 8px; }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-danger { background: var(--price); color: #fff; border: 0; }
.btn-danger:hover { color: #fff; opacity: .9; }
.btn-block { display: block; width: 100%; text-align: center; }

.price { color: var(--price); font-weight: 700; font-size: 18px; font-family: var(--font); }
.price::before { content: '¥'; font-size: 13px; margin-right: 1px; font-weight: 600; }
.price-old { color: var(--text-3); text-decoration: line-through; font-size: 13px; margin-left: 6px; }

.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; background: var(--brand-light); color: var(--brand); }
.tag-green { background: #e6fff4; color: var(--green); }
.tag-blue { background: var(--brand-light); color: var(--brand); }
.tag-red { background: var(--price-light); color: var(--price); }
.tag-gray { background: #f2f3f5; color: var(--text-3); }
.tag-gold { background: #fff6e5; color: #b37607; }

/* ============ 商品网格 ============ */
.goods-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.goods-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.goods-item { background: #fff; border-radius: var(--radius); overflow: hidden; transition: .2s; cursor: pointer; box-shadow: 0 1px 3px rgba(20, 30, 60, .05); }
.goods-item:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(20, 30, 60, .12); }
.goods-item .img { width: 100%; height: 190px; object-fit: contain; background: #fff; padding: 4px; }
.goods-item .info { padding: 8px 12px 14px; }
.goods-item .title { font-size: 13px; height: 38px; overflow: hidden; color: var(--text); line-height: 1.35; }
.goods-item .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.goods-item .sales { color: var(--text-3); font-size: 12px; }

/* ============ 首页 ============ */
.home-hero { display: flex; gap: 16px; margin: 16px 0; }
.home-slider { flex: 1; height: 320px; border-radius: var(--radius); overflow: hidden; position: relative; background: #fff; }
.home-slider img { width: 100%; height: 100%; object-fit: cover; }
.home-slider .caption { position: absolute; left: 22px; bottom: 22px; color: #fff; font-size: 21px; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.home-side { width: 280px; }
.quick-entry { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-entry a { background: var(--brand-light); border-radius: 8px; padding: 13px 0; text-align: center; font-size: 13px; color: var(--brand-dark); font-weight: 500; }
.quick-entry a:hover { background: var(--brand); color: #fff; }

.seckill-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.seckill-item { background: #fff; border-radius: 8px; padding: 10px; text-align: center; }

/* ============ 列表页筛选 ============ */
.filter-bar { background: #fff; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-bar a { padding: 4px 12px; border-radius: 14px; }
.filter-bar a.active { background: var(--brand); color: #fff; }

/* ============ 详情 ============ */
.detail-box { background: #fff; border-radius: var(--radius); padding: 20px; display: flex; gap: 24px; }
.detail-gallery { width: 420px; flex-shrink: 0; }
.detail-gallery .big { width: 100%; height: 420px; object-fit: contain; border-radius: 8px; background: #fafbfd; }
.detail-gallery .thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.detail-gallery .thumbs img { width: 62px; height: 62px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: #fff; }
.detail-gallery .thumbs img.active { border-color: var(--brand); }
.detail-info { flex: 1; min-width: 0; }
.detail-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.detail-sub { color: var(--text-2); margin-bottom: 14px; }
.price-panel { background: linear-gradient(100deg, var(--brand-light), #fff); padding: 14px 16px; border-radius: 8px; }
.spec-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.spec-list span { padding: 5px 14px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.spec-list span.active { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.qty-box { display: flex; align-items: center; }
.qty-box button { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.qty-box input { width: 56px; height: 32px; text-align: center; border: 1px solid var(--border); border-left: 0; border-right: 0; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tb { width: 100%; border-collapse: collapse; background: #fff; min-width: 640px; }
table.tb th, table.tb td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; white-space: nowrap; }
table.tb th { background: #fafbfd; font-weight: 600; color: var(--text-2); }
table.tb tr:hover td { background: #fafbff; }

/* ============ 表单 ============ */
.form-item { display: flex; align-items: center; margin-bottom: 12px; }
.form-item label { width: 92px; color: var(--text-2); text-align: right; padding-right: 10px; flex-shrink: 0; }
.form-item input, .form-item select, .form-item textarea {
    flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; min-width: 0;
}
.form-item input:focus, .form-item textarea:focus, .form-item select:focus { outline: 0; border-color: var(--brand); }

/* ============ 后台 ============ */
.admin-wrap { display: flex; gap: 16px; margin: 16px auto; align-items: flex-start; }
.admin-side { width: 190px; background: #fff; border-radius: var(--radius); padding: 10px; flex-shrink: 0; position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow-y: auto; }
.admin-side .group-title { font-size: 12px; color: var(--text-3); padding: 10px 12px 6px; }
.admin-side a { display: block; padding: 9px 12px; border-radius: 6px; font-size: 14px; }
.admin-side a:hover { background: #fafbff; color: var(--brand); }
.admin-side a.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.admin-main { flex: 1; min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(20,30,60,.05); }
.stat-card .v { font-size: 24px; font-weight: 700; }
.stat-card .k { color: var(--text-3); font-size: 13px; }

/* ============ 其它 ============ */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 16px; background: #fff; border-radius: 20px; font-size: 14px; }
.tabs a.active { background: var(--brand); color: #fff; }

.empty { padding: 50px 0; text-align: center; color: var(--text-3); }
.pager { display: flex; gap: 8px; justify-content: center; padding: 20px 0; flex-wrap: wrap; }
.pager a { padding: 5px 12px; background: #fff; border-radius: 6px; }
.pager a.active { background: var(--brand); color: #fff; }

.toast {
    position: fixed; left: 50%; top: 80px; transform: translateX(-50%); background: rgba(20, 24, 32, .88);
    color: #fff; padding: 10px 22px; border-radius: 22px; z-index: 9999; font-size: 14px; max-width: 80%;
}
.card-key {
    font-family: Consolas, Monaco, monospace; background: #f7f8fa; padding: 6px 10px;
    border-radius: 6px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; word-break: break-all;
}
.footer { background: #fff; border-top: 1px solid var(--border); margin-top: 30px; padding: 24px 0; color: var(--text-3); font-size: 13px; }
.footer .container { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.wallet-card {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff; border-radius: var(--radius); padding: 16px;
}

/* ============ H5 底部导航（默认隐藏，移动端显示） ============ */
.tabbar { display: none; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1264px) {
    .container { width: 100%; padding: 0 14px; }
    .goods-grid { grid-template-columns: repeat(4, 1fr); }
    .seckill-list { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
    .goods-grid { grid-template-columns: repeat(3, 1fr); }
    .home-side { width: 240px; }
    .home-slider { height: 260px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-gallery { width: 320px; }
    .detail-gallery .big { height: 320px; }
}

@media (max-width: 820px) {
    .topbar .container { height: 54px; gap: 12px; }
    .logo { font-size: 19px; }
    .logo span { display: none; }
    .top-nav { display: none; }
    .search-box button { width: 66px; font-size: 14px; }
    .goods-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .goods-item .img { height: 150px; }
    .seckill-list { grid-template-columns: repeat(3, 1fr); }
    .home-hero { flex-direction: column; }
    .home-side { width: 100%; }
    .home-slider { height: 180px; }
    .quick-entry { grid-template-columns: repeat(3, 1fr); }
    .detail-box { flex-direction: column; padding: 14px; gap: 14px; }
    .detail-gallery { width: 100%; }
    .detail-gallery .big { height: 300px; }
    .admin-wrap { flex-direction: column; }
    .admin-side {
        width: 100%; position: static; max-height: none; display: flex; gap: 6px;
        overflow-x: auto; padding: 8px; -webkit-overflow-scrolling: touch;
    }
    .admin-side .group-title { display: none; }
    .admin-side a { white-space: nowrap; padding: 7px 12px; font-size: 13px; background: #f6f7fb; }
    .row { flex-direction: column; }
    .form-item label { width: 76px; }
    .card { padding: 12px; }
}

@media (max-width: 640px) {
    body { padding-bottom: 56px; font-size: 14px; }
    .container { padding: 0 10px; }
    .topbar .container { height: auto; padding: 8px 0; flex-wrap: wrap; gap: 8px; }
    .logo { font-size: 18px; order: 1; }
    .user-area { order: 2; margin-left: auto; font-size: 12px; gap: 8px; }
    .search-box { order: 3; flex-basis: 100%; max-width: 100%; height: 36px; }
    .nav-bar .container { height: 40px; gap: 16px; font-size: 13px; }
    .goods-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .goods-item .img { height: 138px; }
    .goods-item .title { font-size: 12px; height: 34px; }
    .goods-item .info { padding: 6px 8px 10px; }
    .price { font-size: 16px; }
    .seckill-list { grid-template-columns: repeat(2, 1fr); }
    .card { padding: 10px; margin-bottom: 10px; }
    .card-title { font-size: 15px; margin-bottom: 10px; }
    .detail-gallery .big { height: 260px; }
    .detail-title { font-size: 17px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .btn-lg { padding: 10px 22px; font-size: 15px; }
    .btn { padding: 7px 14px; }
    .footer { padding: 16px 0; }
    .footer .container { flex-direction: column; text-align: center; gap: 4px; }
    .filter-bar { padding: 10px; gap: 8px; font-size: 13px; }

    /* H5 底部导航 */
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
        background: #fff; border-top: 1px solid var(--border);
        padding: 5px 0 calc(5px + env(safe-area-inset-bottom));
        box-shadow: 0 -2px 10px rgba(20, 30, 60, .06);
    }
    .tabbar a {
        flex: 1; text-align: center; font-size: 11px; color: var(--text-3);
        display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 0;
    }
    .tabbar a .ico { font-size: 19px; line-height: 1; }
    .tabbar a.active { color: var(--brand); font-weight: 600; }
    table.tb th, table.tb td { padding: 8px 10px; font-size: 12px; }
}
