/* ==========================================================================
   真愛安全帽 - 旗艦高質感大地燕麥系樣式表 (PREMIUM OATMEAL & DESIGNER ICONS EDITION)
   Palette:
     #F9F8F6 (Light Oatmeal Background)
     #EFE9E3 (Subtle Border & Element Background)
     #D9CFC7 (Muted Taupe Accent)
     #C9B59C (Warm Oatmeal Brown Primary)
     #4A433E (Deep Warm Charcoal Text)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  /* 核心色彩變數 */
  --bg-body: #F9F8F6;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F5EFEB;
  --bg-glass: rgba(249, 248, 246, 0.92);
  
  --border-subtle: #EFE9E3;
  --border-medium: #D9CFC7;
  --border-active: #C9B59C;
  
  --primary: #C9B59C;
  --primary-hover: #B8A185;
  --primary-dark: #8C755B;
  
  --text-main: #4A433E;
  --text-muted: #8C8279;
  --text-light: #B5ABA2;
  --text-white: #FFFFFF;
  
  --success: #10B981;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  
  /* 陰影與立體感 */
  --shadow-sm: 0 2px 8px rgba(74, 67, 62, 0.04);
  --shadow-md: 0 8px 20px rgba(74, 67, 62, 0.06);
  --shadow-lg: 0 16px 36px rgba(74, 67, 62, 0.08);
  --shadow-glow: 0 0 0 3px rgba(201, 181, 156, 0.25);
  
  /* 圓角弧度 */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  /* 動畫時序 */
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基礎重設 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   0. 全局向量 SVG 圖示規範 (Designer Icon System)
   ========================================================================== */
.icon-svg {
  width: 1.25em;
  height: 1.25em;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
  display: inline-block;
  transition: transform var(--transition-fast);
}

.icon-sm {
  width: 1.05em;
  height: 1.05em;
}

.icon-xs {
  width: 0.9em;
  height: 0.9em;
}

.icon-xl {
  width: 2.85rem;
  height: 2.85rem;
  stroke-width: 1.8;
  color: var(--primary-dark);
}

.icon-header {
  width: 1.55rem;
  height: 1.55rem;
  stroke-width: 2.2;
  color: var(--primary-dark);
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-with-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ==========================================================================
   1. 頂部精緻導覽列 (Site Header)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.5rem;
  transition: all var(--transition-normal);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Logo 區域 */
.logo-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.logo-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

body.admin-mode .logo-link {
  cursor: default;
}

.logo-text {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-main);
  user-select: text;
  -webkit-user-select: text;
}

.logo-accent {
  color: var(--primary-dark);
  font-weight: 700;
  margin-left: 2px;
}

/* 模式切換器 */
.mode-switcher {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(201, 181, 156, 0.4);
}

/* ==========================================================================
   2. 店長管理模式操作列 (Admin Action Bar)
   ========================================================================== */
.admin-action-bar {
  background: var(--primary-dark);
  color: var(--text-white);
  padding: 0.85rem 1.5rem;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s ease-out;
}

.admin-bar-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  background: #34D399;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3);
  animation: pulse 2s infinite;
}

