/* 商品详情页 */
#bdProductDetail {
  width: 100%;
  min-height: calc(100vh - var(--bd-topbar-h, 56px));
}

html.bd-view-product-detail .bd-main,
.bd-main:has(> #bdProductDetail:not([hidden])) {
  padding: 12px 16px 24px;
}

.pd-root {
  width: 100%;
  font-size: 12px;
}

.pd-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 960px) {
  .pd-layout { grid-template-columns: 1fr; }
}

.pd-card {
  background: var(--bd-card);
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  padding: 14px;
}

.pd-card-media {
  position: relative;
}

.pd-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
  display: block;
}

.pd-card-img-empty {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
}

.pd-card-qr {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.pd-card-qr .ks-qr-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  color: #64748b;
}

.pd-card-qr .ks-qr-btn:hover {
  color: #3c66ff;
  background: #fff;
}

.pd-card-qr .ks-qr-pop {
  left: auto;
  right: 0;
  transform: none;
}

.pd-card-title {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.pd-meta {
  margin-top: 8px;
  color: var(--bd-text-secondary);
  line-height: 1.6;
}

.pd-meta code {
  font-size: 11px;
  word-break: break-all;
}

.pd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pd-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--bd-border);
  background: var(--bd-card);
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
  color: inherit;
}

.pd-btn-primary {
  background: var(--bd-primary);
  border-color: var(--bd-primary);
  color: #fff;
}

.pd-btn-spec {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  text-align: left;
}

.pd-btn-spec-main {
  font-size: 13px;
  font-weight: 600;
}

.pd-btn-spec-sub {
  font-size: 11px;
  color: var(--bd-text-secondary);
  font-weight: 400;
}

.pd-xhs-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 10px;
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  background: #fafafa;
}

.pd-xhs-qr-img {
  display: block;
  border-radius: 6px;
  background: #fff;
}

.pd-xhs-qr-hint {
  margin: 0;
  font-size: 12px;
  color: var(--bd-text-secondary);
}

.pd-xhs-qr-or {
  margin: 0;
  font-size: 11px;
  color: var(--bd-text-muted, #94a3b8);
  text-transform: lowercase;
}

.pd-xhs-qr-pc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid #ef4444;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  text-decoration: none;
}

.pd-xhs-qr-pc:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
  text-decoration: none;
}

.pd-spec-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.pd-spec-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.pd-spec-modal-panel {
  position: relative;
  width: min(860px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: var(--bd-card, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
}

.pd-spec-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--bd-text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.pd-spec-modal-close:hover {
  background: rgba(15, 23, 42, 0.1);
}

.pd-spec-modal-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 0;
}

@media (max-width: 720px) {
  .pd-spec-modal-body {
    grid-template-columns: 1fr;
  }
  .pd-spec-modal-side {
    border-left: none !important;
    border-top: 1px solid var(--bd-border);
  }
}

.pd-spec-modal-main {
  padding: 18px 20px 20px;
  min-width: 0;
}

.pd-spec-modal-side {
  padding: 18px 16px 20px;
  border-left: 1px solid var(--bd-border);
  background: #fafafa;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.pd-spec-modal-side .pd-xhs-qr {
  margin-top: 0;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
}

.pd-spec-modal-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.pd-spec-modal-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f1f5f9;
}

.pd-spec-modal-thumb-empty {
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
}

.pd-spec-modal-head-text {
  min-width: 0;
}

.pd-spec-modal-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.pd-spec-modal-price {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: #dc2626;
}

.pd-spec-modal-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--bd-text-secondary);
}

.pd-spec-modal-label {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.pd-spec-dim + .pd-spec-dim {
  margin-top: 14px;
}

.pd-spec-dim-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bd-text, #0f172a);
}

.pd-spec-dim-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pd-spec-opt {
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: var(--bd-text, #0f172a);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pd-spec-opt:hover:not(.is-disabled) {
  border-color: #fca5a5;
  color: #dc2626;
}

.pd-spec-opt.is-active {
  border-color: #ef4444;
  background: #fff1f2;
  color: #dc2626;
  font-weight: 600;
}

.pd-spec-opt.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.pd-spec-empty {
  padding: 16px 12px;
  border: 1px dashed var(--bd-border);
  border-radius: 8px;
  color: var(--bd-text-secondary);
  font-size: 12px;
  line-height: 1.6;
  background: #fafafa;
}

.pd-spec-modal-count {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 400;
  color: var(--bd-text-secondary);
}

body.pd-spec-modal-open {
  overflow: hidden;
}

.pd-sku-list {
  margin-top: 12px;
}

.pd-sku-list > .pd-meta-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pd-sku-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pd-sku-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 88px;
  max-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.pd-sku-label {
  line-height: 1.35;
  color: var(--bd-text, #0f172a);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pd-sku-price {
  font-weight: 600;
  color: #dc2626;
}

.pd-sku-grid--modal {
  gap: 10px;
}

.pd-sku-item--modal {
  min-width: 108px;
  max-width: none;
  flex: 1 1 108px;
}

.pd-sku-item.is-active {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
}

.pd-sku-item.is-active .pd-sku-label {
  color: #dc2626;
}

.pd-main {
  background: var(--bd-card);
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  overflow: hidden;
}

.pd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--bd-border);
  background: #f8fafc;
}

.pd-tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--bd-text-secondary);
}

.pd-tab.is-active {
  color: var(--bd-primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--bd-primary);
  background: var(--bd-card);
}

.pd-meta-muted {
  margin-top: 4px;
  font-size: 11px;
  color: var(--bd-text-secondary);
}

.pd-panel {
  position: relative;
  padding: 14px 16px 18px;
}

.pd-alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12px;
}

.pd-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pd-metric {
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}

.pd-metric-val {
  font-size: 16px;
  font-weight: 700;
}

.pd-metric-label {
  margin-top: 4px;
  color: var(--bd-text-secondary);
  font-size: 11px;
}

.pd-trend-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pd-day-btns {
  display: flex;
  gap: 6px;
}

.pd-day-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--bd-border);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
}

.pd-day-btn.is-active {
  border-color: var(--bd-primary);
  color: var(--bd-primary);
}

.pd-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding: 8px 4px 4px;
  border: 1px solid var(--bd-border);
  border-radius: 8px;
  overflow-x: auto;
}

.pd-trend-bar {
  flex: 1 0 8px;
  max-width: 16px;
  min-height: 2px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 2px 2px 0 0;
}

.pd-placeholder {
  padding: 40px 16px;
  text-align: center;
  color: var(--bd-text-secondary);
}

.pd-status {
  padding: 24px;
  text-align: center;
  color: var(--bd-text-secondary);
}

.pd-status-error {
  color: #dc2626;
}
