/* 商品前端 V2：沿用 Bootstrap 5.3.8 的 container / row / col。 */
.product-listing-mode #route-view,
.product-detail-mode #route-view {
  background: var(--light);
  padding: 24px 0 64px;
}
.product-listing-mode #route-view > .container > .back-link,
.product-detail-mode #route-view > .container > .back-link {
  display: none;
}
.product-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--mute);
  margin-bottom: 16px;
}
.product-breadcrumb a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--mute);
}
.vehicle-context {
  background: var(--carbon);
  color: white;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.vehicle-context .eyebrow {
  color: #c4cbd5;
  font-size: 10px;
  margin-bottom: 6px;
}
.vehicle-context strong {
  display: block;
  font-size: 17px;
}
.vehicle-context p {
  color: #c4cbd5;
  font-size: 13px;
  margin: 6px 0 0;
}
.vehicle-context .vehicle-change {
  flex-shrink: 0;
  padding: 8px 16px;
  background: transparent;
  color: white;
  border-color: #909aa8;
  width: auto;
}
.listing-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin: 28px 0 16px;
}
.listing-heading h1 {
  font-size: 32px;
  margin: 6px 0 12px;
  overflow-wrap: anywhere;
}
.listing-heading p {
  font-size: 14px;
  color: var(--mute);
  margin: 0;
}
.desktop-sort {
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  font-size: 13px;
}
.desktop-sort .form-select {
  width: 218px;
}
.product-demo-note {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.8;
  border-left: 3px solid #98a4b3;
  padding-left: 12px;
  margin-bottom: 24px;
}
.listing-sidebar {
  width: 272px;
  flex: 0 0 272px;
}
.listing-results {
  min-width: 0;
}
.filter-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: sticky;
  top: calc(var(--product-header-height, 126px) + 16px);
  max-height: calc(100dvh - var(--product-header-height, 126px) - 40px);
  overflow: auto;
  scrollbar-width: thin;
}
.filter-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 8px;
}
.filter-title h2 {
  font-size: 18px;
  margin: 0;
}
.filter-vehicle,
.filter-toolbar-button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 700;
  min-height: 48px;
  padding: 8px 12px;
  width: 100%;
  font-size: 14px;
}
.filter-layer {
  font-size: 13px;
  font-weight: 800;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.filter-group {
  border: 0;
  border-bottom: 1px solid #eef0f2;
  padding: 16px 0;
  margin: 0;
  min-width: 0;
}
.filter-group legend {
  font-size: 14px;
  font-weight: 750;
  margin: 0 0 8px;
  float: none;
  width: auto;
}
.filter-option {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  min-height: 44px;
}
.filter-option input {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: var(--red);
}
.filter-option label {
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 44px;
  flex: 1;
  line-height: 1.5;
}
.filter-help {
  font-size: 12px;
  color: var(--mute);
  line-height: 1.8;
  margin: 8px 0;
}
.applied-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.applied-chip {
  border: 1px solid #d5b0ae;
  border-radius: 6px;
  background: #fff4f3;
  color: #8f2522;
  min-height: 44px;
  padding: 6px 10px;
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.applied-chip span {
  margin-left: 8px;
  font-size: 17px;
}
.result-summary {
  font-size: 13px;
  color: var(--mute);
  margin: 0 0 20px;
}
.catalog-card {
  display: flex;
  flex-direction: column;
  box-shadow: none;
}
.catalog-card .product-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
}
.catalog-card h3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 52px;
}
.catalog-card .brand-label {
  font-size: 11px;
  line-height: 1.7;
}
.catalog-card .spec,
.catalog-card .fitment {
  font-size: 12px;
  line-height: 1.6;
}
.card-fitment {
  background: #f0f3f6;
  color: #405166;
  border-radius: 4px;
  padding: 6px 8px;
}
.catalog-card .p-bottom {
  flex-direction: column;
  align-items: stretch;
  margin-top: auto;
  padding-top: 14px;
}
.card-detail-link {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--red);
  color: white;
  border-color: var(--red);
  font-size: 13px;
  white-space: normal;
  line-height: 1.5;
  text-align: center;
  width: 100%;
}
.card-detail-link:hover {
  background: var(--hover);
  color: white;
  border-color: var(--hover);
}
.image-fallback {
  height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 100px;
  background: #eef0f3;
  color: var(--mute);
}
.product [hidden],
.product-gallery [hidden] {
  display: none !important;
}
.global-search {
  position: relative;
  overflow: visible;
}
.global-search .search-clear {
  background: white;
  color: var(--mute);
  padding: 0;
  width: 32px;
  border-radius: 0;
  font-size: 22px;
  min-height: 40px;
}
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 90;
  background: white;
  color: var(--ink);
  box-shadow: 0 12px 32px #0003;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 60dvh;
  overflow: auto;
  text-align: left;
}
.suggestion-note {
  font-size: 12px;
  color: var(--mute);
  padding: 12px 14px;
  margin: 0;
  background: #f5f6f8;
  line-height: 1.7;
}
.search-suggestions [role="option"] {
  display: flex;
  gap: 10px;
  align-items: start;
  font-size: 13px;
  min-height: 48px;
  padding: 12px 14px;
  cursor: pointer;
  border-top: 1px solid var(--border);
}
.search-suggestions [role="option"] small {
  font-size: 11px;
  color: var(--mute);
  flex-shrink: 0;
  background: #edf0f4;
  border-radius: 3px;
  padding: 2px 4px;
}
.search-suggestions [role="option"] span {
  overflow-wrap: anywhere;
}
.search-suggestions [aria-selected="true"],
.search-suggestions [role="option"]:hover {
  background: #ffefed;
}
.product-gallery {
  min-width: 0;
}
.gallery-main {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 20px;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.zoom-label {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: #f5f6f8;
  color: var(--mute);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 12px;
}
.gallery-thumbnails {
  margin-top: 12px;
  max-width: 360px;
}
.gallery-thumbnail {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  padding: 8px;
  width: 100%;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--mute);
  text-align: left;
  min-height: 64px;
}
.gallery-thumbnail img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.gallery-thumbnail[aria-pressed="true"] {
  border: 2px solid var(--red);
  color: var(--ink);
}
.gallery-mobile-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin: 12px 0;
}
.gallery-mobile-controls .p-detail {
  width: 48px;
}
.zoom-image {
  width: 100%;
  height: 60dvh;
  object-fit: contain;
}
.purchase-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  padding: 24px;
}
.purchase-panel h1 {
  font-size: 28px;
  line-height: 1.5;
  margin: 8px 0 12px;
}
.purchase-panel .brand-label {
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.pdp-price {
  font-size: 26px;
  font-weight: 800;
  margin: 16px 0 24px;
  color: var(--red);
}
.variant-field label,
.purchase-controls label,
.state-preview label,
#picker-form label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
.variant-field label span {
  font-size: 11px;
  color: var(--red);
  margin-left: 8px;
}
.fitment-card {
  margin: 24px 0;
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.fitment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fitment-heading h2 {
  font-size: 16px;
  margin: 0;
}
.fitment-heading .text-button {
  font-size: 12px;
  white-space: nowrap;
}
.fitment-card > p {
  font-size: 12px;
  color: var(--mute);
  line-height: 1.8;
}
.fitment-state {
  font-size: 14px;
  font-weight: 750;
  padding: 10px 12px;
  background: #e9edf2;
  color: #374b61;
  border-radius: 6px;
  margin: 12px 0;
  line-height: 1.6;
}
.fitment-state span {
  margin-right: 8px;
}
.fitment-state-confirmed {
  color: #256047;
  background: #e6f1eb;
}
.fitment-state-conditional {
  color: #715017;
  background: #fff0d6;
}
.fitment-state-incompatible {
  color: #942f2b;
  background: #ffe8e6;
}
.detail-link {
  font-size: 13px;
  color: var(--red);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.state-preview {
  border-top: 1px dashed #c6ced8;
  padding-top: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--mute);
}
.state-preview summary,
.product-detail-section summary {
  cursor: pointer;
  min-height: 44px;
  display: list-item;
  padding: 10px 0;
  line-height: 1.7;
}
.state-preview p {
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.8;
}
.purchase-controls {
  display: flex;
  gap: 12px;
  align-items: end;
}
.purchase-controls > div:first-child {
  flex: 0 0 92px;
}
.purchase-controls > div:last-child {
  flex: 1;
  min-width: 0;
}
.purchase-controls input {
  min-height: 48px;
}
.purchase-button {
  width: 100%;
  padding: 10px 12px;
  gap: 4px;
}
.purchase-button:disabled {
  opacity: 1;
  background: #59616d;
  border-color: #59616d;
  color: white;
  cursor: not-allowed;
}
.purchase-feedback {
  font-size: 13px;
  border-left: 3px solid #586f88;
  background: #f0f4f8;
  color: #344e65;
  padding: 12px;
  line-height: 1.8;
  margin: 14px 0;
}
.purchase-feedback.is-error {
  color: #8b2d28;
  background: #fff0ef;
  border-color: var(--red);
}
.product-line {
  border: 1px solid #9fbeaf;
  border-radius: 6px;
  background: #eef7f1;
  color: #205a3a;
  min-height: 48px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-weight: 700;
  font-size: 13px;
  margin-top: 12px;
  padding: 8px;
}
.product-line span {
  font-size: 11px;
  font-weight: 400;
}
.detail-anchor-nav {
  display: flex;
  position: sticky;
  top: var(--product-header-height, 126px);
  z-index: 15;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 32px 0 0;
  overflow: auto;
  scrollbar-width: thin;
}
.detail-anchor-nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 56px;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 3px solid transparent;
  padding: 12px;
  color: var(--mute);
  white-space: nowrap;
}
.detail-anchor-nav a:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}
.product-detail-section {
  margin-top: 20px;
  padding: 28px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  scroll-margin-top: calc(var(--product-header-height, 126px) + 78px);
}
.product-detail-section h2 {
  font-size: 22px;
  margin: 0 0 20px;
}
.product-detail-section p {
  font-size: 14px;
  line-height: 1.9;
  color: var(--mute);
}
.product-info-box {
  background: #f5f6f8;
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--mute);
  line-height: 1.9;
}
.technical-table {
  width: 100%;
  font-size: 14px;
  border: 1px solid var(--border);
  border-collapse: collapse;
  table-layout: fixed;
}
.technical-table th,
.technical-table td {
  padding: 12px 16px;
  line-height: 1.7;
  border-bottom: 1px solid var(--border);
  text-align: left;
  overflow-wrap: anywhere;
}
.technical-table th {
  width: 40%;
  background: #f5f6f8;
  font-weight: 600;
}
.related-products {
  margin-top: 40px;
}
.related-products h2 {
  font-size: 24px;
}
.related-products .tabs {
  width: auto;
}
.related-products .section-header {
  margin-bottom: 20px;
}
#mobile-purchase-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 45;
  background: white;
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 14px #0b0d1210;
}
.mobile-purchase-content {
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 720px;
  margin: auto;
}
.mobile-purchase-content > div {
  flex: 0 0 92px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-purchase-content strong {
  font-size: 14px;
  color: var(--red);
}
.mobile-purchase-content small {
  font-size: 10px;
  color: var(--mute);
}
.mobile-purchase-content .btn {
  flex: 1;
  font-size: 14px;
}
#filter-drawer {
  width: min(420px, 100%);
  max-width: 100%;
  max-height: 100dvh;
  height: 100dvh;
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  border-radius: 0;
  padding: 20px;
  border-width: 0 0 0 1px;
  overflow: hidden;
}
#filter-drawer > .dialog-header,
#filter-drawer > .filter-drawer-footer {
  flex-shrink: 0;
}
#filter-drawer[open] {
  display: flex;
  flex-direction: column;
}
#drawer-filters {
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}
.filter-drawer-footer {
  padding: 16px 0 env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.filter-drawer-footer > div {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.filter-drawer-footer button {
  flex: 1;
  font-size: 13px;
}
.picker-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.picker-actions button {
  width: auto;
  font-size: 13px;
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .listing-sidebar {
    width: 260px;
    flex-basis: 260px;
  }
  .catalog-card .product-body {
    padding: 12px;
  }
  .catalog-card .card-detail-link {
    font-size: 12px;
    padding: 8px 4px;
  }
  .purchase-panel {
    padding: 18px;
  }
  .purchase-panel h1 {
    font-size: 24px;
  }
  .purchase-controls {
    gap: 8px;
  }
  .purchase-controls > div:first-child {
    flex-basis: 72px;
  }
}
@media (max-width: 991.98px) {
  .mobile-list-toolbar {
    margin-bottom: 20px;
  }
  .listing-heading {
    margin-top: 20px;
  }
  .product-detail-mode {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .sticky-purchase-visible .float-line {
    bottom: calc(100px + env(safe-area-inset-bottom));
  }
  .gallery-thumbnails {
    max-width: none;
  }
  .purchase-panel h1 {
    font-size: 26px;
  }
  .gallery-main {
    max-height: 680px;
  }
  .product-detail-section {
    padding: 24px;
  }
  .vehicle-context {
    padding: 16px;
  }
  .vehicle-context p {
    font-size: 12px;
  }
}
@media (max-width: 575.98px) {
  .product-listing-mode #route-view,
  .product-detail-mode #route-view {
    padding: 16px 0 40px;
  }
  .product-breadcrumb {
    font-size: 12px;
    gap: 4px;
  }
  .vehicle-context {
    padding: 14px 12px;
    gap: 8px;
    margin-bottom: 20px;
    align-items: start;
  }
  .vehicle-context strong {
    font-size: 14px;
  }
  .vehicle-context .eyebrow {
    font-size: 9px;
  }
  .vehicle-context p {
    font-size: 11px;
    margin-top: 4px;
  }
  .vehicle-context .vehicle-change {
    font-size: 11px;
    padding: 6px 8px;
  }
  .listing-heading h1 {
    font-size: 26px;
  }
  .listing-heading p {
    font-size: 13px;
  }
  .product-demo-note {
    font-size: 12px;
    margin-bottom: 20px;
  }
  .catalog-card .product-body {
    padding: 10px;
  }
  .catalog-card h3 {
    font-size: 14px;
    min-height: 67px;
  }
  .catalog-card .brand-label {
    font-size: 11px;
  }
  .catalog-card .spec,
  .catalog-card .fitment {
    font-size: 12px;
  }
  .catalog-card .card-fitment {
    padding: 5px;
  }
  .catalog-card .card-detail-link {
    padding: 8px 4px;
    font-size: 12px;
  }
  .result-summary {
    font-size: 12px;
  }
  .purchase-panel {
    padding: 18px 14px;
  }
  .purchase-panel h1 {
    font-size: 23px;
  }
  .pdp-price {
    font-size: 24px;
  }
  .fitment-card {
    padding: 12px;
  }
  .purchase-controls {
    gap: 8px;
  }
  .purchase-controls > div:first-child {
    flex-basis: 72px;
  }
  .purchase-button {
    font-size: 13px;
  }
  .product-line {
    flex-wrap: wrap;
  }
  .detail-anchor-nav a {
    font-size: 13px;
    min-width: 108px;
  }
  .product-detail-section {
    padding: 20px 16px;
  }
  .product-detail-section h2 {
    font-size: 20px;
  }
  .technical-table {
    font-size: 12px;
  }
  .technical-table th,
  .technical-table td {
    padding: 10px;
  }
  .technical-table th {
    width: 44%;
  }
  .product-info-box {
    padding: 14px;
    font-size: 13px;
  }
  .related-products .section-header {
    align-items: start;
    flex-direction: column;
  }
  .related-products .tabs {
    width: 100%;
  }
  .related-products .tab {
    font-size: 12px;
    padding: 8px 6px;
  }
  .gallery-main {
    padding: 12px;
  }
  .gallery-thumbnail img {
    width: 44px;
    height: 44px;
  }
  .mobile-purchase-content > div {
    flex-basis: 84px;
  }
  .mobile-purchase-content {
    gap: 8px;
  }
  .picker-actions button {
    padding: 8px;
    font-size: 12px;
  }
}

.vehicle-change {
  border: 1px solid #909aa8;
  border-radius: 6px;
  min-height: 44px;
  background: transparent;
  color: white;
  font-size: 13px;
  white-space: nowrap;
}
.related-products > p {
  color: var(--mute);
  font-size: 13px;
  line-height: 1.8;
}
.related-products > .tabs {
  margin: 20px 0;
  width: fit-content;
}
@media (max-width: 575.98px) {
  .related-products > .tabs {
    width: 100%;
  }
}

/* 概念情境圖維持完整比例，不裁切安裝零件。 */
.related-products #related-panel {
  margin-top: 20px;
}

html:has(body.product-detail-mode) {
  scroll-padding-top: 0;
}

/* 手機表單與彈窗：可讀字級、完整觸控區域及單一篩選捲動。 */
html:has(dialog:modal) {
  overflow: hidden;
}
dialog {
  overscroll-behavior: contain;
}
@media (max-width: 991.98px) {
  .global-search input,
  .form-select,
  .form-control {
    font-size: 16px;
  }
  .global-search .search-clear {
    width: 44px;
    min-width: 44px;
  }
}

/* 篩選與空結果使用穩定的結果區，避免清空商品時版面立即塌縮。 */
#listing-items { min-height: 360px; }
