html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  background-color: #f6f7f9;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ===== 商城自定義樣式 ===== */

.hero-banner {
  background: linear-gradient(120deg, #1f3a5f 0%, #2f6fb5 55%, #4aa3df 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(31, 58, 95, 0.18);
}

.hero-badge {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-badge-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.hero-badge-label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 0.35rem;
}

.product-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.product-thumb {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-bottom: 1px solid var(--bs-border-color);
}

.product-name {
  min-height: 2.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.price {
  color: #e4393c;
  font-weight: 700;
}

.detail-price-box {
  background: linear-gradient(90deg, #fff5f5 0%, #fff 100%);
  border: 1px solid #ffdcdc;
}

/* ---------- 商品詳情頁圖片輪播 ---------- */
.product-carousel {
  position: relative;
  background: #fff;
}

.product-carousel .carousel-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-carousel .carousel-indicators {
  margin-bottom: 14px;
}

.product-carousel .carousel-indicators [data-bs-target] {
  width: 9px;
  height: 9px;
  margin: 0 4px;
  border: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  opacity: 1;
  transition: background-color 0.2s ease;
}

.product-carousel .carousel-indicators .active {
  background-color: #0d6efd;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.gallery-thumb {
  padding: 0;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.gallery-thumb:hover {
  border-color: #b9c7d6;
  transform: translateY(-2px);
}

.gallery-thumb.active {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.18);
}

.gallery-counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

/* ---------- 後臺圖片管理 ---------- */
.admin-image-card {
  width: 132px;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 6px;
  background: #fff;
}

.admin-image-card.is-cover {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.16);
}

.admin-image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
}

.cart-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: -2px;
  font-size: 0.65rem;
}

.success-mark {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #d1f0d8;
  color: #1a7f37;
  font-size: 2.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer {
  background-color: #fff;
}

footer {
  font-size: 0.875rem;
}

/* 後臺 */
.admin-sidebar .nav-link {
  border-radius: 0.375rem;
  margin-bottom: 0.15rem;
}

.admin-sidebar .nav-link.active {
  background-color: var(--bs-primary);
  color: #fff;
}

.stat-card-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

/* ---------- 後臺在線客服工作台 ---------- */
.chat-wb {
  display: flex;
  gap: 16px;
  height: calc(100vh - 245px);
  min-height: 480px;
}

/* 左：會話列表 */
.chat-wb-side {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
}

.chat-wb-side-head {
  flex: 0 0 auto;
  padding: 12px;
  border-bottom: 1px solid #eef1f4;
}

.chat-wb-list {
  flex: 1 1 auto;
  overflow-y: auto;
}

.chat-sess {
  padding: 10px 12px;
  border-bottom: 1px solid #f2f4f7;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.chat-sess:hover {
  background: #f8fafc;
}

.chat-sess.is-active {
  background: #eef4fd;
  border-left-color: #0d6efd;
}

.chat-sess.is-waiting .chat-sess-time {
  color: #e4393c;
  font-weight: 600;
}

.chat-sess.is-closed {
  opacity: 0.65;
}

.chat-sess-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.chat-sess-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.chat-sess-time {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: #98a2b3;
}

.chat-sess-preview {
  margin-top: 2px;
  font-size: 0.8rem;
  color: #667085;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sess-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

/* 右：對話窗 */
.chat-wb-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
}

.chat-conv-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-conv {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-conv-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef1f4;
}

.chat-conv-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background: #f7f9fc;
}

