/* Multi-step quote wizard — dark page, white card, yellow brand, green CTA */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Match style.css: body 15px Open Sans; .xs-form .form-control 13px; headings Oswald */
  --font-site: "Open Sans", sans-serif;
  --font-heading: "Oswald", sans-serif;
  --fs-body: 15px;
  --fs-form-input: 13px;
  --fs-label-upper: 12px;
  --fs-step-heading: 24px;
  --fs-btn: 16px;

  --bg: #000000;
  --card: #ffffff;
  --yellow: #f5c400;
  --green: #00a86b;
  --green-hover: #00925d;
  --green-soft: #8fd4b8;
  --label-muted: #777777;
  --text-option: #777777;
  --text-heading: #222222;
  --dot-inactive: #d4d4d4;
  --radio-accent: #1976d2;
  --btn-grey: #c5c5c5;
  --btn-grey-hover: #b0b0b0;
  --input-border: #dddddd;

  /* Responsive layout tokens (mobile-first defaults) */
  --page-pad-x: max(1rem, env(safe-area-inset-left, 0px));
  --page-pad-y: max(1rem, env(safe-area-inset-top, 0px));
  --page-pad-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  --card-pad-x: 1rem;
  --card-pad-y: 1.25rem;
  --quote-form-width: 80vw;
  --quote-form-height: 500px;
  --brand-size: clamp(1.25rem, 4vw, 1.6rem);
}

/* Layout for embedded quote page (do not style body — conflicts with site theme + global .slide/button rules) */
.quote-page-section {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  background: var(--bg);
  font-family: var(--font-site);
  font-size: var(--fs-body);
  line-height: 1.8em;
  font-weight: 400;
  color: var(--label-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-bottom);
  padding-right: max(var(--page-pad-x), env(safe-area-inset-right, 0px));
  padding-left: max(var(--page-pad-x), env(safe-area-inset-left, 0px));
  min-height: auto;
  padding-bottom: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Brand */
.brand {
  align-self: flex-start;
  width: 100%;
  max-width: min(640px, 100%);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: clamp(1rem, 3vw, 2rem);
}

.brand-bar {
  width: 5px;
  height: clamp(1.65rem, 4vw, 2rem);
  background: var(--yellow);
  flex-shrink: 0;
}

.brand-text {
  font-size: var(--brand-size);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

/* Card */
.quote-card {
  width: var(--quote-form-width);
  max-width: var(--quote-form-width);
  height: var(--quote-form-height);
  min-height: var(--quote-form-height);
  background: var(--card);
  border-radius: clamp(0px, 1.5vw, 12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  padding: var(--card-pad-y) var(--card-pad-x);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  font-family: var(--font-site);
  font-size: var(--fs-body);
  line-height: 1.8em;
  color: var(--label-muted);
  overflow: hidden;
}

.quote-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Vertical scroll only on the active step — not on the track (avoids scrollbar when a *different* step is tall). */
.slides-viewport {
  overflow-x: hidden;
  overflow-y: hidden;
  width: 100%;
  position: relative;
  flex: 1;
  min-height: 0;
}

.slides-track {
  display: flex;
  width: 500%;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.slide {
  flex: 0 0 20%;
  width: 20%;
  max-width: 20%;
  height: 100%;
  min-height: 0;
  padding-right: clamp(0.25rem, 1.5vw, 0.5rem);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Errors stay visible at the top; fields scroll underneath */
.slide-error-banner {
  flex-shrink: 0;
  width: 100%;
}

.slide-error-banner .field-error {
  margin: 0 0 0.5rem;
  min-height: 0;
}

.slide-error-banner .field-error:empty {
  display: none;
  margin: 0;
}

.slide-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Inactive slides stay in the flex row (required for correct track width).
   Off-screen slides must not receive focus or clicks. */
.slide[aria-hidden="true"] {
  pointer-events: none;
}

.slide.is-active {
  pointer-events: auto;
}

.quote-title {
  margin: 0 0 clamp(1rem, 3vw, 1.5rem);
  font-family: var(--font-heading);
  font-size: var(--fs-step-heading);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
}

.slide-title {
  margin: 0 0 1.25rem;
  font-family: var(--font-site);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-muted);
  line-height: 1.35;
}

.field-label {
  margin: 0 0 0.85rem;
  font-family: var(--font-site);
  font-size: var(--fs-label-upper);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label-muted);
}

.spaced-label {
  margin-top: 1.35rem;
}

.field-error {
  min-height: 0;
  margin: 0;
  font-family: var(--font-site);
  font-size: 14px;
  color: #b91c1c;
}

.slide-error-banner .field-error:not(:empty) {
  min-height: 1.25rem;
  padding: 0.35rem 0;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-family: var(--font-site);
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--text-option);
  min-height: 44px;
  padding: 0.35rem 0;
}

.radio-option input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--radio-accent);
  cursor: pointer;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-family: var(--font-site);
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--text-option);
  min-height: 44px;
  padding: 0.35rem 0;
}

