/* ============================================================
   紐軒國際（NEW SHINE）— 手機購物 APP 全域樣式
   風格：Shopee 購物風格（橘色主題）
   ============================================================ */

:root {
  --primary: #4A90E2;
  --primary-dark: #3a7bd5;
  --primary-light: #6ba8ec;
  --secondary: #00bfa5;
  --accent: #ffd34d;
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --text: #222222;
  --text-light: #888888;
  --border: #e8e8e8;
  --danger: #ee4d2d;
  --success: #00bfa5;
  --warning: #ff9f00;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --header-height: 52px;
  --tabbar-height: 58px;
  /* 與 edutech.new-shine.com 的 Bootstrap container 對齊（最大寬度 1170px） */
  --page-max-width: 1170px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
}

/* ===== 通用 ===== */
a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* ===== 主導覽選單（黑色橫式列） ===== */
/* 移除項目符號並改為橫向排列 */
.nav-menu {
  display: flex !important;
  flex-direction: row !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background-color: #000000 !important;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar {
  display: none;
}

/* 選單文字樣式 */
.nav-menu li a {
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 10px 16px !important;
  display: block !important;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.nav-menu li a:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* 「查看更多」下拉選單 hover 結構 */
.nav-menu li.dropdown {
  position: relative;
}

.nav-menu li.dropdown > .dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background-color: #000000;
  list-style: none;
  padding: 4px 0;
  margin: 0;
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.nav-menu li.dropdown:hover > .dropdown-content,
.nav-menu li.dropdown:focus-within > .dropdown-content {
  display: block;
}

.nav-menu li.dropdown > .dropdown-content li a {
  color: #ffffff !important;
  text-decoration: none !important;
  display: block !important;
  padding: 10px 16px !important;
  white-space: nowrap;
}

.nav-menu li.dropdown > .dropdown-content li a:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===== 頂部導覽列 ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.header-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-btn {
  color: #fff;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.header-btn .badge {
  position: absolute;
  top: 4px;
  right: 2px;
  background: var(--accent);
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.header-btn-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== 響應式選單（RWD Hamburger Menu）=====
   對應斷點：md = 768px（與 Tailwind 的 md: 斷點一致）
   - 手機（< 768px）：顯示漢堡按鈕 + 滑出式 Drawer + 半透明 Overlay
   - 桌面（>= 768px）：顯示完整導覽列 .desktop-nav，隱藏漢堡按鈕
   ============================================ */

/* ----- 漢堡按鈕（僅手機顯示，對應 Tailwind：md:hidden）----- */
.header-menu-btn {
  display: none; /* 手機優先：預設隱藏，由下方 media query 控制顯示 */
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.header-menu-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

.header-menu-btn .menu-icon {
  display: block;
  pointer-events: none;
}

/* 漢堡按鈕動畫（開 → 關 ✕ 切換，先保留 ☰ 基礎樣式，由 JS 切換 class 控制） */
.header-menu-btn.is-open .menu-icon {
  transform: rotate(90deg);
  transition: transform 0.25s ease-in-out;
}

/* ----- 桌面完整導覽列（僅桌面顯示，對應 Tailwind：hidden md:flex）----- */
.desktop-nav {
  display: none; /* 手機優先：預設隱藏 */
  align-items: center;
  gap: 4px;
  margin-right: 6px;
}

.desktop-nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 12px; /* 點擊/觸控區域 >= 44px */
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.2s ease;
}

.desktop-nav-link:hover,
.desktop-nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.desktop-nav-link:active {
  background: rgba(255, 255, 255, 0.25);
}

/* 後台按鈕：手機版收進漢堡選單，僅桌面顯示 */
.desktop-admin-link {
  display: none;
}

/* ----- 手機版隱藏式選單層（Drawer + Overlay）----- */

/* 半透明遮罩：點擊可關閉選單（對應 Tailwind：fixed inset-0 bg-black/50 transition-opacity） */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}

.mobile-menu-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* 滑出式選單（Drawer）：由左側滑入（對應 Tailwind：fixed z-50 transition-all duration-300 ease-in-out） */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 210;
  width: 82%;
  max-width: 320px;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s ease-in-out, visibility 0s linear 0.3s;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.3s ease-in-out;
}

/* 選單頂部品牌區（與品牌主色 --primary 一致） */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 20px;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}

