/*  Content 是相框裡的照片。
    Padding 是照片和木質邊框之間的留白襯紙。
    Border 就是那圈木質邊框本身。
    Margin 是相框與掛在牆上其他相框之間的距離。
    
    padding-top: 1rem;
    
*/

/* 📸 詳細頁面小縮圖懸停動態效果 */
.thumb-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.product-detail-wrapper {
  width: 100%;
  margin: 0rem, 1.25rem auto; /* 20px -> 1.25rem */
  padding: 2rem, 2rem;        /* 32px -> 2rem */
  background: #ffffff;
  border-radius: 2rem , 0rem;  /* 16px -> 1rem */
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1.25rem 1.563rem -0.313rem rgba(0, 0, 0, 0.05), 
              0 0.625rem 0.625rem -0.313rem rgba(0, 0, 0, 0.03);
  animation: detailFadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes detailFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(0.938rem); /* 15px -> 0.938rem */
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 🖼️ 大圖框動畫過渡 */
.detail-photo-box {
  transition: transform 0.3s ease;
  width: 100%;
  max-height: 33.5rem; 
  background-color: #f8fafc;
  border-radius: 0.75rem;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  border: 1px solid #e2e8f0;
}
.detail-photo-box img {
  background: #f1f5f9;
  min-height: 15.625rem; /* 250px -> 15.625rem */
  width: 100%;
  max-width: 100%;
  max-height: 33.5rem; /* Need same as detail-photo-box */
  object-fit: contain;
}


/* 🛒 全域隱藏工具 (若先前沒加請補上) */
.hidden {
  display: none !important;
}

/* 遮罩背景 */
.cart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px); /* 現代感背景模糊 */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 彈窗主體 */
.cart-modal-content {
  background: #ffffff;
  width: 90%;
  max-width: 31.25rem; /* 500px */
  max-height: 80vh;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

/* 標頭 */
.cart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.cart-modal-header h3 {
  font-size: 1.25rem;
  margin: 0;
  color: #1a202c;
}
.close-modal-btn {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #a0aec0;
  line-height: 1;
}
.close-modal-btn:hover {
  color: #4a5568;
}

/* 滾動商品列表區 */
.cart-items-container {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.25rem;
}
.cart-empty-text {
  text-align: center;
  color: #718096;
  padding: 2rem 0;
  font-size: 1rem;
}

/* 單個商品列樣式 */
.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #edf2f7;
}
.cart-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cart-item-name {
  font-weight: 600;
  color: #2d3748;
  font-size: 0.938rem;
}
.cart-item-qty {
  font-size: 0.813rem;
  color: #718096;
}
.cart-item-price {
  font-weight: 700;
  color: #1a202c;
  font-size: 0.938rem;
}

/* 價格結算區 */
.cart-summary-box {
  background: #f7fafc;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.938rem;
  color: #4a5568;
}
.summary-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 0.5rem 0;
}
.total-row {
  font-weight: 800;
  font-size: 1.125rem;
  color: #e44d26;
  margin-bottom: 0;
}

/* 結帳按鈕 */
.checkout-btn {
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.checkout-btn:hover {
  background: #1d4ed8;
}

/* ==========================================================================
   📦 商品管理後台 (Dashboard Admin) 專屬樣式
   ========================================================================== */

/* 後台主框架外殼 */
.dashboard-admin-wrapper {
  width: 100%;
  margin: 0 auto;
  padding: 0rem;   /* 25px */
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  text-align: left;
  box-sizing: border-box;
}

/* 後台標頭區 */
.dashboard-admin-header {
  margin-bottom: 1.563rem;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 0.938rem;
}
.dashboard-admin-header h2 {
  margin: 0 0 0.5rem 0;
  color: #1e3a8a;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.dashboard-admin-header p {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}

/* 商品動態欄位群組容器 */
.admin-dynamic-form-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem; /* 20px */
}

/* 單個商品填寫區塊卡片 */
.product-form-group {
  border: 2px dashed #cbd5e1;
  padding: 1.25rem;
  margin-bottom: 0.938rem;
  border-radius: 0.375rem;
  position: relative;
  background: #f8fafc;
  transition: all 0.25s ease;
}
.product-form-group:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}
.product-form-group h4 {
  margin: 0 0 0.625rem 0;
  color: #2563eb;
  font-size: 1.05rem;
  font-weight: 700;
}

