/*
 * UPVC Products — frontend styles (shortcode-rendered configurator).
 *
 * Scoped under .upvc-cfg / #upvc-products-configurator-root so it doesn't
 * touch the rest of the page or clash with the legacy pqb-* styles still
 * present during cutover.
 */

#upvc-products-configurator-root {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  color: #073240;
  max-width: 1200px;
  margin: 0 auto;
}

.upvc-cfg-error,
.upvc-cfg-pending {
  padding: 16px 18px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.5;
}
.upvc-cfg-error   { background: #fdecec; border: 1px solid #f5a3a3; color: #6c0e0e; }
.upvc-cfg-pending { background: #fff8e1; border: 1px solid #f0c97c; color: #5d4302; }

/* ── product-page mode (image left, accordions right) ───────────────── */

/* Breadcrumbs row above everything */
.upvc-pp-breadcrumbs { font-size: 12px; color: #6b8a97; margin-bottom: 6px; }
.upvc-pp-breadcrumbs a { color: #6b8a97; text-decoration: none; }
.upvc-pp-breadcrumbs a:hover { color: #073240; text-decoration: underline; }
.upvc-pp-breadcrumbs .sep { margin: 0 6px; color: #c0cdd4; }
.upvc-pp-breadcrumbs .current { color: #073240; }

/* Header (back button + title row + MIB badge) */
.upvc-pp-header { margin-bottom: 20px; }
.upvc-pp-back {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; font-size: 14px; font-weight: 600;
  color: #8cc73d; cursor: pointer; padding: 0; margin-bottom: 10px;
  text-decoration: none; font-family: inherit;
}
.upvc-pp-back:hover { color: #073240; text-decoration: underline; }
.upvc-pp-title-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.upvc-pp-left-name { font-size: 22px; font-weight: 700; color: #073240; margin: 0 0 2px; }
.upvc-pp-left-sub  { font-size: 13px; color: #6b8a97; margin: 0; }
.upvc-pp-mib { height: 60px; flex-shrink: 0; }

/* 2-column detail grid */
.upvc-pp-detail {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
  gap: 28px;
}
@media (max-width: 860px) {
  .upvc-pp-detail { grid-template-columns: 1fr; }
  .upvc-pp-mib    { height: 44px; }
  .upvc-pp-left-name { font-size: 18px; }
}

.upvc-pp-left  { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 140px; align-self: start; }
@media (max-width: 860px) { .upvc-pp-left { position: relative; top: auto; } }
.upvc-pp-right { display: flex; flex-direction: column; gap: 10px; }

/* Big square image */
.upvc-pp-left-img {
  width: 100%; border-radius: 12px; overflow: hidden;
  background: #f0f2f5; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
}
.upvc-pp-left-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upvc-pp-left-img-placeholder { width: 100%; height: 100%; }
@media (max-width: 860px) { .upvc-pp-left-img { aspect-ratio: 4 / 3; } }

/* Trust badges row */
.upvc-pp-trust {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px;
  padding: 14px 16px; background: #f4f7f9; border-radius: 8px;
}
.upvc-pp-trust-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: #073240;
}

/* Klarna strip */
.upvc-pp-klarna {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: #fef6ee; border-radius: 8px;
  font-size: 13px; color: #17120f;
}
.upvc-pp-klarna-badge {
  background: #ffb3c7; color: #17120f; font-weight: 800;
  font-size: 11px; padding: 4px 8px; border-radius: 4px; letter-spacing: .5px;
}

/* "How to Measure your X" button */
.upvc-pp-measure-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px;
  background: #fff; border: 1px solid #e8ecef; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #073240; cursor: pointer;
  text-align: left; font-family: inherit;
}
.upvc-pp-measure-btn:hover { background: #f4f7f9; border-color: #cfd8de; }

/* Pills (legacy compatibility — green badges on the left panel) */
.upvc-pp-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.upvc-pp-pill {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: #ecf6da; color: #4a7311;
}

/* Accordions (generic — each product overrides body content). */
.upvc-pp-accordion {
  border: 1px solid #e8ecef; border-radius: 10px; background: #fff; overflow: hidden;
}
.upvc-pp-accordion + .upvc-pp-accordion { margin-top: -1px; }
.upvc-pp-acc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; font-weight: 600; cursor: pointer;
  background: #f8fafb; border-bottom: 1px solid transparent;
}
.upvc-pp-acc-head:hover { background: #f1f5f8; }
.upvc-pp-accordion.is-open > .upvc-pp-acc-head { border-bottom-color: #e8ecef; }
.upvc-pp-acc-head .chev { transition: transform .15s; }
.upvc-pp-accordion.is-open .chev { transform: rotate(180deg); }
.upvc-pp-acc-body { padding: 14px 16px; display: none; }
.upvc-pp-accordion.is-open > .upvc-pp-acc-body { display: block; }

/* Price strip + ATC button (used by per-product renderers). */
.upvc-pp-pricebar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 10px; background: #073240; color: #fff;
}
.upvc-pp-price { font-size: 22px; font-weight: 700; }
.upvc-pp-atc {
  background: #8cc73d; color: #fff; border: 0; border-radius: 8px;
  padding: 10px 18px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.upvc-pp-atc[disabled] { opacity: .5; cursor: not-allowed; }
.upvc-pp-atc:hover:not([disabled]) { background: #7ab32f; }

/* ── product-page grid mode (full-screen type picker) ───────────────── */

.upvc-pp--grid { padding-top: 4px; }
.upvc-pp-tabs {
  display: flex; gap: 4px; margin-bottom: 24px; padding: 4px;
  background: #f0f2f5; border-radius: 10px;
}
.upvc-pp-tab {
  flex: 1; padding: 10px; border: 0; border-radius: 8px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  background: transparent; color: #6b8a97; cursor: pointer;
  transition: background .2s, color .2s;
}
.upvc-pp-tab:hover { color: #073240; }
.upvc-pp-tab.active { background: #073240; color: #fff; }

.upvc-pp-grid-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.upvc-pp-grid-sub   { margin: 0 0 12px; color: #4b5b65; font-size: 14px; }
.upvc-pp-seo-desc   { font-size: 14px; line-height: 1.7; color: #4b5563; margin-bottom: 24px; }

.upvc-pp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.upvc-pp-card {
  border: 2px solid #e8ecf0; border-radius: 12px; overflow: hidden;
  background: #fff; cursor: pointer; transition: border-color .25s, box-shadow .25s, transform .25s;
  display: flex; flex-direction: column;
}
.upvc-pp-card:hover {
  border-color: #8cc73d; box-shadow: 0 8px 30px rgba(140,199,61,.1);
  transform: translateY(-2px);
}
.upvc-pp-card-img {
  width: 100%; aspect-ratio: 4/3; overflow: hidden; background: #f0f2f5;
  display: flex; align-items: center; justify-content: center;
}
.upvc-pp-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.upvc-pp-card-img-fallback { font-size: 48px; font-weight: 700; color: #c0cdd4; }
.upvc-pp-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.upvc-pp-card-name  { font-size: 15px; font-weight: 700; color: #073240; margin-bottom: 4px; }
.upvc-pp-card-price { font-size: 14px; font-weight: 700; color: #073240; margin-bottom: 6px; }
.upvc-pp-card-price span { font-size: 12px; font-weight: 400; color: #6b8a97; }
.upvc-pp-card-sizes { font-size: 12px; color: #6b8a97; line-height: 1.6; margin-bottom: 10px; }
.upvc-pp-card-btn {
  display: block; padding: 10px; border-radius: 8px; background: #073240;
  color: #fff; font-size: 13px; font-weight: 600; text-align: center;
  margin-top: auto; transition: background .2s;
}
.upvc-pp-card:hover .upvc-pp-card-btn { background: #8cc73d; }

@media (max-width: 1024px) { .upvc-pp-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  {
  .upvc-pp-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .upvc-pp-card-body { padding: 10px 12px; }
  .upvc-pp-card-name { font-size: 13px; }
  .upvc-pp-card-price { font-size: 13px; }
  .upvc-pp-card-sizes { font-size: 11px; margin-bottom: 8px; }
  .upvc-pp-card-btn { padding: 8px; font-size: 12px; }
}

/* ── wizard mode (step-by-step) ─────────────────────────────────────── */
.upvc-wz { display: flex; flex-direction: column; gap: 18px; }
.upvc-wz-stepper { display: flex; gap: 10px; flex-wrap: wrap; }
.upvc-wz-step {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #6b7c87;
  padding: 6px 12px; border-radius: 999px; background: #f1f5f8;
}
.upvc-wz-step.is-active { background: #073240; color: #fff; }
.upvc-wz-step.is-done   { background: #ecf6da; color: #4a7311; }
.upvc-wz-body { padding: 18px; border: 1px solid #e8ecef; border-radius: 12px; background: #fff; }
.upvc-wz-nav  { display: flex; justify-content: space-between; }
.upvc-wz-back, .upvc-wz-next, .upvc-wz-atc {
  font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 0; cursor: pointer; font-size: 14px;
}
.upvc-wz-back { background: #f1f5f8; color: #4a5e6a; }
.upvc-wz-next { background: #073240; color: #fff; }
.upvc-wz-atc  { background: #8cc73d; color: #fff; }
.upvc-wz-next[disabled], .upvc-wz-atc[disabled] { opacity: .5; cursor: not-allowed; }

/* ── shared option-list controls (used by per-product renderers) ─────── */
.upvc-opt-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
}
.upvc-opt-card {
  border: 2px solid #e8ecef; border-radius: 10px; padding: 10px 8px; background: #fff;
  text-align: center; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  font-size: 13px; color: #073240;
}
.upvc-opt-card:hover { border-color: #b0d870; }
.upvc-opt-card.is-selected { border-color: #8cc73d; box-shadow: 0 0 0 2px rgba(140,199,61,.18); }
.upvc-opt-card-img { width: 100%; aspect-ratio: 1/1; object-fit: contain; margin-bottom: 6px; }
.upvc-opt-card-label { display: block; font-weight: 600; }
.upvc-opt-card-meta  { display: block; font-size: 11px; color: #6b7c87; margin-top: 2px; }

/* ── Bi-fold configuration cards ─────────────────────────────────────── */
.upvc-opt-grid--config {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.upvc-opt-card--config {
  padding: 14px 12px 12px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; background: #fafbfc;
}
.upvc-opt-card--config .upvc-opt-card-label {
  font-size: 13px; line-height: 1.3; color: #073240;
}
.upvc-opt-card--config.is-selected { background: #f5fbeb; }

/* Skewed-bar glyph that mirrors the L/R panel split */
.upvc-cfg-fold {
  display: inline-flex; align-items: flex-end; justify-content: center;
  height: 26px; min-width: 60px;
}
.upvc-cfg-panel {
  width: 7px; height: 100%; margin: 0 1px; background: #073240; border-radius: 1px;
  transition: background-color .15s;
}
.upvc-cfg-panel--l { transform: skewX(-22deg); transform-origin: bottom right; }
.upvc-cfg-panel--r { transform: skewX( 22deg); transform-origin: bottom left;  }
.upvc-cfg-gap     { display: inline-block; width: 8px; }
.upvc-opt-card--config.is-selected .upvc-cfg-panel { background: #8cc73d; }

/* Trade-shorthand pill under the plain-English label */
.upvc-cfg-tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef2f5; color: #4a6571;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.upvc-opt-card--config.is-selected .upvc-cfg-tag { background: #e3f1c8; color: #466f10; }

.upvc-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.upvc-field > label { font-weight: 600; font-size: 13px; color: #073240; }
.upvc-field select, .upvc-field input[type=text], .upvc-field input[type=number] {
  border: 1px solid #cfd8de; border-radius: 6px; padding: 7px 10px; font-size: 14px; background: #fff;
}
.upvc-field-row { display: flex; gap: 10px; }
.upvc-field-row > .upvc-field { flex: 1; }