.admin-status-text {
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-senior-add-main {
  background: var(--bg-surface);
  color: var(--primary-dark);
  border: none;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-senior-add-main:hover {
  transform: translateY(-2px);
  background: var(--bg-surface-alt);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.btn-senior-add-main .icon-svg {
  width: 1.35rem;
  height: 1.35rem;
  stroke-width: 2.6;
}

/* ==========================================================================
   3. 全局 CMS 編輯觸發按鈕 (Edit Trigger Buttons)
   ========================================================================== */
.module-container {
  position: relative;
  transition: all var(--transition-normal);
}

.edit-trigger-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: var(--primary-dark);
  color: var(--text-white);
  border: 2px solid var(--bg-surface);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(74, 67, 62, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.edit-trigger-btn .icon-svg {
  width: 1.1em;
  height: 1.1em;
  stroke-width: 2.2;
}

.edit-trigger-btn:hover {
  background: var(--text-main);
  transform: scale(1.05);
}

/* 店長模式下常駐顯示 */
.admin-mode .module-container {
  border-radius: var(--radius-lg);
}

.admin-mode .module-container .edit-trigger-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Logo 專用位置 */
#logoModule .edit-trigger-btn {
  top: -6px;
  left: calc(100% + 14px);
  right: auto;
}

/* 分類專用位置 */
.edit-cat-btn {
  top: -46px;
  right: 0;
}

/* ==========================================================================
   4. 主頁 Bento Box 排版 (Hero & Store Info)
   ========================================================================== */
.hero-bento-section {
  max-width: 1280px;
  margin: 1.5rem auto 2.5rem auto;
  padding: 0 1.5rem;
}

.hero-bento-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  grid-template-rows: auto auto;
  gap: 1.5rem;
  align-items: stretch;
}

.bento-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.bento-box:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

/* 1. 標語文案區塊 */
.hero-text-box {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  padding: 2.75rem 2.75rem 2rem 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-tag-badge {
  display: inline-block;
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  width: fit-content;
  margin-bottom: 1.25rem;
  letter-spacing: 0.5px;
}

.hero-title {
  font-size: 2.85rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 1.2rem;
  letter-spacing: -0.5px;
}

.hero-title .highlight {
  color: var(--primary);
  display: inline-block;
}

.hero-subtitle {
  font-size: 1.12rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 95%;
}

/* 2. 門市營業資訊區塊 */
.hero-info-box {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
  padding: 1.75rem 2.75rem;
  background: var(--bg-surface);
}

.info-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.info-box-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.info-box-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--bg-surface-alt);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.5;
}

.info-item .icon-svg {
  margin-top: 0.15rem;
  color: var(--primary-dark);
}

.info-label {
  font-weight: 800;
  color: var(--primary-dark);
  white-space: nowrap;
  min-width: 76px;
}

.info-value {
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.info-link {
  color: var(--text-main);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition-fast);
}

.info-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.info-link .icon-xs {
  color: var(--primary-dark);
}

/* 3. 主視覺圖片區塊 (自適應高度切齊) */
.hero-image-box {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  padding: 0;
  background: var(--bg-surface-alt);
  min-height: 380px;
}

.image-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.hero-image-box:hover .image-wrapper img {
  transform: scale(1.03);
}

/* ==========================================================================
   5. 控制列 (分類標籤與搜尋)
   ========================================================================== */
.controls-section {
  max-width: 1280px;
  margin: 0 auto 2rem auto;
  padding: 0 1.5rem;
}

.controls-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: var(--bg-surface);
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  flex: 1;
}

.pill-btn {
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pill-btn:hover {
  background: #EDE6E0;
  color: var(--text-main);
}

.pill-btn.active {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(201, 181, 156, 0.4);
}

/* 店長模式下的複合分類藥丸（具備充足篩選點擊區域與 active 狀態） */
.category-pill-admin-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-alt);
  border: 1.5px solid var(--border-medium);
  padding: 5px 8px 5px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.category-pill-admin-item:hover {
  background: #EDE6E0;
  border-color: var(--primary);
}

.category-pill-admin-item.active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(74, 67, 62, 0.3);
}

.category-pill-admin-item.active .cat-name-input {
  color: #FFFFFF !important;
  background: rgba(255, 255, 255, 0.15) !important;
  outline-color: #FCA5A5 !important;
}

.category-pill-admin-item.active .cat-del-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.category-pill-admin-item.active .cat-del-btn:hover {
  background: #EF4444;
  color: #FFFFFF;
}

.category-pill-admin-item .cat-name-input {
  cursor: text !important;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  outline: 1.5px dashed #EF4444 !important;
  outline-offset: 2px !important;
  padding: 2px 10px !important;
  border-radius: 4px !important;
  background: rgba(239, 68, 68, 0.05) !important;
  min-width: 42px;
  transition: all 0.2s ease;
  user-select: text;
}

.category-pill-admin-item .cat-name-input:focus {
  outline: 2px solid #DC2626 !important;
  background: #FFFFFF !important;
  color: var(--text-main) !important;
}

