/* ===========================================================
   日常百货电商 · 全局样式
   设计系统：浅色科技感 + 暖橙主色，响应式适配电脑端/移动端
   =========================================================== */
:root {
  --primary: #ff6a3d;          /* 主色：暖橙 */
  --primary-dark: #e85425;
  --primary-soft: #fff1ea;
  --accent: #2bb3a3;           /* 辅助色：青绿 */
  --text: #2b2b35;
  --text-soft: #6b6b78;
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #ececf2;
  --shadow: 0 6px 22px rgba(40, 44, 70, 0.08);
  --shadow-hover: 0 12px 30px rgba(40, 44, 70, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --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(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }

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

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  height: 64px; max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; font-weight: 800; color: var(--text); white-space: nowrap;
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #ffa06b);
  display: grid; place-items: center; font-size: 18px;
}
.nav-links { display: flex; gap: 6px; margin-left: 8px; }
.nav-links a {
  padding: 8px 14px; border-radius: 999px; color: var(--text-soft);
  font-size: 15px; transition: .2s; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary-soft); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.cart-link {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; background: var(--primary-soft);
  color: var(--primary-dark); font-weight: 600; font-size: 15px; transition: .2s;
}
.cart-link:hover { background: #ffe2d6; }
.cart-badge {
  position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--primary);
  color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 700;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: none; border-radius: 999px; font-size: 15px;
  font-weight: 600; transition: .2s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-soft); }
.user-box .uname { color: var(--text); font-weight: 600; }

/* ---------- 英雄区 ---------- */
.hero {
  background: linear-gradient(120deg, #fff1ea 0%, #e9fbf6 100%);
  border-radius: 0 0 28px 28px; padding: 42px 0 38px;
}
.hero h1 { font-size: 30px; line-height: 1.3; margin-bottom: 10px; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--text-soft); max-width: 560px; }
.hero-tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero-tags span {
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--text-soft);
}

/* ---------- 分类筛选 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 18px; }
.chip {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text-soft); font-size: 14px; transition: .2s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 商品网格 ---------- */
.section-title { font-size: 20px; margin: 6px 0 14px; display: flex; align-items: center; gap: 8px; }
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(4, 1fr);
}
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: .22s; display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card .thumb {
  height: 160px; display: grid; place-items: center; font-size: 60px;
  border-bottom: 1px solid var(--border);
}
.card .body { padding: 14px 14px 16px; display: flex; flex-direction: column; flex: 1; }
.card .cat { font-size: 12px; color: var(--accent); font-weight: 600; }
.card .name {
  font-size: 15px; font-weight: 600; margin: 4px 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 42px;
}
.card .price { color: var(--primary); font-weight: 800; font-size: 18px; margin-top: auto; }
.card .price small { font-size: 12px; font-weight: 600; }
.card .add {
  margin-top: 10px; width: 100%; padding: 9px; border: none; border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: 14px; transition: .2s;
}
.card .add:hover { background: var(--primary); color: #fff; }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 30px 0 10px; flex-wrap: wrap; }
.pager button {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 14px; transition: .2s;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager .info { color: var(--text-soft); font-size: 14px; margin: 0 8px; }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 46px; padding: 26px 0; background: #fff; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 13px; text-align: center; }

/* ---------- 通用页面容器 ---------- */
.page { padding: 30px 0 50px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.page-head h2 { font-size: 22px; }
.page-head .back { color: var(--text-soft); font-size: 14px; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.empty .big { font-size: 48px; margin-bottom: 10px; }

/* ---------- 商品详情 ---------- */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; background: #fff; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.detail .pic { height: 320px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 130px; }
.detail .meta .cat { color: var(--accent); font-weight: 700; }
.detail .meta h2 { font-size: 24px; margin: 6px 0 10px; }
.detail .meta .price { color: var(--primary); font-size: 28px; font-weight: 800; margin: 8px 0 14px; }
.detail .meta .desc { color: var(--text-soft); }
.detail .meta .row { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.qty button { width: 36px; height: 36px; border: none; background: #fff; font-size: 18px; color: var(--text); }
.qty input { width: 46px; height: 36px; border: none; text-align: center; font-size: 15px; }
.qty input:focus { outline: none; }

/* ---------- 购物车 / 结算 列表 ---------- */
.order-list { display: flex; flex-direction: column; gap: 14px; }
.order-item {
  display: grid; grid-template-columns: 70px 1fr auto auto auto; gap: 16px; align-items: center;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
}
.order-item .pic { width: 70px; height: 70px; border-radius: 10px; display: grid; place-items: center; font-size: 34px; }
.order-item .title { font-weight: 600; }
.order-item .title small { display: block; color: var(--text-soft); font-weight: 400; }
.order-item .uprice { color: var(--primary); font-weight: 700; white-space: nowrap; }
.order-item .remove { background: none; border: none; color: var(--text-soft); font-size: 13px; }
.order-item .remove:hover { color: #e23; }

.summary-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.summary-card h3 { font-size: 17px; margin-bottom: 14px; }
.line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.line.total { border-bottom: none; font-size: 18px; font-weight: 800; padding-top: 14px; }
.line.total .v { color: var(--primary); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--text-soft); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; background: #fff; transition: .2s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); }

.layout-2 { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.pay-step { text-align: center; padding: 30px 16px; }
.pay-step .icon { font-size: 56px; margin-bottom: 14px; }

/* ---------- 提示条 / 弹窗 ---------- */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%) translateY(-20px);
  background: var(--text); color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-hover); opacity: 0; pointer-events: none; transition: .3s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #e23; }
.toast.ok { background: #1faf6e; }

/* 居中模态弹窗（提交成功 / 功能提示） */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 22, 35, 0.5);
  display: none; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 18px; padding: 30px 28px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: var(--shadow-hover); animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .m-icon { font-size: 56px; margin-bottom: 12px; }
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.modal p { color: var(--text-soft); margin-bottom: 20px; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 30px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 32px 28px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.auth-card .logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), #ffa06b); display: grid; place-items: center; font-size: 26px; margin: 0 auto 14px; }
.auth-card h2 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-soft); font-size: 14px; margin-bottom: 22px; }
.auth-card .tip { background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 18px; }
.auth-card .foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-soft); }
.auth-card .foot a { color: var(--primary); font-weight: 600; }

/* ===========================================================
   响应式
   =========================================================== */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }            /* 移动端收起文字导航，保留品牌与购物车/登录 */
  .hero { padding: 30px 0 28px; }
  .hero h1 { font-size: 24px; }
  .detail { grid-template-columns: 1fr; gap: 20px; padding: 18px; }
  .detail .pic { height: 220px; font-size: 90px; }
  .layout-2 { grid-template-columns: 1fr; }
  .order-item { grid-template-columns: 56px 1fr; row-gap: 8px; }
  .order-item .pic { width: 56px; height: 56px; font-size: 26px; }
  .order-item .uprice, .order-item .qty, .order-item .remove { grid-column: 2; justify-self: start; }
  .order-item .qty { width: max-content; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card .thumb { height: 120px; font-size: 46px; }
  .container { padding: 0 14px; }
}
