/* POCYBER Fitment widget
   Scoped to .pf — inherits the theme's font, overrides nothing global. */

.pf {
  --pf-line: #9aa1aa;
  --pf-line-soft: #e2e4e8;
  --pf-ink: #14181c;
  --pf-dim: #9aa1aa;
  --pf-fill: #f1f2f4;

  box-sizing: border-box;
  width: 100%;
  max-width: 520px;
  margin: 1.25em 0;
}

.pf *,
.pf *::before,
.pf *::after {
  box-sizing: border-box;
}

/* ---------- header ---------- */

/* 模块标题：默认中性（未确认），仅在判定 FIT 后才变成绿色「Confirmed Fit」。
   未选车就宣称已确认，等于替顾客下了他没做过的结论。 */
.pf-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 12px;
  text-align: left;
}

.pf-head-ck {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #1a6b45;
  color: #fff;
}

.pf-head[data-pf-state="fit"] .pf-head-ck {
  display: inline-flex;
}

/* 勾用边框绘制，不依赖字体里的 ✓ 字形，缩放到任何像素都清晰 */
.pf-head-ck::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(-45deg);
}

.pf-head-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #14181c;
  transition: color 0.18s ease;
}

.pf-head[data-pf-state="fit"] .pf-head-title {
  font-weight: 700;
  color: #1a6b45;
}

.pf-head[data-pf-state="no"] .pf-head-title {
  color: #a12a1c;
}

.pf-head-sep {
  font-size: 14px;
  font-weight: 300;
  color: #c9ced6;
}

.pf-head-sub {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
}

/* ---------- selector stack ---------- */

.pf-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pf-stack[hidden] {
  display: none;
}

.pf-sel {
  display: block;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 42px 0 15px;
  font-family: inherit;
  font-size: 15px;
  line-height: 48px;
  color: var(--pf-ink);
  background-color: #fff;
  border: 1px solid var(--pf-line);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='%236b7280' d='M1.6.6 7 6l5.4-5.4L14 2.2 7 9.2 0 2.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 13px 9px;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

/* Disabled looks deliberately inert: lighter fill, soft border, muted text */
.pf-sel:disabled {
  background-color: var(--pf-fill);
  border-color: var(--pf-line-soft);
  color: var(--pf-dim);
  cursor: default;
}

.pf-sel:not(:disabled):hover {
  border-color: #6b7280;
}

.pf-sel:focus {
  outline: 2px solid #0f3d5c;
  outline-offset: 1px;
  border-color: #0f3d5c;
}

/* ---------- verdict ---------- */

.pf-verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid var(--pf-line-soft);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.pf-verdict[hidden] {
  display: none;
}

.pf-v-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.pf-v-txt {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.pf-v-change {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.pf-v-change:hover {
  background: rgba(0, 0, 0, 0.06);
}

.pf-v-fit {
  background: #e8f5ee;
  border-color: #b8dfca;
  color: #1a6b45;
}

.pf-v-fit .pf-v-icon {
  background: #1a6b45;
  color: #fff;
}

.pf-v-no {
  background: #fdecea;
  border-color: #f3c2bc;
  color: #a12a1c;
}

.pf-v-no .pf-v-icon {
  background: #a12a1c;
  color: #fff;
}

.pf-v-unknown,
.pf-v-loading {
  background: #f6f7f9;
  border-color: var(--pf-line-soft);
  color: #6b7280;
}

.pf-v-unknown .pf-v-icon {
  background: #9aa1aa;
  color: #fff;
}

/* ---------- upstream failure ---------- */

.pf-fallback {
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #6b7280;
  background: #f6f7f9;
  border: 1px solid var(--pf-line-soft);
  border-radius: 6px;
}

.pf-fallback[hidden] {
  display: none;
}

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .pf {
    max-width: none;
  }

  .pf-head {
    margin-bottom: 10px;
    gap: 6px;
  }

  .pf-head-title {
    font-size: 14.5px;
  }

  .pf-head-sep,
  .pf-head-sub {
    font-size: 13px;
  }

  .pf-sel {
    height: 46px;
    font-size: 15px;
  }

  .pf-verdict {
    flex-wrap: wrap;
  }

  .pf-v-txt {
    flex-basis: calc(100% - 30px);
  }
}

/* ---------- fitment table (optional shortcode, eBay-style list) ---------- */

.pf-tbl {
  max-width: 820px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--pf-line-soft);
  border-radius: 8px;
}

.pf-tbl-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--pf-line-soft);
}

.pf-tbl-title {
  font-size: 15px;
  font-weight: 700;
}

.pf-tbl-count {
  font-size: 12.5px;
  color: #6b7280;
}

.pf-grp {
  border-bottom: 1px solid var(--pf-line-soft);
}

.pf-grp:last-child {
  border-bottom: 0;
}

.pf-grp > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 2px;
  font-size: 14px;
  list-style: none;
  cursor: pointer;
}

.pf-grp > summary::-webkit-details-marker {
  display: none;
}

/* 折叠箭头：默认指向右，展开后指向下 */
.pf-grp > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid #6b7280;
  border-bottom: 1.5px solid #6b7280;
  transform: rotate(-45deg);
  transition: transform .15s;
}

.pf-grp[open] > summary::before {
  transform: rotate(45deg);
}

.pf-grp-mk {
  font-weight: 600;
}

.pf-grp-n {
  padding: 1px 7px;
  font-size: 11.5px;
  color: #6b7280;
  background: var(--pf-fill);
  border-radius: 10px;
}

.pf-tbl-t {
  width: 100%;
  margin: 0 0 10px;
  border-collapse: collapse;
  font-size: 13px;
}

.pf-tbl-t th,
.pf-tbl-t td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid #f1f2f4;
}

.pf-tbl-t th {
  font-size: 11.5px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.pf-tbl-t tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 640px) {
  .pf-tbl {
    padding: 12px;
  }

  .pf-tbl-t {
    font-size: 12px;
  }

  .pf-tbl-t th,
  .pf-tbl-t td {
    padding: 6px 6px;
  }
}

/* 服务端只输出空挂载点，组件由前端按 /widget 结果渲染 */
.pf-mount,
.pf-mount[hidden] {
  display: none;
}
