/* ============================================================
   🏪 門市選擇、地圖、表單輸入樣式 (Store & Form - 終極修復版)
   ============================================================ */
/* ============================================================
   1. Store Picker (地圖選擇器 - 樣式強制修復版)
   ============================================================ */
/* === 1. 防止背景滑動 (關鍵) === */
/* 當選單開啟時，請透過 JS 給 body 加上這這 class */
body.sp-lock-scroll {
  overflow: hidden !important;
  overscroll-behavior: none;
}
/* === 容器與遮罩 === */
#store-picker { position: fixed; inset: 0; z-index: 9999; display: none; }
#store-picker[aria-hidden="false"] { display: block; }

.sp-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 30, 25, 0.45);
  backdrop-filter: blur(8px) saturate(120%);
  transition: opacity 0.4s ease;
}

/* === 主面板 === */
.sp-sheet {
  /* 定位與外觀 */
  position: fixed; 
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 -10px 40px rgba(90, 123, 104, 0.2);
  backdrop-filter: blur(20px);
  z-index: 10000;

  /* 🔥 修正 1：移除 padding，避免 sticky 時上方出現白邊空隙 */
  /* padding: 12px 20px 0;  <-- 移除這行 */
  padding: 0; 
  
  /* 🔥 修正 2：明確的高度設定 */
  height: 75vh; /* 直接鎖定高度，讓內部可以捲動 */
  max-height: 75vh;
  
  /* 動畫 */
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  
  /* 🔥 修正 3：捲動核心設定 */
  overflow-y: auto;        /* 讓這裡產生捲軸 */
  overscroll-behavior: contain; /* 防止捲到底部時觸發瀏覽器下拉重整 */
  -webkit-overflow-scrolling: touch; /* iOS 滑順捲動 */
  
  /* 佈局 (維持 Flex 可以，但要小心子元素壓縮) */
  display: flex; 
  flex-direction: column; 
  /* gap: 12px; <-- 建議移除外層 gap，改用 margin 控制，sticky 比較精準 */
}
.sp-sheet.sp-open { transform: translateY(0); }

/* === 1. 拉桿 (Handle) === */
/* 優化點：增加頂部間距，使用更柔和的顏色和更細緻的陰影，看起來更有立體感 */
.sp-handle {
  width: 40px; /* 稍微變窄一點，更優雅 */
  height: 5px;
  background: #e0e8e4; /* 使用帶一點點綠色調的淺灰，比純灰更有質感 */
  border-radius: 10px;
  margin: 12px auto 8px; /* 增加上方間距，讓它不要貼著頂部邊緣 */
  flex-shrink: 0;
  /* 增加一點點內部陰影，製造凹槽感，提升精緻度 */
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
  cursor: grab;
  opacity: 0.8;
}

/* === 2. 標題列容器 (Header) === */
/* 優化點：移除生硬的底部邊框線，改用更大的 Padding 來創造空間感 */
.sp-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* 增加內距，讓標題有呼吸空間 */
  padding: 12px 24px 16px; 
  flex-shrink: 0;
  /* 🔥 移除這條生硬的線，用空間區隔更有質感 */
  /* border-bottom: 1px solid rgba(0,0,0,0.06); */
  margin-bottom: 0; 
}
.sp-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px; /* 設定高度為 1px */
  background-color: rgba(0, 0, 0, 0.08); /* 很淡的灰色，不刺眼 */
  transform: scaleY(0.5); /* 🔥 魔法：壓縮成 0.5px，在手機上看會超細緻 */
  transform-origin: bottom;
  width: 100%;
}

/* === 3. 標題文字 (H3) === */
/* 優化點：微調字體大小，確保與圖標垂直置中對齊 */
.sp-header h3 {
  font-size: 20px; /* 稍微加大一點氣勢 */
  font-weight: 700;
  color: #2f4b3c; /* 維持深綠色主題 */
  letter-spacing: 0.5px;
  display: flex;
  align-items: center; /* 確保圖標和文字垂直置中 */
  margin: 0;
}

