/* ─── product.html Custom Styles ─── */

/* ─── CSS Variables (matched to index.html theme) ─── */
:root {
  --brand-green: #4E5B04;
  /* brand deep grass green */
  --brand-yellow: #f5c518;
  --brand-dark: #002842;
  --brand-orange: #D63900;
  /* brand dark orange-red */
  --bg: #fbfbfb;
  --white: #ffffff;
  --text-primary: #2e3031;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #e0e0e0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 100px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .10);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .14);
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
  --max-w: 1200px;
}

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

body {
  font-family: 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ─── NAV BAR (matches index.html style) ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  flex: 1 1 0%;
  justify-content: flex-start;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--brand-dark);
}

.nav-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-logo img {
  height: 50px;
  object-fit: contain;
}

.nav-logo .logo-text {
  font-size: 16px;
  font-weight: 500;
  color: #1a1a1a;
  margin-top: 1px;
  letter-spacing: 0.5px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 0%;
  justify-content: flex-end;
}

.nav-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-icon-btn:hover {
  background: #f0f0f0;
  color: var(--brand-dark);
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--brand-orange);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-book {
  padding: 10px 20px;
  background: var(--brand-yellow);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-book:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ─── BREADCRUMB ─── */
.breadcrumb-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}

.breadcrumb-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-inner a {
  color: var(--text-secondary);
  transition: color var(--transition);
}

.breadcrumb-inner a:hover {
  color: var(--brand-dark);
}

.breadcrumb-inner .sep {
  color: var(--border);
}

.breadcrumb-inner .current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── MAIN CONTENT ─── */
.product-page {
  max-width: var(--max-w);
  margin: 32px auto 64px;
  padding: 0 24px;
}

/* ─── PRODUCT LAYOUT ─── */
.product-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 48px;
  align-items: start;
}

/* ─── LEFT: IMAGE GALLERY ─── */
.gallery {
  position: relative;
}

.gallery-main {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--white);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  cursor: zoom-in;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  opacity: 1;
  transform: scale(1);
}

.gallery-main:hover img {
  transform: scale(1.05);
  /* 大面積精品實物主圖自帶滑鼠鏡頭微縮放 */
}

.gallery-main img.fade-out {
  opacity: 0.2;
  transform: scale(0.98);
}

