/* ==================== 設計系統與全域變數 ==================== */
:root {
  --bg-page: #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-card: #ffffff;
  --navy: #14233c;
  --navy-hover: #1e3357;
  --ink: #1a1d21;
  --ink-muted: #5f6672;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --line-green: #06c755;
  --danger: #dc2626;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(20, 35, 60, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 35, 60, 0.1);
  --shadow-lg: 0 16px 40px rgba(20, 35, 60, 0.16);
  --font-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

/* ==================== 按鈕系統 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.18s ease;
}

.btn-primary {
  background: var(--navy);
  color: #ffffff;
}
.btn-primary:hover { background: var(--navy-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  background: #ffffff;
  color: var(--navy);
  border-color: var(--navy);
}
.btn-outline:hover {
  background: var(--navy);
  color: #ffffff;
}

.btn-white-outline {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
}
.btn-white-outline:hover {
  background: #ffffff;
  color: var(--navy);
}

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-block { width: 100%; }

.icon-btn {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
}

/* ==================== 頂部公告與導覽列 ==================== */
.top-bar {
  background: var(--navy);
  color: #ffffff;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  gap: 12px;
}
.mode-badge {
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--navy);
}
.brand-mark {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.08em;
}
.brand-sub {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--navy);
  background: var(--bg-subtle);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  width: 230px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}

.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.cart-btn:hover { background: var(--navy-hover); }
.cart-badge {
  background: #ffffff;
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.mobile-drawer {
  border-top: 1px solid var(--border);
  background: #ffffff;
  padding: 16px 20px;
}
.mobile-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mobile-nav-link {
  text-align: left;
  background: var(--bg-subtle);
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}

/* ==================== Hero 橫幅 ==================== */
.hero {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--navy);
}
.hero-bg {
  position: absolute;
  inset: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(20, 35, 60, 0.88) 0%, rgba(20, 35, 60, 0.55) 55%, rgba(20, 35, 60, 0.25) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  color: #ffffff;
  padding: 56px 20px;
  max-width: 680px;
}
.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #cbd5e1;
  margin: 0 0 10px;
}
.hero-content h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.25;
  margin: 0 0 16px;
  font-weight: 700;
}
.hero-desc {
  font-size: 15px;
  color: #e2e8f0;
  margin: 0 0 28px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==================== 訪客價格提示 ==================== */
.guest-notice {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.guest-notice-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}

/* ==================== 商品型錄區 ==================== */
.catalog-section {
  padding: 48px 0 80px;
}
.catalog-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.03em;
}
.section-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.brand-tabs {
  display: flex;
  gap: 8px;
}
.brand-tab {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.brand-tab.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cat-pill {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-pill:hover { border-color: var(--navy); }
.cat-pill.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.card-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-subtle);
  overflow: hidden;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.product-card:hover .card-img-wrap img {
  transform: scale(1.04);
}
.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--navy);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.model-code {
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.03em;
}
.card-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.card-sub {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ink-muted);
}
.card-colors {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
}
.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
}
.color-more {
  font-size: 11px;
  color: var(--ink-muted);
  margin-left: 2px;
}

.card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.price-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}
.price-locked {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: center;
}

/* ==================== Modal & Drawer ==================== */
.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop[hidden], .drawer-backdrop[hidden] { display: none; }

.modal-dialog {
  position: relative;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}
.modal-sm { max-width: 440px; }
.modal-md { max-width: 680px; }
.modal-lg { max-width: 920px; }

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--bg-subtle);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--border); }

.modal-title {
  margin: 0 0 18px;
  font-size: 20px;
  color: var(--navy);
}

/* 商品詳情 */
.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 28px;
}
.detail-img-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
}
.detail-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-color-chip {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.detail-specs-box {
  margin-top: 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.spec-row span { color: var(--ink-muted); }

.detail-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.detail-code-row .product-badge { position: static; }
.detail-title { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
.detail-subtitle { margin: 0 0 12px; font-size: 14px; color: var(--ink-muted); }
.detail-desc { margin: 0 0 16px; font-size: 13.5px; color: var(--ink); line-height: 1.65; }

.detail-price-box {
  background: var(--bg-subtle);
  border-left: 3px solid var(--navy);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.selector-group { margin-bottom: 16px; }
.selector-label {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.selector-label strong { color: var(--navy); }

.color-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.swatch-btn.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--navy);
}

.size-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.size-btn {
  min-width: 46px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.size-btn.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty-stepper button {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-subtle);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}
.qty-stepper input {
  width: 60px;
  height: 36px;
  border: none;
  text-align: center;
  font-weight: 600;
  outline: none;
}

/* ==================== 表單與會員 Modal ==================== */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.auth-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}
.auth-tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--navy);
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 12px;
}

/* ==================== 購物車 Drawer ==================== */
.drawer-backdrop {
  justify-content: flex-end;
  padding: 0;
}
.drawer-panel {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.drawer-header {
  position: relative;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h3 { margin: 0; font-size: 18px; color: var(--navy); }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.cart-item-info { flex: 1; }
.cart-item-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.cart-item-meta { font-size: 12px; color: var(--ink-muted); margin: 3px 0 8px; }
.cart-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-qty-sm {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cart-qty-sm button {
  background: none;
  border: none;
  width: 26px;
  height: 26px;
  cursor: pointer;
}
.cart-qty-sm span {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
}
.remove-item-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.checkout-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
}
.checkout-form h4 { margin: 0 0 12px; color: var(--navy); }

.order-success-view { text-align: center; padding: 12px 0; }
.success-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  font-size: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.bank-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  margin: 16px 0;
  font-size: 13.5px;
}
.bank-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}
.bank-card hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.success-hint { font-size: 12.5px; color: var(--ink-muted); margin-bottom: 16px; }

/* 訂單紀錄 */
.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.order-card-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}
.order-status {
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
}

/* ==================== 浮動 LINE 與頁尾 ==================== */
.floating-line {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--line-green);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 99px;
  box-shadow: var(--shadow-md);
  transition: transform 0.18s ease;
}
.floating-line:hover { transform: translateY(-2px); }

.site-footer {
  background: var(--navy);
  color: #cbd5e1;
  padding: 44px 0 24px;
  font-size: 13.5px;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-brand {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}
.footer-info p { margin: 4px 0; }
.footer-info a { color: #86efac; text-decoration: none; }
.footer-bottom {
  padding-top: 18px;
  font-size: 12px;
  color: #94a3b8;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.toast[hidden] { display: none; }

/* ==================== 響應式斷點 ==================== */
.mobile-only { display: none; }

@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .desktop-only { display: none; }
  .mobile-only { display: inline-flex; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .product-detail-layout { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .hero { min-height: 320px; }
  .modal-dialog { padding: 20px; }
}
