:root {
  --sky-primary: #4A90E2;       /* 主色：晨光晴空藍 */
  --sky-primary-dark: #357ABD;  /* 點擊深藍 */
  --sky-light: #EBF4FC;         /* 柔和天藍微光 */
  --sky-accent: #FF6B81;        /* 甜點粉紅點綴色 */
  --sky-bg: #F4F8FC;            /* 清爽晴空淡灰白底色 */
  --sky-card-bg: #FFFFFF;
  --sky-text: #1F2D3D;          /* 深海軍藍灰文字，對比柔和清晰 */
  --sky-muted: #6B7C93;
  --sky-border: #E1EBF5;
}

body {
  background-color: var(--sky-bg);
  color: var(--sky-text);
  font-family: 'Noto Sans TC', sans-serif;
  padding-bottom: 95px;
}

.container-farm {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px;
  transition: max-width 0.2s ease;
}

/* ==========================================================
   頂部天空晴空橫幅 (Sky Banner)
========================================================== */
.farm-header {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #4A90E2 0%, #68B0F2 60%, #82C2FF 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px 16px 20px;
  margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.2);
  color: #FFFFFF;
  overflow: hidden;
}

/* 天空飄浮雲朵與好物圖騰 */
.sky-header-svg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0.25;
}

.groupbuy-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #FFFFFF;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 30px;
  margin-bottom: 8px;
  z-index: 2;
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: #FFF275;
  border-radius: 50%;
  box-shadow: 0 0 8px #FFF275;
}

.farm-title {
  color: #FFFFFF !important;
  font-weight: 900;
  font-size: 1.45rem;
  letter-spacing: 1.2px;
  margin-bottom: 4px;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(31, 45, 61, 0.2);
}

.farm-subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 0.82rem;
  margin: 0;
  z-index: 2;
}

/* ==========================================================
   三大主分頁按鈕（晴空膠囊導航）
========================================================== */
.nav-tabs-farm {
  display: flex;
  background-color: #E2EEF8;
  border-radius: 30px;
  padding: 4px;
  margin-bottom: 16px;
  border: none;
}
.nav-tabs-farm .nav-item { flex: 1; }
.nav-tabs-farm .nav-link {
  width: 100%;
  text-align: center;
  border-radius: 25px;
  border: none;
  padding: 9px 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--sky-muted);
  background: transparent;
  transition: all 0.2s ease;
}
.nav-tabs-farm .nav-link.active {
  background-color: var(--sky-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.35);
}

/* 輪播大圖 */
.farm-carousel-wrap {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.08);
  margin-bottom: 16px;
  background-color: #E8F2FA;
}
.carousel-item { height: 180px; position: relative; }
.carousel-item img { width: 100%; height: 100%; object-fit: cover; }
.carousel-caption-custom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 14px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(31, 45, 61, 0.8) 100%);
  color: #FFFFFF;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

/* 搜尋與分類 */
.search-wrapper { position: relative; margin-bottom: 12px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--sky-muted); pointer-events: none; }
.search-input {
  border: 1px solid var(--sky-border);
  border-radius: 25px;
  padding: 10px 14px 10px 40px;
  background-color: #FFFFFF;
  font-size: 0.9rem;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.search-input:focus { outline: none; border-color: var(--sky-primary); box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2); }

.category-scroll-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; scrollbar-width: none; }
.category-scroll-bar::-webkit-scrollbar { display: none; }
.category-chip {
  white-space: nowrap;
  background-color: #FFFFFF;
  color: #4A5B70;
  border: 1px solid var(--sky-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.category-chip.active {
  background-color: var(--sky-primary);
  color: #FFFFFF;
  border-color: var(--sky-primary);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.25);
}

/* ==========================================================
   商品卡片：生活選品風格
========================================================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.product-grid-card {
  background-color: var(--sky-card-bg);
  border: 1px solid var(--sky-border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 3px 10px rgba(74, 144, 226, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.product-grid-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(74, 144, 226, 0.12);
}

.product-img-box {
  width: 100%;
  height: 135px;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--sky-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}
.product-img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.product-img-box:hover img { transform: scale(1.05); }

/* 放大鏡角標 */
.product-zoom-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(31, 45, 61, 0.55);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.product-badge {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--sky-primary);
  background-color: var(--sky-light);
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 700;
  margin-bottom: 4px;
}

