/* ============================================================
   Carport Quiz — Frontend Styles
   Matches the exact brand look of the residential landing page.
   Colors injected via CSS custom properties from PHP.
   ============================================================ */

/* ── Root tokens (overridden per instance via inline style) ── */
.cq-section {
  --cq-primary:        #f4580d;
  --cq-primary-hover:  #d43e08;
  --cq-primary-light:  #fff3ee;
  --cq-dark:           #111111;
  --cq-border:         #e4e4e4;
  --cq-text:           #333333;
  --cq-heading:        #1a1a1a;
  --cq-muted:          #666666;
  --cq-green:          #22a85a;
  --cq-bg:             #ffffff;
  --cq-card-bg:        #f8f8f8;
}

/* ── Section wrapper ─────────────────────────────────────────── */
.cq-section {
  background: transparent;
  padding: 68px 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.cq-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header text ──────────────────────────────────────────────── */
.cq-eyebrow {
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 11px;
  color: var(--cq-primary);
  font-weight: 700;
  margin-bottom: 18px;
  text-align: center;
}

.cq-heading {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  color: var(--cq-heading);
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.cq-subhead {
  color: var(--cq-muted);
  font-size: 15px;
  text-align: center;
  margin-bottom: 32px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
  line-height: 1.75;
}

/* ── Quiz box ─────────────────────────────────────────────────── */
.cq-box {
  background: var(--cq-bg);
  border-radius: 14px;
  padding: 42px 40px;
  max-width: 700px;
  margin: 0 auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

/* ── Progress bar ─────────────────────────────────────────────── */
.cq-progress {
  display: flex;
  gap: 5px;
  margin-bottom: 30px;
}

.cq-pb {
  height: 5px;
  flex: 1;
  background: var(--cq-border);
  border-radius: 3px;
  transition: background 0.3s;
}

.cq-pb.on {
  background: var(--cq-primary);
}

/* ── Step ─────────────────────────────────────────────────────── */
.cq-step {
  display: none;
}

.cq-step.show {
  display: block;
  animation: cqFadeIn 0.2s ease;
}

@keyframes cqFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Question text ────────────────────────────────────────────── */
.cq-q-label {
  font-size: 18px;
  font-weight: 800;
  color: var(--cq-heading);
  letter-spacing: -0.2px;
  margin-bottom: 6px;
  line-height: 1.3;
}

.cq-q-hint {
  font-size: 13px;
  color: var(--cq-muted);
  margin-bottom: 22px;
  font-weight: 400;
}

/* ── Answer options grid ──────────────────────────────────────── */
.cq-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.cq-opt {
  border: 2px solid var(--cq-border);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  background: var(--cq-bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--cq-heading);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1.4;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cq-opt:hover {
  border-color: var(--cq-primary);
  background: var(--cq-primary-light);
  transform: translateY(-1px);
}

.cq-opt.sel {
  border-color: var(--cq-primary);
  background: var(--cq-primary-light);
  color: var(--cq-primary);
}

.cq-opt-ico {
  font-size: 26px;
  display: block;
  line-height: 1;
}

/* Image icon — 120×60, no distortion, 5px radius */
.cq-opt-ico--img {
  display: flex !important; /* override .cq-opt-ico display:block */
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 60px;
  margin: 0 auto 4px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
}

.cq-opt-ico--img img {
  width: 120px !important;
  height: 60px !important;
  object-fit: contain;
  display: block;
  border-radius: 5px;
}

/* Font Awesome icon */
.cq-opt-ico--fa {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  margin-bottom: 2px;
}

.cq-opt-ico--fa i {
  font-size: 24px;
  color: inherit;
  line-height: 1;
}

.cq-opt.sel .cq-opt-ico--fa i { color: var(--cq-primary); }

.cq-opt-lbl {
  display: block;
}

.cq-opt-sub {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  color: var(--cq-muted);
  display: block;
  letter-spacing: 0;
}

/* ── Navigation row ───────────────────────────────────────────── */
.cq-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
}

.cq-back {
  background: none;
  border: none;
  color: var(--cq-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  padding: 0;
  transition: color 0.2s;
}

.cq-back:hover {
  color: var(--cq-heading);
}

.cq-count {
  font-size: 12px;
  color: var(--cq-muted);
  font-weight: 600;
}

/* ── Loading spinner ──────────────────────────────────────────── */
.cq-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--cq-muted);
}

.cq-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--cq-border);
  border-top-color: var(--cq-primary);
  border-radius: 50%;
  animation: cqSpin 0.75s linear infinite;
  margin: 0 auto 16px;
}

