/* ===== 基本設定 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* 北歐木質漸層背景 */
    background: radial-gradient(circle at top left, #f8f3ea 0%, #f3e7d8 40%, #ebdfcf 100%);
    min-height: 100vh;
    color: #4b4137;
    padding-bottom: 110px; /* 給固定 footer 預留空間 */
}

/* ===== Header（北歐木質風） ===== */
header {
    width: 100%;
    border-bottom: 1px solid #d2bfa3;
    background: rgba(247, 241, 232, 0.96);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #5b5044;
    cursor: pointer;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-cart {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #6b5b4a;
}

.nav-btn {
    border-radius: 999px;
    border: 1px solid #8f7a63;
    background: #8f7a63;
    color: #fff;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}
.nav-btn:hover {
    background: #7a6854;
    border-color: #7a6854;
}

.nav-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(245, 235, 222, 0.9);
}

.tab-btn {
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #6b5b4a;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

.tab-btn.active {
    background: #e0d3c3;
    border-color: #c9b59c;
    color: #4a3d30;
}

@media (max-width: 640px) {
    .nav {
        padding: 8px 12px;
    }
    .nav-logo {
        font-size: 17px;
    }
}

/* ===== Main ===== */
main { width: 100%; }
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 40px;
}

.screen { display: none; }
.screen.active { display: block; }

/* ===== Sections / Card ===== */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 10px 0;
}
.section-sub {
    font-size: 13px;
    color: #6b6155;
    margin-bottom: 12px;
}

.card {
    background: #faf7f2;
    border-radius: 14px;
    border: 1px solid #d6c4ad;
    box-shadow: 0 10px 25px rgba(0,0,0,.06);
    padding: 14px;
}

/* Buttons */
.btn-black, .btn-outline {
    width: 100%;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-black {
    border: 1px solid #5b5044;
    background: #5b5044;
    color: #fff;
}
.btn-outline {
    border: 1px solid #5b5044;
    background: #fff;
    color: #5b5044;
}

.price {
    font-size: 20px;
    font-weight: 800;
    margin: 8px 0;
    text-align: center;
    color: #b63a2b;
}

/* ================= Banner ================= */
.list-hero {
    position: relative;
    border-radius: 10px;
    border: 1px solid #d2bfa3;
    height: 220px;
    background: #efe8dd;
    margin-bottom: 10px;
    overflow: hidden;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #efe8dd;

  position: relative;
  z-index: 1;
}


.banner-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.banner-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    border: 1px solid #ffffff;
    background: rgba(0,0,0,0.4);
    cursor: pointer;
}
.banner-dot.active {
    background: #ffffff;
}

/* ========= 商品分類列 ========= */
.filter-bar {
    margin: 12px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    border-radius: 999px;
    padding: 6px 14px;
    border: 1px solid #8f7a63;
    background: #f7efe3;
    font-size: 13px;
    cursor: pointer;
    color: #5b5044;
}

.filter-btn.active {
    background: #8f7a63;
    color: #fff;
}
/* ===== 分類列布局 ===== */
.filter-bar {
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-left {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 搜尋區 */
.filter-search {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

/* 搜尋按鈕 */
.search-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #8f7a63;
    background: #f7efe3;
    color: #5b5044;
    font-size: 16px;
    cursor: pointer;
}

.search-btn:hover {
    background: #8f7a63;
    color: white;
}

/* 搜尋輸入框（預設隱藏） */
.search-input {
    height: 32px;
    width: 0;
    opacity: 0;
    border-radius: 999px;
    border: 1px solid #b8a58f;
    background: #fff;
    padding: 0 12px;
    font-size: 13px;
    transition: width .3s ease, opacity .2s ease;
}

/* 展開後的狀態 */
.search-input.active {
    width: 150px;
    opacity: 1;
}

/* ===== 商品列表（北歐木質卡片） ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.product-card {
    border-radius: 14px;
    border: 1px solid #d6c4ad;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #faf7f2;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    transition: transform .15s ease, box-shadow .15s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}

.product-thumb {
    border-radius: 12px;
    border: 1px solid #d2bfa3;
    background: #efe8dd;
    aspect-ratio: 4 / 5; /* 固定比例，圖片永遠不會爆版 */
    aspect-ratio: 4 / 5;
    overflow: hidden;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform .25s ease;
}
.product-card:hover .product-thumb img {
    transform: scale(1.08);
}
.product-name {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    color: #5b5044;
}

.product-price {
    font-size: 17px;
    font-weight: 800;
    text-align: center;
    color: #b63a2b;
    margin-top: -2px;
}

.more-btn {
    align-self: center;
    padding: 6px 20px;
    border-radius: 999px;
    border: 1px solid #8f7a63;
    background: #8f7a63;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}
.more-btn:hover {
    background: #7a6854;
    border-color: #7a6854;
}

/* =============== 詳細頁圖片輪播 =============== */
.detail-gallery {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid #d6c4ad;
    background: #efe8dd;
    margin-bottom: 10px;
}

.detail-slides {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.detail-slides img {
    flex: 0 0 100%; 
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #efe8dd;  /* 不足的部分以背景填滿 */
}


.detail-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.detail-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: 1px solid #fff;
    cursor: pointer;
}
.detail-dot.active {
    background: #fff;
}

/* 詳細頁箭頭 */
.detail-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(0,0,0,0.35);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.detail-arrow-left { left: 10px; }
.detail-arrow-right { right: 10px; }

.detail-text {
    border-top: 1px solid #d6c4ad;
    border-bottom: 1px solid #d6c4ad;
    padding: 10px 6px;
    font-size: 13px;
    margin-bottom: 8px;
    color: #6b6155;
}

.detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.product-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #b85c38;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
}
.price-old {
  text-decoration: line-through;
  color: #999;
  font-size: 13px;
  margin-right: 6px;
}

.price-sale {
  color: #b85c38;
  font-weight: bold;
}

/* ===== 折扣 / 免運提示小字 ===== */
.product-meta {
  font-size: 12px;
  color: #6b6155;
  text-align: center;
  line-height: 1.4;
}

.rule-hint {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(240, 231, 218, 0.8);
  border: 1px solid #d6c4ad;
  font-size: 12px;
  color: #6b6155;
  line-height: 1.5;
}

.sheet-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #6b6155;
  text-align: center;
  line-height: 1.4;
}

