/**
 * styles.css
 * 主要樣式（響應式設計，手機優先）
 * Version: 1.0
 */

/* 基礎設定 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft JhengHei', '微軟正黑體', Arial, sans-serif;
  font-size: 18px; /* 手機優先，字體放大 */
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  padding: 10px;
}

/* 容器 */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px;
}

/* 標題 */
h1 {
  font-size: 28px; /* 手機優先，字體放大 */
  color: #4285f4;
  margin-bottom: 20px;
  text-align: center;
}

h2 {
  font-size: 24px; /* 手機優先，字體放大 */
  color: #34a853;
  margin-bottom: 15px;
}

h3 {
  font-size: 20px; /* 手機優先，字體放大 */
  color: #ea4335;
  margin-bottom: 10px;
}

/* 按鈕 */
.btn {
  display: inline-block;
  padding: 12px 24px; /* 手機優先，按鈕放大 */
  font-size: 18px; /* 手機優先，字體放大 */
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 5px;
}

.btn-primary {
  background-color: #4285f4;
  color: white;
}

.btn-primary:hover {
  background-color: #3367d6;
}

.btn-success {
  background-color: #34a853;
  color: white;
}

.btn-success:hover {
  background-color: #2d8e47;
}

.btn-danger {
  background-color: #ea4335;
  color: white;
}

.btn-danger:hover {
  background-color: #d33b2c;
}

.btn-warning {
  background-color: #fbbc04;
  color: white;
}

.btn-warning:hover {
  background-color: #f9ab00;
}

.btn-secondary {
  background-color: #9aa0a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #80868b;
}

/* 重新整理按鈕 */
.btn-refresh {
  background-color: #9c27b0;
  color: white;
  padding: 10px 15px;
  font-size: 20px;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-refresh:hover {
  background-color: #7b1fa2;
  transform: rotate(180deg);
}

/* 商品卡片容器 - 使用 grid 布局，響應式設計（手機優先） */
#productsContainer {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important; /* 手機：2 個 */
  gap: 10px;
  padding: 10px 0;
  width: 100%;
  max-width: 100%;
}

/* 商品卡片 - 蝦皮風格設計 */
.product-card {
  background: white;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #f0f0f0;
  position: relative;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-color: #e0e0e0;
}

/* 圖片容器 - 蝦皮風格（正方形，固定高度） */
.product-image-container {
  width: 100%;
  aspect-ratio: 1; /* 正方形 */
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 覆蓋整個容器，保持比例 */
  cursor: pointer;
  display: block;
}

.product-image-placeholder {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1; /* 確保在圖片上方，但只在顯示時 */
}

/* 確保當圖片載入成功時，placeholder 隱藏 */
.product-image-container .product-image:not([style*="display: none"]) ~ .product-image-placeholder {
  display: none !important;
}

/* 商品信息區域（蝦皮風格） */
.product-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* 商品信息區域（蝦皮風格） */
.product-info .product-name {
  font-size: 15px; /* 加大1 */
  font-weight: normal;
  color: #333;
  margin-bottom: 8px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 限制兩行 */
  -webkit-box-orient: vertical;
  min-height: 40px;
  flex-shrink: 0;
}

.product-info .product-price {
  font-size: 19px; /* 加大1 */
  font-weight: bold;
  color: #ea4335;
  margin-bottom: 6px;
  flex-shrink: 0;
}

/* 折扣價格容器 */
.product-price-container {
  position: relative;
  margin-bottom: 6px;
}

/* 原價（劃掉） */
.product-price-original {
  font-size: 14px;
  color: #999;
  text-decoration: line-through;
  margin-bottom: 2px;
}

/* 特價 */
.product-price-discounted {
  font-size: 19px; /* 加大1 */
  font-weight: bold;
  color: #ea4335;
}

/* 折扣標籤動畫 */
.discount-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 6px;
  border-radius: 8px;
  animation: discountPulse 2s infinite; /* 預設動畫 */
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 5; /* 降低 z-index，避免遮擋圖片 */
  pointer-events: none; /* 不阻擋點擊事件 */
}

