/* =========================================================================
   Enclosure Wizard — guided product filter (replaces the old finder)
   Scoped entirely under .enc-wiz. Works inside a Bricks code block.
   ========================================================================= */

.enc-wiz {
  --ew-brand: #0b5aa5;
  --ew-brand-dark: #002965;
  --ew-accent: #29558a;
  --ew-border: #cdd3db;
  --ew-border-soft: #e5e8ee;
  --ew-surface: #ffffff;
  --ew-surface-muted: #f4f6fa;
  --ew-text: #101820;
  --ew-text-muted: #5b6371;
  --ew-text-faint: #8b8b8b;
  --ew-shadow: 0 2px 10px rgba(16, 24, 32, 0.06);
  --ew-radius: 4px;

  box-sizing: border-box;
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ew-text);
  width: 100%;
}

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

/* ---- Layout grid ------------------------------------------------------- */
.enc-wiz__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 24px;
  align-items: stretch;
}

.enc-wiz__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.enc-wiz__intro {
  margin-bottom: 14px;
}

.enc-wiz__heading {
  margin: 0 0 6px;
  color: var(--ew-brand);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

.enc-wiz__tagline {
  margin: 0;
  color: var(--ew-text-muted);
  font-size: 14px;
}

/* Expanded variant — used by /catalogsearch/advanced */
.enc-wiz--expanded .enc-wiz__grid { grid-template-columns: minmax(0, 1fr); }
.enc-wiz--expanded .enc-wiz__promo { display: none; }
.enc-wiz--expanded .enc-wiz__heading { text-align: center; font-size: 36px; margin-bottom: 10px; }
.enc-wiz--expanded .enc-wiz__tagline { text-align: center; }
.enc-wiz--expanded .enc-wiz__main { max-width: 780px; margin: 0 auto; width: 100%; }

/* ---- Card wrapper ------------------------------------------------------ */
.enc-wiz__card {
  background: var(--ew-surface);
  border: 1px solid var(--ew-border);
  border-radius: var(--ew-radius);
  box-shadow: var(--ew-shadow);
  padding: 20px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.enc-wiz__boot {
  color: var(--ew-text-faint);
  font-size: 14px;
  padding: 40px 0;
  text-align: center;
}

/* ---- Progress bar ------------------------------------------------------ */
.enc-wiz__progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.enc-wiz__dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.enc-wiz__dot {
  width: 18px;
  height: 6px;
  border-radius: 3px;
  background: var(--ew-border);
  display: inline-block;
  transition: background 0.15s ease;
}
.enc-wiz__dot--optional {
  width: 10px;
  background: var(--ew-border-soft);
}
.enc-wiz__dot--done { background: var(--ew-brand); }
.enc-wiz__dot--current {
  background: var(--ew-accent);
  box-shadow: 0 0 0 2px rgba(11, 90, 165, 0.15);
}

.enc-wiz__progress-summary {
  color: var(--ew-text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---- Chips (active selections) ---------------------------------------- */
.enc-wiz__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -4px;
}

.enc-wiz__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--ew-surface-muted);
  border: 1px solid var(--ew-border-soft);
  border-radius: 999px;
  color: var(--ew-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.enc-wiz__chip:hover {
  border-color: var(--ew-border);
  background: #ebeef4;
}

.enc-wiz__chip-label { line-height: 1.3; }

.enc-wiz__chip-x {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(16, 24, 32, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: var(--ew-text-muted);
}
.enc-wiz__chip:hover .enc-wiz__chip-x {
  background: var(--ew-brand);
  color: #fff;
}

/* ---- Step body -------------------------------------------------------- */
.enc-wiz__body {
  flex: 1 1 auto;
  min-height: 0;
}

.enc-wiz__step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.enc-wiz__step-title {
  margin: 0;
  color: var(--ew-brand-dark);
  font-size: 18px;
  font-weight: 700;
}

.enc-wiz__step-sublabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--ew-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.enc-wiz__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}

/* Each option is a radio wrapped in a label (the whole pill is clickable) */
.enc-wiz__option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--ew-border);
  border-radius: var(--ew-radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  font-size: 14px;
  user-select: none;
}
.enc-wiz__option:hover {
  border-color: var(--ew-brand);
  background: #f5f9fd;
}
.enc-wiz__option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.enc-wiz__option--selected {
  border-color: var(--ew-brand);
  background: #eaf2fa;
  box-shadow: 0 0 0 2px rgba(11, 90, 165, 0.12);
}

.enc-wiz__option-label {
  font-weight: 600;
  color: var(--ew-text);
  line-height: 1.2;
}
.enc-wiz__option-count {
  color: var(--ew-text-faint);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* Options that carry a thumbnail (Enclosure Type, Enclosure Feature). The image
   sits above the label text so the pill turns into a small product card. */
.enc-wiz__option--with-image {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px;
  min-height: 150px;
}
.enc-wiz__option-image {
  width: 100%;
  height: 96px;
  object-fit: contain;
  background: var(--ew-surface-muted);
  border-radius: var(--ew-radius);
  display: block;
}
.enc-wiz__option--with-image .enc-wiz__option-label {
  font-size: 13px;
  line-height: 1.3;
}
.enc-wiz__option--with-image .enc-wiz__option-count {
  align-self: flex-end;
}
/* Slightly wider columns for image options so thumbnails don't get squeezed */
.enc-wiz__options:has(.enc-wiz__option--with-image) {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* Header diagram on Height/Width/Depth steps — shown above the value pills. */
.enc-wiz__step-figure {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}
.enc-wiz__step-figure img {
  max-width: 240px;
  max-height: 140px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Lots of numeric options (heights, widths, depths): tighter grid */
.enc-wiz__options--dense {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}
.enc-wiz__options--dense .enc-wiz__option {
  justify-content: center;
  padding: 8px 10px;
  flex-direction: column;
  gap: 2px;
}
.enc-wiz__options--dense .enc-wiz__option-label { font-size: 15px; }
.enc-wiz__options--dense .enc-wiz__option-count { font-size: 11px; }

/* Loading + error states */
.enc-wiz__loading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ew-text-muted);
  padding: 24px 0;
  justify-content: center;
}

.enc-wiz__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ew-border);
  border-top-color: var(--ew-brand);
  border-radius: 50%;
  animation: enc-wiz-spin 0.8s linear infinite;
}
@keyframes enc-wiz-spin { to { transform: rotate(360deg); } }

.enc-wiz__error {
  padding: 24px;
  text-align: center;
  color: var(--ew-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Empty state (no products match) */
.enc-wiz__empty {
  padding: 20px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.enc-wiz__empty-title {
  margin: 0;
  font-weight: 600;
  color: var(--ew-brand-dark);
  font-size: 15px;
}
.enc-wiz__empty-hint {
  margin: 0;
  color: var(--ew-text-muted);
  font-size: 13px;
}
.enc-wiz__empty .enc-wiz__chips { justify-content: center; }

/* ---- Footer ---------------------------------------------------------- */
.enc-wiz__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--ew-border-soft);
}

.enc-wiz__footer-left,
.enc-wiz__footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.enc-wiz__btn {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--ew-radius);
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.enc-wiz__btn:disabled { cursor: not-allowed; opacity: 0.5; }

.enc-wiz__btn--primary {
  background: var(--ew-brand);
  color: #fff;
  border-color: var(--ew-brand);
}
.enc-wiz__btn--primary:hover:not(:disabled) { background: var(--ew-brand-dark); border-color: var(--ew-brand-dark); }

.enc-wiz__btn--ghost {
  background: transparent;
  color: var(--ew-brand);
  border-color: var(--ew-border);
}
.enc-wiz__btn--ghost:hover:not(:disabled) {
  border-color: var(--ew-brand);
  background: rgba(11, 90, 165, 0.06);
}

/* ---- Promo panel (unchanged visual from old finder) ------------------ */
.enc-wiz__promo {
  display: flex;
  align-items: stretch;
}
.enc-wiz__promo-inner {
  background: linear-gradient(135deg, #002965 0%, #0b5aa5 100%);
  color: #fff;
  padding: 24px 22px;
  border-radius: var(--ew-radius);
  box-shadow: var(--ew-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  justify-content: space-between;
}
.enc-wiz__promo-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}
.enc-wiz__promo-title span {
  display: block;
  font-weight: 500;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 4px;
}
.enc-wiz__promo-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}
.enc-wiz__promo-btn {
  align-self: flex-start;
  background: #fff;
  color: var(--ew-brand-dark);
  padding: 10px 16px;
  border-radius: var(--ew-radius);
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
}
.enc-wiz__promo-btn:hover { background: #eaf2fa; }

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 820px) {
  .enc-wiz__grid { grid-template-columns: 1fr; }
  .enc-wiz__promo-inner { padding: 18px; }
  .enc-wiz__promo-title { font-size: 18px; }
}

@media (max-width: 600px) {
  .enc-wiz__card { padding: 14px; }
  .enc-wiz__heading { font-size: 22px; }
  .enc-wiz__options { grid-template-columns: 1fr; max-height: 280px; }
  .enc-wiz__options--dense { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .enc-wiz__footer { flex-direction: column-reverse; align-items: stretch; }
  .enc-wiz__footer-left,
  .enc-wiz__footer-right { justify-content: stretch; }
  .enc-wiz__btn { flex: 1 1 auto; text-align: center; }
}
