/* =========================
   Global
========================= */
*{ text-decoration: none; }

body{
  font-family: 'Noto Sans TC','Poppins',sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}

.tag{ color:#000; }

/* =========================
   Header
========================= */
header.site-header{
  background: var(--bg);
  color: var(--text);
  display:flex;
  justify-content: space-between;
  align-items:center;
  padding:12px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo{
  font-weight: 700;
  font-size: 22px;
}
.logo .brand{ color: var(--accent); }

/* 桌機：水平導覽 */
.nav{
  display:flex;
  gap:14px;
}

.nav a{
  text-decoration:none;
  color: var(--text);
  padding:6px 14px;
  border-radius: var(--radius);
  font-weight:500;
  transition: .2s;
}
.nav a:hover,
.nav a.active{
  background: var(--main);
  color:#fff;
}

/* 漢堡 / 購物車按鈕 */
.menu-toggle,
.cart-toggle{
  display:none; /* 桌機預設隱藏，手機才顯示 */
  font-size:26px;
  background:none;
  border:none;
  cursor:pointer;
  color: var(--accent);
  z-index: 1100;
}

/* =========================
   Overlay（左選單 + 右購物車共用遮罩）
========================= */
.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 900;
}
.overlay.show{
  opacity: 1;
  pointer-events: auto;
}

/* =========================
   Cart Panel（右側購物車）
========================= */
.cart-panel{
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100%;
  background: var(--bg);
  box-shadow: -2px 0 10px rgba(0,0,0,0.1);
  display:flex;
  flex-direction: column;
  justify-content: space-between;
  transition: right .35s ease;
  z-index: 960;
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}
.cart-panel.open{ right: 0; }

.cart-panel h3{
  margin: 0;
  padding: 16px;
  background: var(--main);
  color:#fff;
}

.cart-items{
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.cart-footer{
  padding: 16px;
  border-top: 1px solid #eee;
  background: var(--light);
}

.checkout-btn{
  width: 100%;
  background: var(--main);
  color:#fff;
  border:none;
  border-radius: var(--radius);
  padding: 10px;
  font-size: 16px;
  cursor:pointer;
}
.checkout-btn:hover{ background: var(--accent); }

/* =========================
   Banner（主 banner：用 active + opacity 顯示）
   規則：
   - >=480px：比例跟著寬度走，最高 480px
   - <480px：不限制 max-height（仍跟著比例）
========================= */
.banner{
  position: relative;
  overflow: hidden;
}

/* 容器：用比例撐高度（absolute 子層才不會讓 height:auto 變 0） */
.banner .slides{
  position: relative;
  width: 100%;
  overflow: hidden;

  aspect-ratio: 16 / 9;   /* 桌機預設比例 */
  max-height: 600px;      /* 最高 480px */
}

/* 每張 slide 疊在一起，用 .active 顯示（主 banner 用） */
.banner .slide{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;

  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;

  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}

.banner .slide.active{
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* 如果 slide 內是 img */
.banner .slides img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* 想完整顯示不裁切可改 contain */
}

/* caption */
.banner .slide .slide-caption{
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 6px 10px;
  background: rgba(0,0,0,.5);
  color:#fff;
  font-size: 14px;
  border-radius: 6px;
  z-index: 2;
}

/* dots：主 banner 是固定在 banner 內底部 */
.banner .dots{
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display:flex;
  gap:6px;
  z-index: 3;
}

.banner .dots .dot,
.banner .dots span{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #999;
  background: rgba(255,255,255,.85);
  cursor: pointer;
  opacity: .8;
}

.banner .dots .dot.active,
.banner .dots .active{
  background: var(--main);
  border-color: var(--main);
  opacity: 1;
}

@media (max-width: 479.98px){
  .banner .slides{
    max-height: none; /* ✅ 不限制高度 */
  }
}

/* =========================================================
   ✅ Banner Middle（精選商品下方：translateX 輪播用）
   這裡會覆蓋掉主 banner 的 active/opacity 規則，避免「整片空白」
========================================================= */
.banner.banner-middle{ margin-top: 16px; 
     max-width: 1400px;
    margin:0 auto ;
    
}

/* 中段容器：給稍扁一點的比例，比主 banner 更像廣告條 */
.banner.banner-middle .slides{
  aspect-ratio: 16 / 6;
  max-height: none;
  min-height: 180px;
  border-radius: 14px;
}

@media (max-width: 480px){
  .banner.banner-middle .slides{
    aspect-ratio: 16 / 7;
    min-height: 140px;
  }
}

/* ✅ 中段 slide 一律顯示（不吃主 banner 的 opacity:0） */
.banner.banner-middle .slide{
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: transform .45s ease !important;
  will-change: transform;
}

/* ✅ 中段 dots 放在 banner 下方（不固定在圖片內） */
.banner.banner-middle .dots{
  position: static !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;

  justify-content: center;
  margin-top: 10px;
  gap: 8px;
}

/* 中段 dot 外觀（可沿用主的，也可稍微小一點） */
.banner.banner-middle .dots .dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  background: rgba(17,24,39,.22);
  opacity: 1;
}
.banner.banner-middle .dots .dot.active{
  background: rgba(37,99,235,.9);
  transform: scale(1.15);
}

/* =========================
   Categories / Recommend
========================= */
.categories,
.recommend{
  text-align:center;
  padding:20px 10px;
}

.category-list{
  display:flex;
  justify-content:center;
  gap:15px;
  flex-wrap:wrap;
}

.cat-card{
  background: var(--light);
  border-radius: var(--radius);
  padding:10px;
  width:100px;
  box-shadow: var(--shadow);
  transition: .2s;
}
.cat-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
}

