
/*
  Products 前台商品樣式
*/
/* ========== 商品詳情頁圖片（取代 inline style） ========== */
.product-main-image {
  max-height: 500px;
  width: 100%;
  object-fit: contain;
}

.product-related-img {
  height: 200px;
  object-fit: cover;
  width: 100%;
}

.product-placeholder-img {
  background-color: #f8f9fa;
}

.qty-input-group {
  max-width: 150px;
}

.qty-number-input {
  max-width: 60px;
}

.field-label {
  font-size: 0.875rem;
  color: #495057;
}

.products-count-highlight {
  color: var(--theme-primary-color);
  font-weight: 700;
}

/* ========== 商品列表頁工具列（麵包屑 + 搜尋 + 分類 整合區塊） ========== */
.frontend-toolbar {
  overflow: hidden;
}
.frontend-toolbar .frontend-toolbar-breadcrumb .breadcrumb {
  font-size: 0.875rem;
}
.frontend-toolbar .frontend-toolbar-controls .form-label,
.frontend-toolbar .frontend-toolbar-categories .form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.25rem;
}
.frontend-toolbar .frontend-toolbar-controls .search-result-info {
  font-size: 0.9375rem;
  color: #6c757d;
}

/* ========== 商品分類標籤 ========== */
.category-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-tag-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background-color: transparent;
  border: 1px solid var(--theme-primary-color);
  color: var(--theme-primary-color);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.category-tag-btn:hover, .category-tag-btn.active {
  background-color: var(--theme-primary-color);
  color: #fff;
  text-decoration: none;
}

/* 商品數量顯示 */
.products-count {
  font-size: 1rem;
}

/* 空商品狀態 */
.empty-products-state {
  padding: 4rem 2rem;
}
.empty-products-state .empty-products-icon svg {
  opacity: 0.3;
}
.empty-products-state .empty-products-title {
  font-weight: 600;
  color: #1e293b;
}
@media (max-width: 768px) {
  .empty-products-state {
    padding: 3rem 1rem;
  }
  .empty-products-state .empty-products-icon svg {
    width: 80px;
    height: 80px;
  }
}

/* ========== 商品詳情頁 ========== */
.product-detail-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}
@media (max-width: 768px) {
  .product-detail-title {
    font-size: 1.25rem;
  }
}

.product-top-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.product-subtitle {
  font-size: 0.875rem;
  color: #6c757d;
  line-height: 1.5;
}

/* 商品標籤 */
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.product-tags .product-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
}
.product-tags .product-tag:hover {
  border-color: var(--theme-primary-color);
  color: var(--theme-primary-color);
  text-decoration: none;
}

/* 商品價格區塊 */
.product-price-section {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}
.product-price-section .product-price-current {
  font-size: 1.75rem;
  font-weight: 700;
  color: #dc3545;
}
@media (max-width: 768px) {
  .product-price-section .product-price-current {
    font-size: 1.5rem;
  }
}

.product-description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5em;
  max-height: 4.5em;
}

/* ========== 商品規格選擇樣式 ========== */
.product-model-options .custom-control {
  margin-bottom: 0;
}
.product-model-options .custom-control-label {
  cursor: pointer;
  padding: 0.75rem 1rem;
  border: 1px solid #dee2e6;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
  background: #fff;
  width: 100%;
}
.product-model-options .custom-control-label:hover {
  background-color: #f8f9fa;
  border-color: var(--theme-primary-color);
}
.product-model-options .custom-control:last-child .custom-control-label {
  margin-bottom: 0;
}
.product-model-options .custom-control-input:checked ~ .custom-control-label {
  border-color: var(--theme-primary-color);
  border-width: 2px;
  background-color: #fff;
}
.product-model-options .custom-control-input:disabled ~ .custom-control-label {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8f9fa;
}
.product-model-options .custom-control-input:disabled ~ .custom-control-label:hover {
  transform: none;
}
.product-model-options .custom-control-input:disabled ~ .custom-control-label .model-name {
  text-decoration: line-through;
}
.product-model-options .model-name {
  font-weight: 600;
  color: #212529;
  transition: color 0.2s ease;
}
.product-model-options .model-price-info {
  white-space: nowrap;
  font-weight: 600;
}

/* ========== 加入購物車區塊樣式 ========== */
.selected-price {
  padding: 1rem 0;
  border-bottom: 2px dashed #dee2e6;
}

.qty-control .btn {
  transition: all 0.2s ease;
}
.add-to-cart-btn {
  font-weight: 700;
  transition: all 0.3s ease;
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
}
.add-to-cart-btn.adding {
  background-color: #6c757d;
  border-color: #6c757d;
  cursor: wait;
}
.add-to-cart-btn.added {
  background: #28a745;
  border-color: #28a745;
}