/* 網格欄位通用排版 */
.admin-form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); /* 200px */
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}
.admin-form-grid-5 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.75rem, 1fr)); /* 140px */
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}
.admin-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

/* 後台表單專屬輸入框樣式 */
.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  font-size: 0.95rem;
  background: #ffffff;
  color: #334155;
  box-sizing: border-box;
  transition: all 0.2s ease;
}
.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 圖片上傳區區塊 */
.admin-image-upload-box {
  margin-top: 0.5rem;
}
.admin-image-upload-box label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #4a5568;
  display: block;
  margin-bottom: 0.25rem;
}

/* 後台按鈕工具列 */
.admin-action-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.563rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 1.25rem;
}

/* 按鈕基本樣式與動態效果 */
.admin-btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.admin-btn-add {
  background: #10b981;
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
}
.admin-btn-add:hover {
  background: #059669;
  transform: translateY(-1px);
}
.admin-btn-submit {
  background: #2563eb;
  color: white;
  margin-left: auto;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}
.admin-btn-submit:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}
.admin-btn-remove {
  position: absolute;
  right: 0.938rem;
  top: 0.938rem;
  background: #ef4444;
  color: #ffffff;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 0.25rem;
}
.admin-btn-remove:hover {
  background: #dc2626;
}

/* 歷史訂單卡片主體 */
.order-tab-card {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
  border: 0.0625rem solid #e2e8f0;
  margin-bottom: 1.5rem;
}

/* 卡片頭部 */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 0.0625rem solid #e2e8f0;
}

.card-title {
  font-size: 1.25rem; /* 使用 rem */
  font-weight: 600;
  color: #1a202c;
  margin: 0;
}

.status-badge-paid {
  font-size: 0.875rem; /* 使用 rem */
  color: #4a5568;
  background-color: #edf2f7;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
}