.chat-line {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.chat-line-visitor {
  align-items: flex-start;
}

.chat-line-service {
  align-items: flex-end;
}

.chat-line-head {
  display: flex;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 0.72rem;
  color: #98a2b3;
}

.chat-line-text {
  max-width: 72%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.87rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-line-visitor .chat-line-text {
  background: #fff;
  border: 1px solid #e3e6ea;
  border-bottom-left-radius: 4px;
}

.chat-line-service .chat-line-text {
  background: #0d6efd;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-conv-foot {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-top: 1px solid #eef1f4;
}

.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-quick-replies button {
  padding: 2px 10px;
  border: 1px solid #d6dee8;
  border-radius: 999px;
  background: #fff;
  color: #2f6fb5;
  font-size: 0.76rem;
}

.chat-quick-replies button:hover {
  background: #eef4fd;
}

.chat-conv-input {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.chat-conv-input textarea {
  flex: 1 1 auto;
  resize: vertical;
}

.chat-conv-input-btns {
  flex: 0 0 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* 窄屏：上下排，列表限高，別把對話窗擠沒了 */
@media (max-width: 992px) {
  .chat-wb {
    flex-direction: column;
    height: auto;
  }

  .chat-wb-side {
    flex: 0 0 auto;
    max-height: 320px;
  }

  .chat-wb-main {
    min-height: 460px;
  }
}

/* ---------- 分頁條 ---------- */

/* 頁碼只渲染當前頁附近 + 首尾頁（見 ViewModels/PagerViewModel），
   所以頁數再多，分頁條的寬度也是固定的；
   萬一窄屏一行放不下，讓它整條換行，而不是橫向溢出把屏幕撐寬 */
.pager-wrap .pagination {
  flex-wrap: wrap;
  row-gap: 0.25rem;
  margin-bottom: 0;
}

/* 「跳至第 N 頁」的輸入框，做窄一點省地方 */
.pager-jump {
  width: 5rem;
}

/* 手機上頁碼格縮窄一號：
   手機那套窗口本來就只有「1 … 37 [38] 39 … 75」，加上前後翻頁一共 9 格，
   縮過之後 375px 寬的手機剛好能排進一行，不用折行 */
@media (max-width: 767.98px) {
  .pager-wrap .page-link {
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
  }
}

/* ---------- 後臺相冊採集 ---------- */

/* 圖片用自適應網格鋪開：窄屏兩列、寬屏五六列，張數再多也不會拉出橫向滾動條 */
.album-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.album-result-item {
  min-width: 0;
}

/* 縮略圖統一裁成正方形，一排看起來才齊 */
.album-result-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  overflow: hidden;
  background-color: #f8f9fa;
}

.album-result-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 左上角序號，方便跟對方相冊裡的順序對照 */
.album-result-order {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
}

.album-result-url {
  font-size: 0.75rem;
}

/* 商品 ID / 相冊 ID 很長，允許在任意位置斷行，免得把卡片撐破 */
.album-meta-value {
  max-width: 22rem;
  overflow-wrap: anywhere;
}

/* 批量採集：單條結果卡片折叠時只露前 6 張圖，其餘點「顯示全部圖片」再看 */
.album-result-grid-collapsed .album-result-item:nth-child(n + 7) {
  display: none;
}

/* 採集失敗的條目淡一點，視覺上和待填寫的區分開 */
.album-item-failed {
  opacity: 0.75;
  background-color: var(--bs-tertiary-bg);
}

/* ---------- 商品詳情頁：尺寸選項按鈕 ---------- */

/* 尺寸按鈕一行鋪開，選中那顆高亮；窄屏自動換行 */
.size-option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.size-option {
  min-width: 3.25rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--bs-border-color);
  background-color: #fff;
  color: var(--bs-body-color);
  border-radius: 0.375rem;
  line-height: 1.4;
  transition: all 0.15s ease-in-out;
}

.size-option:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.size-option.active {
  border-color: var(--bs-primary);
  background-color: var(--bs-primary);
  color: #fff;
  font-weight: 600;
}

/* 後臺勾選尺寸的按鈕（採集頁 / 商品編輯）。
   勾中態由 Bootstrap 的 .btn-check:checked + .btn 負責，這裡只統一寬度，
   讓「S」這種單字符的按鈕和「XL」一樣寬，一排看過去齊整 */
.size-chip {
  min-width: 3.25rem;
}

/* 類別按鈕右邊的「幾個尺寸」小角標，別搶主標籤的視線 */
.size-chip .badge {
  font-size: 0.6875rem;
  font-weight: 500;
}

/* 「單個尺寸」那排比類別小一號：先選類別，尺寸只是微調，視覺上分主次 */
.size-chip-sm {
  min-width: 2.5rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.8125rem;
}

/* 商品列表的「採集備注」：採集標題是多行長文本，列表裡最多佔兩行，
   截斷的完整內容掛在 title 上，鼠標停一下就能看全 */
.product-remark {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}