.check-option input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--radio-accent);
  cursor: pointer;
  border-radius: 2px;
}

.text-input,
.text-area {
  width: 100%;
  max-width: 100%;
  padding: 10px 20px;
  font-family: var(--font-site);
  font-size: var(--fs-form-input);
  line-height: 1.5;
  border: 1px solid var(--input-border);
  border-radius: 0;
  background: #fff;
  color: var(--text-heading);
}

.text-input {
  min-height: 50px;
  box-sizing: border-box;
}

.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 168, 107, 0.2);
}

.text-area {
  resize: vertical;
  min-height: clamp(100px, 22vh, 160px);
}

.stack-fields {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-label {
  font-family: var(--font-site);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}

/* Review */
.review-intro {
  margin: 0 0 1rem;
  font-family: var(--font-site);
  font-size: var(--fs-body);
  color: var(--text-option);
}

.review-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.review-block {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.review-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.review-label {
  display: block;
  margin: 0;
  font-family: var(--font-site);
  font-size: var(--fs-label-upper);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-muted);
}

.review-value {
  display: block;
  margin: 0.35rem 0 0;
  font-family: var(--font-site);
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-heading);
  word-break: break-word;
}

/* Footer */
.card-footer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  min-height: 44px;
  margin-top: auto;
  padding-top: clamp(1.25rem, 4vw, 2.25rem);
}

.btn-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
  width: 100%;
}

.step-dots {
  position: static;
  transform: none;
  align-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
  order: -1;
}

.step-dots li {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-inactive);
  transition: background 0.25s ease;
}

/* Completed steps — soft green */
.step-dots li.is-done {
  background: var(--green-soft);
}

/* Current step — solid green */
.step-dots li.is-active {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 168, 107, 0.25);
}

.btn-next,
.btn-prev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 5.5rem;
  padding: 0 clamp(1.25rem, 4vw, 1.75rem);
  border: none;
  border-radius: 2px;
  font-family: var(--font-site);
  font-size: var(--fs-btn);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

.btn-next {
  background: var(--green);
  color: #ffffff;
}

.btn-next:hover:not(:disabled) {
  background: var(--green-hover);
}

.btn-prev {
  background: var(--btn-grey);
  color: #ffffff;
}

.btn-prev:hover:not(:disabled) {
  background: var(--btn-grey-hover);
}

.btn-next:focus-visible,
.btn-prev:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 0.85rem 1.25rem;
  background: #14532d;
  color: #ecfdf5;
  font-family: var(--font-site);
  font-size: var(--fs-body);
  font-weight: 500;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 100;
}

.toast.hidden {
  display: none;
}

/* Beautiful Modal Styles */
.success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.success-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.success-modal[aria-hidden="false"] .modal-content {
  transform: scale(1);
}

.modal-icon {
  margin-bottom: 1.5rem;
}