.category-pill-admin-item .cat-del-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.12);
  color: #DC2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.category-pill-admin-item .cat-del-btn:hover {
  background: #DC2626;
  color: #FFFFFF;
  transform: scale(1.15);
}

.category-pill-admin-item .cat-del-btn .icon-svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}

/* 行內新增分類藥丸按鈕 */
.btn-inline-add-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.06);
  border: 1.5px dashed #EF4444;
  color: #DC2626;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-inline-add-cat:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #DC2626;
  transform: translateY(-1px);
}

.btn-inline-add-cat .icon-svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.8;
}

/* 搜尋框 */
.search-box-wrapper {
  min-width: 280px;
}

.search-input-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-box {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input-inner input {
  width: 100%;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 38px 10px 42px;
  border-radius: var(--radius-pill);
  outline: none;
  transition: all var(--transition-fast);
}

.search-input-inner input:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.clear-search-btn:hover { color: var(--text-main); }

/* ==========================================================================
   6. 商品展示網格 (Product Grid)
   ========================================================================== */
.products-section {
  max-width: 1280px;
  margin: 0 auto 5rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.products-container {
  width: 100%;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

/* 商品卡片 */
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

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

/* 1:1 正方形商品縮圖 */
.product-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-surface-alt);
  position: relative;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.product-card:hover .product-thumb img {
  transform: scale(1.06);
}

/* 商品內容 */
.product-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background: var(--bg-surface);
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.product-cat-tag {
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.product-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.65rem;
}

.product-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.product-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.product-view-hint {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.product-view-hint .icon-svg {
  width: 1em;
  height: 1em;
  transition: transform var(--transition-fast);
}

.product-card:hover .product-view-hint .icon-svg {
  transform: translateX(4px);
}

/* 查無商品空狀態 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-medium);
}

.empty-icon-box {
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.empty-icon-box .icon-svg {
  width: 3.5rem;
  height: 3.5rem;
}

.empty-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ==========================================
   7. 頁尾宣告 (Footer)
   ========================================== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem;
  margin-top: auto;
  text-align: center;
}

.footer-copy {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================
   8. 彈窗系統 (Modals - 高級燕麥長者友善)
   ========================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 67, 62, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.senior-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-backdrop.active .senior-modal {
  transform: translateY(0) scale(1);
}

/* Modal 標題列 */
.senior-modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
}

.senior-modal-title {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-main);
}

.btn-close-modal {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-close-modal:hover {
  background: #E5DDD5;
  transform: rotate(90deg);
}

/* Modal 內容滾動區 (Flex: 1) */
.senior-modal-body {
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
  background: var(--bg-body);
}

/* Modal 固定底部操作列 (Sticky Footer) */
.senior-modal-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.04);
  z-index: 10;
}

/* 表單元件 */
.senior-form-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.senior-label {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  color: var(--text-main);
}

.senior-input, .senior-textarea, .senior-select {
  width: 100%;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 600;
  outline: none;
  transition: all var(--transition-fast);
}

.senior-input:focus, .senior-textarea:focus, .senior-select:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.senior-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.input-hint {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

/* 密碼輸入框組合 */
.pwd-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.btn-toggle-pwd:hover { color: var(--text-main); }

/* 照片拍照與上傳區 */
.photo-upload-area {
  border: 3px dashed var(--border-medium);
  background: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.photo-upload-area:hover {
  background: #EFE7E0;
  border-color: var(--primary);
}

.upload-icon-circle {
  margin-bottom: 0.5rem;
}

.upload-text-main {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.upload-text-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.photo-preview-img {
  max-width: 100%;
  max-height: 240px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  box-shadow: var(--shadow-md);
}

/* 大按鈕系列 */
.btn-senior-save {
  background: var(--primary-dark);
  color: var(--text-white);
  border: none;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 14px rgba(140, 117, 91, 0.35);
  transition: all var(--transition-fast);
  text-align: center;
  text-decoration: none;
  display: block;
}

.btn-senior-save:hover {
  background: #75614B;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(140, 117, 91, 0.45);
}

.btn-senior-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-medium);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: all var(--transition-fast);
}

.btn-senior-cancel:hover {
  background: var(--bg-surface-alt);
  color: var(--text-main);
}

.btn-senior-delete {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: all var(--transition-fast);
}

.btn-senior-delete:hover {
  background: var(--danger-bg);
}

/* 顧客商品詳情彈窗 */
.product-detail-modal {
  max-width: 780px;
}

.detail-modal-body {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 2rem;
  padding: 2.25rem;
  background: var(--bg-surface);
}

.detail-image-container {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface-alt);
  box-shadow: var(--shadow-md);
}