.gallery-thumbs {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.gallery-thumb {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  /* 12px 圓角磨砂小切換鈕 */
  overflow: hidden;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  padding: 4px;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-thumb.active {
  border-color: #4E5B04 !important;
  /* 選中帶有 2px 綠色外框 */
  background: rgba(229, 233, 216, 0.6);
  box-shadow: 0 4px 12px rgba(78, 91, 4, 0.15);
}

.gallery-thumb:hover {
  border-color: rgba(78, 91, 4, 0.5);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* ─── RIGHT: PRODUCT INFO ─── */
.product-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-brand {
  background: #e8f0fe;
  color: #2d5be3;
}

.badge-sale {
  background: #fde8e8;
  color: var(--brand-orange);
}

.badge-free {
  background: #e8f5e9;
  color: #2e7d32;
}

.product-name {
  font-size: 20px !important;
  /* 加上 !important 強制覆蓋 Elementor 的樣式 */
  font-weight: 100;
  line-height: 0.5;
  color: #20201F;
  /* 炭黑色 */
  letter-spacing: 0.02em;
  /* 在這裡調整商品名稱字間距 */
  margin-bottom: 2px !important;
  /* 👈 加上這行來控制與下方的間距（數值越大間距越寬） */
}

/* Price block */
.price-block {
  background: linear-gradient(135deg, #fffcfb 0%, #fff 100%);
  border: 1px solid #f0e6e1;
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.price-original {
  font-size: 12px;
  /* 縮小字級 */
  color: #A9AAA5;
  /* 草木暖灰/淺灰，低調退到背景 */
  text-decoration: line-through;
  margin-left: 8px;
}

.price-sale {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.price-label {
  font-size: 11px !important;
  /* 促銷價文字調小 */
  color: #77796D;
  /* 草木暖灰 */
  font-weight: 500;
}

.price-amount {
  font-size: 18px;
  /* 促銷價金額調小 */
  font-weight: 700;
  color: #D63900;
  /* 深橘紅 */
  font-family: 'Fredoka One', cursive;
}

.price-note {
  font-size: 11px;
  /* 促銷價文字調小 */
  color: #77796D;
  /* 草木暖灰 */
}

.price-tag-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.price-tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  background: rgba(229, 233, 216, 0.4);
  /* 極淡草綠底 #E5E9D8/40 */
  color: #4E5B04;
  /* #4E5B04 */
  border: none !important;
  /* 去框化 */
}

.price-tag-stock {
  background: transparent !important;
  color: #77796D !important;
  padding: 4px 0 !important;
  font-weight: 500 !important;
}

/* Info table */
.info-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.info-row {
  display: flex;
  align-items: stretch;
  /* items-stretch, ensure left-right match height */
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  width: 90px;
  min-width: 90px;
  padding: 14px 16px;
  background: #f8f9fa;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  /* 統一字級縮小 */
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  /* 垂直置中 */
  justify-content: center;
  /* 水平置中 */
  text-align: center;
  /* 文字置中 */
}

.info-val {
  padding: 14px 16px;
  color: var(--text-primary);
  flex: 1;
  font-size: 12px;
  /* 統一字級縮小為 text-xs */
}

.info-val a {
  color: var(--brand-dark);
  font-weight: 600;
}

.info-val a:hover {
  text-decoration: underline;
}

/* Payment badges */
.pay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pay-badge {
  padding: 6px 12px;
  border-radius: 8px;
  /* rounded-lg 8px圓角 */
  font-size: 11px;
  /* text-[11px] */
  font-weight: 600;
  background: rgba(229, 233, 216, 0.3);
  /* 極淡嫩草綠 #E5E9D8/30 */
  color: #4E5B04;
  /* 品牌深草綠 */
  border: none !important;
  /* 拿掉邊框 */
  display: inline-block;
}

.pay-note {
  font-size: 12px;
  color: #D63900;
  /* 質感暗橘紅 */
  margin-top: 6px;
}

/* Shipping & Variant badges */
.product-info .ship-badges,
.product-info .variant-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.product-info .ship-badge,
.product-info .variant-badge {
  display: inline-block;
  padding: 6px 16px !important; /* py-2, px-4 完美比例 */
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  background: #ffffff !important; /* 未選中背景：純白 */
  color: #77796D !important; /* 未選中文字：草木暖灰 */
  border: 1.5px solid #DADBD9 !important; /* 未選中邊框：極細暖灰 */
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-align: center !important;
  box-shadow: none !important;
  user-select: none !important;
  outline: none !important;
}

.product-info .ship-badge:hover,
.product-info .variant-badge:hover {
  border-color: #4E5B04 !important;
  color: #4E5B04 !important;
  transform: translateY(-1.5px) !important; /* 滑鼠懸停微幅上浮 */
  box-shadow: 0 4px 8px rgba(78, 91, 4, 0.08) !important;
}

.product-info .ship-badge:active,
.product-info .variant-badge:active {
  transform: scale(0.95) !important; /* 點擊時套用 active:scale-95 下壓回饋 */
}

.product-info .ship-badge.active,
.product-info .variant-badge.active {
  background: rgba(229, 233, 216, 0.4) !important; /* 選中背景：淡嫩草綠柔光 #E5E9D8/40 */
  color: #4E5B04 !important; /* 選中文字：深草綠 */
  border-color: #4E5B04 !important; /* 選中邊框：品牌深草綠 */
  box-shadow: none !important;
  transform: none !important; /* 已選中時取消上浮位移 */
}

.product-info .ship-badge.active:active,
.product-info .variant-badge.active:active {
  transform: scale(0.95) !important;
}

.product-info .ship-note {
  font-size: 11px;
  color: #77796D;
  margin-top: 6px;
}

/* Quantity control */
.product-info .qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid #DADBD9 !important;
  /* 微暖灰邊框 */
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
  background: var(--white);
  height: 32px !important;
  /* 固定高度為 32px */
}

.product-info .qty-btn {
  width: 25px !important;
  height: 32px !important;
  border: none !important;
  background: #ffffff !important;
  font-size: 12px !important;
  /* 縮小按鈕內的字型 text-xs */
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #77796D !important;
  transition: background var(--transition), color var(--transition), transform 0.1s ease;
  user-select: none;
}

.product-info .qty-btn:hover {
  background: #FAFAFA !important;
  color: #4E5B04 !important;
}

.product-info .qty-btn:active {
  background: #F0F0F0 !important;
  /* 點擊時呈現極淡灰 */
  transform: scale(0.9) !important;
}

.product-info .qty-display {
  width: 35px !important;
  height: 32px !important;
  text-align: center;
  font-size: 14px !important;
  font-weight: 700;
  border: none !important;
  /* 統一為無邊框 */
  outline: none !important;
  padding: 0 !important;
  color: var(--text-primary) !important;
  background: var(--white) !important;
}

/* CTA Buttons */
.cta-row {
  display: flex;
  gap: 12px !important;
  /* gap-3 */
  flex-wrap: nowrap !important;
  /* 左右並排 */
  align-items: center;
  margin-top: 10px;
  width: 100% !important;
}

.product-info .btn-primary {
  /* 直接購買/結帳 */
  /* flex: 1 !important; */
  width: 180px !important;
  min-width: 0 !important;
  height: 42px !important;
  /* 調降高度 */
  background: transparent !important;
  color: #4E5B04 !important;
  font-family: 'Noto Sans TC', sans-serif !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border: 1.5px solid #4E5B04 !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  transition: all var(--transition) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: none !important;
}

.product-info .btn-primary:hover {
  background: #4E5B04 !important;
  color: var(--white) !important;
  box-shadow: 0 4px 12px rgba(78, 91, 4, 0.15) !important;
}

.product-info .btn-primary:active {
  transform: scale(0.95) !important;
}

.product-info .btn-secondary {
  /* 加入購物車 */
  /* flex: 1 !important; */
  width: 180px !important;
  min-width: 0 !important;
  height: 42px !important;
  /* 調降高度 */
  background: #4E5B04 !important;
  color: var(--white) !important;
  font-family: 'Noto Sans TC', sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border: none !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  transition: all var(--transition) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  /* 設為相對定位 */
  white-space: nowrap !important;
  /* 防止文字折行 */
  padding-left: 50px !important;
  /* 👈 調整此數值即可將文字往右推 (數值越大文字越偏右) */
}

.product-info .btn-secondary img {
  position: absolute !important;
  left: 30px !important;
  /* 👈 調整此數值即可控制圖示的左右位置 (數值越小越靠左) */
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 18px !important;
  height: 18px !important;
  content: url("../images/svg/basket_open.svg") !important; /* 預設為開口籃子 */
}

.product-info .btn-secondary:hover img {
  content: url("../images/svg/basket.svg") !important; /* 滑鼠懸停變更為閉合籃子 */
}

.product-info .btn-secondary:hover:not(:disabled) {
  background: #6F8200 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(111, 130, 0, 0.25) !important;
}

.product-info .btn-secondary:active:not(:disabled) {
  transform: scale(0.95) !important;
}

.product-info .btn-secondary:disabled {
  background: #77796D !important;
  color: #ccc !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

.product-info .btn-wishlist {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  border: 1.5px solid var(--border) !important;
  background: var(--white) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  color: var(--text-muted) !important;
  transition: all var(--transition) !important;
}

.product-info .btn-wishlist:hover {
  border-color: #e44d8a !important;
  color: #e44d8a !important;
  background: #fff0f5 !important;
}

.product-info .btn-wishlist.active {
  border-color: #e44d8a !important;
  color: #e44d8a !important;
  background: #fff0f5 !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--brand-dark);
  color: var(--white);
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all .35s cubic-bezier(.34, 1.56, .64, 1);
  z-index: 9999;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── NOT FOUND ─── */
.not-found {
  text-align: center;
  padding: 80px 24px;
}

.not-found i {
  font-size: 64px;
  color: var(--border);
  margin-bottom: 24px;
  display: block;
}

.not-found h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.not-found p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.not-found a {
  display: inline-block;
  padding: 12px 28px;
  background: var(--brand-dark);
  color: var(--white);
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: all var(--transition);
}

.not-found a:hover {
  background: #003d60;
  transform: translateY(-1px);
}

/* ─── RESPONSIVE ─── */

/* ─── 消除焦點亮藍外框 ─── */
button:focus,
input:focus,
select:focus,
textarea:focus,
label:focus,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label:focus-visible,
.qty-btn:focus,
.ship-option:focus-within,
input[type="radio"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* ─── 大地雜誌美學非對稱排版 ─── */
.editorial-tabs {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 896px;
  /* max-w-4xl */
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.editorial-row {
  display: flex;
  flex-direction: row;
  width: 100%;
  align-items: flex-start;
}

.editorial-title {
  width: 20%;
  font-size: 18px;
  font-weight: 700;
  color: #20201F;
  letter-spacing: 0.15em;
  border-left: 4px solid #4E5B04;
  /* 質感左側綠框線 */
  padding-left: 12px;
  box-sizing: border-box;
}

.editorial-content {
  width: 80%;
  font-size: 13.5px;
  color: #77796D;
  /* 質感灰字 #77796D */
  line-height: 1.7;
  white-space: normal;
  word-break: break-word;
  padding-left: 16px;
  box-sizing: border-box;
}

/* 🌿 Markdown 渲染元素精緻排版 ─── */
.editorial-content h1,
.editorial-content h2,
.editorial-content h3,
.editorial-content h4,
.editorial-content h5,
.editorial-content h6 {
  color: #203F34;
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.editorial-content h1 { font-size: 18px; border-bottom: 2px solid #4E5B04; padding-bottom: 4px; }
.editorial-content h2 { font-size: 16px; border-left: 3.5px solid #4E5B04; padding-left: 8px; }
.editorial-content h3 { font-size: 15px; color: #2E5B4B; }
.editorial-content h4 { font-size: 14px; }

.editorial-content strong,
.editorial-content b {
  color: #20201F;
  font-weight: 700;
}

.editorial-content ul,
.editorial-content ol {
  padding-left: 20px;
  margin: 8px 0 12px 0;
}

.editorial-content li {
  margin-bottom: 4px;
  list-style-position: outside;
}

.editorial-content p {
  margin-bottom: 10px;
}

.editorial-content blockquote {
  border-left: 4px solid #4E5B04;
  background: #FAFCF7;
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 0 8px 8px 0;
  color: #4A523A;
}

.editorial-content code {
  background: #F0F2E8;
  color: #203F34;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

.editorial-content pre {
  background: #203F34;
  color: #FFFFFF;
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.editorial-content a {
  color: #D63900;
  font-weight: 600;
  text-decoration: underline;
}

.editorial-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 12px 0;
}

/* 行動端適應性調整 */
@media (max-width: 768px) {
  .editorial-row {
    flex-direction: column;
    gap: 16px;
  }

  .editorial-title {
    width: 100%;
    border-left: 4px solid #4E5B04;
    padding-left: 12px;
    margin-bottom: 4px;
    font-size: 16px;
  }

  .editorial-content {
    width: 100%;
    padding-left: 0;
  }
}

/* ─── Disabled and Out-of-Stock Styles (v3.0) ─── */
.product-info .btn-primary:disabled,
.product-info .btn-secondary:disabled {
  background: #C8C8C6 !important;
  border-color: #C8C8C6 !important;
  color: #ffffff !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.8 !important;
}

.product-info .btn-secondary:disabled img {
  opacity: 0.5 !important;
}

.product-info .qty-control.disabled {
  pointer-events: none !important;
  opacity: 0.5 !important;
  background-color: #f5f5f5 !important;
  border-color: #DADBD9 !important;
}

.product-info .qty-control.disabled .qty-btn {
  background-color: #f5f5f5 !important;
  color: #ccc !important;
}

.product-info .qty-control.disabled .qty-display {
  background-color: #f5f5f5 !important;
  color: #ccc !important;
}