.ship-reason {
  margin-top: 8px;
  font-size: 12px;
  color: #6b6155;
  line-height: 1.5;
}

/* =============== Lightbox 大圖 =============== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.lightbox.show {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    object-fit: contain;
    background: #000;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    border: none;
    background: transparent;
    color: #f9fafb;
    font-size: 20px;
    cursor: pointer;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(0,0,0,0.4);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.lightbox-arrow-left { left: 20px; }
.lightbox-arrow-right { right: 20px; }

/* ===== 結帳 ===== */
.cart-main {
    border-radius: 12px;
    border: 1px solid #d6c4ad;
    padding: 10px;
    margin-bottom: 14px;
    background: #faf7f2;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #d6c4ad;
    padding-bottom: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.cart-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.cart-item-hero {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    border: 1px solid #d2bfa3;
    background: #efe8dd;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #5b5044;
    overflow: hidden;
    font-size: 12px;
    margin-top: 4px;
}
.qty-control button {
    border: none;
    padding: 0 10px;
    background: #faf7f2;
    cursor: pointer;
}
.qty-control span {
    padding: 2px 12px;
    border-left: 1px solid #5b5044;
    border-right: 1px solid #5b5044;
    min-width: 22px;
    text-align: center;
}

.cart-total {
    text-align: right;
    font-weight: 700;
    margin-top: 6px;
}

/* ===== 訂購資料 ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    font-size: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #b8a58f;
    padding: 7px 12px;
    background: #fff;
}

/* ===== 北歐木質風 Footer（固定） ===== */
.footer {
    width: 100%;
    background: rgba(247, 241, 232, 0.98);
    border-top: 1px solid #d2bfa3;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 99;
    padding: 16px 20px 14px;
    backdrop-filter: blur(6px);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-logo {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #5b5044;
    margin-bottom: 6px;
}

.footer-links {
    margin-bottom: 6px;
    font-size: 13px;
}

.footer-links a {
    margin: 0 8px;
    color: #746659;
    text-decoration: none;
    opacity: 0.85;
}

.footer-links a:hover {
    opacity: 1;
    color: #5b5044;
}

.footer-copy {
    font-size: 11px;
    color: #7a6e63;
    opacity: 0.9;
}
/* ===============================
   ✅ Loading / Empty 通知樣式
================================ */
.notice{
  display:none;
  padding:12px 14px;
  border-radius:12px;
  border:1px dashed #d6c4ad;
  background:#fffaf2;
  color:#5b5044;
  font-size:13px;
  text-align:center;
  margin-bottom:10px;
}

.notice.show{ display:block; }

.notice-loading{
  background:#f7efe3;
}

.notice-empty{
  background:#fffaf2;
}

/* ===============================
   ✅ iPhone 底部安全區（固定 footer 不遮擋）
================================ */
body{
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

/* ===============================
   ✅ Banner 只有 1 張：點點直接隱藏
================================ */
.banner-dots.hidden{
  display:none;
}
/* ===============================
   ✅ 購物車多商品清單
================================ */
.cart-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:12px;
}

.cart-item{
  display:flex;
  gap:10px;
  padding:10px;
  border:1px solid #d6c4ad;
  border-radius:12px;
  background:#faf7f2;
}

.cart-item-thumb{
  width:70px;
  height:70px;
  border-radius:10px;
  border:1px solid #d2bfa3;
  background:#efe8dd;
  overflow:hidden;
  flex:0 0 auto;
}
.cart-item-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.cart-item-info{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.cart-item-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}

.cart-item-name{
  font-weight:700;
  font-size:14px;
  color:#4b4137;
}

.cart-item-price{
  font-weight:800;
  color:#b63a2b;
  white-space:nowrap;
}

.cart-item-actions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.cart-remove{
  border:1px solid #c9b59c;
  background:#fff;
  color:#6b5b4a;
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  cursor:pointer;
}

.cart-summary{
  border-top:1px solid #d6c4ad;
  padding-top:12px;
}
.cart-summary-row{
  display:flex;
  justify-content:space-between;
  margin-bottom:10px;
  font-size:14px;
}

/* ===============================
   ✅ Bottom Sheet（數量選擇）
================================ */
.sheet{
  position:fixed;
  inset:0;
  display:none;
  z-index:2500;
}
.sheet.show{ display:block; }

.sheet-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.45);
}