.cat-card img{
  border-radius:50%;
  width:80px;
  height:80px;
}

/* =========================
   Search Bar
========================= */
.search-bar{
  background: var(--accent);
  padding: 20px;
  display:flex;
  justify-content:center;
  align-items:center;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.search-bar form{
  display:flex;
  gap:10px;
  max-width: 800px;
  width: 100%;
}

.search-bar select{
  flex: 0 0 150px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-size: 16px;
  background: #fff;
}

.search-wrapper{
  position: relative;
  flex: 1;
}

.search-wrapper i{ color: var(--accent); }

.search-bar input{
  width: 100%;
  padding: 10px 44px 10px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-size: 16px;
  box-sizing: border-box;
}

.search-bar input:focus{ outline: 2px solid var(--main); }

.search-bar button{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background:none;
  border:none;
  color: var(--main);
  font-size: 20px;
  cursor:pointer;
  transition: color .2s;
}
.search-bar button:hover{ color: var(--accent); }

@media (max-width:768px){
  .search-bar form{
    flex-direction: column;
    gap: 8px;
  }
  .search-bar select,
  .search-wrapper{
    width: 100%;
  }
}

/* =========================
   Products Section / Grid（保留你後面 Grid 版本）
========================= */
.products-section{
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 20px;
}

.products-sec-titlebox{
  position: relative;
  width: 100%;
  height: 70px;
  margin: 20px 0;
}

.products-section h2{
  text-align:start;
  margin-bottom:20px;
  z-index: 1001;
  position: absolute;
  left: 0;
  top: -13px;
}

.pstbg{
  position: absolute;
  width: auto;
  top: -25px;
  left: 0px;
  color: #eeeeee;
  font-size: 64px;
  z-index: 1;
  font-weight: bold;
  letter-spacing: 5px;
}
.pstbox{ z-index: 1; }

.product-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  justify-items: center;
}

/* 商品卡 */
.product-card{
  background: var(--bg);
  border-radius: var(--radius);
  width: 100%;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;

  display:flex;
  flex-direction: column;
  position: relative;
}
.product-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.product-card img{
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* 內容區 */
.product-card-body{
  padding: 8px 10px 10px;
  display:flex;
  flex-direction: column;
  gap: 4px;
}

/* 商品名稱：最多兩行 */
.product-card h3{
  font-size: 16px;
  margin: 4px 0 2px;
  color: var(--text);
  text-align: start;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.4em;
  min-height: calc(1.4em * 2);
}

/* 商品描述：最多兩行 */
.product-desc{
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 4px;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;

  line-height: 1.4em;
  min-height: calc(1.4em * 2);
  word-break: break-word;
}

/* 價格 + 觀看數 */
.meta-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-top: 4px;
}
.meta-row .price{
  font-weight: 700;
  color: var(--accent);
}
.meta-row .views{
  font-size: 12px;
  color: #9ca3af;
  display:inline-flex;
  align-items:center;
  gap: 4px;
}
.meta-row .views::before{ content:"👁"; }

/* 價格區（若你仍有用到原本 price_box） */
.price_box{
  width: 100%;
  display:flex;
  justify-content: space-between;
  align-items:center;
}
.product-card .price{
  color: var(--accent);
  font-weight:700;
  text-align:start;
}

/* 購買按鈕 */
.product-card .buy-btn{
  background: var(--main);
  color:#fff;
  border:none;
  border-radius: 0 0 var(--radius) var(--radius);
  width: 100%;
  cursor:pointer;
  transition: background .2s;
}
.product-card .buy-btn:hover{ background: var(--accent); }

/* 標籤（熱銷/新品） */
.product-card .badge-row{
  position: absolute;
  left: 8px;
  top: 8px;
  display:flex;
  gap: 4px;
  z-index: 2;
}
.product-card .badge-pill{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  color:#fff;
  box-shadow: 0 2px 6px rgba(15,23,42,.25);
  background: #6b7280;
}
.product-card .badge-pill.badge-hot{ background: #ef4444; }
.product-card .badge-pill.badge-new{ background: #22c55e; }

/* Products RWD */
@media (max-width:1024px){
  .product-grid{ grid-template-columns: repeat(4, 1fr); }
}
@media (max-width:768px){
  .product-grid{ grid-template-columns: repeat(2, 1fr); }
}

/* =========================
   Mobile Nav Drawer（把 .nav 變成左滑選單）
========================= */
@media (max-width:768px){
  .menu-toggle,
  .cart-toggle{ display:block; font-size:24px; }

  /* 手機：改成左側抽屜 */
  .nav{
    flex-direction: column;
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100%;
    background: var(--bg);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding-top: 60px;
    gap: 10px;
    transition: left .35s ease;
    z-index: 950;
  }
  .nav.open{ left: 0; }

  .nav a{
    display:block;
    padding:14px;
    border-bottom: 1px solid #eee;
  }
}