/* 卡片內容區與表格響應式 */
.card-body {
  padding: 1.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 表格基本樣式 */
.order-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.order-table th,
.order-table td {
  padding: 1rem 1.25rem;
  border-bottom: 0.0625rem solid #edf2f7;
  font-size: 0.9375rem; /* 使用 rem */
  white-space: nowrap;
}

.order-table th {
  background-color: #f7fafc;
  color: #4a5568;
  font-weight: 600;
  font-size: 0.875rem; /* 使用 rem */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.order-table tbody tr:hover {
  background-color: #f8fafc;
}

/* 核心欄位與狀態樣式 */
.order-id {
  font-family: monospace;
  font-weight: 500;
  color: #2b6cb0;
}

.order-amount {
  font-weight: 600;
  color: #2d3748;
}

/* 針對 paid 狀態的特別標籤 */
.badge-paid {
  display: inline-block;
  font-size: 0.8125rem; /* 使用 rem */
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  background-color: #c6f6d5;
  color: #22543d;
}

/* 操作按鈕 */
.btn-detail {
  font-size: 0.875rem; /* 使用 rem */
  padding: 0.375rem 0.875rem;
  background-color: #fff;
  border: 0.0625rem solid #cbd5e0;
  border-radius: 0.375rem;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-detail:hover {
  background-color: #edf2f7;
  border-color: #a0aec0;
  color: #2d3748;
}

/* ─── 🧭 導覽列核心網格 ─── */
.main-navbar {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 4rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 2rem; box-sizing: border-box; z-index: 9999;
}
.nav-logo { font-size: 1.25rem; font-weight: 800; color: #1e3a8a; cursor: pointer; }
.nav-actions-right { display: flex; align-items: center; gap: 1.25rem; }

.nav-icon-btn {
  position: relative; font-size: 1.5rem; cursor: pointer;
  width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center;
  border-radius: 0.5rem; transition: background 0.2s;
}
.nav-icon-btn:hover { background: #f1f5f9; }

/* 三條線漢堡包圖示變形基礎 *//* ─── ☰ 三條線（漢堡包）顯示核心修復 ─── */
.hamburger-btn {
  display: flex !important; /* 強制覆蓋 */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px; /* 橫線之間的間距 */
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
}

/* 確保橫線具備實體積、顏色與邊角弧度 */
.hamburger-btn .bar {
  display: block;
  width: 1.5rem;          /* 實體寬度 */
  height: 3px;            /* 實體厚度 */
  background-color: #1e293b !important; /* 實體深色，確保在白底上顯現 */
  border-radius: 9999px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 懸停時的視覺回饋（三條線微微縮放） */
.hamburger-btn:hover .bar:nth-child(1) { transform: translateX(-2px); }
.hamburger-btn:hover .bar:nth-child(3) { transform: translateX(2px); }

/* ─── 🚪 豪華側邊欄與毛玻璃背景 ─── */
.drawer-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.4); 
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); /* 網美級模糊 */
  z-index: 10000; transition: opacity 0.3s ease;
}

.side-drawer {
  position: fixed; top: 0; right: -22rem; width: 22rem; height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: -10px 0 35px rgba(15, 23, 42, 0.15);
  z-index: 10001; display: flex; flex-direction: column;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1); box-sizing: border-box;
}
.side-drawer.open { right: 0; }

.drawer-header {
  padding: 1.5rem; border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex; justify-content: space-between; align-items: center;
}

.drawer-header h4 { margin: 0; color: #1e3a8a; font-size: 1.2rem; font-weight: 800; }
.drawer-close-x { background: #f1f5f9; border: none; font-size: 1rem; cursor: pointer; color: #64748b; width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.drawer-close-x:hover { background: #fee2e2; color: #ef4444; }

.drawer-body { flex: 1; padding: 1rem 0; display: flex; flex-direction: column; justify-content: space-between; }
.drawer-menu-list { list-style: none; padding: 0; margin: 0; }
.drawer-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.5rem; color: #475569; font-weight: 600;
  text-decoration: none; border-left: 4px solid transparent; transition: all 0.2s ease; font-size: 0.95rem;
}
.drawer-item:hover, .drawer-item.active {
  background: rgba(37, 99, 235, 0.05); color: #2563eb; border-left-color: #2563eb;
}

/* 登出專屬紅色驚嘆調 */
.btn-drawer-logout {
  color: #dc2626; border-top: 1px solid rgba(226, 232, 240, 0.6); margin-top: 0.5rem;
}
.btn-drawer-logout:hover {
  background: #fff5f5; color: #b91c1c; border-left-color: #dc2626;
}

/* ─── 🚚 歷史訂單面板過渡淡出動畫 ─── */
.fade-in-panel {
  animation: panelFadeInEffect 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes panelFadeInEffect {
  from { opacity: 0; transform: translateY(12px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* 後台權限區段微縮防線 */
.admin-only-section { margin-top: 1rem; }
.section-divider { padding: 1rem 1.5rem; font-size: 1.5rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-item:hover { color: #dc2626; border-left-color: #dc2626; background: #fff5f5; }

/* 語系切換文字大小調整 */
.language-selector-wrapper {
    padding: 1.5rem;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}
/* ─── 底部頁尾容器（包覆語系與訪客模式） ─── */
.drawer-footer { 
  padding: 1.25rem 1.5rem; /* 依專案調整間距 */
  border-top: 1px solid #f1f5f9; 
  background: #f8fafc; 
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #64748b;
  gap: 0.5rem; /* 💡 關鍵：利用 flex 內距，讓語系與訪客模式緊貼（僅差 8px） */
}

/* ─── 語系切換文字與大小調整 ─── */
.language-selector-wrapper {
  padding: 0rem;          /* 清除原本過大的 padding，改用容器的 gap 控制 */
  font-size: 0.938rem;    /* 15px -> 0.938rem */
  color: #475569;         /* 維持與導覽列一致的深灰色 */
  font-weight: 600;
}

/* 語系選項之間的微調（選填，可增加點擊感） */
.language-selector-wrapper .lang-opt {
  margin-left: 0.5rem;
  cursor: pointer;
  color: #2563eb;         /* 專案標準藍色 */
}
.language-selector-wrapper .lang-opt:hover {
  text-decoration: underline;
}

/* ─── 訪客模式文字大小調整 ─── */
.visitor-status {
  font-size: 0.85rem;     /* 繼承原 footer 的 0.85rem 規範 */
  color: #64748b;
}

.hidden { display: none !important; opacity: 0; }


/* =============================== 手機 RWD 優化 =============================== */

/* 📱 響應式手機板優化 (RWD) */
@media (max-width: 768px) {
  
  .admin-form-grid-2 {
    grid-template-columns: 1fr;
  }

  .product-detail-wrapper {
    margin: 0.75rem;    /* 12px -> 0.75rem */
    padding: 1.25rem;   /* 20px -> 1.25rem */
    border-radius: 0.75rem; /* 12px -> 0.75rem */
  }
}