/* ========== 商品詳細資訊頁籤 ========== */
.nav-tabs {
  border-bottom: 2px solid #dee2e6;
}
.nav-tabs .nav-item {
  margin-bottom: -2px;
}
.nav-tabs .nav-link {
  font-weight: 500;
  color: #6c757d;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 1rem 1.5rem;
  transition: all 0.2s ease;
}
.nav-tabs .nav-link:hover {
  color: var(--theme-primary-color);
  background: #f8f9fa;
}
.nav-tabs .nav-link.active {
  color: var(--theme-primary-color);
  background: transparent;
  border-bottom-color: var(--theme-primary-color);
}

.tab-content {
  padding: 2rem;
  border: 1px solid #dee2e6;
  border-top: none;
  background: #fff;
}
.tab-content p {
  line-height: 1.8;
}

/* ========== 商品圖片放大 Lightbox ========== */
.product-lightbox-trigger {
  cursor: zoom-in;
  display: block;
}
@media (max-width: 767.98px) {
  .product-lightbox-trigger {
    cursor: default;
    pointer-events: none;
  }
}

/* ========== 行動版：carousel 下方水平縮圖列 ========== */
.product-mobile-img-strip {
  display: flex;
  flex-direction: row;
  gap: 6px;
  margin-top: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.product-mobile-img-strip::-webkit-scrollbar {
  display: none;
}
.product-mobile-img-strip .product-mobile-img-item {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border: 2px solid #dee2e6;
  overflow: hidden;
  cursor: pointer;
  line-height: 0;
  transition: border-color 0.15s ease;
}
.product-mobile-img-strip .product-mobile-img-item picture {
  display: block;
  width: 100%;
  height: 100%;
}
.product-mobile-img-strip .product-mobile-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-mobile-img-strip .product-mobile-img-item.active {
  border-color: var(--theme-primary-color);
  border-width: 2px;
}

.product-lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.product-lightbox.is-open {
  display: flex;
}
.product-lightbox .lightbox-inner {
  display: flex;
  background: #fff;
  overflow: hidden;
  max-width: 960px;
  width: 100%;
  max-height: 88vh;
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.product-lightbox .lightbox-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
  position: relative;
}
.product-lightbox .lightbox-main .lightbox-img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 2rem;
}
.product-lightbox .lightbox-main .lightbox-img-wrapper picture {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 80vh;
}
.product-lightbox .lightbox-main .lightbox-img-wrapper img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
}
.product-lightbox .lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease;
}
.product-lightbox .lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}
.product-lightbox .lightbox-nav.lightbox-prev {
  left: 0.875rem;
}
.product-lightbox .lightbox-nav.lightbox-next {
  right: 0.875rem;
}
.product-lightbox .lightbox-sidebar {
  width: 210px;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e9ecef;
  background: #fff;
  overflow: hidden;
}
.product-lightbox .lightbox-product-name {
  padding: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #212529;
  border-bottom: 1px solid #e9ecef;
  line-height: 1.45;
  word-break: break-word;
  flex-shrink: 0;
}
.product-lightbox .lightbox-thumbnails {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.product-lightbox .lightbox-thumb {
  cursor: pointer;
  border: 2px solid transparent;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}
.product-lightbox .lightbox-thumb picture {
  display: block;
}
.product-lightbox .lightbox-thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
}
.product-lightbox .lightbox-thumb.active, .product-lightbox .lightbox-thumb:hover {
  border-color: var(--theme-primary-color);
}
.product-lightbox .lightbox-close {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease;
}
.product-lightbox .lightbox-close:hover {
  background: rgba(0, 0, 0, 0.85);
}
@media (max-width: 768px) {
  .product-lightbox {
    padding: 0;
  }
  .product-lightbox .lightbox-inner {
    flex-direction: column;
    max-height: 100dvh;
  }
  .product-lightbox .lightbox-main .lightbox-img-wrapper {
    padding: 1rem;
  }
  .product-lightbox .lightbox-main .lightbox-img-wrapper img {
    max-height: 52vh;
  }
  .product-lightbox .lightbox-sidebar {
    width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid #e9ecef;
    max-height: 32vh;
  }
  .product-lightbox .lightbox-thumbnails {
    flex-direction: row;
    overflow-y: hidden;
    overflow-x: auto;
  }
  .product-lightbox .lightbox-thumbnails .lightbox-thumb {
    min-width: 72px;
  }
  .product-lightbox .lightbox-thumbnails .lightbox-thumb img {
    height: 60px;
  }
  .product-lightbox .lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
  }
}