/* === 4. SVG 圖釘圖標 (Icon) === */
/* 優化點：調整金色，使其更溫潤，並增加與文字的間距 */
.sp-header h3::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 10px; /* 增加與文字的距離 */
  /* 使用更溫潤、更有質感的金色 */
  background-color: #c49a25; 
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M11.54 22.351l.07.04.028.016a.76.76 0 00.723 0l.028-.015.071-.041a16.975 16.975 0 001.144-.742 19.58 19.58 0 002.683-2.282c1.944-1.99 3.963-4.98 3.963-8.827a8.25 8.25 0 00-16.5 0c0 3.846 2.02 6.837 3.963 8.827a19.58 19.58 0 002.682 2.282 16.975 16.975 0 001.145.742zM12 13.5a3 3 0 100-6 3 3 0 000 6z' clip-rule='evenodd' /%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M11.54 22.351l.07.04.028.016a.76.76 0 00.723 0l.028-.015.071-.041a16.975 16.975 0 001.144-.742 19.58 19.58 0 002.683-2.282c1.944-1.99 3.963-4.98 3.963-8.827a8.25 8.25 0 00-16.5 0c0 3.846 2.02 6.837 3.963 8.827a19.58 19.58 0 002.682 2.282 16.975 16.975 0 001.145.742zM12 13.5a3 3 0 100-6 3 3 0 000 6z' clip-rule='evenodd' /%3E%3C/svg%3E") no-repeat center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* === 5. 關閉按鈕 (Close Button) === */
/* 優化點：移除顯眼的灰色背景，改用透明背景和主題色圖標，並加入 Hover 效果 */
.sp-close {
  font-size: 26px; /* 圖標稍微大一點 */
  width: 36px;
  height: 36px;
  /* background: rgba(0,0,0,0.04); 🔥 移除這個灰底 */
  background: transparent; /* 改為透明 */
  border-radius: 50%;
  border: none;
  color: #2f4b3c; /* 使用主題深綠色，比較強烈 */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease; /* 加入過渡效果 */
}

/* 加入高質感的 Hover 效果 */
.sp-close:hover {
  background-color: rgba(47, 75, 60, 0.08); /* 滑鼠移上去時出現淡淡的主題色背景 */
  color: #1a2e24; /* 顏色變深一點 */
  transform: scale(1.05); /* 微微放大 */
}

.sp-close:active {
  transform: scale(0.95); /* 點擊時微微縮小，增加回饋感 */
}

/* === 🔥 工具列修正 (強制樣式) === */
.sp-toolbar {
  display: flex !important;
  flex-direction: column !important; /* 垂直堆疊 */
  align-items: stretch !important;   /* 左右拉伸填滿 */
  justify-content: flex-start !important;
  gap: 12px !important;              /* 間距 */
  margin-bottom: 16px;
  width: 100% !important;            /* 容器本身也要滿寬 */
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 20px 20px 12px 20px;
}

/* 強制指定工具列內的輸入框樣式 */
#store-picker .sp-select,
#store-picker .sp-input {
  display: block !important;
  width: 100% !important;       /* 寬度填滿 */
  max-width: 100% !important;
  min-width: 0 !important;      /* 防止 Flexbox 溢出 */
  
  height: 48px !important;      /* 高度固定 */
  min-height: 48px !important;
  
  padding: 0 16px !important;   /* 內距 */
  padding-right: 40px !important; /* 右邊留給箭頭 */
  
  font-size: 16px !important;   /* 字體大小 */
  line-height: 1.5 !important;
  
  border-radius: 12px !important;
  border: 1.5px solid rgba(170, 190, 180, 0.5) !important;
  background-color: #fcfdfd !important;
  color: #2b2b2b !important;
  
  /* 🔥 關鍵：移除原生樣式，才能自訂外觀 */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  
  /* 重新載入箭頭圖示 */
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%235a7b68' stroke-width='1' d='M1 2l5 5 5-5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 12px auto !important;
  
  box-sizing: border-box !important;
  margin: 0 !important; /* 清除可能存在的 margin */
}
/* 3. 搜尋按鈕 (sp-search-title) */
#store-picker .sp-search-title {
  width: 100% !important;
  height: 48px !important;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #5a7b68, #7fa38a);
  border: none;
  box-shadow: 0 4px 10px rgba(90, 123, 104, 0.2);
  cursor: pointer;
  margin-top: 4px;
}

