/* ==========================================================================
   HOME WORTH PAGE — What's My Home Worth?
   ========================================================================== */

/* Override body for this page */
body{
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg, #f8f8f8);
  color: var(--text, #141414);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Container */
.hw-container{
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}

/* Back link */
.hw-back{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted, #666);
  text-decoration: none;
  margin-bottom: 24px;
}
.hw-back svg{
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.hw-back:hover{ color: var(--brand, #0f5fff); }

/* Skeleton */
.hw-skeleton{ padding: 32px 0; }
.hw-skel-title{
  height: 28px; width: 60%; border-radius: 8px;
  background: var(--skeleton, rgba(0,0,0,.06));
  margin-bottom: 12px;
}
.hw-skel-sub{
  height: 16px; width: 80%; border-radius: 6px;
  background: var(--skeleton, rgba(0,0,0,.06));
  margin-bottom: 28px;
}
.hw-skel-fields{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.hw-skel-field{
  height: 48px; border-radius: 10px;
  background: var(--skeleton, rgba(0,0,0,.06));
}

/* Footer */
.hw-footer{
  text-align: center;
  padding: 24px 20px 40px;
  font-size: 12px;
  color: var(--text-muted, #666);
  line-height: 1.6;
}
.hw-footer a{
  color: var(--brand, #0f5fff);
  text-decoration: none;
}

/* ==========================================================================
   FORM CARD
   ========================================================================== */
.hw-card{
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(15,23,42,.08));
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,.04);
}

/* Test banner */
.hw-test-banner{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(247,144,9,.08);
  border: 1px solid rgba(247,144,9,.25);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #92600a;
  margin-bottom: 20px;
}
.hw-test-banner-icon{ flex-shrink: 0; font-size: 16px; }

/* Header */
.hw-header{ text-align: center; margin-bottom: 28px; }
.hw-header-icon{
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(15,95,255,.10);
  border: 1px solid rgba(15,95,255,.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.hw-header-icon svg{
  width: 26px; height: 26px;
  stroke: var(--brand, #0f5fff);
  stroke-width: 2;
  fill: none;
}
.hw-title{
  font-family: "DM Serif Display", serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 8px;
}
.hw-subtitle{
  font-size: 14px;
  color: var(--text-muted, #666);
  line-height: 1.5;
}

/* ==========================================================================
   PROGRESS STEPS
   ========================================================================== */
.hw-progress{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}
.hw-progress-step{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #999);
  transition: color .2s;
}
.hw-progress-step.active{ color: var(--brand, #0f5fff); }
.hw-progress-step.completed{ color: var(--green, #12b76a); }
.hw-progress-dot{
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0,0,0,.05);
  color: var(--text-muted, #999);
  transition: background .2s, color .2s;
}
.hw-progress-step.active .hw-progress-dot{
  background: var(--brand, #0f5fff);
  color: #fff;
}
.hw-progress-step.completed .hw-progress-dot{
  background: var(--green, #12b76a);
  color: #fff;
}
.hw-progress-line{
  width: 40px;
  height: 2px;
  background: rgba(0,0,0,.08);
  margin: 0 10px;
  transition: background .2s;
}
.hw-progress-line.done{
  background: var(--green, #12b76a);
}

/* ==========================================================================
   STEP PANELS
   ========================================================================== */
.hw-step{ display: none; }
.hw-step.active{ display: block; }

.hw-step-title{
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.hw-step-sub{
  font-size: 13px;
  color: var(--text-muted, #666);
  margin-bottom: 20px;
}

/* ==========================================================================
   FORM FIELDS
   ========================================================================== */
.hw-fields{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.hw-field{ display: flex; flex-direction: column; }
.hw-field.full{ grid-column: 1 / -1; }

/* Section dividers within form */
.hw-section-title{
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #666);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, rgba(15,23,42,.08));
}

.hw-label{
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #666);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.hw-input,
.hw-select{
  height: 44px;
  border: 1px solid var(--border, rgba(15,23,42,.12));
  border-radius: 10px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text, #141414);
  background: var(--card, #fff);
  outline: none;
  transition: border-color .15s;
}
.hw-input:focus,
.hw-select:focus{
  border-color: var(--brand, #0f5fff);
  box-shadow: 0 0 0 3px rgba(15,95,255,.10);
}
.hw-input::placeholder{ color: #aaa; }
.hw-textarea{
  min-height: 80px;
  padding: 10px 14px;
  resize: vertical;
  height: auto;
  line-height: 1.5;
}
.hw-select{ appearance: none; cursor: pointer; }

.hw-input.error,
.hw-select.error{
  border-color: var(--red, #f04438);
}
.hw-field-error{
  font-size: 11px;
  color: var(--red, #f04438);
  margin-top: 3px;
  display: none;
}
.hw-field-error.show{ display: block; }

/* Select wrapper with caret */
.hw-select-wrap{
  position: relative;
}
.hw-select-wrap .hw-select{
  width: 100%;
  padding-right: 34px;
}
.hw-select-wrap::after{
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted, #999);
  pointer-events: none;
}

/* ==========================================================================
   NAVIGATION BUTTONS
   ========================================================================== */
.hw-nav{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}
.hw-btn-back{
  background: none;
  border: 1px solid var(--border, rgba(15,23,42,.12));
  border-radius: 10px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted, #666);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.hw-btn-back:hover{
  background: rgba(0,0,0,.03);
  border-color: rgba(0,0,0,.18);
}

.hw-btn-next{
  background: var(--brand, #0f5fff);
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background .15s, transform .1s;
  margin-left: auto;
}
.hw-btn-next:hover{
  background: #0d4fdd;
  transform: translateY(-1px);
}
.hw-btn-next:disabled{
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   RESULTS — STEP 3
   ========================================================================== */

/* Loading spinner */
.hw-loading{
  text-align: center;
  padding: 60px 0;
}
.hw-loading-spinner{
  width: 40px; height: 40px;
  border: 3px solid rgba(15,95,255,.15);
  border-top-color: var(--brand, #0f5fff);
  border-radius: 50%;
  animation: hwSpin .8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes hwSpin{
  to{ transform: rotate(360deg); }
}
.hw-loading-text{
  font-size: 14px;
  color: var(--text-muted, #666);
}

/* Result display */
.hw-result{ text-align: center; }

.hw-result-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15,95,255,.08);
  color: var(--brand, #0f5fff);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.hw-result-badge svg{
  width: 14px; height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.hw-result-label{
  font-size: 13px;
  color: var(--text-muted, #666);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 500;
  margin-bottom: 6px;
}

.hw-result-value{
  font-family: "DM Serif Display", serif;
  font-size: 44px;
  font-weight: 400;
  color: var(--brand, #0f5fff);
  line-height: 1.1;
  margin-bottom: 8px;
}

/* Confidence */
.hw-result-confidence{
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 24px;
}
.hw-result-confidence.high{
  background: rgba(18,183,106,.12);
  color: #12b76a;
}
.hw-result-confidence.med{
  background: rgba(247,144,9,.12);
  color: #f79009;
}
.hw-result-confidence.low{
  background: rgba(240,68,56,.12);
  color: #f04438;
}

/* Range bar */
.hw-result-range{
  max-width: 400px;
  margin: 0 auto 28px;
}
.hw-result-range-labels{
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted, #666);
  margin-bottom: 8px;
}
.hw-result-range-labels span{
  font-weight: 500;
}
.hw-result-range-track{
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(15,95,255,.10), var(--brand, #0f5fff), rgba(15,95,255,.10));
  margin-bottom: 6px;
}
.hw-result-range-marker{
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand, #0f5fff);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.hw-result-range-values{
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}

/* Summary card */
.hw-result-summary{
  background: var(--bg, #f8f8f8);
  border: 1px solid var(--border, rgba(15,23,42,.08));
  border-radius: 12px;
  padding: 18px;
  margin: 24px 0;
  text-align: left;
}
.hw-result-summary-title{
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted, #666);
  margin-bottom: 12px;
}
.hw-result-summary-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hw-result-summary-item{
  font-size: 13px;
}
.hw-result-summary-item span:first-child{
  color: var(--text-muted, #666);
}
.hw-result-summary-item span:last-child{
  font-weight: 600;
  margin-left: 4px;
}

/* CTAs */
.hw-result-ctas{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}
.hw-cta-primary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand, #0f5fff);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.hw-cta-primary:hover{ background: #0d4fdd; }
.hw-cta-primary svg{
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.hw-cta-secondary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  color: var(--text, #141414);
  border: 1px solid var(--border, rgba(15,23,42,.12));
  border-radius: 10px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.hw-cta-secondary:hover{ background: rgba(0,0,0,.03); }
.hw-cta-secondary svg{
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.hw-result-note{
  font-size: 11px;
  color: var(--text-muted, #999);
  margin-top: 18px;
  line-height: 1.5;
}

/* Error state */
.hw-error{
  text-align: center;
  padding: 40px 0;
}
.hw-error-icon{
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(240,68,56,.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.hw-error-icon svg{
  width: 24px; height: 24px;
  stroke: var(--red, #f04438);
  stroke-width: 2;
  fill: none;
}
.hw-error-title{
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.hw-error-text{
  font-size: 14px;
  color: var(--text-muted, #666);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */
[data-theme="dark"] .hw-card{
  background: var(--card);
  border-color: rgba(255,255,255,.08);
}
[data-theme="dark"] .hw-test-banner{
  background: rgba(247,144,9,.10);
  border-color: rgba(247,144,9,.20);
  color: #d4a64a;
}

[data-theme="dark"] .hw-input,
[data-theme="dark"] .hw-select{
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
  color: #e4e4e4;
}
[data-theme="dark"] .hw-input::placeholder{ color: #666; }
[data-theme="dark"] .hw-section-title{
  color: #888;
  border-color: rgba(255,255,255,.08);
}

[data-theme="dark"] .hw-btn-back{
  border-color: rgba(255,255,255,.10);
  color: #aaa;
}
[data-theme="dark"] .hw-btn-back:hover{
  background: rgba(255,255,255,.06);
}

[data-theme="dark"] .hw-result-range-track{
  background: linear-gradient(90deg, rgba(255,255,255,.08), var(--brand), rgba(255,255,255,.08));
}
[data-theme="dark"] .hw-result-range-marker{
  border-color: var(--card, #1a1a1a);
}

[data-theme="dark"] .hw-result-summary{
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.06);
}

[data-theme="dark"] .hw-cta-secondary{
  border-color: rgba(255,255,255,.10);
  color: #e4e4e4;
}
[data-theme="dark"] .hw-cta-secondary:hover{
  background: rgba(255,255,255,.06);
}

[data-theme="dark"] .hw-error-icon{
  background: rgba(240,68,56,.15);
}

[data-theme="dark"] .hw-skeleton .skel-block,
[data-theme="dark"] .hw-skel-title,
[data-theme="dark"] .hw-skel-sub,
[data-theme="dark"] .hw-skel-field{
  background: rgba(255,255,255,.06);
}

[data-theme="dark"] .hw-select-wrap::after{
  border-top-color: #666;
}

[data-theme="dark"] .hw-progress-dot{
  background: rgba(255,255,255,.08);
  color: #888;
}

[data-theme="dark"] .hw-progress-line{
  background: rgba(255,255,255,.08);
}

[data-theme="dark"] .hw-footer{
  color: #666;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media(max-width:768px){
  .hw-container{ padding-top: 70px; }
  .hw-card{ padding: 24px 20px; }
  .hw-title{ font-size: 22px; }
  .hw-result-value{ font-size: 36px; }
  .hw-fields{ grid-template-columns: 1fr; }
  .hw-result-summary-grid{ grid-template-columns: 1fr; }
  .hw-progress-line{ width: 24px; margin: 0 6px; }
}

@media(max-width:480px){
  .hw-container{ padding: 64px 14px 30px; }
  .hw-card{ padding: 20px 16px; border-radius: 12px; }
  .hw-title{ font-size: 20px; }
  .hw-result-value{ font-size: 30px; }
  .hw-progress-step span:not(.hw-progress-dot){ display: none; }
}

/* Keep chat widget full-width on this page */
.chat-box{ width: min(400px, calc(100% - 32px)); }
