:root {
  --primary: #4f6ef7;
  --primary-dark: #3a55d9;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --text-sub: #7a8194;
  --border: #e6e8f0;
  --danger: #ef4444;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

/* ===== 登录门（仿 WordPress 风格） ===== */
.login-gate {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: #f0f0f1; padding: 14vh 20px 20px;
}
.login-logo { margin-bottom: 22px; }
.login-logo img { width: 84px; height: 84px; display: block; }
.login-card {
  background: #fff; border: 1px solid #c3c4c7; border-radius: 2px;
  padding: 26px 24px 30px; width: 320px; max-width: 100%; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.login-card h1 { display: none; }
.login-label { display: block; font-size: 14px; color: #1d2327; font-weight: 600; margin-bottom: 6px; }
.login-pw-wrap { position: relative; margin-bottom: 14px; }
.login-card input[type="password"] {
  width: 100%; padding: 10px 42px 10px 12px; border: 1px solid #8c8f94; border-radius: 3px;
  font-size: 15px; outline: none; background: #fff; color: #1d2327;
}
.login-card input[type="password"]:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 4px; cursor: pointer; color: #8c8f94; line-height: 0;
}
.pw-toggle:hover { color: #2271b1; }
.pw-toggle .eye-off { display: none; }
.pw-toggle.show .eye-on { display: none; }
.pw-toggle.show .eye-off { display: inline; }
.login-remember { display: flex; align-items: center; gap: 7px; margin-bottom: 18px; font-size: 13px; color: #50575e; cursor: pointer; }
.login-actions { display: flex; justify-content: flex-end; }
.login-card .btn-login {
  background: #2271b1; color: #fff; border: 1px solid #2271b1; border-radius: 3px;
  padding: 10px 18px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.login-card .btn-login:hover { background: #135e96; border-color: #135e96; }
.login-card .btn-login:disabled { opacity: .6; cursor: not-allowed; }
.login-error { color: #d63638; font-size: 13px; margin-top: 14px; }

/* ===== 通用按钮 ===== */
.btn {
  border: none; border-radius: 10px; padding: 12px 20px; font-size: 15px; cursor: pointer;
  transition: all .15s; font-weight: 600;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-icon { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--text-sub); padding: 6px; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between; padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; font-size: 19px; font-weight: 700; }
.topbar-logo { width: 40px; height: 40px; margin-right: 10px; padding: 5px; box-sizing: border-box; background: #fff; border: 2px solid var(--primary); border-radius: 50%; }
.btn-cart { background: #fff; border: 1.5px solid var(--primary); color: var(--primary); position: relative; }
.badge {
  background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px;
  padding: 1px 7px; margin-left: 4px; font-weight: 700;
}

/* ===== 分类标签 ===== */
.category-tabs {
  display: flex; gap: 10px; padding: 16px 24px 4px; overflow-x: auto; scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 9px 20px; border-radius: 999px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text-sub); font-size: 14px; cursor: pointer; font-weight: 600;
  transition: all .15s;
}
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== 商品网格 ===== */
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px; padding: 18px 24px 90px; max-width: 1200px; margin: 0 auto;
}
.product-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 10px rgba(30,40,80,.06); transition: transform .18s, box-shadow .18s;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(30,40,80,.12); }
.product-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #eef0f5; }
.product-info { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.product-name { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.product-desc {
  font-size: 12.5px; color: var(--text-sub); line-height: 1.5; margin-bottom: 12px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.price-sale { color: var(--danger); font-size: 20px; font-weight: 800; }
.price-sale::before { content: "¥"; font-size: 13px; }
.price-original { color: var(--text-sub); font-size: 13px; text-decoration: line-through; }
.add-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 9px;
  padding: 9px 0; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .15s;
}
.add-btn:hover { background: var(--primary-dark); }
.add-btn.added { background: #22c55e; color: #fff; }
.add-btn.added:disabled { opacity: 1; cursor: not-allowed; }

/* ===== 购物车侧栏 ===== */
.cart-overlay { position: fixed; inset: 0; background: rgba(15,20,40,.45); z-index: 20; }
.cart-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw; z-index: 21;
  background: #fff; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,.15);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.cart-header {
  display: flex; justify-content: space-between; align-items: center; padding: 18px 20px;
  font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--border);
}
.cart-items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-empty { text-align: center; color: var(--text-sub); padding: 60px 0; font-size: 14px; }
.cart-item {
  display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--border); align-items: center;
}
.cart-item img { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.cart-item-mid { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { color: var(--danger); font-size: 14px; font-weight: 700; margin-top: 3px; }
.qty-controls { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--border);
  background: #fff; font-size: 15px; cursor: pointer; line-height: 1; color: var(--text); font-weight: 700;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-num { font-size: 14px; font-weight: 700; min-width: 18px; text-align: center; }
.cart-footer { padding: 16px 20px 22px; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 14px; }
.cart-total { color: var(--danger); font-size: 22px; font-weight: 800; }
.cart-total::before { content: "¥"; font-size: 14px; }

/* ===== 弹窗 / 提示 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,20,40,.5); z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 20px; padding: 36px 32px; width: 360px; max-width: 100%;
  text-align: center; animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-icon { font-size: 48px; }
.modal-card h2 { margin: 10px 0 16px; }
.order-no-label { font-size: 12px; color: var(--text-sub); }
.order-no { font-size: 18px; font-weight: 800; letter-spacing: 1px; color: var(--primary); margin: 4px 0 12px; user-select: all; }
.order-summary { font-size: 14px; color: var(--text-sub); margin-bottom: 22px; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 40;
  background: rgba(20,24,40,.88); color: #fff; font-size: 14px; padding: 11px 22px;
  border-radius: 999px; animation: pop .18s ease; max-width: 86vw;
}

/* ===== Hero 横幅 ===== */
.hero { background: linear-gradient(135deg, #4f6ef7 0%, #6d86ff 55%, #8aa0ff 100%); color: #fff; padding: 56px 24px; text-align: center; }
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero-title { font-size: 34px; font-weight: 800; letter-spacing: 1px; margin-bottom: 10px; }
.hero-sub { font-size: 15px; opacity: .92; margin-bottom: 22px; }
.hero-btn { background: #fff; color: #4f6ef7; border: none; border-radius: 999px; padding: 12px 30px; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.15); transition: transform .15s; }
.hero-btn:hover { transform: translateY(-2px); }

/* ===== 页脚 ===== */
.site-footer { text-align: center; color: var(--text-sub); font-size: 13px; padding: 30px 16px 44px; border-top: 1px solid var(--border); background: #fff; }

@media (max-width: 640px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 14px 14px 90px; }
  .category-tabs, .topbar { padding-left: 14px; padding-right: 14px; }
  .price-sale { font-size: 17px; }
  .hero { padding: 40px 18px; }
  .hero-title { font-size: 26px; }
}
