/* ================= 設計系統 ================= */
:root {
  --blue: #2a57e8;
  --blue-dark: #1e46c8;
  --blue-soft: #e9edfb;
  --orange: #ff7a00;
  --orange-2: #ff9e00;
  --red: #f43f3f;
  --green: #34a853;
  --star: #ffa000;
  --dark: #242424;
  --gray: #8a8f99;
  --line: #ececf2;
  --bg: #f6f7fb;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(30, 40, 70, .07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  background: var(--bg);
  color: var(--dark);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }

.container { max-width: 1320px; margin: 0 auto; padding: 0 20px; }

/* ================= 頂部主列 ================= */
.topbar { background: #fff; position: relative; z-index: 30; }
.topbar .container { display: flex; align-items: center; gap: 22px; height: 78px; }

.menu-btn {
  position: fixed; left: 14px; top: 12px; z-index: 120;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--blue); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(42, 87, 232, .4);
}
.menu-btn svg { width: 22px; height: 22px; }

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo img { width: 46px; height: 46px; }
.logo-text { font-size: 24px; font-weight: 900; letter-spacing: 2px; line-height: 1.1; }
.logo-text small { display: block; font-size: 11px; font-weight: 700; color: var(--red); letter-spacing: 3px; }

.search { flex: 1; max-width: 720px; display: flex; align-items: center; background: #f2f3f8; border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 22px; }
.search input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; }
.search button {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.search button svg { width: 19px; height: 19px; }

.topnav { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.iconbtn {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); color: var(--dark);
}
.iconbtn:hover { border-color: var(--blue); color: var(--blue); }
.iconbtn svg { width: 21px; height: 21px; }
.iconbtn .badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--blue); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.iconbtn.wish-count .badge { background: var(--red); }
.iconbtn.cart-btn { background: var(--blue); border-color: var(--blue); color: #fff; }
.iconbtn.cart-btn .badge { background: #fff; color: var(--blue); top: -6px; left: -6px; right: auto; }
.cart-total { font-weight: 800; color: var(--blue); white-space: nowrap; }
.linkbtn { font-weight: 700; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.linkbtn:hover { color: var(--blue); }

/* ================= 分類導航 ================= */
.catnav { background: var(--blue-soft); position: sticky; top: 0; z-index: 40; }
.catnav .container { display: flex; align-items: center; gap: 6px; height: 58px; overflow-x: auto; scrollbar-width: none; }
.catnav .container::-webkit-scrollbar { display: none; }
.catnav a { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 8px; font-weight: 700; font-size: 14.5px; white-space: nowrap; color: #2b2f3a; }
.catnav a:hover { background: rgba(255, 255, 255, .65); color: var(--blue); }
.catnav a.active { background: #fff; color: var(--blue); }
.catnav a img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.catnav .spacer { flex: 1; }
.catswitch { position: relative; }
.catswitch > a::after { content: '▾'; font-size: 11px; margin-left: 2px; }
.catswitch .dropdown {
  display: none; position: absolute; top: calc(100% + 10px); left: 0; min-width: 200px;
  background: #fff; border-radius: 12px; box-shadow: 0 10px 34px rgba(20, 30, 60, .16); padding: 8px; z-index: 60;
}
.catswitch.open .dropdown { display: block; }
.catswitch .dropdown a { display: flex; width: 100%; padding: 10px 14px; border-radius: 8px; }

/* ================= 側邊抽屜 ================= */
.drawer-mask { position: fixed; inset: 0; background: rgba(15, 20, 40, .5); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer { position: fixed; left: 0; top: 0; bottom: 0; width: 320px; max-width: 85vw; background: #fff; z-index: 130; transform: translateX(-105%); transition: transform .3s; overflow-y: auto; padding: 20px; }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-mask { opacity: 1; pointer-events: auto; }
.drawer h4 { margin: 18px 0 8px; color: var(--gray); font-size: 13px; letter-spacing: 2px; }
.drawer a.item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; font-weight: 700; }
.drawer a.item:hover { background: var(--blue-soft); color: var(--blue); }
.drawer a.item img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.drawer .close-drawer { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: none; background: #f2f3f8; font-size: 16px; }

/* ================= 限時優惠橫幅 ================= */
.promo-wrap { padding: 26px 0 6px; }
.promo {
  position: relative; background: #fff; border: 2px solid var(--orange); border-radius: 18px;
  padding: 34px 20px 38px; text-align: center; overflow: visible;
}
.promo .flag {
  position: absolute; top: 14px; right: 16px; background: var(--red); color: #fff;
  font-size: 14px; font-weight: 800; padding: 6px 14px; border-radius: 8px 0 8px 0; letter-spacing: 2px;
}
.promo h1 { color: var(--red); font-size: clamp(24px, 4vw, 34px); letter-spacing: 2px; }
.promo .sub { margin: 10px 0 22px; font-size: 17px; font-weight: 600; color: #333; }
.countdown { display: flex; justify-content: center; gap: 14px; margin-bottom: 26px; }
.countdown .unit {
  width: 74px; padding: 10px 0 8px; border-radius: 12px; background: #26262b; color: #fff; text-align: center;
}
.countdown .unit b { display: block; font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.countdown .unit span { font-size: 12px; color: #b9bcc6; }
.btn-cta {
  display: inline-block; background: linear-gradient(90deg, var(--orange-2), var(--orange));
  color: #fff; font-size: 17px; font-weight: 800; padding: 14px 34px; border-radius: 12px;
  border: none; box-shadow: 0 6px 16px rgba(255, 122, 0, .35); transition: transform .15s;
}
.btn-cta:hover { transform: translateY(-2px); }

/* ================= 標題 ================= */
.section-title { text-align: center; font-size: clamp(26px, 4vw, 38px); font-weight: 900; color: var(--dark); margin: 54px 0 30px; letter-spacing: 2px; }

/* ================= 分類卡片 ================= */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.cat-card { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 1 / 1.05; background: #dde3f0; }
.cat-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.cat-card:hover img { transform: scale(1.05); }
.cat-card .pill {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #fff; padding: 10px 26px; border-radius: 999px; font-size: 19px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18); white-space: nowrap;
}
.cat-card:hover .pill { color: var(--blue); }

/* ================= 品牌牆 ================= */
.brand-wall { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.brand-wall a { border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: 14px 10px; font-weight: 700; font-size: 17px; transition: all .2s; }
.brand-wall a:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

/* ================= 區段副列(促销行) ================= */
.subrow { display: flex; align-items: center; justify-content: space-between; margin: 0 0 18px; }
.subrow h3 { font-size: 22px; font-weight: 900; }
.pill-btn { background: var(--blue-soft); color: var(--blue); font-weight: 700; padding: 9px 20px; border-radius: 999px; font-size: 14px; }
.pill-btn:hover { background: var(--blue); color: #fff; }

/* ================= 商品卡 ================= */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px;
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(30, 40, 70, .12); }
.card .thumb { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #f2f3f8; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .name { margin-top: 12px; font-weight: 800; font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px; }
.card .name:hover { color: var(--blue); }
.card .cat { color: var(--gray); font-size: 13px; margin-top: 2px; }
.stars { color: var(--star); font-size: 15px; letter-spacing: 2px; margin-top: 6px; }
.stock-line { margin-top: 6px; font-size: 13.5px; font-weight: 700; color: var(--blue); display: flex; align-items: center; gap: 5px; }
.stock-line.out { color: var(--gray); }
.card .price { color: var(--blue); font-weight: 800; font-size: 19px; margin-top: 6px; }
.card .price del { color: var(--gray); font-weight: 500; font-size: 13px; margin-left: 6px; }
.btn-primary {
  display: block; width: 100%; margin-top: 12px; background: var(--blue); color: #fff;
  border: none; border-radius: 10px; padding: 12px 0; font-size: 15px; font-weight: 800; text-align: center;
  transition: background .2s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #c3cade; cursor: not-allowed; }

/* ================= 購物須知 ================= */
.notice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.notice-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border-top: 4px solid var(--line); padding: 24px 26px; }
.notice-card h3 { font-size: 18px; margin-bottom: 14px; padding-left: 12px; border-left: 4px solid; }
.notice-card.red { border-top-color: var(--red); }   .notice-card.red h3 { border-color: var(--red); }
.notice-card.blue { border-top-color: #4f8ef7; }     .notice-card.blue h3 { border-color: #4f8ef7; }
.notice-card.green { border-top-color: var(--green); } .notice-card.green h3 { border-color: var(--green); }
.notice-card li { list-style: none; position: relative; padding-left: 16px; color: #555; font-size: 14px; line-height: 2; }
.notice-card li::before { content: ''; position: absolute; left: 2px; top: .95em; width: 6px; height: 6px; border-radius: 50%; background: var(--gray); }
.notice-card.red li::before { background: var(--red); }
.notice-card.blue li::before { background: #4f8ef7; }
.notice-card.green li::before { background: var(--green); }
.notice-note { text-align: center; color: #666; margin-top: 22px; font-size: 14px; }

/* ================= 會員招募 ================= */
.member-wrap { display: flex; justify-content: center; padding: 54px 0 30px; }
.member-card { width: 380px; max-width: 100%; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.member-card img { width: 100%; }
.member-card .body { padding: 22px 24px; }
.member-card h3 { font-size: 20px; font-weight: 900; margin-bottom: 8px; }
.member-card li { list-style: none; position: relative; padding-left: 16px; color: #555; font-size: 14px; line-height: 2; }
.member-card li::before { content: ''; position: absolute; left: 2px; top: .95em; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.member-card .foot { border-top: 1px solid var(--line); text-align: center; padding: 16px; }
.member-card .foot a { font-weight: 800; color: var(--dark); }
.member-card .foot a:hover { color: var(--blue); }

/* ================= 頁尾 ================= */
.footer { background: #23252d; color: #b9bdc9; margin-top: 60px; padding: 44px 0 0; }
.footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 30px; padding-bottom: 34px; }
.footer h5 { color: #fff; font-size: 16px; margin-bottom: 14px; }
.footer a { display: block; padding: 4px 0; font-size: 14px; }
.footer a:hover { color: #fff; }
.footer .brandline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer .brandline img { width: 40px; height: 40px; }
.footer .brandline b { color: #fff; font-size: 20px; letter-spacing: 2px; }
.footer .bar { border-top: 1px solid #3a3d47; text-align: center; padding: 16px 0; font-size: 13px; }

/* 回到頂部 */
.to-top {
  position: fixed; right: 22px; bottom: 26px; width: 46px; height: 46px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--dark);
  display: none; align-items: center; justify-content: center; z-index: 80;
}
.to-top.show { display: flex; }

/* ================= 提示泡泡 ================= */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: #26262b; color: #fff; padding: 12px 22px; border-radius: 12px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= 列表頁 ================= */
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 26px 0 20px; }
.page-head h1 { font-size: 26px; font-weight: 900; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font-weight: 700; font-size: 13.5px; }
.chip.active, .chip:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.empty-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; padding: 70px 20px; color: var(--gray); font-size: 16px; }
.empty-box .big { font-size: 52px; margin-bottom: 12px; }

/* ================= 商品詳情 ================= */
.pd { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px; margin-top: 26px; }
.pd-gallery .main { border-radius: 14px; overflow: hidden; aspect-ratio: 1; background: #f6f7fb; }
.pd-gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.pd-thumbs img { width: 72px; height: 72px; border-radius: 10px; border: 2px solid var(--line); cursor: pointer; object-fit: cover; }
.pd-thumbs img.active { border-color: var(--blue); }
.pd-info h1 { font-size: 26px; font-weight: 900; line-height: 1.4; }
.pd-info .cat { color: var(--gray); margin-top: 4px; }
.pd-price { font-size: 32px; color: var(--blue); font-weight: 900; margin: 18px 0 6px; }
.pd-price small { font-size: 14px; color: var(--gray); font-weight: 600; }
.opt-title { font-weight: 800; margin: 18px 0 10px; }
.opt-group { display: flex; flex-wrap: wrap; gap: 10px; }
.opt-group label {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 18px; cursor: pointer; font-weight: 700; font-size: 14px;
}
.opt-group input { display: none; }
.opt-group input:checked + span { color: var(--blue); }
.opt-group label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 22px 0; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 40px; height: 42px; border: none; background: #f6f7fb; font-size: 18px; font-weight: 800; }
.qty input { width: 56px; height: 42px; border: none; outline: none; text-align: center; font-weight: 800; font-size: 16px; }
.pd-actions { display: flex; gap: 12px; }
.pd-actions .btn-primary { margin-top: 0; flex: 1; }
.btn-outline {
  flex: 0 0 52px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 20px; color: var(--gray);
}
.btn-outline.on { color: var(--red); border-color: var(--red); }
.pd-desc { margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--line); color: #555; }
.pd-meta-line { display: flex; gap: 18px; margin-top: 10px; font-size: 14px; color: var(--gray); }

/* ================= 購物車/結帳 ================= */
.cart-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 24px; align-items: start; margin-top: 26px; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.cart-item { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; }
.cart-item .n { font-weight: 800; }
.cart-item .v { color: var(--gray); font-size: 13px; margin-top: 2px; }
.cart-item .p { color: var(--blue); font-weight: 800; margin-top: 6px; }
.cart-item .right { text-align: right; }
.cart-item .qty { margin-left: auto; }
.cart-item .remove { display: block; margin-top: 8px; color: var(--gray); font-size: 13px; background: none; border: none; }
.cart-item .remove:hover { color: var(--red); }
.sum-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; }
.sum-row.total { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 14px; font-size: 19px; font-weight: 900; color: var(--blue); }
.ship-note { background: var(--blue-soft); color: var(--blue); font-size: 13px; border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.btn-block { display: block; width: 100%; background: var(--blue); color: #fff; border: none; border-radius: 12px; padding: 15px 0; font-size: 17px; font-weight: 900; margin-top: 16px; }
.btn-block:hover { background: var(--blue-dark); }

.form-grid { display: grid; gap: 14px; }
.form-grid label { font-weight: 700; font-size: 14px; display: block; margin-bottom: 5px; }
.form-grid input, .form-grid textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 14px; outline: none;
}
.form-grid input:focus, .form-grid textarea:focus { border-color: var(--blue); }
.pickup-box { border: 1.5px dashed var(--blue); background: #f4f7ff; border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--blue); font-weight: 700; }
.form-err { background: #fff1f1; color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 14px; font-weight: 700; }

/* ================= 訂單 ================= */
.order-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 16px; }
.order-head { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 10px; font-size: 14px; color: var(--gray); }
.order-head b { color: var(--dark); }
.status { margin-left: auto; font-weight: 800; font-size: 13px; padding: 4px 14px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); }
.status.s-shipped { background: #fff4e5; color: var(--orange); }
.status.s-done { background: #e9f7ee; color: var(--green); }
.order-item { display: flex; gap: 10px; padding: 10px 0; font-size: 14.5px; border-bottom: 1px dashed var(--line); }
.order-item:last-child { border-bottom: none; }
.order-item .l { flex: 1; font-weight: 700; }
.order-item .v { color: var(--gray); }
.order-total { text-align: right; padding-top: 10px; font-weight: 900; color: var(--blue); }

/* ================= 登入 ================= */
.auth-wrap { display: flex; justify-content: center; padding: 50px 0; }
.auth-card { width: 420px; max-width: 100%; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 32px; }
.auth-tabs { display: flex; background: #f2f3f8; border-radius: 12px; padding: 5px; margin-bottom: 26px; }
.auth-tabs a { flex: 1; text-align: center; padding: 10px; font-weight: 800; border-radius: 9px; color: var(--gray); }
.auth-tabs a.active { background: #fff; color: var(--blue); box-shadow: var(--shadow); }

/* ================= 響應式 ================= */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .topnav .linkbtn, .catnav .hide-m { display: none; }
  .pd { grid-template-columns: 1fr; gap: 22px; }
  .cart-layout { grid-template-columns: 1fr; }
  .notice-grid { grid-template-columns: 1fr; }
  .logo-text { font-size: 19px; }
  .search { padding-left: 14px; }
  .topbar .container { height: 66px; gap: 10px; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .brand-wall { grid-template-columns: repeat(2, 1fr); }
  .countdown .unit { width: 62px; }
  .section-title { margin: 38px 0 22px; }
  .footer .cols { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 64px 1fr auto; }
  .cart-item img { width: 64px; height: 64px; }
}