@keyframes cqSpin {
  to { transform: rotate(360deg); }
}

/* ── Result panel ─────────────────────────────────────────────── */
.cq-result {
  animation: cqFadeIn 0.3s ease;
}

.cq-result-recommend {
  background: var(--cq-primary-light);
  border: 2px solid var(--cq-primary);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 24px;
}

.cq-result-recommend h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--cq-heading);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

/* Result value cards (type / size / price) */
.cq-result-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.cq-rc {
  background: var(--cq-bg);
  border: 1px solid var(--cq-border);
  border-radius: 8px;
  padding: 16px 14px;
  text-align: center;
}

.cq-rc-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cq-muted);
  margin-bottom: 6px;
}

.cq-rc-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--cq-heading);
  line-height: 1.3;
}

/* Feature bullets */
.cq-result-feats {
  display: grid;
  gap: 9px;
}

.cq-feat {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  color: var(--cq-text);
  font-weight: 400;
}

.cq-feat-check {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Product cards ────────────────────────────────────────────── */
.cq-product-cards {
  margin-bottom: 24px;
}

.cq-product-cards-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.cq-pc {
  border: 1px solid var(--cq-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--cq-bg);
  transition: transform 0.2s, box-shadow 0.2s;
}

.cq-pc:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244,88,13,0.12);
  border-color: var(--cq-primary);
}

.cq-pc-img {
  height: 120px;
  background: var(--cq-card-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cq-pc-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cq-product-placeholder {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(45deg, #e8e8e8, #e8e8e8 10px, #f0f0f0 10px, #f0f0f0 20px);
}

.cq-pc-body {
  padding: 14px 12px;
}

.cq-pc-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--cq-heading);
  margin-bottom: 4px;
  line-height: 1.3;
}

.cq-pc-price {
  font-size: 13px;
  color: var(--cq-primary);
  font-weight: 700;
  margin-bottom: 10px;
}

.cq-pc-link {
  display: inline-block;
  font-size: 12px;
  color: var(--cq-primary);
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.cq-pc-link:hover {
  border-color: var(--cq-primary);
}

/* ── CTA button ───────────────────────────────────────────────── */
.cq-result-cta {
  text-align: center;
  margin-top: 10px;
}

/* CTA button — specificity (0,2,1) beats .breakdance a (0,1,1) even with !important */
.cq-results a.cq-cta-btn,
.cq-section a.cq-cta-btn,
a.cq-cta-btn {
  display: inline-block;
  background: var(--cq-primary);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 16px;
  padding: 16px 44px;
  border-radius: 30px;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: background 0.2s, transform 0.15s;
}

.cq-results a.cq-cta-btn:hover,
.cq-section a.cq-cta-btn:hover,
a.cq-cta-btn:hover {
  background: var(--cq-primary-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
}

.cq-result-cta p {
  font-size: 13px;
  color: var(--cq-muted);
  margin-top: 12px;
}

/* ── Restart ──────────────────────────────────────────────────── */
.cq-restart-wrap {
  text-align: center;
  margin-top: 18px;
}

.cq-restart {
  background: none;
  border: none;
  color: var(--cq-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.2s;
}

.cq-restart:hover {
  color: var(--cq-heading);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cq-section  { padding: 48px 0; }
  .cq-box      { padding: 28px 20px; }
  .cq-result-cards { grid-template-columns: 1fr; }
  .cq-opts     { grid-template-columns: repeat(2, 1fr); }
  .cq-product-cards-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .cq-opts     { grid-template-columns: 1fr; }
  .cq-product-cards-inner { grid-template-columns: 1fr; }
}