.sheet-panel{
  position:absolute;
  left:0; right:0; bottom:0;
  background:rgba(247, 241, 232, 0.98);
  border-top-left-radius:18px;
  border-top-right-radius:18px;
  border:1px solid #d2bfa3;
  box-shadow:0 -12px 30px rgba(0,0,0,.18);
  padding:10px 14px 14px;
  backdrop-filter: blur(8px);
}

.sheet-handle{
  width:44px;
  height:4px;
  border-radius:999px;
  background:#c9b59c;
  margin:6px auto 10px;
}

.sheet-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}
.sheet-title{
  font-weight:800;
  color:#4b4137;
}
.sheet-close{
  border:none;
  background:transparent;
  font-size:18px;
  cursor:pointer;
  color:#4b4137;
}

.sheet-body{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.sheet-row{
  display:flex;
  gap:10px;
  align-items:center;
}

.sheet-thumb{
  width:70px;
  height:70px;
  border-radius:12px;
  border:1px solid #d2bfa3;
  background:#efe8dd;
  overflow:hidden;
}
.sheet-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.sheet-meta{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.sheet-price{
  font-weight:900;
  color:#b63a2b;
  font-size:16px;
}
.sheet-sub{
  font-size:12px;
  color:#6b6155;
}

.sheet-qty{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  padding:8px 0;
}
.qty-btn{
  width:38px;
  height:38px;
  border-radius:999px;
  border:1px solid #8f7a63;
  background:#f7efe3;
  color:#4b4137;
  font-size:18px;
  cursor:pointer;
}
#sheetQty{
  min-width:32px;
  text-align:center;
  font-weight:800;
  font-size:16px;
  color:#4b4137;
}


/*轉圈圈動畫*/
/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* show 時顯示 */
.loading-overlay.show {
  display: flex;
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #ddd;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* Skeleton Card */
.skeleton-card {
  background: #f5f5f5;
  border-radius: 14px;
  padding: 12px;
  animation: pulse 1.2s ease-in-out infinite;
}

.skeleton-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #e0e0e0;
  border-radius: 12px;
  margin-bottom: 10px;
}

.skeleton-line {
  height: 14px;
  background: #e0e0e0;
  border-radius: 8px;
  margin-bottom: 8px;
}

.skeleton-line.short {
  width: 60%;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: .5; }
  100% { opacity: 1; }
}
/* ===== Banner Skeleton（避免 banner 載入時破圖 icon） ===== */
.banner-skeleton{
  position:absolute;
  inset:0;
  border-radius:10px;
  background:#e0e0e0;
  animation:pulse 1.2s ease-in-out infinite;
  z-index:2;
}
.banner-skeleton.hide{ display:none; }

.banner-img{
  position:relative;
  z-index:1;
}
/* banner 載入時：只顯示 spinner，不要破圖 icon */
.banner-img.is-loading{
  opacity: 0;
  visibility: hidden;
}

.banner-img.is-ready{
  opacity: 1;
  visibility: visible;
  transition: opacity .25s ease;
}

/* banner 內的 loader（只蓋 banner，不蓋整頁） */
.banner-loader{
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent; /* ✅ 不要灰一大片 */
  z-index: 2;
}
.banner-loader.show{ display: flex; }

/* 你原本 spinner 可以沿用，如果要小一點： */
.list-hero .spinner{
  width: 36px;
  height: 36px;
  border-width: 4px;
}
.ship-mode{
  border: 1px solid #e7dfd3;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #4a4036;
}
.ship-mode-title{
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 2px;
}
.ship-mode label{
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
/* =========================
   返回鍵（浮動）
========================= */
.back-fab{
  position: fixed;
  left: 14px;
  bottom: 92px;
  z-index: 3500;
  border: 1px solid #e6e8ef;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #111;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
  display: none; /* 預設不顯示 */
}
.back-fab:hover{
  transform: translateY(-1px);
}
.back-fab:active{
  transform: translateY(0px);
}

.detail-thumbs{
  display:flex;
  gap:10px;
  margin-top:12px;
  overflow-x:auto;
  padding-bottom:4px;
}

.detail-thumb{
  flex:0 0 auto;
  width:72px;
  height:72px;
  border:2px solid transparent;
  border-radius:10px;
  overflow:hidden;
  background:#fff;
  cursor:pointer;
}

.detail-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.detail-thumb.active{
  border-color:#222;
}

@media (max-width: 768px){
  .back-fab{
    bottom: 104px;
    left: 12px;
    padding: 10px 12px;
  }
}