/* =========================================
   1. 容器與基礎設定 (修正爆版問題 + 玻璃質感)
   ========================================= */
.giftbox-container {
  width: 100%;
  box-sizing: border-box;
  padding: 32px 24px; /* 增加一點內距，讓畫面呼吸 */
  
  /* 改為更通透的白色，帶一點點暖色調 */
  background: rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  
  /* 關鍵：背景模糊度加強，營造高級玻璃感 */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  /* 邊框改為柔和的亮光，而非實線 */
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 
    0 20px 50px -10px rgba(47, 75, 60, 0.1), /* 深綠色調的柔和陰影 */
    inset 0 0 0 1px rgba(255, 255, 255, 0.5); /* 內發光 */
  
  position: relative;
  margin: 0 auto;
  max-width: 100%;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* =========================================
   2. 茶罐樣式 (Flexbox 自動適應寬度)
   ========================================= */
.giftbox-slots {
  display: flex;
  justify-content: center; /* 置中 */
  align-items: flex-end;   /* 底部對齊 */
  gap: 16px;               /* 適中距離 */
  margin-bottom: 28px;
  width: 100%;
}

.metal-slot {
  /* 改用 flex 比例，自動縮放 */
  flex: 1;
  max-width: 140px;
  min-width: 100px;
  cursor: pointer;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.metal-slot:hover { transform: translateY(-6px); }
.metal-slot:active { transform: scale(0.96); }

/* --- 瓶蓋 (香檳金) --- */
.metal-cap {
  width: 70%;
  height: 18px;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  /* 優雅的香檳金漸層 */
  background: linear-gradient(to right, #d4c5a9, #f2ebd9, #d4c5a9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  
  position: relative;
  z-index: 2;
  bottom: -1px; /* 往下壓蓋住縫隙 */
}

/* --- 瓶身 (磨砂玻璃白) --- */
.metal-body {
  width: 100%;
  height: 140px; /* 固定高度，保持整齊 */
  border-radius: 16px;
  
  /* 乾淨的白底 + 綠色邊框 */
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #dae6df;
  
  box-shadow: 
    0 8px 24px rgba(90, 123, 104, 0.06),
    inset 0 0 20px rgba(255, 255, 255, 0.5);
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
  
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* 選中狀態 (Active) */
.metal-slot.active .metal-body {
  border-color: #8fb79c;
  background: linear-gradient(180deg, #ffffff 0%, #f0f7f3 100%);
  box-shadow: 0 0 0 3px rgba(143, 183, 156, 0.2);
}

/* 文字優化 */
.metal-text {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #7a8c82;
  line-height: 1.4;
  z-index: 2;
}

.metal-slot.active .metal-text {
  color: #2f4b3c;
}

.metal-sub {
  display: block;
  font-size: 12px;
  color: #aabcb2;
  margin-top: 4px;
  font-weight: 400;
}

/* =========================================
   3. 進度條與按鈕
   ========================================= */
.giftbox-progress {
  width: 85%; /* 稍微縮窄，比較優雅 */
  margin: 10px auto 24px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #eef1f0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8fb79c, #5a7b68);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 99px;
}

.progress-text {
  margin-top: 8px;
  font-family: "Didot", "Times New Roman", serif; /* 數字用襯線體比較高級 */
  font-size: 14px;
  color: #7a8c82;
}

.giftbox-status {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #99a;
  margin-bottom: 16px;
  min-height: 24px;
}

.giftbox-submit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  background: #e0e6e3;
  color: #aabcb2;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: not-allowed;
  box-shadow: none;
}

.giftbox-submit.enabled {
  background: linear-gradient(135deg, #5a7b68, #8fb79c);
  color: #fff;
  box-shadow: 0 6px 16px rgba(90, 123, 104, 0.25);
  cursor: pointer;
}
.giftbox-submit.enabled:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(90, 123, 104, 0.35); }
.giftbox-submit.enabled:active { transform: scale(0.98); }

/* 完成時的容器光暈 */
.gold-flow-active {
  border-color: #8fb79c !important;
  box-shadow: 
    0 10px 40px rgba(90, 123, 104, 0.15),
    0 0 0 2px rgba(143, 183, 156, 0.2) !important;
  transition: all 0.5s ease;
}

.box-style-btn.active {
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-weight: 700;
}

/* =========================================
   4. 茶葉飛入動畫粒子 (GSAP 用)
   ========================================= */
.leaf-particle {
  position: fixed;
  width: 12px;
  height: 12px;
  background-color: #5a7b68;
  border-radius: 50% 0 50% 0; /* 葉子形狀 */
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
}

.fly-item {
  position: fixed; 
  z-index: 9999;
  width: 32px; 
  height: 32px;
  background: radial-gradient(circle, #8fb79c, #5a7b68);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(90, 123, 104, 0.4);
  transition: all 0.8s cubic-bezier(0.2, 1, 0.2, 1);
}

/* =========================================
   6. 選擇茶品彈窗 (Selector Modal) - 這是您要找回來的！
   ========================================= */

/* 遮罩層 */
.selector-modal {
  position: fixed;
  inset: 0; /* 佔滿全螢幕 */
  z-index: 10000;
  background: rgba(40, 50, 45, 0.4); /* 深綠半透明遮罩 */
  backdrop-filter: blur(6px);
  display: none; /* JS 控制開關 */
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.selector-modal.show { opacity: 1; }

/* 彈窗本體 */
.selector-panel {
  width: 90%;
  max-width: 380px;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.selector-modal.show .selector-panel { transform: scale(1); }

/* 標題列 */
.selector-header {
  padding: 16px 20px;
  background: linear-gradient(to right, #f7faf8, #ffffff);
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selector-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #2f4b3c;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 關閉按鈕 */
.selector-header .close-btn {
  background: #f0f2f1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.selector-header .close-btn:hover { background: #e0e6e3; color: #2f4b3c; }

/* 列表區域 */
.selector-list-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  background: #fcfdfd;
}

/* 單個選項 */
.selector-item {
  padding: 16px 24px;
  border-bottom: 1px solid #f0f5f3;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selector-item:last-child { border-bottom: none; }
.selector-item:hover { background: #f0f7f4; }

/* 選項文字 */
.sel-name { font-size: 16px; font-weight: 600; color: #2f4b3c; }
.sel-meta { font-size: 13px; color: #889990; margin-top: 4px; }
.sel-price { font-weight: 700; color: #b8860b; font-family: "Noto Serif TC", serif; }

/* =========================================
   GIFTBOX QUANTITY SELECTOR (數量控制器)
   ========================================= */
/* 1. 外層容器：確保垂直置中 */
.giftbox-qty-row {
  display: flex;
  align-items: center; /* 垂直置中 */
  justify-content: center;
  gap: 16px; /* 標籤與控制器的距離 */
  margin: 12px auto;
}

.giftbox-qty-row label {
  font-family: "Noto Serif TC", serif;
  font-size: 14px;
  color: #8c7c62;
  letter-spacing: 1px;
  margin: 0;
  line-height: 1; /* 避免標籤本身有高度偏差 */
}

/* 2. 控制器本體：彈性佈局 */
.qty-control {
  display: flex;
  align-items: center; /* 讓按鈕跟輸入框的中線對齊 */
  gap: 8px; /* 按鈕跟輸入框的間距 */
}

/* 3. 按鈕整形：強制正圓 */
.qty-btn {
  /* 強制固定尺寸，這是圓形的關鍵 */
  width: 32px !important; 
  height: 32px !important;
  min-width: 32px; /* 防止被擠壓 */
  
  /* 移除瀏覽器預設樣式 */
  padding: 0;
  margin: 0;
  border: 1px solid #dcdcdc; /* 淺灰色細邊框 */
  border-radius: 50%; /* 50% 才是正圓 */
  background: #fff;
  
  /* 內容置中 (讓 + - 號絕對置中) */
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* 文字樣式 */
  color: #5a665e;
  font-size: 18px; /* 符號大小 */
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03); /* 極淡的陰影增加立體感 */
}

.qty-btn:hover {
  border-color: #8fb79c;
  color: #2f4b3c;
  background: #f4f8f6;
}

.qty-btn:active {
  transform: scale(0.92); /* 點擊時微縮 */
}

/* 4. 輸入框整形：高度與按鈕一致 */
.qty-control input#box-qty {
  /* 高度設定與按鈕相同 */
  height: 32px; 
  width: 48px; /* 寬度適中 */
  
  /* 清除預設樣式 */
  padding: 0;
  margin: 0;
  background: transparent;
  border: 1px solid #e0e0e0; /* 給一個淡淡的框，比截圖裡的細一點 */
  border-radius: 6px; /* 圓角矩形，不要太圓 */
  
  /* 文字樣式 */
  text-align: center;
  font-family: "Didot", "Times New Roman", serif;
  font-size: 16px;
  color: #2f4b3c;
  font-weight: 600;
  
  /* 移除 outline */
  outline: none;
}

/* 移除輸入框右邊那個醜醜的上下箭頭 (Chrome/Safari) */
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-control input[type=number] {
  -moz-appearance: textfield; /* Firefox */
}
/* --- 2. 修復茶葉動畫 (補上缺少的 CSS) --- */
.leaf-particle {
  position: absolute;
  width: 12px;       /* 必須設定大小 */
  height: 12px;      /* 必須設定大小 */
  background-color: #5a7b68; /* 預設顏色，JS 會覆蓋，但要有備用 */
  border-radius: 2px 10px;   /* 葉子形狀：對角圓角 */
  opacity: 0;
  z-index: 2147483647; /* ⭐️ 關鍵：一定要比 Modal 和 Card 高，設最大值 */
  pointer-events: none;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.1); /* 加一點陰影更有立體感 */
}

/* =========================================
   新增：禮盒形象展示區 (Showcase)
   ========================================= */
.giftbox-showcase {
  position: relative;
  width: 100%;
  max-width: 460px; /* 稍微放寬一點 */
  margin: 0 auto 24px auto;
  
  /* 🟢 修改重點：移除 background: #fff，改用透明 */
  background: transparent; 
  border-radius: 20px;
  overflow: visible; /* 允許陰影超出 */
  box-shadow: none;  /* 移除原本的方塊陰影 */
  
  /* 初始載入動畫 */
  animation: fadeInDown 0.8s cubic-bezier(0.2, 1, 0.3, 1) forwards;
  opacity: 0; 
  transform: translateY(-10px);
}

.giftbox-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px; /* 圖片本身圓角 */
  
  /* 讓圖片本身浮起來的陰影 */
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15));
  transition: transform 0.5s ease, filter 0.5s ease;
}

.giftbox-showcase:hover .giftbox-img {
  transform: translateY(-5px) scale(1.02);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.2));
}

/* 標籤優化 */
.giftbox-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  color: #8B0000; /* 深紅 */
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.5);
  z-index: 5;
}

/* =========================================
   3. 禮盒款式選擇按鈕 (Red/Gold Selector)
   ========================================= */
/* 這是 JS 產生的按鈕樣式，請直接加在 CSS 檔案裡 */

#box-style-selector {
  margin-top: 20px !important;
  padding: 4px;
  /* 給按鈕區一個淺淺的底座，像膠囊一樣 */
  background: rgba(230, 235, 232, 0.4);
  border-radius: 30px;
  display: inline-flex !important; /* 讓底座隨內容寬度 */
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

/* 按鈕基礎樣式 */
.box-style-btn {
  /* 覆寫 JS inline style 的部分屬性 */
  border: 1px solid transparent !important;
  background: transparent !important;
  padding: 8px 18px !important;
  border-radius: 24px !important;
  font-family: "Noto Serif TC", serif;
  color: #666;
  font-weight: 500;
  
  /* 滑鼠互動 */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.box-style-btn:hover {
  color: #2f4b3c;
  background: rgba(255,255,255,0.5) !important;
}

/* 🔴 紅色禮盒 - 選中狀態 (需要配合 JS logic) */
/* 由於 JS 是寫死 inline style，建議這段主要是作為參考，
   或者回到 JS 把 inline style 拿掉，改用 class 控制 (推薦) */

/* 如果你想用純 CSS 覆蓋 JS 的 inline style，可以用屬性選取器 */
.box-style-btn[style*="font-weight: bold"] {
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
  color: #2f4b3c !important;
  transform: scale(1.05);
}

/* 針對不同款式的邊框色 (如果 JS 有設定 border color，這裡會輔助) */
/* 紅色選中時 */
.box-style-btn[style*="rgb(139, 0, 0)"] { /* 對應 #8B0000 */
  border-color: #eecbcb !important; /* 淺紅邊框 */
  color: #8B0000 !important;
}

/* 金色選中時 */
.box-style-btn[style*="rgb(212, 175, 55)"] { /* 對應 #D4AF37 */
  border-color: #e8dcb5 !important; /* 淺金邊框 */
  color: #9a7d2e !important;       /* 深金字體 */
  background: linear-gradient(to bottom, #fff, #faf8f2) !important; /* 微金色漸層 */
}

/* 定義動畫 */
@keyframes fadeInDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 手機版微調 */
@media (max-width: 480px) {
  .giftbox-showcase {
    margin-bottom: 24px;
    border-radius: 12px;
  }
}