/* 下拉箭頭 */
.sp-toolbar .sp-select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%235a7b68' stroke-width='1' d='M1 2l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

/* 聚焦效果 */
.sp-toolbar .sp-input:focus,
.sp-toolbar .sp-select:focus {
  border-color: #5a7b68; background: #fff;
  box-shadow: 0 0 0 4px rgba(90, 123, 104, 0.15); outline: none;
}

/* 搜尋按鈕 */
.sp-toolbar .sp-search-title {
  width: 100%; /* 填滿寬度 */
  height: 48px !important; /* 強制高度 */
  padding: 0;
  font-size: 16px; font-weight: 600; color: #fff; letter-spacing: 1px;
  background: linear-gradient(135deg, #5a7b68, #7fa38a);
  border: none; border-radius: 12px;
  box-shadow: 0 4px 12px rgba(90, 123, 104, 0.2);
  cursor: pointer; transition: all 0.2s;
}
.sp-toolbar .sp-search-title:hover { transform: translateY(-1px); background: linear-gradient(135deg, #4e6b58, #6d8f79); }

/* 3. 新增的捲動區域：剩下的空間都給它，捲軸長在這 */
.sp-body {
  flex: 1; /* 佔滿剩下高度 */
  overflow-y: auto; /* 🔥 捲軸移到這裡 */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* === 地圖容器 === */
#sp-map {
  height: 200px;
  width: 100%;
  flex-shrink: 0;
  
  position: -webkit-sticky;
  position: sticky;
  top: 0; /* 🔥 這裡設 0 就好！因為它是在 sp-body 裡面的頂端 */
  z-index: 10;
  
  /* 修正：如果原本有 margin，可能會影響黏貼效果，建議歸零 */
  margin: 0;
}

/* === 搜尋結果 === */
.sp-scroll {
  overflow: visible !important; /* 取消內部捲動 */
  height: auto !important;
  flex: none;
  padding-bottom: 100px; /* 底部留白 */
}
#sp-results { display: flex; flex-direction: column; }
/* 隱藏外層 Scrollbar 但保留功能 (美觀考量) */
.sp-sheet::-webkit-scrollbar {
  width: 6px;
}
.sp-sheet::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 3px;
}

.sp-item {
  padding: 16px 14px; margin-bottom: 8px; border-radius: 14px;
  background: #fff; border: 1px solid rgba(0,0,0,0.04);
  cursor: pointer; transition: all 0.2s ease;
  display: flex; justify-content: space-between; align-items: center;
}
.sp-item.active {
  background: #f0fdf4 !important; /* 淡淡的綠底 */
  border-color: #5a7b68 !important; /* 深綠邊框 */
  box-shadow: 0 0 0 2px rgba(90, 123, 104, 0.2); /* 光暈 */
  transform: scale(1.02); /* 微微放大 */
  z-index: 10;
}
.sp-item:hover { background: linear-gradient(135deg, #f5f9f7, #fff); border-color: #8fb79c; box-shadow: 0 4px 12px rgba(90, 123, 104, 0.08); transform: translateY(-1px); }
.sp-item b { color: #2f4b3c; font-size: 15.5px; }
.sp-item .muted { color: #7a8c82; font-size: 13px; margin-top: 4px; display: block; }
.sp-item .distance { font-size: 13px; font-weight: 600; color: #5a7b68; background: #e8f3ed; padding: 4px 8px; border-radius: 8px; }

/* === Leaflet === */
.leaflet-container { z-index: 1 !important; font-family: inherit; }
.leaflet-control-zoom { border: none !important; box-shadow: none !important; margin-top: 12px !important; margin-right: 12px !important; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; border-radius: 50% !important; background: rgba(255, 255, 255, 0.95) !important; box-shadow: 0 4px 14px rgba(0,0,0,0.15) !important; color: #2f4b3c !important; font-size: 18px !important; margin-bottom: 10px !important; backdrop-filter: blur(4px); }
.leaflet-popup-content-wrapper { border-radius: 12px !important; padding: 8px !important; box-shadow: 0 6px 18px rgba(90, 123, 104, 0.25) !important; }

/* 底部安全距離 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sp-sheet { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}
/* ============================================================
   2. Form Styles (收件資料表單 - 旗艦極致版)
   ============================================================ */

/* === 區塊容器 (懸浮玻璃卡片) === */
.section {
  position: relative;
  box-sizing: border-box;
  padding: 32px 28px 40px; /* 加大留白，營造高級感 */
  margin: 24px 0;
  border-radius: 28px; /* 更大的圓角 */
  
  /* 頂級玻璃質感：多層陰影 + 混合模式 */
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(245, 250, 248, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 
    0 12px 40px rgba(90, 123, 104, 0.08), /* 深處的陰影 */
    0 4px 12px rgba(90, 123, 104, 0.04),  /* 淺處的陰影 */
    inset 0 1px 0 rgba(255, 255, 255, 0.6); /* 頂部反光 */
    
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  
  opacity: 0; 
  animation: sectionFade 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes sectionFade { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* === 標題 (書法感) === */
.section-title {
  font-size: 22px;
  font-weight: 800;
  color: #2a3a32;
  margin: 0 0 24px;
  position: relative;
  letter-spacing: 1px;
  
  /* 🔥 新增：Flex 排版，讓 Icon 與文字垂直置中 */
  display: flex;
  align-items: center;
  gap: 10px; /* 圖示與文字的間距 */
}

/* 調整 Icon 的位置，稍微修正視覺重心 */
.section-title lord-icon {
  transform: translateY(-2px); /* 微調向上，對齊中文字 */
  filter: drop-shadow(0 2px 4px rgba(184, 134, 11, 0.2)); /* 給金色圖示一點光暈 */
}

/* 標題下方的「茶韻流光」 */
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 40px;
  height: 4px;
  background: linear-gradient(90deg, #8fb79c, #c8dfce);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.section:hover .section-title::after { width: 120px; } /* Hover 時延伸 */

/* === 表單群組 === */
/* 表單群組 */
.form-group { margin-bottom: 20px; position: relative; }

/* Label 優化 (稍微縮小間距) */
.form-group label, .sp-label {
  font-size: 15px; font-weight: 700; color: #3f5c4c; 
  display: block; margin-bottom: 8px; letter-spacing: 0.5px; padding-left: 2px;
}

/* 輔助文字 */
.form-group .muted {
  font-size: 12.5px; color: #8fa396; margin-top: 6px; display: block; font-weight: 400;
}

/* === 🔥 輸入框核心精修 (Input) === */
.section input[type="text"],
.section input[type="tel"],
.section input[type="number"],
.section select,
.section textarea,
.sp-input, .sp-select {
  width: 100%;
  /* ✅ 高度修正：48px 是手機最佳手感，56px 太笨重 */
  height: 48px; 
  
  /* ✅ 文字排版修正：確保垂直置中 */
  font-size: 16px; /* 防止 iOS 自動放大 */
  padding: 4px 16px; 
  line-height: normal; /* 讓瀏覽器自動計算垂直置中 */
  
  border-radius: 12px; /* 圓角稍微收斂一點，比較俐落 */
  border: 1.5px solid rgba(180, 200, 190, 0.45); 
  background: #fcfdfd; /* 極淡白，更乾淨 */
  color: #2b3b33;
  
  box-sizing: border-box;
  transition: all 0.25s ease;
  appearance: none; -webkit-appearance: none;
}

/* === ✨ 聚焦特效 (Focus) === */
.section input:focus, 
.section select:focus, 
.section textarea:focus,
.sp-input:focus, .sp-select:focus {
  border-color: #5a7b68;
  background: #ffffff;
  outline: none;
  /* 光暈縮小一點，比較精緻 */
  box-shadow: 0 0 0 3px rgba(143, 183, 156, 0.2); 
}

/* Textarea */
textarea.sp-input {
  height: auto; min-height: 100px; padding: 12px 16px; line-height: 1.5; resize: vertical;
}

/* 下拉箭頭 */
.sp-select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%235a7b68' stroke-width='1' d='M1 2l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 32px;
}

/* === 優惠碼區塊修正 === */
.promo-row {
  display: flex; gap: 10px; align-items: center; 
}
/* 確保按鈕高度跟 input 一樣 */
.promo-row button {
  flex-shrink: 0; height: 48px; padding: 0 20px;
  font-size: 15px; font-weight: 600; color: #fff; letter-spacing: 0.5px;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, #7fa38a, #9bbba6);
  box-shadow: 0 3px 8px rgba(90, 123, 104, 0.15);
  cursor: pointer; transition: all 0.2s ease;
}
.promo-row button:active { transform: scale(0.96); }

/* === 錯誤訊息修正 (改到 Input 下方，不會擠壓) === */
.error-msg {
  color: #e74c3c; font-size: 13px; margin-top: 6px;
  display: none; font-weight: 500; padding-left: 2px;
  align-items: center; gap: 4px;
}
.error-msg::before { content: "!"; display: inline-flex; width: 14px; height: 14px; background: #e74c3c; color: #fff; border-radius: 50%; font-size: 10px; justify-content: center; align-items: center; }
.error-msg.show { display: flex; animation: fadeIn 0.3s; }

/* 🔴 錯誤狀態的 Input 樣式 */
.input-error {
  border-color: #e74c3c !important;
  background: #fff5f5 !important;
  animation: shake 0.4s ease;
}

@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }

/* === 3. 運送方式 & 超商欄位 (Layout Fix) === */

/* 運送按鈕 (Radio Cards) */
.ship-options { display: flex; justify-content: center; gap: 14px; margin-bottom: 24px; }
.ship-radio {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  padding: 14px 0; border-radius: 14px; font-size: 16px; font-weight: 600;
  background: rgba(255,255,255,0.5); border: 1.5px solid rgba(200,210,205,0.5);
  color: #66776e; cursor: pointer; transition: all 0.3s;
}
.ship-radio:has(input:checked) {
  border-color: #8fb79c; background: linear-gradient(135deg, #f0f7f3, #ffffff);
  color: #2f4b3c; box-shadow: 0 4px 12px rgba(90, 123, 104, 0.15); transform: translateY(-1px);
}
.ship-radio input { display: none; }

/* 🔥【關鍵修復】Store Row 排版智慧調整 */
/* 預設：橫向排列 (給 Select + Button 用) */
.store-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}

/* 變體：如果是「標籤 + 輸入框」的組合，改為直排，避免擠壓 */
.store-row:has(label) {
  flex-direction: column; align-items: stretch; gap: 6px;
}

/* 附近門市按鈕 (美化) */
.sp-search-title {
  flex-shrink: 0; height: 48px; padding: 0 18px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #5a7b68, #7fa38a); border: none; border-radius: 12px;
  box-shadow: 0 3px 8px rgba(90,123,104,0.2); cursor: pointer; white-space: nowrap;
}
.sp-search-title:hover { transform: translateY(-1px); background: linear-gradient(135deg, #4e6b58, #6d8f79); }

/* === 新增：綠界模式樣式 === */
/* === 物流卡片容器 === */
.logistics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

/* === 卡片本體設計 === */
.logistics-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #ffffff;
  border: 1.5px solid #e0e0e0; /* 預設淺灰邊框 */
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  text-align: left;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

/* 滑鼠移上去的效果 */
.logistics-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  border-color: #b0b0b0;
}

/* 點擊後的按壓感 */
.logistics-card:active {
  transform: scale(0.98);
}

/* === 品牌識別線 (左側細條紋) === */
.brand-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
}
.line-711 { background: #f37d00; }   /* 7-11 橘 */
.line-family { background: #00a0e9; } /* 全家 藍 */

/* === 文字排版 === */
.card-content {
  display: flex;
  flex-direction: column;
  padding-left: 8px; /* 避開左邊線條 */
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 2px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}
/* === 🏪 7-ELEVEN 專屬配色 === */
.card-711 {
  border-color: #f37d00; /* 7-11 官方橘 */
}

/* 左側流動線條：綠 -> 紅 -> 橘 (經典三色條紋感) */
.line-711 { 
  background: linear-gradient(to bottom, #008249 0%, #008249 30%, #e11b22 30%, #e11b22 45%, #f37d00 45%, #f37d00 100%);
  width: 6px; /* 稍微加粗一點讓顏色明顯 */
}

/* 滑鼠懸停：橘色光暈 */
.card-711:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(243, 125, 0, 0.25); /* 橘色影子 */
  border-color: #ff9029;
}


/* === 🏠 全家 FamilyMart 專屬配色 === */
.card-family {
  border-color: #00a0e9; /* 全家 官方藍 */
}

/* 左側流動線條：藍 -> 綠 (經典雙色漸層) */
.line-family { 
  background: linear-gradient(to bottom, #00a0e9 0%, #00a0e9 55%, #009945 55%, #009945 100%);
  width: 6px;
}

/* 滑鼠懸停：藍色光暈 */
.card-family:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 160, 233, 0.25); /* 藍色影子 */
  border-color: #2dc0ff;
}

/* === 品牌識別線 (共用設定) === */
.brand-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  /* width 由上面個別設定 */
}

/* === 文字排版微調 === */
.card-content {
  display: flex;
  flex-direction: column;
  padding-left: 10px; /* 因為線變粗了，內距稍微加大 */
}

/* 讓品牌名稱也跟著變色 */
.card-711 .brand-name { color: #f37d00; }
.card-family .brand-name { color: #00a0e9; }
.action-text {
  font-size: 12px;
  color: #888;
}

.card-icon {
  font-size: 24px;
  opacity: 0.8;
}


/* === 結果顯示卡片 (Tea Shop 風格) === */
.store-result-card {
  background: #fdfdfd;
  border: 1px solid #8fb79c; /* 茶綠色邊框 */
  border-radius: 12px;
  padding: 16px;
  position: relative;
  margin-top: 10px;
  /* 加上細微的綠色光暈 */
  box-shadow: 0 4px 12px rgba(90, 123, 104, 0.1);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px dashed #eee;
  padding-bottom: 8px;
}

.result-label {
  font-size: 12px;
  color: #66776e; /* 莫蘭迪綠 */
  font-weight: 600;
  letter-spacing: 1px;
}

.reselect-btn {
  background: transparent;
  border: 1px solid #8fb79c; /* 品牌茶綠色邊框 */
  color: #5a7b68;            /* 深一點的綠色文字 */
  padding: 6px 14px;         /* 增加一點呼吸空間 */
  border-radius: 20px;       /* 圓潤的膠囊形狀 */
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;                  /* 讓圖示跟文字有點距離 */
  letter-spacing: 0.5px;
}

.reselect-btn:hover {
  background-color: #5a7b68; /* 滑鼠移上去變實心 */
  color: #ffffff;
  border-color: #5a7b68;
  transform: translateY(-1px); /* 微微浮起 */
  box-shadow: 0 2px 5px rgba(90, 123, 104, 0.2);
}

.reselect-btn:active {
  transform: translateY(0);
}

.result-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-icon-box {
  width: 40px;
  height: 40px;
  background: #f0f7f3; /* 淺茶綠底 */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.store-info {
  flex: 1;
}

.store-title {
  display: block;
  font-size: 15px;
  color: #2f4b3c; /* 深茶綠 */
  font-weight: 700;
  margin-bottom: 2px;
}

.store-addr {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

/* === 聚焦閃爍動畫 (Scroll 後提示用) === */
@keyframes highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(143, 183, 156, 0.4); border-color: #8fb79c; }
  70% { box-shadow: 0 0 0 10px rgba(143, 183, 156, 0); border-color: #2f4b3c; }
  100% { box-shadow: 0 0 0 0 rgba(143, 183, 156, 0); border-color: #8fb79c; }
}

.highlight-active {
  animation: highlight-pulse 1.5s ease-out;
}

/* === 店號小標籤 (Badge) === */
.store-id-badge {
  font-size: 12px;
  color: #666;
  background-color: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace; /* 用等寬字體，數字比較好看 */
  letter-spacing: 0.5px;
  border: 1px solid #ddd;
}

/* === 4. 宅配欄位 (Layout) === */
.delivery-row {
  display: flex; gap: 0; align-items: flex-end; margin-bottom: 16px;
  border: 1.5px solid rgba(170, 190, 180, 0.45); border-radius: 14px;
  overflow: hidden; background: rgba(255, 255, 255, 0.6);
}
.delivery-col { flex: 1; display: flex; flex-direction: column; padding: 12px 16px; position: relative; }
/* 中隔線 */
.delivery-col:first-child::after {
  content: ""; position: absolute; top: 15%; right: 0; width: 1px; height: 70%;
  background: rgba(160, 180, 165, 0.3);
}
/* 移除框線，融入背景 */
.delivery-col select { border: none; background: transparent; padding-left: 0; height: auto; box-shadow: none; font-weight: 600; }
.delivery-col select:focus { box-shadow: none; background: transparent; }
.delivery-col label { font-size: 13px; margin-bottom: 2px; color: #6b7d6f; }


/* ============================================================
   ⚡ 常用收件地址 (Smart Recent Address - Flagship)
   ============================================================ */

/* === 1. 外層容器 (玻璃光感卡片) === */
.recent-box {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(245, 250, 248, 0.8));
  border: 1px solid rgba(180, 200, 190, 0.5);
  border-radius: 20px;
  padding: 20px 22px;
  margin-bottom: 28px;
  
  /* 懸浮陰影 */
  box-shadow: 
    0 10px 30px rgba(90, 123, 104, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
    
  backdrop-filter: blur(12px);
  opacity: 1;
  transform: translateY(0);
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
  position: relative;
}

/* 隱藏狀態 */
.recent-box.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(-10px);
}

/* === 2. 標題 (帶有閃電圖示) === */
.recent-title {
  font-size: 15px;
  font-weight: 700;
  color: #2f4b3c; /* 深茶綠 */
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

/* 閃電圖示裝飾 */
.recent-title::before {
  content: "⚡"; /* 或者用 icon font */
  font-size: 14px;
  color: #e5a50a; /* 琥珀金 */
  filter: drop-shadow(0 2px 4px rgba(229, 165, 10, 0.3));
}

/* === 3. Tabs 切換器 (iOS Segmented Control 風格) === */
.recent-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.04); /* 淺灰底槽 */
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(0,0,0,0.02);
}

.recent-tab {
  flex: 1;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #7a8c82; /* 未選中顏色 */
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* 選中狀態：白底浮起 + 陰影 */
.recent-tab.active {
  background: #fff;
  color: #2f4b3c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: scale(1);
}

.recent-tab:hover:not(.active) {
  color: #4e6b58;
  background: rgba(255,255,255,0.5);
}

/* === 4. 地址列表 (票券卡片風格) === */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px; /* 預留捲軸空間 */
}

/* 捲軸美化 */
.recent-list::-webkit-scrollbar { width: 4px; }
.recent-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* 單個地址卡片 */
.recent-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid rgba(230, 235, 230, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
  
  /* 內部排版 */
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hover 效果 */
.recent-item:hover {
  border-color: #8fb79c;
  background: #f8fbf9;
  transform: translateX(2px);
  box-shadow: 0 4px 12px rgba(90, 123, 104, 0.08);
}

/* 點擊效果 */
.recent-item:active {
  transform: scale(0.98);
}

/* 地址文字 */
.recent-item .text {
  font-size: 14.5px;
  color: #333;
  line-height: 1.4;
  flex: 1;
}

/* 裝飾圖示 (JS 動態產生時可以加個 icon) */
.recent-item::before {
  content: "📍";
  font-size: 16px;
  opacity: 0.8;
}

/* 強調已選擇的項目 (如果有做這功能) */
.recent-item.selected {
  background: linear-gradient(135deg, #f0f7f3, #e6f0ea);
  border-color: #5a7b68;
  box-shadow: inset 0 0 0 1px #5a7b68;
}

/* ============================================================
   ⚡ 常用地址 - 收合模式優化 (Accordion)
   ============================================================ */

/* 1. 標題變成可點擊的按鈕 */
.recent-title {
  cursor: pointer;
  position: relative;
  padding-right: 30px; /* 留空間給箭頭 */
  transition: color 0.3s;
}

.recent-title:hover {
  color: #4e6b58;
}

/* 2. 右側箭頭動畫 */
.recent-title::after {
  content: "▼"; /* 也可以換成 icon font */
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #888;
  transition: transform 0.3s ease;
}

/* 3. 收合狀態 (.collapsed) */
.recent-box.collapsed .recent-title::after {
  transform: translateY(-50%) rotate(-90deg); /* 箭頭轉向 */
}

/* 收合時隱藏內容 */
.recent-box.collapsed .recent-tabs,
.recent-box.collapsed .recent-list {
  display: none;
}

/* 收合時的外觀微調 */
.recent-box.collapsed {
  padding-bottom: 18px; /* 減少底部留白 */
  background: rgba(255, 255, 255, 0.6); /* 稍微變透明 */
  border-color: rgba(180, 200, 190, 0.3);
}

/* 4. 選中後的標題提示文字 */
.selected-hint {
  font-size: 13px;
  font-weight: 400;
  color: #5a7b68;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}
.recent-box.collapsed .selected-hint {
  opacity: 1; /* 收合時才顯示提示 */
}

/* ============================================================
   4. Payment Options (付款方式 - 旗艦視覺版)
   ============================================================ */

/* 容器：改用 Grid 佈局，讓選項並排更有氣勢 */
.pay-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* 自動適應寬度 */
  gap: 16px;
  margin-top: 8px;
}

/* 按鈕本體 (卡片化) */
.pay-btn {
  position: relative;
  display: flex;
  flex-direction: column; /* 垂直排列內容 */
  align-items: center;    /* 置中 */
  justify-content: center;
  text-align: center;
  
  padding: 24px 16px;
  height: auto;           /* 自適應高度 */
  min-height: 110px;
  
  background: rgba(255, 255, 255, 0.5);
  border: 1.5px solid rgba(180, 190, 185, 0.4);
  border-radius: 20px;
  
  color: #66776e;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  
  /* 玻璃質感 */
  backdrop-filter: blur(4px);
  overflow: hidden; /* 為了流光動畫 */
}

/* Hover 效果：上浮 + 變亮 */
.pay-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: #a8c2b3;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(90, 123, 104, 0.1);
}

/* === Active (選中狀態) - 重點設計 === */
.pay-btn.active {
  background: linear-gradient(145deg, #f3fcf6 0%, #ffffff 100%);
  border-color: #5a7b68; /* 品牌主色 */
  color: #2f4b3c;
  
  /* 雙層陰影：內發光 + 外投影 */
  box-shadow: 
    0 10px 24px rgba(90, 123, 104, 0.15),
    inset 0 0 0 1.5px #5a7b68; /* 模擬加粗邊框，不影響排版 */
    
  transform: translateY(-2px);
}

/* === 圖示 (使用 CSS 注入 SVG，不需改 HTML) === */
.pay-btn::before {
  content: "";
  display: block;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.6; /* 未選中時淡一點 */
  transition: all 0.3s;
}

/* 貨到付款圖示 (包裹/貨車) */
.pay-btn[data-method="cod"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235a7b68' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M20 8h-9.586a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 5H4a1 1 0 00-1 1v12a1 1 0 001 1h16a1 1 0 001-1V9a1 1 0 00-1-1z'/%3E%3C/svg%3E");
}

/* 線上支付圖示 (信用卡) */
.pay-btn[data-method="online"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235a7b68' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z'/%3E%3C/svg%3E");
}

/* 選中時圖示變大、變清楚 */
.pay-btn.active::before {
  opacity: 1;
  transform: scale(1.1);
  filter: drop-shadow(0 4px 6px rgba(90, 123, 104, 0.2));
}

/* === 文字排版 === */
.pay-title {
  font-size: 17px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.pay-sub {
  font-size: 13px;
  opacity: 0.8;
  font-weight: 400;
  display: block;
}

/* === 選中時的「打勾」標記 (右上角) === */
.pay-btn.active::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5a7b68;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* 進場動畫 */
  animation: checkPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  box-shadow: 0 2px 6px rgba(90, 123, 104, 0.3);
}

@keyframes checkPop {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* === 流光背景動畫 (茶湯流動感) === */
.pay-btn.active .pay-title {
  background: linear-gradient(90deg, #2f4b3c, #4a7c5f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 手機版微調：如果螢幕太小，還是維持直排比較安全，或者縮小字體 */
@media (max-width: 360px) {
  .pay-options { grid-template-columns: 1fr; }
  .pay-btn { flex-direction: row; text-align: left; justify-content: flex-start; min-height: auto; padding: 16px; }
  .pay-btn::before { margin-bottom: 0; margin-right: 12px; }
  .pay-info { display: flex; flex-direction: column; } /* 如果你有包一層的話，但目前 HTML 沒有，所以這行備用 */
}

