/* ============================================================
   PHE Inquiry Wizard — Front-end Styles v2 (phe-wizard.css)
   ============================================================ */

/* ── Variables ───────────────────────────────────────────── */
:root {
  --phe-primary:   #0d3d5e;
  --phe-primary-l: #1a5f8a;
  --phe-accent:    #f59e0b;
  --phe-accent-l:  #fbbf24;
  --phe-success:   #16a34a;
  --phe-error:     #dc2626;
  --phe-bg:        #f8fafc;
  --phe-card-bg:   #ffffff;
  --phe-border:    #e2e8f0;
  --phe-text:      #1e293b;
  --phe-muted:     #64748b;
  --phe-radius:    10px;
  --phe-shadow:    0 4px 18px rgba(13,61,94,.10);
  --phe-trans:     .22s ease;
}

/* ── Honeypot ────────────────────────────────────────────── */
.phe-hp-wrap {
  position: absolute; left: -9999px; top: -9999px;
  opacity: 0; pointer-events: none; height: 0; overflow: hidden;
}

/* ── Wizard shell ────────────────────────────────────────── */
.phe-wizard {
  font-family: 'Inter','Segoe UI',Arial,sans-serif;
  background: var(--phe-bg);
  border: 1px solid var(--phe-border);
  border-radius: 16px;
  padding: 32px 36px 28px;
  max-width: 860px;
  margin: 0 auto 40px;
  box-shadow: var(--phe-shadow);
  color: var(--phe-text);
  position: relative;
}


/* ── Progress bar ────────────────────────────────────────── */
.phe-progress { margin-bottom: 32px; }
.phe-progress-steps { display: flex; align-items: center; }
.phe-progress-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex: 1; position: relative;
}
.phe-progress-circle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2.5px solid var(--phe-border); background: var(--phe-card-bg);
  color: var(--phe-muted); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--phe-trans); z-index: 1;
}
.phe-progress-label { font-size: 11px; color: var(--phe-muted); text-align: center; font-weight: 500; max-width: 80px; line-height: 1.3; }
.phe-progress-line { flex: 1; height: 3px; background: var(--phe-border); margin-top: -20px; transition: background var(--phe-trans); }
.phe-progress-step--active .phe-progress-circle { background: var(--phe-primary); border-color: var(--phe-primary); color: #fff; box-shadow: 0 0 0 4px rgba(13,61,94,.15); }
.phe-progress-step--active .phe-progress-label { color: var(--phe-primary); font-weight: 700; }
.phe-progress-step--done .phe-progress-circle { background: var(--phe-success); border-color: var(--phe-success); color: #fff; }
.phe-progress-step--done + .phe-progress-line { background: var(--phe-success); }

/* ── Step container ──────────────────────────────────────── */
.phe-step { animation: pheFadeIn .25s ease; }
@keyframes pheFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.phe-step-header { margin-bottom: 24px; }
.phe-step-desc { font-size: 14px; color: var(--phe-muted); margin: 4px 0 0; }
.phe-step-error {
  margin-top: 12px; color: var(--phe-error); font-size: 13px; font-weight: 600;
  display: none; padding: 8px 14px; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 6px;
}

/* ── Step 1: Big title ───────────────────────────────────── */
.phe-step-title {
  margin: 0; line-height: 1.15;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.phe-title-select {
  font-size: 38px; font-weight: 800; color: var(--phe-muted);
}
.phe-title-big {
  font-size: 38px; font-weight: 800; color: var(--phe-primary);
}

/* ── Brand cards ─────────────────────────────────────────── */
.phe-brand-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr));
  gap: 12px; margin-bottom: 24px;
}
.phe-brand-card {
  background: var(--phe-card-bg); border: 2px solid var(--phe-border);
  border-radius: var(--phe-radius); padding: 14px 10px; text-align: center;
  cursor: pointer; font-size: 13px; font-weight: 700; color: var(--phe-text);
  transition: all var(--phe-trans); position: relative; user-select: none;
}
.phe-brand-card:hover { border-color: var(--phe-primary-l); box-shadow: 0 3px 10px rgba(13,61,94,.12); transform: translateY(-2px); }
.phe-brand-card--selected {
  border-color: var(--phe-primary); background: rgba(13,61,94,.05);
  box-shadow: 0 0 0 3px rgba(13,61,94,.12);
}
.phe-brand-card--selected::after {
  content: '✓'; position: absolute; top: 5px; right: 7px;
  font-size: 11px; color: var(--phe-primary); font-weight: 900;
}

