/* ==========================================================================
   團購好物小宇宙 - 全域設計系統與 CSS 樣式表
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 設計系統變數 (CSS Variables) - 修改這裡即可一秒套用不同的視覺風格！
   -------------------------------------------------------------------------- */
:root {
  /* 品牌色系 */
  --primary: #DDBA76;          /* 主色調 (如按鈕、核心強調標籤) */
  --primary-hover: #C5A15D;    /* 主色調 Hover 狀態 */
  --primary-light: #FDF9F1;    /* 主色調極淺色 (卡片背景) */
  --secondary: #E2D3BB;        /* 輔助色 */
  
  /* 功能狀態色 */
  --success: #A3E635;          /* 成功/上架狀態 (綠色) */
  --danger: #FF5757;           /* 警告/限量/刪除狀態 (紅色) */
  --danger-hover: #E04646;
  --rose: #D4A3A3;             /* 收藏/促銷強調 (粉色) */
  --rose-light: #FAF0F0;
  
  /* 背景與中性色 */
  --bg-main: #FAF7F0;          /* 網站主背景色 (暖沙/米白) */
  --bg-card: #FFFFFF;          /* 卡片/元件背景色 (純白) */
  --bg-hover: #F5F2EA;         /* Hover 灰色背景 */
  
  /* 文字顏色 */
  --text-main: #1C1917;        /* 主要標題/內文深色 */
  --text-muted: #78716C;       /* 次要描述文字灰色 */
  --text-white: #FFFFFF;       /* 亮色背景專用白字 */
  
  /* 邊框與陰影 */
  --border-color: #E7E5E4;     /* 標準細邊框線條 */
  --border-radius: 16px;       /* 網頁卡片/按鈕的圓角弧度 */
  --border-radius-sm: 8px;     /* 小按鈕/標籤的圓角弧度 */
  --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04); /* 卡片標準陰影 */
  --box-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08); /* 抽屜與彈窗陰影 */
  
  /* 字體與排版 */
  --font-sans: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
}

/* --------------------------------------------------------------------------
   2. 全域基礎重設 (Reset) & 滾動條
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  transition: all 0.2s ease-in-out;
}

/* 精美網頁滾動條 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #E2D3BB;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* --------------------------------------------------------------------------
   3. 實用樣式類別 (Utilities)
   -------------------------------------------------------------------------- */
.text-rose { color: var(--rose) !important; }
.bg-rose-light { background-color: var(--rose-light) !important; }
.text-danger { color: var(--danger) !important; }
.hidden { display: none !important; }
.flex-spacer { flex: 1; }
.w-full { width: 100% !important; }

/* --------------------------------------------------------------------------
   4. 載入動畫 (Loader Cover)
   -------------------------------------------------------------------------- */