.product-name {
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--sky-text);
  line-height: 1.35;
  margin-bottom: 4px;
}

.product-desc {
  font-size: 0.78rem;
  color: var(--sky-muted);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 28px;
}

.product-price {
  color: #E24A4A;
  font-weight: 900;
  font-size: 1.15rem;
}

/* 計數器 */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #EEF4FA;
  border-radius: 20px;
  padding: 2px;
}
.stepper-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background-color: #FFFFFF;
  color: var(--sky-text);
  font-weight: bold;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}
.stepper-val { font-weight: 800; font-size: 0.92rem; color: var(--sky-text); }

/* 庫存狀態標籤 */
.badge-stock-low {
  background-color: #FFF0F2;
  color: #FF4757;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
  border: 1px solid #FFCCD2;
}
.badge-sold-out {
  background-color: #E9ECEF;
  color: #868E96;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
}
.card-sold-out { opacity: 0.65; background-color: #F8F9FA !important; }

/* 通用卡片與表單 */
.farm-card {
  background-color: var(--sky-card-bg);
  border: 1px solid var(--sky-border);
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(74, 144, 226, 0.04);
  padding: 18px;
  margin-bottom: 16px;
}
.form-label { font-size: 0.84rem; font-weight: 700; color: #34495E; margin-bottom: 4px; }
.form-control, .form-select { border: 1px solid #CEDEEA; border-radius: 10px; padding: 9px 12px; font-size: 0.92rem; }
.form-control:focus, .form-select:focus { border-color: var(--sky-primary); box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2); }

/* 待出貨與已出貨標籤 */
.badge-pending {
  background-color: #FFF4EC !important;
  color: #C85A17 !important;
  border: 1px solid #F5C6A5 !important;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.badge-shipped {
  background-color: #E8F5E9 !important;
  color: #2E7D32 !important;
  border: 1px solid #C8E6C9 !important;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* 底部購物車 */
.sticky-bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid #D6E4F0;
  padding: 12px 16px;
  z-index: 1000;
  box-shadow: 0 -4px 16px rgba(74, 144, 226, 0.08);
}

.btn-checkout {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: #FFFFFF;
  font-weight: 800;
  border: none;
  border-radius: 30px;
  padding: 10px 22px;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.35);
  transition: all 0.2s ease;
}
.btn-checkout:hover { background: linear-gradient(135deg, #357ABD 0%, #2A629A 100%); color: #fff; }

.btn-cart-view {
  background: linear-gradient(135deg, #4A90E2 0%, #2F73B8 100%);
  color: #FFFFFF;
  font-weight: 800;
  border: none;
  border-radius: 30px;
  padding: 11px 24px;
  box-shadow: 0 4px 14px rgba(74, 144, 226, 0.35);
}

.btn-sub-tab { border-radius: 20px; font-size: 0.85rem; padding: 5px 16px; border: 1px solid #CEDEEA; background-color: #F4F8FC; color: var(--sky-muted); }
.btn-sub-tab.active { background-color: var(--sky-primary); color: #FFF; border-color: var(--sky-primary); }

.farm-footer-copyright {
  font-size: 0.8rem;
  letter-spacing: 2px;
  font-weight: 700;
  color: #A0B2C6;
  text-align: center !important;
  margin: 32px auto 16px auto !important;
  text-transform: uppercase;
}

/* 載入動畫 */
.farm-loading-box {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 30px 16px;
}
.spinner-wrapper { position: relative; width: 70px; height: 70px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; }
.spinner-ring {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border: 4px solid #E1EBF5;
  border-top: 4px solid var(--sky-primary);
  border-radius: 50%;
  animation: farmSpin 1s linear infinite;
}
.spinner-core { font-size: 2rem; user-select: none; }
.farm-load-bar { width: 150px; height: 4px; background: #E1EBF5; border-radius: 10px; overflow: hidden; position: relative; margin: 12px auto 0; }
.farm-load-progress { position: absolute; left: -40%; width: 40%; height: 100%; background: var(--sky-primary); border-radius: 10px; animation: loadSlide 1.4s infinite ease-in-out; }

@keyframes farmSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes loadSlide { 0% { left: -40%; width: 30%; } 50% { left: 40%; width: 50%; } 100% { left: 100%; width: 30%; } }