/* ── Model section ───────────────────────────────────────── */
.phe-model-section { margin-bottom: 8px; }
.phe-model-title {
  font-size: 15px; font-weight: 700; color: var(--phe-primary);
  margin: 0 0 12px; border-bottom: 2px solid var(--phe-border); padding-bottom: 8px;
}
.phe-model-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
/* Force 6-column layout on wide screens */
@media (min-width: 600px) {
  .phe-model-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
  }
}
.phe-model-pill {
  background: var(--phe-card-bg); border: 1.5px solid var(--phe-border);
  border-radius: 6px; padding: 7px 4px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--phe-text);
  cursor: pointer; transition: all var(--phe-trans);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.phe-model-pill:hover { border-color: var(--phe-primary-l); color: var(--phe-primary); background: #eff6ff; }
.phe-model-pill--selected {
  background: var(--phe-primary); border-color: var(--phe-primary);
  color: #fff; box-shadow: 0 2px 8px rgba(13,61,94,.25);
}

/* ── Part-type image cards (Step 2) ──────────────────────── */
.phe-parts-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px;
}
@media (max-width: 600px) { .phe-parts-grid { grid-template-columns: 1fr; } }
.phe-part-card {
  border: 2.5px solid var(--phe-border); border-radius: var(--phe-radius);
  overflow: hidden; cursor: pointer; transition: all var(--phe-trans);
  position: relative; background: var(--phe-card-bg);
}
.phe-part-card:hover { border-color: var(--phe-primary-l); transform: translateY(-3px); box-shadow: 0 6px 18px rgba(13,61,94,.14); }
.phe-part-card--selected { border-color: var(--phe-accent); box-shadow: 0 0 0 3px rgba(245,158,11,.25); }
.phe-part-card__check {
  display: none; position: absolute; top: 8px; right: 8px;
  background: var(--phe-accent); color: #fff; border-radius: 50%;
  width: 24px; height: 24px; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; z-index: 2;
}
.phe-part-card--selected .phe-part-card__check { display: flex; }
/* ← Key change: contain so nothing is cropped */
.phe-part-card__img {
  width: 100%; height: 190px;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #f0f4f8;
  padding: 6px;
  box-sizing: border-box;
}
.phe-part-card__label {
  display: block; padding: 10px 12px;
  font-size: 13px; font-weight: 700; color: var(--phe-text);
  text-align: center; border-top: 1px solid var(--phe-border);
}

/* ── Step 3: Two-column spec layout ──────────────────────── */
.phe-spec-section { margin-bottom: 28px; }
.phe-spec-section__title {
  font-size: 17px; font-weight: 800; color: var(--phe-primary);
  border-bottom: 2px solid var(--phe-border); padding-bottom: 8px; margin-bottom: 16px;
}
.phe-spec-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;
}
@media (max-width: 560px) { .phe-spec-cols { grid-template-columns: 1fr; } }
.phe-spec-col {
  background: var(--phe-card-bg); border: 1px solid var(--phe-border);
  border-radius: var(--phe-radius); padding: 16px; text-align: center;
}
.phe-spec-col__img {
  width: 100%; height: 130px; object-fit: contain; object-position: center;
  border-radius: 6px; display: block; background: #f0f4f8; margin-bottom: 8px;
}
.phe-spec-col__cap {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--phe-primary); margin-bottom: 10px;
}

/* ── Qty stepper ─────────────────────────────────────────── */
.phe-qty-wrap { display: flex; align-items: center; justify-content: center; margin-top: 6px; }
.phe-qty-btn {
  width: 34px; height: 38px; border: 1.5px solid var(--phe-border);
  background: var(--phe-bg); color: var(--phe-primary);
  font-size: 18px; font-weight: 700; cursor: pointer; line-height: 1;
  transition: background var(--phe-trans);
}
.phe-qty-btn:first-child { border-radius: 6px 0 0 6px; }
.phe-qty-btn:last-child  { border-radius: 0 6px 6px 0; }
.phe-qty-btn:hover { background: var(--phe-border); }
.phe-qty-input {
  width: 56px; height: 38px;
  border: 1.5px solid var(--phe-border); border-left: none; border-right: none;
  text-align: center; font-size: 15px; font-weight: 700;
  color: var(--phe-text); background: var(--phe-card-bg); outline: none;
}
.phe-qty-input::-webkit-inner-spin-button,
.phe-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Material radio pills ────────────────────────────────── */
.phe-mat-group { margin-top: 16px; }
.phe-mat-group .phe-label {
  font-size: 14px; font-weight: 700; color: var(--phe-primary);
  margin-bottom: 10px;
}
.phe-radio-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.phe-mat-pill {
  background: var(--phe-card-bg); border: 1.5px solid var(--phe-border);
  border-radius: 20px; padding: 7px 16px;
  font-size: 13px; font-weight: 600; color: var(--phe-text);
  cursor: pointer; transition: all var(--phe-trans); white-space: nowrap;
}
.phe-mat-pill:hover { border-color: var(--phe-primary-l); color: var(--phe-primary); background: #eff6ff; }
.phe-mat-pill--selected {
  background: var(--phe-primary); border-color: var(--phe-primary); color: #fff;
  box-shadow: 0 2px 8px rgba(13,61,94,.22);
}

/* ── Step 4: Contact fields ──────────────────────────────── */
.phe-contact-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;
}
@media (max-width: 560px) { .phe-contact-grid { grid-template-columns: 1fr; } }
.phe-field-group { margin-bottom: 16px; }
.phe-label { display: block; font-size: 13px; font-weight: 600; color: var(--phe-text); margin-bottom: 6px; }
.phe-required { color: var(--phe-error); }
.phe-optional { color: var(--phe-muted); font-weight: 400; font-size: 12px; }
.phe-input {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--phe-border);
  border-radius: 7px; font-size: 14px; color: var(--phe-text);
  background: var(--phe-card-bg); transition: border-color var(--phe-trans), box-shadow var(--phe-trans);
  box-sizing: border-box; -webkit-appearance: none; appearance: none;
}
.phe-input:focus { outline: none; border-color: var(--phe-primary); box-shadow: 0 0 0 3px rgba(13,61,94,.12); }
.phe-input--error { border-color: var(--phe-error) !important; box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.phe-textarea { min-height: 90px; resize: vertical; }
.phe-field-group--error .phe-label { color: var(--phe-error); }

/* Per-field inline error message */
.phe-field-err {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--phe-error); margin-top: 4px; min-height: 0;
}
.phe-field-err:not(:empty)::before { content: '⚠ '; }

