:root {
  --primary: #d4625a;
  --primary-dark: #b84d46;
  --primary-light: #fdf0ef;
  --gold: #c9a227;
  --charity: #4a9d6e;
  --ink-900: #1a1a1a;
  --ink-700: #3d3d3d;
  --ink-500: #888;
  --ink-300: #d9d9d9;
  --line: #eee;
  --bg: #faf8f6;
  --white: #fff;
  --green: #4a9d6e;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px -10px rgba(212, 98, 90, 0.25);
  --shadow-lg: 0 18px 50px -16px rgba(0, 0, 0, 0.18);
  --maxw: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ----------------------------- 顶部公益条 ----------------------------- */
.promo-bar {
  background: linear-gradient(90deg, var(--charity), #3b8a61);
  color: #fff; text-align: center; font-size: 13px;
  padding: 8px 0; letter-spacing: .3px;
}

/* ------------------------------ 站点头 ------------------------------- */
.site-header { background: var(--white); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 30; }
.header-main {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 22px;
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 22px; font-weight: 800; color: var(--primary); white-space: nowrap; }
.logo svg { width: 30px; height: 30px; }
.search { flex: 1; display: flex; border: 2px solid var(--primary); border-radius: 999px; overflow: hidden; max-width: 560px; }
.search input { flex: 1; border: 0; outline: 0; padding: 11px 18px; font-size: 14px; background: transparent; }
.search button { border: 0; background: var(--primary); color: #fff; padding: 0 26px; font-size: 14px; font-weight: 600; cursor: pointer; }
.search button:hover { background: var(--primary-dark); }
.nav { display: flex; align-items: center; gap: 22px; font-size: 15px; font-weight: 600; }
.nav a:hover { color: var(--primary); }
.cart-link { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.cart-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; line-height: 1;
}
.cart-badge.zero { display: none; }

/* ------------------------------ 通用按钮 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; cursor: pointer; font-size: 14px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px; transition: all .18s; white-space: nowrap;
}
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-md); }
.btn--primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn--ghost { background: var(--primary-light); color: var(--primary); }
.btn--ghost:hover { background: #f5dedc; }
.btn--outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn--outline:hover { background: var(--primary-light); }
.btn--danger { background: var(--primary); color: #fff; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ------------------------------ 分类导航 ------------------------------ */
.cat-nav { background: var(--white); border-top: 1px solid var(--line); }
.cat-nav__inner { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.cat-nav a { padding: 13px 16px; font-size: 14px; color: var(--ink-700); white-space: nowrap; border-bottom: 2px solid transparent; }
.cat-nav a:hover, .cat-nav a.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ------------------------------ 首页 Hero ----------------------------- */
.hero {
  margin-top: 18px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(120deg, #e8b4a0, #d4625a 45%, #b84d46);
  color: #fff; position: relative; min-height: 320px;
  display: grid; grid-template-columns: 1.2fr 1fr; align-items: center;
}
.hero__text { padding: 46px 50px; }
.hero__text .tag { display: inline-block; background: rgba(255,255,255,.2); padding: 5px 14px; border-radius: 999px; font-size: 13px; margin-bottom: 16px; }
.hero__text h1 { font-size: 40px; line-height: 1.2; font-weight: 800; }
.hero__text p { margin: 16px 0 26px; font-size: 16px; opacity: .92; }
.hero__img { align-self: stretch; background: url("/static/images/hero.jpg") center/cover; min-height: 320px; }
.hero__img::after { content: ""; }

/* ------------------------------ 区块标题 ------------------------------ */
.section { margin-top: 40px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section__head h2 { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.section__head h2::before { content: ""; width: 5px; height: 20px; background: var(--primary); border-radius: 3px; }
.section__head a { font-size: 13px; color: var(--ink-500); }
.section__head a:hover { color: var(--primary); }

/* ------------------------------ 分类宫格 ------------------------------ */
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cat-card {
  background: var(--white); border-radius: var(--radius); padding: 18px 8px; text-align: center;
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s; cursor: pointer;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.cat-card .ico { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 14px; background: var(--primary-light); display: grid; place-items: center; font-size: 22px; }
.cat-card span { font-size: 13px; color: var(--ink-700); font-weight: 600; }

/* ------------------------------ 商品卡片 ------------------------------ */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.product-card {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s; cursor: pointer; position: relative;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.product-card__img { aspect-ratio: 1/1; overflow: hidden; background: #f5f0ee; }
.product-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .product-card__img img { transform: scale(1.06); }
.product-card__body { padding: 13px 14px 16px; }
.product-card__name {
  font-size: 14px; color: var(--ink-900); line-height: 1.45; height: 40px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.product-card__tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0; }
.tag-pill { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--primary-light); color: var(--primary); font-weight: 600; }
.product-card__price { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.price-now { color: var(--primary); font-weight: 800; font-size: 19px; }
.price-now small { font-size: 12px; font-weight: 700; }
.price-old { color: var(--ink-500); font-size: 12px; text-decoration: line-through; }
.product-card__meta { font-size: 12px; color: var(--ink-500); margin-top: 7px; display: flex; justify-content: space-between; }

/* ------------------------------ 页脚 --------------------------------- */
.site-footer { margin-top: 56px; background: #2a2522; color: #bbb; }
.footer-cols { max-width: var(--maxw, var(--maxw)); margin: 0 auto; padding: 40px 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.footer-cols h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-cols a { display: block; font-size: 13px; padding: 4px 0; color: #bbb; }
.footer-cols a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid #3a3532; text-align: center; padding: 18px; font-size: 12px; color: #888; }

/* --------------------------- 商品列表页 ------------------------------ */
.shop-layout { display: grid; grid-template-columns: 200px 1fr; gap: 22px; margin-top: 22px; }
.filter-side { background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); align-self: start; position: sticky; top: 130px; }
.filter-side h3 { font-size: 14px; margin-bottom: 12px; }
.filter-side .f-group { margin-bottom: 18px; }
.filter-side .f-title { font-size: 12px; color: var(--ink-500); margin-bottom: 8px; }
.filter-list { display: flex; flex-direction: column; gap: 4px; }
.filter-list a { font-size: 13px; padding: 7px 10px; border-radius: 8px; color: var(--ink-700); }
.filter-list a:hover, .filter-list a.is-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.shop-main { min-width: 0; }
.shop-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--white); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px; flex-wrap: wrap; }
.shop-bar .count { font-size: 13px; color: var(--ink-500); }
.sort-btns { display: flex; gap: 6px; }
.sort-btns button { border: 0; background: transparent; font-size: 13px; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-700); }
.sort-btns button.is-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.shop-bar .search-inline { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.shop-bar .search-inline input { border: 0; outline: 0; padding: 8px 12px; font-size: 13px; width: 180px; }
.shop-bar .search-inline button { border: 0; background: var(--primary); color: #fff; padding: 0 14px; cursor: pointer; font-size: 13px; }

/* --------------------------- 商品详情页 ------------------------------ */
.breadcrumb { font-size: 13px; color: var(--ink-500); padding: 18px 0 4px; }
.breadcrumb a:hover { color: var(--primary); }
.detail { display: grid; grid-template-columns: 460px 1fr; gap: 36px; margin-top: 14px; background: var(--white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }
.gallery__main { aspect-ratio: 1/1; border-radius: 12px; overflow: hidden; background: #f5f0ee; }
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery__thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 9px; border: 2px solid transparent; cursor: pointer; background: #f5f0ee; }
.gallery__thumbs img.is-active { border-color: var(--primary); }
.detail__info h1 { font-size: 24px; font-weight: 800; line-height: 1.35; }
.detail__rating { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 13px; color: var(--ink-500); }
.stars { color: var(--gold); letter-spacing: 1px; }
.detail__price { background: linear-gradient(90deg, #fef5f3, #fff8f5); border-radius: 12px; padding: 18px 20px; margin: 16px 0; }
.detail__price .now { color: var(--primary); font-size: 32px; font-weight: 800; }
.detail__price .now small { font-size: 16px; }
.detail__price .old { color: var(--ink-500); text-decoration: line-through; margin-left: 12px; font-size: 14px; }
.detail__attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 16px 0; font-size: 14px; color: var(--ink-700); }
.detail__attrs div { display: flex; gap: 8px; }
.detail__attrs span { color: var(--ink-500); min-width: 56px; }
.detail__actions { display: flex; gap: 12px; margin-top: 22px; align-items: center; }
.qty { display: flex; align-items: center; border: 1px solid var(--ink-300); border-radius: 999px; overflow: hidden; }
.qty button { width: 38px; height: 40px; border: 0; background: #fafafa; font-size: 18px; cursor: pointer; color: var(--ink-700); }
.qty input { width: 46px; text-align: center; border: 0; outline: 0; font-size: 15px; }
.tabs { margin-top: 22px; }
.tabs__head { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs__head button { border: 0; background: transparent; padding: 14px 18px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink-500); border-bottom: 2px solid transparent; }
.tabs__head button.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs__body { padding: 22px 4px; font-size: 14px; color: var(--ink-700); line-height: 1.8; }
.related { margin: 40px 0 20px; }

/* ------------------------------ 购物车 -------------------------------- */
.cart-table { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.cart-row { display: grid; grid-template-columns: 90px 1fr 120px 130px 130px 40px; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.cart-row.head { background: #fafafa; font-size: 13px; color: var(--ink-500); font-weight: 600; }
.cart-row .ci-img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #f5f0ee; }
.cart-row .ci-name { font-size: 14px; font-weight: 600; }
.cart-row .ci-sub { font-size: 12px; color: var(--ink-500); margin-top: 4px; }
.cart-row .ci-price { color: var(--primary); font-weight: 700; }
.cart-row .ci-sum { font-weight: 800; }
.cart-row .ci-del { border: 0; background: transparent; color: var(--ink-500); cursor: pointer; font-size: 18px; }
.cart-row .ci-del:hover { color: var(--primary); }
.cart-summary { margin-top: 22px; background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.cart-summary .total { font-size: 15px; color: var(--ink-700); }
.cart-summary .total b { color: var(--primary); font-size: 28px; margin-left: 6px; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--ink-500); }
.empty-state .em { font-size: 54px; }
.empty-state p { margin: 14px 0 20px; }

/* ------------------------------ 管理后台 ------------------------------ */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin__side { background: #2a2522; color: #c5cad6; padding: 22px 16px; }
.admin__brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-size: 17px; margin-bottom: 26px; padding: 0 6px; }
.admin__nav a { display: block; padding: 11px 14px; border-radius: 9px; color: #c5cad6; font-size: 14px; margin-bottom: 4px; }
.admin__nav a:hover, .admin__nav a.is-active { background: var(--primary); color: #fff; }
.admin__main { padding: 26px 32px; background: var(--bg); overflow: auto; }
.admin__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.admin__top h1 { font-size: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.astat { background: var(--white); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.astat .n { font-size: 26px; font-weight: 800; color: var(--primary); }
.astat .l { font-size: 13px; color: var(--ink-500); margin-top: 6px; }
.admin-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 12px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .4px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.admin-table tr:hover { background: #fafaf6; }
.admin-table .t-img { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #f5f0ee; }
.admin-table .t-name { font-weight: 600; }
.admin-table .t-price { color: var(--primary); font-weight: 700; }

/* ------------------------------ 弹窗 ---------------------------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal__panel { position: relative; width: 100%; max-width: 560px; background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 24px 26px; max-height: 90vh; overflow: auto; animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal__head h3 { font-size: 18px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: var(--ink-500); width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { background: #f0f0f0; color: var(--ink-900); }
.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form__row { margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 13px; color: var(--ink-700); font-weight: 600; }
.field span i { color: var(--primary); font-style: normal; }
.field input, .field select, .field textarea { border: 1px solid var(--ink-300); border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none; color: var(--ink-900); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.field textarea { resize: vertical; }
.form__err { background: #fce8e4; color: var(--primary-dark); font-size: 13px; padding: 10px 12px; border-radius: 8px; }

/* ------------------------------ 提示 ---------------------------------- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--ink-900); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 80; animation: pop .2s ease; }
.toast--ok { background: var(--green); }
.toast--err { background: var(--primary-dark); }

/* ------------------------------ 响应式 -------------------------------- */
@media (max-width: 1000px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .hero__img { min-height: 200px; }
  .detail { grid-template-columns: 1fr; }
  .shop-layout { grid-template-columns: 1fr; }
  .filter-side { position: static; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .header-main { flex-wrap: wrap; }
  .search { order: 3; max-width: 100%; flex-basis: 100%; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .nav { gap: 14px; font-size: 14px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .cart-row { grid-template-columns: 70px 1fr; }
  .cart-row .ci-price, .cart-row .ci-qty, .cart-row .ci-sum { display: none; }
  .form__grid { grid-template-columns: 1fr; }
}
