/**
 * HVAC Replacement Cost Estimator — Calculator Styles
 * Loaded conditionally on the Estimator Page template only.
 */

/* ─── Calculator Form ──────────────────────────────────────────────────────── */

.hvac-calculator {
  max-width: 720px;
  margin: 0 auto;
  font-family: inherit;
}

.hvac-calculator fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

.hvac-calculator legend {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: block;
  width: 100%;
}

.hvac-calculator label {
  display: block;
  cursor: pointer;
}

.hvac-calculator .input-group {
  margin-bottom: 1.25rem;
}

.hvac-calculator .input-group > label {
  font-weight: 600;
  margin-bottom: 0.375rem;
}

/* Radio options */
.hvac-calculator .radio-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hvac-calculator .radio-option {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

@media (prefers-reduced-motion: reduce) {
  .hvac-calculator .radio-option {
    transition: none;
  }
}

.hvac-calculator .radio-option:hover {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.hvac-calculator .radio-option:has(input:checked) {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.hvac-calculator .radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: #2563eb;
}

/* Dropdowns */
.hvac-calculator select {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #fff;
  min-height: 44px;
  appearance: auto;
}

.hvac-calculator select:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

/* Text input (repair cost) */
.hvac-calculator input[type="text"] {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-height: 44px;
  box-sizing: border-box;
}

.hvac-calculator input[type="text"]:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

/* Section headers */
.hvac-calculator .section-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.hvac-calculator .optional-header {
  color: #6b7280;
}

/* Field help text */
.hvac-calculator .field-help {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Repair cost soft warning */
.hvac-calculator .repair-cost-warning {
  font-size: 0.875rem;
  color: #d97706;
  margin-top: 0.25rem;
}

/* Inline error */
.hvac-calculator .field-error {
  font-size: 0.875rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

/* ─── Calculate Button ─────────────────────────────────────────────────────── */

.hvac-calculator .calculate-btn {
  display: block;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  background-color: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  margin-top: 2rem;
  transition: background-color 0.15s;
}

@media (prefers-reduced-motion: reduce) {
  .hvac-calculator .calculate-btn {
    transition: none;
  }
}

.hvac-calculator .calculate-btn:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.hvac-calculator .calculate-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.hvac-calculator .calculate-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.hvac-calculator .fields-hint {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
  text-align: center;
}

/* ─── Results Section ──────────────────────────────────────────────────────── */

#calculator-results {
  margin-top: 2.5rem;
  padding: 2rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

#calculator-results:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

#calculator-results[data-stale="true"] {
  opacity: 0.6;
}

.results-heading {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 1.5rem 0;
}

/* Stale notice */
.stale-notice {
  text-align: center;
  padding: 0.5rem;
  background-color: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Cost range display */
.cost-range {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  text-align: center;
  margin-bottom: 2rem;
}

.cost-value {
  padding: 1rem;
}

.cost-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.cost-amount {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: #111827;
}

.cost-mid .cost-amount {
  font-size: 2.25rem;
  color: #2563eb;
}

.cost-sublabel {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Cost drivers */
.cost-drivers {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.cost-drivers h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
}

.cost-drivers ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
}

.cost-drivers li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* Repair signal */
.repair-signal {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.repair-signal p {
  margin: 0;
  line-height: 1.6;
}

/* Disclaimer */
.calculator-disclaimer {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.calculator-disclaimer p:first-child {
  margin-top: 0;
}

.calculator-disclaimer p:last-child {
  margin-bottom: 0;
}

/* Data recency */
.data-recency {
  text-align: center;
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 1rem 0;
}

/* ─── Email Capture CTAs (Story 7.3) ─────────────────────────────────────── */
.email-cta { padding: 1.5rem; border-radius: 8px; margin-top: 1.5rem; }
.email-cta--primary { background-color: #eff6ff; border: 1px solid #bfdbfe; }
.email-cta--secondary { background-color: #f9fafb; border: 1px solid #e5e7eb; margin-top: 1rem; }
.email-cta__heading { font-size: 1.125rem; font-weight: 700; margin: 0 0 0.375rem 0; }
.email-cta--secondary .email-cta__heading { font-size: 1rem; color: #374151; }
.email-cta__subtext { font-size: 0.9375rem; color: #374151; margin: 0 0 1rem 0; }
.email-cta--secondary .email-cta__subtext { font-size: 0.875rem; color: #6b7280; }
.email-cta__form { display: flex; flex-direction: column; gap: 0.75rem; }
.email-cta__field { display: flex; flex-direction: column; gap: 0.25rem; }
.email-cta__label { font-size: 0.875rem; font-weight: 600; color: #374151; }
.email-cta__optional { font-weight: 400; color: #6b7280; }
.email-cta__input { display: block; width: 100%; padding: 0.625rem 0.75rem; font-size: 1rem;
  border: 1px solid #d1d5db; border-radius: 6px; background-color: #fff;
  min-height: 44px; box-sizing: border-box; }
.email-cta__input:focus { outline: 2px solid #2563eb; outline-offset: 1px; border-color: #2563eb; }
.email-cta__gdpr { padding: 0.75rem; background-color: #fefce8; border: 1px solid #fde68a; border-radius: 6px; }
.email-cta__gdpr-label { display: flex; align-items: flex-start; gap: 0.5rem;
  font-size: 0.875rem; color: #374151; cursor: pointer; }
.email-cta__gdpr-check { width: 18px; height: 18px; min-width: 18px; margin-top: 0.125rem; accent-color: #2563eb; }
.email-cta__error { font-size: 0.875rem; color: #dc2626; margin: 0; }
.email-cta__btn { display: block; width: 100%; padding: 0.75rem 1.25rem; font-size: 1rem;
  font-weight: 700; border: none; border-radius: 6px; cursor: pointer; min-height: 44px;
  transition: background-color 0.15s; }
@media (prefers-reduced-motion: reduce) { .email-cta__btn { transition: none; } }
.email-cta__btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.email-cta__btn:disabled { opacity: 0.6; cursor: not-allowed; }
.email-cta__btn--primary { background-color: #2563eb; color: #fff; }
.email-cta__btn--primary:hover:not(:disabled) { background-color: #1d4ed8; }
.email-cta__btn--secondary { background-color: #fff; color: #374151; border: 1px solid #d1d5db; }
.email-cta__btn--secondary:hover:not(:disabled) { background-color: #f3f4f6; }
.email-cta__privacy { font-size: 0.75rem; color: #9ca3af; text-align: center; margin: 0; }
/* Honeypot — visually hidden from humans */
.email-cta__honeypot { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Error state */
.calculator-error {
  color: #dc2626;
  text-align: center;
  padding: 1rem;
}

/* ─── Educational Fallback (repair-vs-replace) ─────────────────────────────── */

.repair-replace-fallback {
  font-size: 0.875rem;
  color: #6b7280;
  background-color: #f9fafb;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ─── Mobile Responsive ────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .cost-range {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .cost-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
  }

  .cost-value:last-child {
    border-bottom: none;
  }

  .cost-label {
    margin-bottom: 0;
  }

  .cost-amount {
    font-size: 1.5rem;
  }

  .cost-mid .cost-amount {
    font-size: 1.75rem;
  }

  .cost-sublabel {
    display: none;
  }

  #calculator-results {
    padding: 1.25rem;
  }

  .radio-options {
    flex-direction: column;
  }

  .email-cta { padding: 1.25rem; }
}

/* 320px viewport — no horizontal scroll */
@media (max-width: 320px) {
  .hvac-calculator {
    padding: 0 0.5rem;
  }

  .results-heading {
    font-size: 1.25rem;
  }
}

/* ─── Estimator Page Layout ──────────────────────────────────────────────── */

.estimator-page .inside-article {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}