/* ── Review panel ────────────────────────────────────────── */
.phe-review {
  background: var(--phe-card-bg); border: 1.5px solid var(--phe-border);
  border-radius: var(--phe-radius); margin-bottom: 20px; overflow: hidden;
}
.phe-review__toggle {
  padding: 12px 16px; font-size: 13px; font-weight: 700;
  color: var(--phe-primary); cursor: pointer; user-select: none; list-style: none;
}
.phe-review__toggle::-webkit-details-marker { display: none; }
.phe-review__body { padding: 0 16px 12px; }
.phe-review__row {
  display: flex; justify-content: space-between;
  padding: 5px 0; border-bottom: 1px solid var(--phe-border); font-size: 13px;
}
.phe-review__row:last-child { border: none; }
.phe-review__key { color: var(--phe-muted); }
.phe-review__val { font-weight: 600; }

/* ── Captcha field ───────────────────────────────────────── */
.phe-captcha-group { margin-top: 20px; }
.phe-captcha-input {
  max-width: 120px;
  -moz-appearance: textfield;
}
.phe-captcha-input::-webkit-inner-spin-button,
.phe-captcha-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Privacy checkbox ────────────────────────────────────── */
.phe-privacy-group { margin-top: 16px; }
.phe-privacy-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--phe-text);
  line-height: 1.5;
}
.phe-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
  width: 18px; height: 18px;
  accent-color: var(--phe-primary);
  cursor: pointer;
}
.phe-privacy-label a {
  color: var(--phe-primary);
  text-decoration: underline;
}
.phe-privacy-group .phe-field-group--error .phe-privacy-label { color: var(--phe-error); }
.phe-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 12px; }
.phe-btn {
  padding: 12px 28px; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all var(--phe-trans); display: inline-flex; align-items: center; gap: 8px;
}
.phe-btn--back { background: var(--phe-bg); border: 1.5px solid var(--phe-border); color: var(--phe-muted); }
.phe-btn--back:hover { border-color: var(--phe-primary); color: var(--phe-primary); }
.phe-btn--next { background: var(--phe-primary); color: #fff; margin-left: auto; }
.phe-btn--next:hover { background: var(--phe-primary-l); }
.phe-btn--submit { background: var(--phe-accent); color: #fff; margin-left: auto; }
.phe-btn--submit:hover { background: var(--phe-accent-l); }
.phe-btn--submit:disabled { opacity: .65; cursor: not-allowed; }

/* ── Spinner ─────────────────────────────────────────────── */
.phe-spinner {
  width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: pheSpin .7s linear infinite; display: inline-block;
}
@keyframes pheSpin { to { transform: rotate(360deg); } }

/* ── Success panel ───────────────────────────────────────── */
.phe-success { text-align: center; padding: 48px 24px; animation: pheFadeIn .3s ease; }
.phe-success__icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--phe-success); color: #fff;
  font-size: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
}
.phe-success__title { font-size: 24px; font-weight: 800; color: var(--phe-primary); margin: 0 0 10px; }
.phe-success__msg   { font-size: 15px; color: var(--phe-muted); margin: 0; }

/* ── RTL overrides ───────────────────────────────────────── */
[dir="rtl"] .phe-lang-bar  { flex-direction: row-reverse; }
[dir="rtl"] .phe-step-title { flex-direction: row-reverse; }
[dir="rtl"] .phe-brand-card--selected::after { right: auto; left: 7px; }
[dir="rtl"] .phe-part-card__check { right: auto; left: 8px; }
[dir="rtl"] .phe-nav { flex-direction: row-reverse; }
[dir="rtl"] .phe-btn--next, [dir="rtl"] .phe-btn--submit { margin-left: 0; margin-right: auto; }
[dir="rtl"] .phe-review__row { flex-direction: row-reverse; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .phe-wizard { padding: 20px 16px; border-radius: 10px; }
  .phe-progress-label { display: none; }
  .phe-brand-grid { grid-template-columns: repeat(2,1fr); }
  .phe-title-big { font-size: 28px; }
}
