/* ============================================================
   PURE CARPET CLEANERS — calculator.css
   The instant quote calculator page (/quote/). Uses the site's
   design tokens from styles.css (colors, radius, shadow, fonts).
   ============================================================ */

/* A class selector with an explicit `display` (e.g. .calc-loading,
   .calc-bar) out-specifies the UA `[hidden]{display:none}` rule, so the
   `hidden` attribute would be ignored. Restore it for our toggled bits. */
.calc-loading[hidden], .calc-error[hidden], .calc-bar[hidden],
.calc-empty[hidden], .calc-item-line[hidden], .calc-grid[hidden],
.calc-gate[hidden], .calc-area[hidden], .calc-ooa[hidden],
.calc-addons[hidden], .calc-min-note[hidden], .calc-resume[hidden],
.calc-sched-body[hidden], .calc-gate-msg[hidden] { display: none !important; }

/* ── Save-state "welcome back" banner ────────────────────── */
.calc-resume {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--sky-50); border: 1px solid var(--sky); border-radius: var(--radius);
  padding: 11px 16px; margin-bottom: 18px; font-size: .9rem; color: var(--navy); font-weight: 600;
}
.calc-resume .ic { width: 16px; height: 16px; color: var(--citrus-deep); vertical-align: -0.16em; }
.calc-resume-clear {
  background: none; border: none; color: var(--blue-600); font-weight: 700; font-size: .86rem;
  text-decoration: underline; padding: 4px 2px;
}