.mobile-menu-title {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 關閉按鈕：44px 點擊區域 */
.mobile-menu-close {
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.3rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.mobile-menu-close:active {
  background: rgba(255, 255, 255, 0.15);
}

/* 選單列表：連結高度 >= 44px，利於手指點擊 */
.mobile-menu-list {
  flex: 1;
  padding: 8px 0;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px; /* 點擊高度約 46px */
  min-height: 46px;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  border-left: 4px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, padding-left 0.2s ease;
}

.mobile-menu-item-icon {
  font-size: 1.2rem;
  line-height: 1;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus-visible {
  background: rgba(74, 144, 226, 0.06);
}

.mobile-menu-item:active {
  background: rgba(74, 144, 226, 0.12);
}

/* 選單底部：語系切換（與 edutech.new-shine.com 手機版風格一致） */
.mobile-menu-footer {
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* 選單開啟期間鎖住背景捲動 */
body.menu-open {
  overflow: hidden;
}

/* ----- 響應式斷點對照 Tailwind：md = 768px ----- */

/* 手機（< 768px）：顯示漢堡按鈕，隱藏桌面導覽列 */
@media (max-width: 767.98px) {
  .header-menu-btn {
    display: flex;
  }
}

/* 桌面（>= 768px）：顯示完整導覽列，隱藏漢堡按鈕與 Drawer（對應 Tailwind：md:flex / md:hidden） */
@media (min-width: 768px) {
  .header-menu-btn {
    display: none;
  }

  .desktop-nav {
    display: flex;
  }

  .desktop-admin-link {
    display: flex;
  }

  .mobile-menu,
  .mobile-menu-overlay {
    display: none;
  }
}

/* ===== 頂部 Banner 輪播（與 edutech.new-shine.com 投影片樣式一致） ===== */
.banner-section {
  width: 100%;
  max-width: var(--page-max-width);
  margin: calc(var(--header-height) + 8px) auto 0;
  padding: 0 12px 8px;
  box-sizing: border-box;
}

.banner-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: #eee;
}

.banner-track {
  display: flex;
  transition: transform 0.5s ease;
}

.banner-slide {
  flex: 0 0 100%;
  min-width: 100%;
}

.banner-slide img {
  width: 100%;
  height: auto;
  aspect-ratio: 1140 / 380;
  object-fit: cover;
  display: block;
}

.banner-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: background 0.2s;
}

.banner-btn:hover {
  background: rgba(0,0,0,0.55);
}

.banner-prev {
  left: 8px;
}

.banner-next {
  right: 8px;
}

.banner-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 5;
}

.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.banner-dot.active {
  background: #fff;
  transform: scale(1.2);
}

/* ===== 搜尋列 ===== */
.search-bar {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 12px 8px;
  box-sizing: border-box;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 22px;
  padding: 0 14px;
  height: 40px;
  box-shadow: var(--shadow-sm);
}

.search-input-wrapper .search-icon {
  color: var(--text-light);
  margin-right: 8px;
  font-size: 1.1rem;
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-size: 0.95rem;
  color: var(--text);
}

.search-input-wrapper input::placeholder {
  color: #bbb;
}

/* ===== 分類橫幅 ===== */
.category-strip {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 4px 12px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-sizing: border-box;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.category-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 商品區塊 ===== */
.section-title {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 12px 14px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

.product-grid {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 8px 8px;
  box-sizing: border-box;
}

/* 大螢幕：與 edutech.new-shine.com 的響應式多欄商品排列對齊 */
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 992px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.product-card:active {
  transform: scale(0.96);
}

.product-card .product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #ddd;
}

.product-card .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  padding: 8px 10px 10px;
}

.product-name {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
  height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 6px;
}

.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-price {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.05rem;
}

.product-price .currency {
  font-size: 0.7rem;
  margin-right: 2px;
}

.product-sold {
  font-size: 0.7rem;
  color: var(--text-light);
}

.product-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* 庫存標籤 */
.stock-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.stock-ok {
  color: #2e7d32;
  background: #e8f5e9;
}

.stock-low {
  color: #e65100;
  background: #fff3e0;
}

.stock-soldout {
  color: #c62828;
  background: #ffebee;
}

/* 完售遮罩 */
.product-soldout-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #c62828;
  letter-spacing: 2px;
}

.sold-out-card {
  opacity: 0.85;
}

.sold-out-card .product-actions button {
  cursor: not-allowed;
  background: #eee !important;
  color: #aaa !important;
  border-color: #ddd !important;
}