.success-icon svg,
.error-icon svg {
  animation: iconPop 0.5s ease-out;
}

@keyframes iconPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.75rem;
}

.modal-message {
  font-family: var(--font-site);
  font-size: var(--fs-body);
  color: var(--label-muted);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.modal-btn {
  background: var(--green);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-family: var(--font-site);
  font-size: var(--fs-btn);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-btn:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.3);
}

.modal-btn:focus {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.error-modal .modal-btn {
  background: #ef4444;
}

.error-modal .modal-btn:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.error-modal .modal-btn:focus {
  outline: 2px solid #ef4444;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .modal-title {
    font-size: 1.25rem;
  }
  
  .modal-btn {
    width: 100%;
    padding: 0.875rem;
  }
}

/* —— Tablet & up: comfortable reading width, horizontal footer —— */
@media (min-width: 480px) {
  :root {
    --card-pad-x: 1.5rem;
    --card-pad-y: 1.75rem;
  }

  .brand-bar {
    width: 6px;
  }
}

@media (min-width: 640px) {
  :root {
    --card-pad-x: 2rem;
    --card-pad-y: 2rem;
  }

  .card-footer {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
    min-height: 52px;
  }

  .step-dots {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    align-self: auto;
    order: 0;
  }

  .btn-row {
    width: auto;
    margin-left: auto;
  }
}

/* —— Desktop: section padding —— */
@media (min-width: 900px) {
  :root {
    --page-pad-x: max(1.5rem, env(safe-area-inset-left, 0px));
  }

  .quote-page-section {
    padding-top: max(1.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
  }
}

/* —— Small phones: stack buttons full width optional —— */
@media (max-width: 359px) {
  .quote-card .btn-row {
    flex-direction: column;
    align-items: stretch;
  }

  .quote-card .card-footer .btn-row .btn-next,
  .quote-card .card-footer .btn-row .btn-prev {
    width: 100% !important;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slides-track {
    transition-duration: 0.01ms;
  }

  .slide {
    transition-duration: 0.01ms;
  }
}

/* —— Embedded in site: override style.css global demo rules (.slide display:none; button position:absolute) —— */
.quote-card .slides-track .slide {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0;
  width: 20%;
  max-width: 20%;
  flex: 0 0 20%;
  overflow: hidden !important;
}

.quote-card .slides-track .slide .slide-scroll {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.quote-card .card-footer button.btn-prev,
.quote-card .card-footer button.btn-next {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: auto !important;
  min-width: 5.5rem;
  height: auto !important;
  min-height: 48px;
  border-radius: 2px !important;
  box-shadow: none !important;
  font-family: var(--font-site) !important;
  font-size: var(--fs-btn) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.quote-card .card-footer button.btn-next {
  background: var(--green) !important;
  color: #ffffff !important;
}

.quote-card .card-footer button.btn-next:hover:not(:disabled) {
  background: var(--green-hover) !important;
  transform: none !important;
}

.quote-card .card-footer button.btn-prev {
  background: var(--btn-grey) !important;
  color: #ffffff !important;
}

.quote-card .card-footer button.btn-prev:hover:not(:disabled) {
  background: var(--btn-grey-hover) !important;
  transform: none !important;
}

/* Submit also uses .btn-next — base rule’s display:inline-flex must not beat .hidden */
.quote-card .card-footer button.btn-next.hidden,
.quote-card .card-footer button.btn-prev[hidden] {
  display: none !important;
}

/* Keep wizard titles readable vs site h1/h2 resets */
.quote-card .quote-title {
  font-family: var(--font-heading);
  font-size: var(--fs-step-heading);
  color: var(--text-heading);
}

.quote-card .slide-title {
  font-size: 14px;
  color: var(--label-muted);
}

.quote-card .slide-review .slide-title {
  font-family: var(--font-heading);
  font-size: var(--fs-step-heading);
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-heading);
}