/* 折扣層級顏色方案 - 折扣越多越醒目（深紅色），折扣越少越淡（淺色） */

/* 折扣層級 1：90-100%（折扣 0-10%，折扣最少）- 淺黃色/淡色 */
.discount-badge.discount-level-1 {
  background: linear-gradient(135deg, #fff9e6, #ffe6b3);
  color: #996633; /* 深色文字以便閱讀 */
  box-shadow: 0 2px 4px rgba(153, 102, 51, 0.2);
}

/* 折扣層級 2：80-90%（折扣 10-20%）- 黃色 */
.discount-badge.discount-level-2 {
  background: linear-gradient(135deg, #ffe6b3, #ffcc66);
  color: #996633; /* 深色文字以便閱讀 */
  box-shadow: 0 2px 4px rgba(255, 204, 102, 0.3);
}

/* 折扣層級 3：70-80%（折扣 20-30%）- 橙色 */
.discount-badge.discount-level-3 {
  background: linear-gradient(135deg, #ffcc66, #ff9933);
  color: white;
  box-shadow: 0 2px 4px rgba(255, 153, 51, 0.4);
}

/* 折扣層級 4：60-70%（折扣 30-40%）- 深橙色/紅色 */
.discount-badge.discount-level-4 {
  background: linear-gradient(135deg, #ff6600, #ff3300);
  color: white;
  box-shadow: 0 2px 6px rgba(255, 51, 0, 0.5);
}

/* 折扣層級 5：50-60%（折扣 40-50%，最大折扣）- 深紅色/鮮紅色（最醒目） */
.discount-badge.discount-level-5 {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  color: white;
  box-shadow: 0 3px 8px rgba(204, 0, 0, 0.6);
  animation: discountPulseIntense 1.5s infinite; /* 最大折扣使用更明顯的動畫 */
}

/* 折扣標籤脈衝動畫 - 所有層級共用 */
@keyframes discountPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

/* 最大折扣（層級 5）專用動畫 - 更明顯的脈衝效果 */
@keyframes discountPulseIntense {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 3px 8px rgba(204, 0, 0, 0.6);
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 4px 12px rgba(204, 0, 0, 0.8);
  }
}

.product-info .product-stock {
  font-size: 13px; /* 加大1 */
  color: #34a853;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.product-info .product-stock.low {
  color: #fbbc04;
}

.product-info .product-stock.out {
  color: #ea4335;
}

.product-info .product-note {
  font-size: 12px; /* 加大1 */
  color: #999;
  margin-top: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  flex-shrink: 0;
}

/* 商品詳情頁面樣式 */
.product-detail-card {
  display: flex;
  gap: 30px;
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 1200px;
  margin: 0 auto;
}

.product-detail-image {
  width: 560px; /* 140px * 4 = 560px */
  height: 560px;
  object-fit: cover;
  border-radius: 12px;
  background-color: #f5f5f5;
  flex-shrink: 0;
}

.product-detail-image-placeholder {
  width: 560px;
  height: 560px;
  background-color: #f5f5f5;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 18px;
  flex-shrink: 0;
}

.product-detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 560px; /* 與圖片高度一致 */
}

.product-detail-info h2 {
  font-size: 28px;
  color: #333;
  margin-bottom: 20px;
}

.product-detail-price {
  font-size: 32px;
  font-weight: bold;
  color: #ea4335;
  margin-bottom: 15px;
}

.product-detail-stock {
  font-size: 18px;
  color: #34a853;
  margin-bottom: 10px;
}

.product-detail-expiry {
  font-size: 16px;
  color: #666;
  margin-bottom: 10px;
}

.product-detail-note {
  font-size: 16px;
  color: #666;
  margin-bottom: 10px;
}

.product-detail-status {
  font-size: 16px;
  color: #4285f4;
  margin-bottom: 20px;
}

/* 商品詳情操作區域（置底對齊） */
.product-detail-actions {
  margin-top: auto; /* 自動推到底部，與圖片底端對齊 */
  padding-top: 20px;
  border-top: 1px solid #eee;
}

/* 商品詳情操作區域（置底對齊） */
.product-detail-actions {
  margin-top: auto; /* 自動推到底部 */
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.product-image-placeholder {
  width: 100%;
  height: 140px;
  background-color: #f5f5f5;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
  margin-bottom: 8px;
}

.product-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex-shrink: 0;
}

.product-price {
  font-size: 18px;
  font-weight: bold;
  color: #ea4335;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.product-stock {
  font-size: 14px;
  color: #34a853;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.product-stock.low {
  color: #fbbc04;
}

.product-stock.out {
  color: #ea4335;
}

.product-note {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex-shrink: 0;
}

/* 商品卡片按鈕 */
.product-card .btn {
  margin-top: auto;
  padding: 8px 16px;
  font-size: 14px;
  flex-shrink: 0;
}

/* 表單 */
/* 管理介面表單卡片樣式 */
.admin-form-card {
  padding: 30px !important; /* 增加內距，讓內容不靠近邊框 */
  cursor: default !important; /* 表單卡片不需要 pointer cursor */
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 18px; /* 手機優先，字體放大 */
  font-weight: bold;
  margin-bottom: 8px;
  color: #333;
}

.form-input {
  width: 100%;
  padding: 12px; /* 手機優先，輸入框放大 */
  font-size: 18px; /* 手機優先，字體放大 */
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: #4285f4;
}

.form-textarea {
  width: 100%;
  padding: 12px; /* 手機優先，輸入框放大 */
  font-size: 18px; /* 手機優先，字體放大 */
  border: 2px solid #ddd;
  border-radius: 8px;
  resize: vertical;
  min-height: 100px;
}

/* 購物車 */
.cart-item {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.cart-item-info {
  flex: 1;
  min-width: 200px;
}

.cart-item-name {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

.cart-item-details {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

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

.cart-total {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  text-align: center;
}

.cart-total-amount {
  font-size: 28px; /* 手機優先，字體放大 */
  font-weight: bold;
  color: #ea4335;
  margin-top: 10px;
}

/* 訂單列表 */
.order-item {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.order-item-detail {
  padding: 10px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 8px;
}

.order-item-detail:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.order-item-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

.order-item-info {
  font-size: 14px;
  color: #666;
}

.order-total {
  text-align: right;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 2px solid #f0f0f0;
  font-size: 18px;
  color: #ea4335;
}

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

.order-status {
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 16px; /* 手機優先，字體放大 */
  font-weight: bold;
}

.order-status.pending {
  background-color: #fbbc04;
  color: white;
}

.order-status.paid {
  background-color: #34a853;
  color: white;
}

.order-status.cancelled {
  background-color: #ea4335;
  color: white;
}

/* 訊息閃現 */
.flash-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  padding: 15px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  font-size: 18px; /* 手機優先，字體放大 */
  animation: flashFadeInOut 3s ease-in-out;
  font-weight: bold;
}

/* 訊息類型樣式 */
.flash-message.flash-info {
  background-color: #4285f4; /* 藍色 - 一般訊息 */
}

.flash-message.flash-success {
  background-color: #34a853; /* 綠色 - 成功 */
}

.flash-message.flash-error {
  background-color: #ea4335; /* 紅色 - 錯誤 */
}

.flash-message.flash-warning {
  background-color: #fbbc04; /* 黃色 - 警告 */
  color: #333; /* 深色文字以便閱讀 */
}

@keyframes flashFadeInOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  10% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* 訂單通知容器 */
.order-notifications-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 90%;
  pointer-events: none;
}

/* 訂單通知項目 */
.order-notification-item {
  background: linear-gradient(135deg, #4285f4, #34a853);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  font-size: 16px;
  font-weight: bold;
  animation: slideUpFadeIn 0.5s ease-out, fadeOut 0.5s ease-out 2.5s forwards;
  pointer-events: auto;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.flash-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  padding: 15px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  font-size: 18px; /* 手機優先，字體放大 */
  animation: flashFadeInOut 3s ease-in-out;
  font-weight: bold;
}

/* 訊息類型樣式 */
.flash-message.flash-info {
  background-color: #4285f4; /* 藍色 - 一般訊息 */
}

.flash-message.flash-success {
  background-color: #34a853; /* 綠色 - 成功 */
}

.flash-message.flash-error {
  background-color: #ea4335; /* 紅色 - 錯誤 */
}

.flash-message.flash-warning {
  background-color: #fbbc04; /* 黃色 - 警告 */
  color: #333; /* 深色文字以便閱讀 */
}

@keyframes flashFadeInOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  10% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* 推薦商品彈窗 */
.recommendation-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recommendation-content {
  background: white;
  border-radius: 12px;
  padding: 20px;
  max-width: 90%;
  max-height: 80%;
  overflow-y: auto;
  position: relative;
}

.recommendation-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 30px;
  cursor: pointer;
  color: #666;
}

.recommendation-close:hover {
  color: #333;
}

/* 登入提示 */
.login-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-content {
  background: white;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
}

.login-content h2 {
  color: #4285f4;
  margin-bottom: 10px;
  font-size: 24px;
}

.login-content p {
  color: #666;
  margin-bottom: 30px;
  font-size: 16px;
}

#google-signin-button {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* 使用者資訊（固定置頂） */
.user-info {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  border-radius: 0 0 8px 8px;
  padding: 10px 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 回到頂端按鈕 */
.scroll-to-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #4285f4;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-weight: bold;
}

.scroll-to-top-btn:hover {
  background: #3367d6;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.scroll-to-top-btn:active {
  transform: scale(0.95);
}

/* 手機版按鈕樣式 */
@media (max-width: 767px) {
  .scroll-to-top-btn {
    width: 55px;
    height: 55px;
    bottom: 15px;
    right: 15px;
    font-size: 14px;
  }
  
  .scroll-to-top-btn span:first-child {
    font-size: 18px;
  }
  
  .scroll-to-top-btn span:last-child {
    font-size: 10px;
  }
}

/* 使用者資訊內容（同一行顯示） */
.user-info-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.user-info-content #userName {
  font-size: 18px;
  font-weight: bold;
  color: #4285f4;
  flex-shrink: 0;
}

/* 移除 Email 顯示樣式（已取消顯示） */

.user-info-content .user-pending-amount {
  font-size: 16px;
  font-weight: bold;
  color: #ea4335;
  flex-shrink: 0;
}

.logout-btn {
  padding: 6px 12px;
  font-size: 14px;
  background: #ea4335;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.logout-btn:hover {
  background: #d33b2c;
}

/* 手機版使用者資訊樣式 */
@media (max-width: 767px) {
  .user-info {
    padding: 8px 12px;
  }
  
  .user-info-content {
    gap: 8px;
  }
  
  .user-info-content #userName {
    font-size: 16px;
  }
  
  /* Email 顯示已移除，不再需要此樣式 */
  
  .user-info-content .user-pending-amount {
    font-size: 14px;
  }
  
  .logout-btn {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* 導航列（不固定，正常流動） */
.nav-bar {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  position: relative; /* 移除固定定位 */
}

.nav-link {
  padding: 10px 20px;
  font-size: 18px; /* 手機優先，字體放大 */
  text-decoration: none;
  color: #4285f4;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.nav-link:hover {
  background-color: #f0f0f0;
}

.nav-link.active {
  background-color: #4285f4;
  color: white;
}

/* 打烊頁面 */
.closed-message {
  text-align: center;
  padding: 50px 20px;
}

.closed-icon {
  font-size: 80px; /* 手機優先，圖示放大 */
  margin-bottom: 20px;
}

.closed-text {
  font-size: 24px; /* 手機優先，字體放大 */
  color: #666;
}

/* 載入動畫 */
.loading {
  text-align: center;
  padding: 50px 20px;
  font-size: 20px; /* 手機優先，字體放大 */
  color: #666;
  grid-column: 1 / -1; /* 載入狀態佔滿整行 */
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4285f4;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 16px;
  color: #666;
}

/* 響應式設計 - 桌面優先 */
@media (min-width: 1024px) {
  body {
    font-size: 16px;
  }
  
  .container {
    max-width: 1400px;
  }
  
  h1 {
    font-size: 32px;
  }
  
  h2 {
    font-size: 28px;
  }
  
  h3 {
    font-size: 24px;
  }
  
  /* 桌面：每行 5 個卡片 */
  #productsContainer {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 15px !important;
  }
  
  .product-card {
    /* 移除 max-width，讓 grid 控制寬度 */
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* 平板：每行 3 個卡片 */
  #productsContainer {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
  
  .product-card {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  /* 手機：每行 2 個卡片 */
  #productsContainer {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  .product-card {
    padding: 8px;
    max-width: 100%;
  }
  
  .product-image-container {
    /* 手機上保持正方形 */
  }
  
  .product-name {
    font-size: 14px;
  }
  
  .product-price {
    font-size: 16px;
  }
  
  .product-stock {
    font-size: 12px;
  }
  
  .product-detail-card {
    flex-direction: column;
    padding: 15px;
  }
  
  .product-detail-image,
  .product-detail-image-placeholder {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 400px;
  }
  
  .product-detail-info {
    min-height: auto; /* 手機版不需要最小高度 */
  }
  
  .product-detail-actions {
    margin-top: 20px; /* 手機版保持正常間距 */
  }
}

/* 工具類 */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

.hidden {
  display: none;
}

/* 購物車頁面商品清單樣式 */
/* Version: 1.1 */
.product-list-item {
  flex-shrink: 0;
  width: 120px;
  cursor: pointer;
  transition: transform 0.2s;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
}

.product-list-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.product-list-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.product-list-item .product-list-placeholder {
  width: 100%;
  height: 120px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

.product-list-item .product-list-name {
  padding: 8px;
  font-size: 12px;
  text-align: center;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-list-item .product-list-price {
  padding: 0 8px 8px;
  font-size: 14px;
  font-weight: bold;
  color: #ea4335;
  text-align: center;
}

/* 手機版商品清單項目 */
.product-list-mobile-item {
  flex-shrink: 0;
  width: 150px;
  scroll-snap-align: center;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
}

.product-list-mobile-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.product-list-mobile-item .product-list-placeholder {
  width: 100%;
  height: 150px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

.product-list-mobile-item .product-list-name {
  padding: 10px;
  font-size: 14px;
  text-align: center;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-list-mobile-item .product-list-price {
  padding: 0 10px 10px;
  font-size: 16px;
  font-weight: bold;
  color: #ea4335;
  text-align: center;
}

/* 浮動快捷按鈕面板中的商品項目 */
.product-list-quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid #eee;
}

.product-list-quick-item:hover {
  background: #f5f5f5;
}

.product-list-quick-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.product-list-quick-item .product-list-placeholder {
  width: 60px;
  height: 60px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.product-list-quick-item-info {
  flex: 1;
  min-width: 0;
}

.product-list-quick-item-name {
  font-size: 14px;
  color: #333;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-list-quick-item-price {
  font-size: 16px;
  font-weight: bold;
  color: #ea4335;
}

/* 響應式設計 */
@media (min-width: 768px) {
  .product-list-desktop {
    display: block !important;
  }
  
  .product-list-mobile {
    display: none !important;
  }
  
  .product-list-quick-btn {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .product-list-desktop {
    display: none !important;
  }
  
  .product-list-mobile {
    display: block !important;
  }
  
  .product-list-quick-btn {
    display: block !important;
  }
}