/* ── Service-area gate ───────────────────────────────────── */
.calc-gate { display: flex; justify-content: center; padding: clamp(6px, 3vw, 26px) 0 clamp(20px, 4vw, 40px); }
.calc-gate-card {
  width: 100%; max-width: 520px; text-align: center;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: clamp(24px, 4vw, 38px) clamp(20px, 3vw, 34px);
}
.calc-gate-step {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 8px;
}
.calc-gate-title { font-size: clamp(1.3rem, 2.6vw, 1.7rem); color: var(--navy); margin-bottom: 8px; }
.calc-gate-sub { font-size: .94rem; color: var(--ink-soft); line-height: 1.55; margin-bottom: 20px; }
.calc-gate-row { display: flex; gap: 10px; }
.calc-gate-row input {
  flex: 1; min-width: 0; font-family: var(--font-body); font-size: 1.05rem; font-weight: 600;
  text-align: center; letter-spacing: .1em;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--sky-50);
  padding: 13px 14px; color: var(--ink); transition: border-color var(--ease), background var(--ease);
}
.calc-gate-row input:focus { outline: none; border-color: var(--cyan); background: var(--white); box-shadow: var(--ring); }
.calc-gate-row .btn { flex-shrink: 0; }
.calc-gate-city { margin-top: 16px; text-align: left; }
.calc-gate-city label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; text-align: center; }
.calc-gate-city select {
  width: 100%; font-family: var(--font-body); font-size: .96rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 11px 12px;
}
.calc-gate-city select:focus { outline: none; border-color: var(--cyan); box-shadow: var(--ring); }
.calc-gate-msg { margin-top: 14px; font-size: .9rem; font-weight: 600; }
.calc-gate-msg.err { color: #C2410C; }

/* ── Confirmed-area chip ─────────────────────────────────── */
.calc-area {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #ECFBF3; border: 1px solid #B6E7CC; border-radius: var(--radius-pill);
  padding: 8px 8px 8px 16px; margin-bottom: 18px; font-size: .9rem; font-weight: 600; color: #10603A;
}
.calc-area.is-ooa { background: #FEF3EC; border-color: #F6C9A8; color: #7C2D12; }
.calc-area .ic { width: 16px; height: 16px; vertical-align: -0.18em; }
.calc-area-change {
  background: var(--white); border: 1px solid currentColor; color: inherit; font-weight: 700; font-size: .8rem;
  border-radius: var(--radius-pill); padding: 6px 14px;
}

/* ── Out-of-area soft fail ───────────────────────────────── */
.calc-ooa {
  background: #FEF3EC; border: 1px solid #F6C9A8; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; color: #7C2D12; font-size: .92rem; line-height: 1.55;
}
.calc-ooa a { color: var(--blue-600); font-weight: 700; }

/* ── Add-on upsell strip ─────────────────────────────────── */
.calc-addons {
  background: linear-gradient(135deg, var(--sky-50), var(--white));
  border: 1.5px solid var(--sky); border-radius: var(--radius-lg);
  padding: 18px 18px 20px; margin-top: 6px;
}
.calc-addons-title { font-size: 1.05rem; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.calc-addons-title .ic { width: 18px; height: 18px; color: var(--citrus); }
.calc-addons-sub { font-size: .84rem; color: var(--ink-soft); margin: 4px 0 14px; }
.calc-addon-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.calc-addon {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.calc-addon:hover { border-color: var(--cyan); }
.calc-addon.is-on { border-color: var(--cyan); background: var(--sky-50); box-shadow: 0 4px 16px rgba(0,120,200,.12); }
.calc-addon-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calc-addon-name { font-weight: 700; color: var(--ink); font-size: .94rem; }
.calc-addon-price { font-size: .82rem; font-weight: 700; color: var(--blue); }
.calc-addon-act {
  flex-shrink: 0; font-size: .82rem; font-weight: 700; color: var(--blue);
  border: 1.5px solid var(--line); border-radius: var(--radius-pill); padding: 6px 12px; background: var(--sky-50);
}
.calc-addon.is-on .calc-addon-act { background: var(--cyan); color: var(--white); border-color: var(--cyan); }

/* ── Minimum-order notice ────────────────────────────────── */
.calc-min-note {
  font-size: .82rem; line-height: 1.5; color: #7C2D12;
  background: #FEF3EC; border: 1px solid #F6C9A8; border-radius: 10px; padding: 10px 12px; margin-top: 12px;
}
.calc-min-note b { color: #7C2D12; }

/* ── Optional scheduling ─────────────────────────────────── */
.calc-sched { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 14px; }
.calc-sched-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--sky-50); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; font-family: var(--font-body); font-size: .92rem; font-weight: 700; color: var(--navy);
  cursor: pointer; transition: border-color var(--ease), background var(--ease);
}
.calc-sched-toggle:hover { border-color: var(--cyan); }
.calc-sched-toggle .ic { width: 15px; height: 15px; color: var(--blue); vertical-align: -0.16em; margin-right: 4px; }
.calc-sched-toggle .opt { font-weight: 400; color: var(--ink-soft); }
.calc-sched-chev { width: 9px; height: 9px; border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue); transform: rotate(45deg); transition: transform var(--ease); }
.calc-sched-toggle[aria-expanded="true"] .calc-sched-chev { transform: rotate(-135deg); }
.calc-sched-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.calc-sched-hint { font-size: .8rem; color: var(--ink-soft); line-height: 1.5; }

@media (max-width: 560px) {
  .calc-gate-row { flex-direction: column; }
  .calc-addon-list { grid-template-columns: 1fr; }
}

/* ── Header ──────────────────────────────────────────────── */
.calc-head {
  background: linear-gradient(170deg, var(--sky-50) 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
  padding: clamp(34px, 5vw, 60px) 0 clamp(28px, 4vw, 44px);
  text-align: center;
}
.calc-head .eyebrow { justify-content: center; }
.calc-head .section-title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
.calc-head .section-sub { max-width: 640px; margin-left: auto; margin-right: auto; }
.calc-proof {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px 24px; margin-top: 22px;
}
.calc-proof li { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
.calc-proof .ic { width: 18px; height: 18px; color: var(--blue); }
.calc-proof .ic-fill { color: var(--citrus); }

/* ── Layout ──────────────────────────────────────────────── */
.calc-section { padding: clamp(30px, 5vw, 56px) 0 clamp(56px, 8vw, 96px); }
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}

/* ── Loading / error ─────────────────────────────────────── */
.calc-loading {
  display: flex; align-items: center; gap: 11px;
  color: var(--ink-soft); font-size: .95rem; padding: 30px 4px;
}
.calc-spin {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--blue);
  animation: calc-spin .7s linear infinite;
}
@keyframes calc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .calc-spin { animation-duration: 2s; } }
.calc-error {
  background: #FEF3EC; border: 1px solid #F6C9A8; border-radius: var(--radius);
  padding: 18px 20px; color: #7C2D12; font-size: .95rem;
}
.calc-error a { color: var(--blue-600); font-weight: 700; }

/* ── Category + item cards ───────────────────────────────── */
.calc-cat { margin-bottom: clamp(20px, 3vw, 30px); scroll-margin-top: 84px; }
.calc-cat-title {
  font-size: 1.15rem; color: var(--navy); margin-bottom: 12px;
  padding-bottom: 9px; border-bottom: 2px solid var(--sky);
  transition: color var(--ease);
}
/* Brief highlight when a service page deep-links to this category. */
.calc-cat--hl .calc-cat-title { color: var(--blue); border-bottom-color: var(--cyan); }
.calc-cat--hl { animation: calc-cat-pop 2.2s var(--ease); }
@keyframes calc-cat-pop { 0%,100% { background: transparent; } 12% { background: var(--sky-50); } }
@media (prefers-reduced-motion: reduce) { .calc-cat--hl { animation: none; } }
.calc-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.calc-item.is-on { border-color: var(--cyan); box-shadow: 0 4px 18px rgba(0,120,200,.12); }
.calc-item-info { min-width: 0; }
.calc-item-name { font-weight: 700; color: var(--ink); font-size: 1rem; }
.calc-item-desc { font-size: .84rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; }
.calc-item-price { font-size: .84rem; font-weight: 700; color: var(--blue); margin-top: 7px; }
.calc-item-control { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.calc-item-line { font-size: .92rem; font-weight: 700; color: var(--navy); }

/* Stepper (− n +) */
.calc-stepper {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: var(--radius-pill);
  background: var(--sky-50); overflow: hidden;
}
.calc-step {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.35rem; line-height: 1; font-weight: 600; color: var(--blue);
  background: transparent; border: none; transition: background var(--ease), color var(--ease);
}
.calc-step:hover { background: var(--sky); }
.calc-step:active { background: var(--cyan); color: var(--white); }
.calc-qty { min-width: 34px; text-align: center; font-weight: 700; font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Square-foot input */
.calc-sqft {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--sky-50);
  padding: 4px 12px 4px 6px; transition: border-color var(--ease), background var(--ease);
}
.calc-sqft:focus-within { border-color: var(--cyan); background: var(--white); box-shadow: var(--ring); }
.calc-sqft-input {
  width: 74px; border: none; background: transparent; text-align: right;
  font-family: var(--font-body); font-size: .96rem; font-weight: 600; color: var(--ink);
  padding: 8px 0; -moz-appearance: textfield;
}
.calc-sqft-input:focus { outline: none; }
.calc-sqft-input::-webkit-outer-spin-button,
.calc-sqft-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-sqft-unit { font-size: .8rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

/* ── Summary + form side panel ───────────────────────────── */
.calc-side { position: sticky; top: 88px; }
.calc-summary-card {
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 22px 22px 24px;
}
.calc-summary-title { font-size: 1.25rem; color: var(--navy); margin-bottom: 14px; }
.calc-lines { display: flex; flex-direction: column; gap: 9px; }
.calc-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: .92rem; }
.calc-line-name { color: var(--ink); }
.calc-line-qty { color: var(--ink-soft); font-size: .82rem; font-weight: 600; }
.calc-line-amt { font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-empty { font-size: .9rem; color: var(--ink-soft); padding: 6px 0 2px; }

.calc-total-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 16px; padding-top: 15px; border-top: 2px solid var(--sky);
  font-size: 1rem; font-weight: 700; color: var(--navy);
}
.calc-total { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; color: var(--blue); font-variant-numeric: tabular-nums; }
.calc-disclaimer {
  font-size: .78rem; color: var(--ink-soft); line-height: 1.55;
  background: var(--sky-50); border-radius: 10px; padding: 10px 12px; margin-top: 14px;
}

.calc-form { display: flex; flex-direction: column; gap: 13px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── Sticky mobile total bar ─────────────────────────────── */
.calc-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
  background: var(--white); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 22px rgba(0,61,122,.12);
}
.calc-bar-label { display: block; font-size: .72rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.calc-bar-amount { display: block; font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.calc-bar .btn { flex-shrink: 0; }

.calc-success { max-width: 460px; margin: 0 auto; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-side { position: static; }
  /* Room so the fixed bar never covers the submit button. */
  .calc-section { padding-bottom: 96px; }
}
/* The mobile total bar is redundant next to the sticky desktop panel. */
@media (min-width: 901px) {
  .calc-bar { display: none !important; }
}
@media (max-width: 560px) {
  .calc-item { flex-direction: column; align-items: stretch; gap: 12px; }
  .calc-item-control { flex-direction: row; align-items: center; justify-content: space-between; }
}