/* 商品卡片按鈕（加入購物車 / 立即購買） */
.btn-card-add,
.btn-card-buy {
  flex: 1;
  padding: 7px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn-card-add {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}

.btn-card-add:hover {
  background: var(--primary-dark);
}

.btn-card-buy {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-card-buy:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
}

.btn-card-add:active,
.btn-card-buy:active {
  transform: scale(0.95);
}

.btn-card-add.sold-out,
.btn-card-buy.sold-out {
  background: #eee !important;
  color: #aaa !important;
  border-color: #ddd !important;
  cursor: not-allowed;
}

/* ===== 商品詳情頁 ===== */
.product-detail-image {
  width: 100%;
  aspect-ratio: 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: #ddd;
}

.product-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail-body {
  background: #fff;
  padding: 14px;
}

.product-detail-name {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
}

.product-detail-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.product-detail-price .currency {
  font-size: 0.9rem;
}

.product-model-select {
  margin-top: 10px;
}

.product-model-select label {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 6px;
  display: block;
}

.product-model-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-chip {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fafafa;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.model-chip input {
  display: none;
}

.model-chip.selected {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.08);
  color: var(--primary);
  font-weight: 600;
}

.product-detail-desc {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 8px solid var(--bg);
}

.product-detail-desc h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.product-detail-desc p {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.8;
  white-space: pre-line;
}

/* ===== 商品詳情滾動與底部留白修正 ===== */

/* 1. 允許商品詳情容器自動產生垂直滾動條，
      避免內容被視窗限制或截斷 */
.product-detail-body,
.product-detail-desc,
.modal-body {
  max-height: calc(100vh - 120px) !important; /* 動態調整最大高度 */
  overflow-y: auto !important;                /* 內容超過時顯示滾動軸 */
  -webkit-overflow-scrolling: touch;
}

/* 2. 在商品說明最下方加入留白，避免文字被底部固定按鈕遮擋 */
.product-detail-desc,
#productDesc {
  padding-bottom: 80px !important;            /* 為底部黑鈕預留空間 */
}

/* ===== 底部固定操作列 ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 16px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-block {
  width: 100%;
  flex: 1;
}

.btn-lg {
  padding: 14px 20px;
  font-size: 1.05rem;
}

/* ===== 蝦皮購買按鈕 ===== */
.btn-shopee {
  background: #ee4d2d;
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(238, 77, 45, 0.35);
}

.btn-shopee:hover {
  background: #d73211;
}

.btn-shopee:active {
  background: #d73211;
}

.btn-shopee:disabled {
  background: #f0a08e;
}

/* ===== 語系切換按鈕 ===== */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lang-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 38px;
  text-align: center;
}

.lang-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.lang-btn:active {
  transform: scale(0.95);
}

/* ===== 購物車圖示 ===== */
.cart-icon-btn {
  position: relative;
}

.cart-count-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--accent);
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ===== 購物車頁 ===== */
.cart-page {
  padding-top: var(--header-height);
}

.cart-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.cart-item .cart-item-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ddd;
  flex-shrink: 0;
  overflow: hidden;
}