.loader-container {
  position: fixed;
  inset: 0;
  background-color: var(--bg-main);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.cart-animation {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-cart-icon {
  width: 60px;
  height: 60px;
  color: var(--text-main);
  animation: cartWobble 3s infinite ease-in-out;
}

.loader-item-box {
  position: absolute;
  top: 0;
  width: 100%;
  height: 60px;
}

.loader-item {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
}

.item-1 {
  left: 20px;
  color: var(--rose);
  animation: dropItem 2.5s infinite ease-in-out 0s;
}

.item-2 {
  left: 50px;
  color: var(--primary);
  animation: dropItem 2.5s infinite ease-in-out 0.8s;
}

.item-3 {
  left: 80px;
  color: var(--success);
  animation: dropItem 2.5s infinite ease-in-out 1.6s;
}

.loader-text-card {
  background-color: var(--bg-card);
  padding: 12px 24px;
  border-radius: 100px;
  box-shadow: var(--box-shadow);
  border: 1px border var(--border-color);
  font-weight: 700;
  font-size: 0.95rem;
}

@keyframes cartWobble {
  0%, 100% { transform: translateX(-5px) rotate(0deg); }
  50% { transform: translateX(5px) rotate(2deg); }
}

@keyframes dropItem {
  0% { transform: translateY(-10px) scale(0.5); opacity: 0; }
  30% { opacity: 1; }
  70% { transform: translateY(60px) scale(1) rotate(180deg); opacity: 1; }
  100% { transform: translateY(70px) scale(0.5) rotate(360deg); opacity: 0; }
}

/* --------------------------------------------------------------------------
   5. 頁首與導覽列 (Header)
   -------------------------------------------------------------------------- */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-b: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-container {
  max-width: 1024px;
  height: 70px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.header-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
  transform: translateY(-2px);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-img-wrapper {
  width: 36px;
  height: 36px;
  background-color: var(--primary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  transition: transform 0.3s;
}

.logo-group:hover .logo-img-wrapper {
  transform: rotate(15deg);
}

.logo-title {
  font-family: 'Outfit', var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* 搜尋框 - 桌面版 */
.search-wrapper-desktop {
  position: relative;
  display: none;
}

@media (min-width: 640px) {
  .search-wrapper-desktop {
    display: block;
  }
}

.search-wrapper-desktop input,
.search-wrapper-mobile input {
  height: 40px;
  padding: 0 16px 0 38px;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-hover);
  outline: none;
  font-size: 0.9rem;
  width: 180px;
  transition: all 0.3s;
}

.search-wrapper-desktop input:focus {
  width: 240px;
  background-color: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(221, 186, 118, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* 購物車觸發按鈕 */
.cart-trigger-btn {
  height: 42px;
  padding: 0 16px;
  background-color: var(--primary);
  color: var(--text-white);
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(221, 186, 118, 0.25);
}

.cart-trigger-btn:hover {
  background-color: var(--primary-hover);
  transform: scale(1.03);
}

.cart-badge {
  background-color: var(--danger);
  color: var(--text-white);
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
}

/* --------------------------------------------------------------------------
   6. 側邊抽屜選單 (Sidebar Drawer)
   -------------------------------------------------------------------------- */
.sidebar-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  transition: all 0.3s;
}

.sidebar-drawer.open {
  visibility: visible;
}

.drawer-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-drawer.open .drawer-overlay {
  opacity: 1;
}

.drawer-content {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 280px;
  background-color: var(--bg-main);
  box-shadow: var(--box-shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-drawer.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  height: 70px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-b: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.drawer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
}

.logo-icon-drawer {
  color: var(--primary);
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.close-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.drawer-search {
  padding: 16px;
  background-color: var(--bg-card);
  border-b: 1px solid var(--border-color);
}

@media (min-width: 640px) {
  .drawer-search {
    display: none; /* 桌面版已在Header顯示，此處隱藏 */
  }
}

.search-wrapper-mobile {
  position: relative;
}

.search-wrapper-mobile input {
  width: 100%;
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.drawer-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-nav li button {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
}

.drawer-nav li.active button {
  background-color: var(--rose-light);
  color: var(--rose);
  border: 1px solid var(--rose);
}

.drawer-nav li:not(.active) button:hover {
  background-color: var(--bg-card);
  color: var(--text-main);
  transform: translateX(4px);
}

.drawer-footer {
  padding: 16px;
  border-t: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.admin-login-btn {
  width: 100%;
  height: 40px;
  border-radius: var(--border-radius-sm);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.admin-login-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
}

/* --------------------------------------------------------------------------
   7. 輪播看板 (Hero Carousel Banner)
   -------------------------------------------------------------------------- */
.hero-carousel-section {
  max-width: 1024px;
  margin: 20px auto 30px auto;
  padding: 0 16px;
}

.carousel-container {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 9; /* 電影級橫幅比例 */
  background-color: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  border: 1px solid var(--border-color);
}

@media (max-width: 640px) {
  .carousel-container {
    aspect-ratio: 16 / 9; /* 手機板改用 16:9 顯示更多高度 */
  }
}

.carousel-track {
  height: 100%;
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.carousel-slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-overlay-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 30px 24px;
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.carousel-overlay-content h3 {
  font-size: 1.4rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.carousel-overlay-content p {
  font-size: 0.9rem;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s;
}

.dot.active {
  background-color: var(--primary);
  width: 20px;
  border-radius: 100px;
}

/* --------------------------------------------------------------------------
   8. 分類標籤滑動條 (Category Tabs)
   -------------------------------------------------------------------------- */
.category-tabs-section {
  max-width: 1024px;
  margin: 0 auto 24px auto;
  padding: 0 16px;
}

.category-tabs-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  /* 隱藏橫向滾動條，保持極簡 */
  scrollbar-width: none;
}

.category-tabs-container::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 10px 20px;
  border-radius: 100px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--box-shadow);
}

.cat-tab:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.cat-tab.active {
  background-color: var(--text-main);
  color: var(--bg-main);
  border-color: var(--text-main);
}

/* --------------------------------------------------------------------------
   9. 商品列表與排版 (Product Grid & Cards)
   -------------------------------------------------------------------------- */
.products-listing-section {
  max-width: 1024px;
  margin: 0 auto 50px auto;
  padding: 0 16px;
}

.listing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.results-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sort-select {
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  outline: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 商品卡片本體 */
.product-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--box-shadow-lg);
  border-color: var(--primary);
}

/* 卡片圖片框 */
.card-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #FAFAFA;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.product-card:hover .card-img-wrapper img {
  transform: scale(1.05);
}

/* 卡片徽章標籤 */
.card-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.badge-pinned { background-color: var(--primary); color: var(--text-white); }
.badge-limited { background-color: var(--danger); color: var(--text-white); }
.badge-sold-out { background-color: #78716C; color: var(--text-white); }
.badge-hot {
  background-color: var(--rose);
  color: var(--text-white);
}

/* 卡片收藏/愛心 */
.card-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  z-index: 2;
}

.card-fav-btn:hover {
  transform: scale(1.1);
  background-color: #FFFFFF;
}

.card-fav-btn.active {
  color: var(--danger);
}

.card-fav-btn i {
  width: 16px;
  height: 16px;
}

.card-fav-btn.active i {
  fill: var(--danger);
}

/* 卡片文字資訊 */
.card-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.7rem; /* 固定兩行高度，保持卡片對齊 */
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-pricing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: auto;
  margin-bottom: 10px;
}

.card-price-value {
  font-size: 1.15rem;
  font-weight: 800;
}

.card-original-price {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.card-action-btn {
  width: 100%;
  height: 38px;
  background-color: var(--primary-light);
  border: 1px solid var(--primary);
  color: var(--primary-hover);
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.product-card:hover .card-action-btn {
  background-color: var(--primary);
  color: var(--text-white);
}

.card-action-btn:disabled {
  background-color: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   10. 通用彈窗與覆蓋層 (Modal Components)
   -------------------------------------------------------------------------- */
.modal-container {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-container.open {
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s;
}

.modal-container.open .modal-overlay {
  opacity: 1;
}

.modal-content {
  position: relative;
  background-color: var(--bg-main);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-lg);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
  border: 1px solid var(--border-color);
}

.modal-container.open .modal-content {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   11. 商品詳情彈窗 (Product Detail Modal)
   -------------------------------------------------------------------------- */
.product-detail-content {
  width: 900px;
  padding: 24px;
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
  transform: translateY(-1px);
}

.detail-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 768px) {
  .detail-layout {
    flex-direction: row;
  }
}

/* 詳情頁圖片藝廊 */
.detail-gallery {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.main-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: #FFFFFF;
}

.main-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-floating-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.floating-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.floating-btn:hover {
  transform: scale(1.08);
  color: var(--text-main);
}

.floating-btn.active {
  color: var(--danger);
}

.floating-btn.active i {
  fill: var(--danger);
}

.thumbnail-list-container {
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.thumbnail-list-container::-webkit-scrollbar {
  display: none;
}

.thumbnail-list {
  display: flex;
  gap: 8px;
}

.thumbnail-item {
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background-color: #FFFFFF;
  flex-shrink: 0;
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-item.active {
  border-color: var(--primary);
}

/* 詳情頁資訊 */
.detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.detail-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.meta-tag-category {
  background-color: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
}

.meta-tag-status {
  background-color: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 16px;
}

/* 倒數計時器 */
.countdown-card {
  background-color: #EEF2FF;
  border: 2px solid var(--text-main);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: 3px 3px 0px 0px var(--text-main);
}

.countdown-icon {
  width: 20px;
  height: 20px;
  color: var(--text-main);
}

.countdown-label {
  font-weight: 800;
  font-size: 0.9rem;
}

.countdown-timer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}

.countdown-timer span {
  background-color: #FFFFFF;
  border: 2px solid var(--text-main);
  box-shadow: 2px 2px 0 0 var(--text-main);
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 1.05rem;
}

.countdown-timer small {
  font-size: 0.75rem;
  margin: 0 2px;
}

/* 價格專區 */
.detail-pricing {
  background-color: var(--primary-light);
  border: 1px solid rgba(221, 186, 118, 0.4);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-hover);
}

.price-value {
  font-size: 1.6rem;
  font-weight: 900;
}

.price-row-original {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.price-original-value {
  text-decoration: line-through;
}

/* 介紹特色 */
.detail-section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.detail-description-text {
  font-size: 0.9rem;
  color: #444;
  white-space: pre-wrap;
}

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

.features-list li::before {
  content: "✦";
  color: var(--primary);
  font-weight: bold;
}

/* 規格選擇器與組合包 */
.buying-selector-box {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selector-title {
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.variant-dropdown {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--text-main);
  background-color: #FFFFFF;
  outline: none;
  font-weight: 700;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231C1917' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}

/* 多維度按鈕規格 */
.multi-variants-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.variant-buttons-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-btn {
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  font-weight: 700;
  font-size: 0.85rem;
}

.variant-btn:hover {
  background-color: var(--bg-hover);
}

.variant-btn.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary-hover);
}

/* 組合包編輯卡片 */
.combo-items-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.combo-row-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #FFFFFF;
  padding: 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.combo-row-number {
  background-color: var(--text-main);
  color: var(--bg-main);
  font-size: 0.75rem;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combo-row-select {
  flex: 1;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  outline: none;
  font-weight: 600;
  font-size: 0.8rem;
}

.combo-row-del-btn {
  color: var(--danger);
  padding: 6px;
}

.combo-add-btn {
  width: 100%;
  height: 40px;
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  color: var(--text-muted);
}

.combo-add-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* 數量與購買按鈕 */
.buying-actions-area {
  margin-top: auto;
  border-t: 1px solid var(--border-color);
  padding-top: 20px;
}

.quantity-selector-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.quantity-label {
  font-weight: 700;
}

.qty-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  background-color: var(--bg-card);
  padding: 4px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.qty-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.qty-val {
  width: 36px;
  text-align: center;
  font-weight: 800;
}

.qty-limit-notice {
  font-size: 0.75rem;
  font-weight: 700;
}

.action-buttons-group {
  display: flex;
  gap: 12px;
}

.btn {
  height: 48px;
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  transition: all 0.2s;
}

.flex-1 { flex: 1; }

.btn-primary {
  background-color: var(--primary);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(221, 186, 118, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--rose-light);
  border: 1px solid var(--rose);
  color: var(--rose);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #FCE8E8;
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-white);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn:disabled {
  background-color: var(--border-color);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.checkout-notice-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   12. 購物車抽屜彈窗 (Shopping Cart Drawer)
   -------------------------------------------------------------------------- */
.cart-drawer-content {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 420px;
  max-width: 100%;
  border-radius: 0;
  transform: translateX(100%);
  display: flex;
  flex-direction: column;
}

.modal-container.open .cart-drawer-content {
  transform: translateX(0);
}

.cart-header {
  height: 70px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-b: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.cart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
}

.cart-items-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 購物車單一商品卡 */
.cart-item {
  display: flex;
  gap: 12px;
  background-color: var(--bg-card);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  position: relative;
}

.cart-item-img {
  width: 70px;
  height: 70px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-color);
  background-color: #FFFFFF;
}

.cart-item-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.cart-item-variant {
  font-size: 0.75rem;
  color: var(--rose);
  font-weight: 700;
  margin-top: 2px;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.cart-item-price {
  font-weight: 800;
  font-size: 0.9rem;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  padding: 2px;
}

.cart-item-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.cart-item-qty-val {
  width: 28px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.cart-item-del-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--text-muted);
  padding: 4px;
}

.cart-item-del-btn:hover {
  color: var(--danger);
}

/* 購物車頁尾 */
.cart-footer {
  padding: 20px;
  border-t: 1px solid var(--border-color);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 1.05rem;
}

.cart-total-price {
  font-size: 1.4rem;
  color: var(--text-main);
}

.btn-checkout {
  width: 100%;
  height: 52px;
  background-color: var(--primary);
  color: var(--text-white);
  border-radius: var(--border-radius);
  font-size: 1rem;
}

.btn-checkout:hover {
  background-color: var(--primary-hover);
}

.cart-checkout-tip {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   13. 後台管理與表單 (Admin Panel Form & Layout)
   -------------------------------------------------------------------------- */
.auth-modal-content {
  width: 360px;
  padding: 24px;
}

.modal-header-simple {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  height: 42px;
  padding: 0 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: #FFFFFF;
  outline: none;
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 後台商品編輯面板 */
.admin-edit-content {
  width: 960px;
  padding: 24px;
}

.admin-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-b: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 768px) {
  .admin-form {
    flex-direction: row;
  }
}

.admin-form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkbox-group-card {
  background-color: var(--bg-hover);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.textarea-mid {
  height: 100px !important;
  padding: 8px 12px !important;
  resize: vertical;
}

.textarea-small {
  height: 70px !important;
  padding: 8px 12px !important;
  resize: vertical;
}

/* 多維度規格產生器 */
.variant-groups-builder-section {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  background-color: var(--bg-hover);
}

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

.btn-builder-add {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-hover);
  background-color: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--primary);
}

.groups-builder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-builder-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: #FFFFFF;
  padding: 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.group-builder-inputs {
  display: flex;
  gap: 8px;
}

.group-builder-name {
  width: 35%;
  height: 34px !important;
  font-size: 0.8rem !important;
}

.group-builder-options {
  flex: 1;
  height: 34px !important;
  font-size: 0.8rem !important;
}

.group-builder-del {
  color: var(--danger);
  padding: 4px;
}

.group-builder-required {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.group-builder-required input {
  width: 14px;
  height: 14px;
}

.admin-edit-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-t: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}