.detail-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info-container {
  display: flex;
  flex-direction: column;
}

.detail-category-badge {
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  width: fit-content;
  margin-bottom: 0.75rem;
}

.detail-product-name {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 1.25rem;
}

.detail-desc-box {
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.detail-desc-label {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.detail-desc-text {
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-store-callout {
  margin-top: auto;
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  position: relative;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.callout-edit-btn {
  top: -8px !important;
  right: 0 !important;
  font-size: 0.85rem !important;
  padding: 5px 12px !important;
  box-shadow: var(--shadow-sm) !important;
}

.detail-section-edit-btn {
  top: 6px !important;
  right: 6px !important;
  font-size: 0.88rem !important;
  padding: 5px 12px !important;
  box-shadow: var(--shadow-sm) !important;
}

/* ==========================================================================
   行內即時編輯系統 (紅色虛線視覺指引 & INLINE EDITING)
   ========================================================================== */

/* 店長模式下：所有可編輯文字常駐紅色虛線外框 (預留充足最小空間與空值佔位) */
body.admin-mode [data-inline-edit] {
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  display: inline-block !important;
  min-width: 38px !important;
  min-height: 1.2em !important;
  vertical-align: baseline !important;
  margin: 0 3px !important;
  padding: 1px 6px !important;
  outline: 1.5px dashed #EF4444 !important;
  outline-offset: 2px !important;
  border-radius: 4px !important;
  background: rgba(239, 68, 68, 0.05) !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

/* 當文字被完全清空時，自動顯示防坍塌佔位字 */
body.admin-mode [data-inline-edit]:empty::before {
  content: '點此輸入';
  color: rgba(220, 38, 38, 0.65);
  font-size: 0.85em;
  font-style: italic;
  font-weight: 500;
  pointer-events: none;
}

body.admin-mode [data-inline-edit]:hover {
  outline: 2px dashed #DC2626 !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

body.admin-mode [data-inline-edit]:focus {
  outline: 2px solid #DC2626 !important;
  background: #FFFFFF !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25) !important;
  color: var(--text-main) !important;
}

/* 店長模式下：所有可更換圖片常駐紅色虛線外框 */
body.admin-mode [data-inline-image] {
  cursor: pointer !important;
  position: relative !important;
  outline: 2.5px dashed #EF4444 !important;
  outline-offset: -2px !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.2s ease !important;
}

body.admin-mode [data-inline-image]:hover {
  outline: 3px dashed #DC2626 !important;
}

/* 行內分類快速切換下拉選單 */
.inline-cat-select {
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-medium);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

body.admin-mode .inline-cat-select,
body.admin-mode [data-inline-cat] {
  outline: 1.5px dashed #EF4444 !important;
  outline-offset: 3px !important;
  background: rgba(239, 68, 68, 0.05) !important;
}

body.admin-mode .inline-cat-select:focus {
  outline: 2px solid #DC2626 !important;
  background: #FFFFFF !important;
}

/* 超連結網址自訂按鈕 (店長模式) */
.inline-link-edit-btn {
  background: rgba(239, 68, 68, 0.06);
  border: 1.5px dashed #EF4444;
  color: #DC2626;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.inline-link-edit-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #DC2626;
  transform: translateY(-1px);
}

.inline-link-edit-btn .icon-svg {
  width: 0.85em;
  height: 0.85em;
  stroke-width: 2.4;
}

/* 點擊更換照片提示標籤 (改至圖片正中央底部或左上方，避免與右上角刪除鍵重疊) */
body.admin-mode [data-inline-image]::after {
  content: '📷 點擊更換照片';
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(220, 38, 38, 0.92);
  color: #FFFFFF;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 5;
  white-space: nowrap;
}

body.admin-mode [data-inline-image]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 商品卡片刪除按鈕：固定在卡片右上角 */
.card-delete-btn {
  top: 10px !important;
  right: 10px !important;
  font-size: 0.85rem !important;
  padding: 5px 12px !important;
  z-index: 10 !important;
  box-shadow: var(--shadow-sm) !important;
}

body.admin-mode .hero-banner-image [data-inline-image]::after {
  top: 16px;
  right: 16px;
}

/* 行內編輯小提示徽章 */
.inline-edit-hint-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--bg-surface-alt);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: 6px;
  vertical-align: middle;
}

.detail-header-group .detail-section-edit-btn {
  top: 0 !important;
  right: 0 !important;
}

.callout-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.callout-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==========================================================================
   9. 全局 Toast 提示元件
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #10B981;
  color: #FFFFFF;
  padding: 16px 28px;
  border-radius: var(--radius-pill);
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideDown 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 1;
  transition: all 0.25s ease;
}

.toast .icon-svg {
  width: 1.4em;
  height: 1.4em;
  stroke-width: 2.5;
}

.toast.toast-warning {
  background: var(--text-main);
}

.toast-undo-btn {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--transition-fast);
}

.toast-undo-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.toast.hiding {
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
}

/* ==========================================================================
   10. 動畫與響應式斷點 (RWD)
   ========================================================================== */
@keyframes toastSlideDown {
  0% { opacity: 0; transform: translateY(-30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@media (max-width: 900px) {
  .hero-bento-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-image-box {
    grid-column: 1 / 2;
    grid-row: auto;
    min-height: 300px;
  }

  .detail-modal-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .site-header { padding: 0.5rem 1rem; }
  .hero-bento-section, .controls-section, .products-section { padding: 0 1rem; }
  
  .hero-text-box { padding: 2rem 1.5rem; }
  .hero-title { font-size: 2.2rem; }
  .hero-info-box { padding: 1.5rem; }
  
  .controls-container { padding: 1rem; flex-direction: column; align-items: stretch; }
  .search-box-wrapper { min-width: 100%; }
  
  .senior-modal { max-height: 94vh; }
  .senior-modal-header, .senior-modal-body, .senior-modal-footer { padding: 1.25rem; }
}

/* ==========================================================================
   浮動儲存膠囊 (Floating Save Capsule)
   ========================================================================== */
.floating-save-capsule {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.admin-mode .floating-save-capsule {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.capsule-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(36, 32, 28, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 10px 18px 10px 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(201, 181, 156, 0.35);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.capsule-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.capsule-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
}

.floating-save-capsule.has-changes .capsule-inner {
  border-color: #EF4444;
  box-shadow: 0 14px 40px rgba(239, 68, 68, 0.35), 0 0 0 1px rgba(239, 68, 68, 0.4);
}

.floating-save-capsule.has-changes .capsule-dot {
  background: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4);
  animation: pulse 1.5s infinite;
}

.capsule-text {
  color: #FFFFFF;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.capsule-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.capsule-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  font-family: inherit;
}

.capsule-btn-discard {
  background: rgba(255, 255, 255, 0.12);
  color: #E5E7EB;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.capsule-btn-discard:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.capsule-btn-save {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(201, 181, 156, 0.4);
}

.capsule-btn-save:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201, 181, 156, 0.6);
}

.floating-save-capsule.has-changes .capsule-btn-save {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.6) !important;
}

.floating-save-capsule.has-changes .capsule-btn-save:hover {
  background: #B91C1C !important;
  transform: scale(1.04) translateY(-1px);
}

.capsule-btn .icon-svg {
  width: 1.1em;
  height: 1.1em;
  stroke-width: 2.4;
}