.cart-item .cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-model {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 6px;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-item-price {
  color: var(--primary);
  font-weight: 700;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-control button {
  width: 30px;
  height: 28px;
  border: none;
  background: #fafafa;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-control button:active {
  background: #eee;
}

.qty-control .qty-value {
  width: 36px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.cart-item-remove {
  color: var(--text-light);
  background: none;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 4px;
  padding: 2px;
}

/* ===== 購物車結算 ===== */
.cart-summary {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.cart-total-label {
  font-size: 0.85rem;
  color: var(--text-light);
}

.cart-total-price {
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 700;
  flex: 1;
}

/* ===== 訂單頁 / 結帳頁 ===== */
.checkout-page,
.orders-page,
.cart-page {
  padding-top: var(--header-height);
  min-height: 100vh;
}

.form-section {
  background: #fff;
  margin: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group input.error,
.form-group select.error {
  border-color: var(--danger);
}

.error-text {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 2px;
  display: none;
}

.error-text.show {
  display: block;
}

/* 付款方式選項 */
.payment-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.payment-option.selected {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.05);
}

.payment-option .payment-icon {
  font-size: 1.3rem;
}

.payment-option .payment-label {
  flex: 1;
  font-size: 0.9rem;
}

.payment-option .payment-desc {
  font-size: 0.75rem;
  color: var(--text-light);
}

.payment-option input {
  accent-color: var(--primary);
}

/* 運送方式選項 */
.shipping-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shipping-option {
  flex: 1;
  min-width: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.shipping-option.selected {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.05);
  color: var(--primary);
  font-weight: 600;
}

/* 訂單商品明細 */
.order-items-review {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-item-review {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.order-item-review:last-child {
  border-bottom: none;
}

.order-item-review .item-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}

.order-item-review .item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.order-item-review .item-detail {
  flex: 1;
  min-width: 0;
}

.order-item-review .item-name {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-item-review .item-meta {
  font-size: 0.75rem;
  color: var(--text-light);
}

.order-item-review .item-subtotal {
  font-size: 0.9rem;
  font-weight: 600;
}

/* 金額總結 */
.price-summary {
  background: #fff;
  margin: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.price-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
  color: #555;
}

.price-row.total {
  border-top: 1px dashed var(--border);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.price-row.total .amount {
  color: var(--primary);
  font-size: 1.3rem;
}

/* ===== 訂單查詢頁 ===== */
.orders-search {
  padding: calc(var(--header-height) + 10px) 12px 8px;
}

.orders-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.order-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.order-status {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  background: #eee;
  color: #666;
  font-weight: 600;
}

.order-status.pending { background: #fff3e0; color: #e65100; }
.order-status.confirmed { background: #e3f2fd; color: #1565c0; }
.order-status.shipped { background: #e8f5e9; color: #2e7d32; }
.order-status.completed { background: #e0f2f1; color: #00796b; }
.order-status.cancelled { background: #fce4ec; color: #c62828; }

.order-card-items {
  margin-bottom: 8px;
}

.order-card-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #666;
  padding: 2px 0;
}

.order-card-item .item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
}

.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.order-card-total {
  font-weight: 700;
  color: var(--primary);
}

.order-card-date {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ===== 狀態列 ===== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 8px;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
}

.status-bar.loading {
  color: var(--text-light);
}

.status-bar.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-bar.error {
  background: #fce4ec;
  color: #c62828;
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: var(--page-max-width);
  pointer-events: none;
}

.toast {
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  text-align: center;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.success {
  background: rgba(0, 191, 165, 0.9);
}

.toast.error {
  background: rgba(238, 77, 45, 0.9);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.fade-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ===== 底部標籤列 ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 6px;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-light);
  font-size: 0.65rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
}

.tab-item .tab-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.tab-item.active {
  color: var(--primary);
}

.tab-item .tab-badge {
  position: absolute;
  top: -2px;
  right: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 0.6rem;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.tab-item-wrapper {
  position: relative;
  flex: 1;
}

/* ===== 載入中動畫 ===== */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 空狀態 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ===== 訂單成功頁 ===== */
.order-success {
  text-align: center;
  padding: 60px 20px;
}

.order-success .success-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  color: var(--success);
}

.order-success h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.order-success p {
  color: var(--text-light);
  margin-bottom: 4px;
}

.order-success .order-number-display {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
  word-break: break-all;
}

/* ===== 桌面版調整 ===== */
@media (min-width: 768px) {
  body {
    max-width: var(--page-max-width);
    margin: 0 auto;
  }

  .header {
    max-width: var(--page-max-width);
    margin: 0 auto;
  }

  .tab-bar,
  .bottom-bar,
  .cart-summary {
    max-width: var(--page-max-width);
    margin: 0 auto;
  }

  .bottom-bar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--page-max-width);
  }

  .lang-switcher {
    border-color: rgba(74, 144, 226, 0.25);
    background: rgba(74, 144, 226, 0.06);
  }

  .lang-btn {
    color: var(--text-light);
  }

  .lang-btn.active {
    background: var(--primary);
    color: #fff;
  }
}

/* ============================================================
   主題色覆寫：純黑（Black #000000）
   ============================================================ */

/* 頂部導覽列 / Header 背景 */
.top-navbar,
.header-banner,
.header {
  background-color: #000000 !important; /* 純黑背景 */
  color: #ffffff !important;            /* 白色文字 */
}

/* 主按鈕（如：加入購物車） */
.add-to-cart-btn,
.btn-primary {
  background-color: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

/* 外框按鈕（如：立即購買） */
.buy-now-btn,
.btn-outline {
  background-color: transparent !important;
  border: 1px solid #000000 !important;
  color: #000000 !important;
}

/* --- 全局黑色按鈕樣式 --- */
button, 
.btn, 
.add-to-cart-btn, 
.buy-now-btn, 
.btn-primary,
.category-tag { /* 包含像「全部 (384)」這種標籤 */
    background-color: #000000 !important; /* 黑色背景 */
    color: #ffffff !important;           /* 白色文字 */
    border: 1px solid #000000 !important;
}

/* 如果按鈕有 hover 效果，也改為深灰色 */
button:hover, 
.btn:hover {
    background-color: #333333 !important;
    border-color: #333333 !important;
}

/* --- 文字顏色修正：將原本的藍色改為黑色 --- */
body, 
h1, h2, h3, h4, p, span, 
a {
    color: #000000 !important; /* 強制所有預設文字變黑色 */
}

/* 特別針對連結文字若是藍色的情況 */
a:visited, a:link {
    color: #000000 !important;
}

/* 蝦皮風格的分類連結 (原為藍色) */
.category-link, .filter-text {
    color: #000000 !important;
    font-weight: bold;
}

/* ============================================================
   黑色頁首 Dark Header（.dark-header／Shopee 黑色風格）
   說明：對應 index.html 中 <header class="dark-header"> 結構，
        樣式整合於此處；dark-header.css 保留為空佔位檔避免 404。
   注意：本區樣式使用 !important 覆寫上方「全域文字改黑色」規則，
        確保黑色頁首中的連結與圖示維持白色。
   ============================================================ */

.dark-header {
  background-color: #000000 !important;
  color: #ffffff !important;
  border-bottom: 2px solid #222222 !important;
  width: 100% !important;
}

.header-container {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 24px !important;
  max-width: var(--page-max-width) !important;
  margin: 0 auto !important;
  gap: 12px !important;
  flex-wrap: nowrap !important;
}

.brand-logo {
  flex-shrink: 0 !important;
  min-width: 0 !important;
}

.brand-logo a {
  color: #ffffff !important;
  font-size: 22px !important;
  font-weight: bold !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
  max-width: 100% !important;
}

/* 右側功能區：語系切換 / 搜尋 / 購物車 / 後台 */
.header-tools {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  color: #ffffff !important;
}

/* 頁首內搜尋輸入框（與 .search-input-wrapper input 不同情境） */
.search-input {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 20px !important;
  color: #ffffff !important;
  padding: 8px 14px !important;
  font-size: 0.9rem !important;
  outline: none !important;
  width: 200px !important;
  transition: border-color 0.2s, background 0.2s !important;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

.search-input:focus {
  border-color: #ffffff !important;
  background: rgba(255, 255, 255, 0.18) !important;
}

/* 頁首圖示按鈕（購物車 / 後台管理） */
.btn-icon {
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  transition: background 0.2s !important;
  white-space: nowrap !important;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

/* 語系切換按鈕：黑色頁首內改用深色主題 */
.dark-header .lang-btn.active {
  background-color: #222222 !important;
  border-color: #222222 !important;
  color: #ffffff !important;
}

.dark-header .lang-btn {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* 蝦皮導覽選單列（黑色橫式列） */
.main-nav {
  background-color: #111111 !important;
  border-top: 1px solid #222222 !important;
  width: 100% !important;
}

/* 手機版：功能按鈕收斂、品牌字縮小 */
@media (max-width: 767.98px) {
  .header-container {
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  .brand-logo a {
    font-size: 15px !important;
  }

  .search-input {
    width: 110px !important;
    padding: 7px 10px !important;
    font-size: 0.8rem !important;
  }

  .btn-icon {
    font-size: 0.75rem !important;
    padding: 7px 8px !important;
  }
}

@media (max-width: 479.98px) {
  .brand-logo a {
    font-size: 13px !important;
  }

  .search-input {
    width: 80px !important;
  }

  .btn-icon#btnAdmin {
    display: none !important;
  }
}

/* ===== Banner 間距修正 =====
   黑色頁首（.dark-header）為靜態定位（非 fixed），
   .banner-section 原樣式 margin-top 為固定頁首設計（52px + 8px），
   此處覆寫僅保留 8px 外距，避免首頁 Banner 下方出現過大空隙。 */
.dark-header + main.content-container .banner-section,
.dark-header + .content-container .banner-section {
  margin-top: 8px !important;
}

/* ===== 補齊：購物車徽章（.btn-icon .badge）===== */
.btn-icon {
  position: relative !important;
}

.btn-icon .badge {
  position: absolute !important;
  top: -5px !important;
  right: -8px !important;
  background: var(--accent) !important;
  color: #111111 !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  min-width: 18px !important;
  height: 18px !important;
  line-height: 18px !important;
  border-radius: 9px !important;
  text-align: center !important;
  padding: 0 4px !important;
}

/* ===== 補齊：導覽列目前頁面高亮（.nav-menu li.active）===== */
.nav-menu li.active > a {
  background: rgba(255, 255, 255, 0.18) !important;
  font-weight: 700 !important;
  box-shadow: inset 0 -2px 0 var(--accent) !important;
}
