/* cube-wizard.css */

/* Ensure [hidden] attribute always wins over display rules */
[hidden] { display: none !important; }

/* Nudge the reCAPTCHA v3 badge up (default bottom: 14px) so it clears
   the site's chat widget icon, without disturbing its right-side
   position or hover slide-in animation. */
.grecaptcha-badge {
  bottom: 90px !important;
}

.cube-wizard {
  max-width: 680px;
  margin: 0 auto;
  font-family: inherit;
}
/* Wider on step 1 (public offer) only — the offer text reads better with more
   horizontal room, while narrower is better for steps 2-4's form fields. */
.cube-wizard.cube-wizard--offer {
  max-width: 960px;
}

/* htmx swaps .cube-wizard__steps' innerHTML in place without resetting scroll
   position — if the user was scrolled down mid-step, the next step's header
   can land underneath the theme's fixed .x-navbar-fixed-top (measured 90px).
   scroll-margin-top makes scrollStepIntoView()'s scrollIntoView() (cube-wizard.js)
   land the new step cleanly below it instead. */
.cube-step {
  scroll-margin-top: 110px;
}

/* ── Step header ─────────────────────────────────────────────────────────── */
.cube-step__header {
  margin-bottom: 1.5rem;
}
.cube-step__num {
  display: inline-block;
  font-size: .8rem;
  color: #777;
  margin-bottom: .25rem;
}
.cube-step__header h3 {
  margin: 0 0 .35em;
  /* em, not rem: this context inherits a font-size from the theme (measured
     21px vs the html root's 14px) — rem would anchor to the root and ignore
     that, which is exactly why 1.25rem (17.5px) rendered smaller than the
     surrounding 21px form text instead of reading as a heading. */
  font-size: 1.5em;
}
.cube-step__hint {
  color: #666;
  font-size: .9rem;
  margin: 0;
}

/* ── Offer scroll box ────────────────────────────────────────────────────── */
.cube-offer-wrap {
  position: relative;
}

.cube-offer-scroll {
  height: min(70vh, 700px); /* fallback before JS computes the real available height */
  overflow-y: scroll;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  background: #fafafa;
  line-height: 1.65;
  margin-bottom: 1rem;
}

.cube-offer-scroll-btn {
  position: absolute;
  right: 1.25rem;
  bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1rem;
  border: none;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  font-size: .85rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: background .15s;
}
.cube-offer-scroll-btn:hover {
  background: #2563eb;
}

.cube-offer-confirm {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .75rem 0;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.cube-fieldset {
  border: none;
  margin: 0 0 1.25rem;
  padding: 0;
}
.cube-fieldset legend {
  font-weight: 600;
  margin-bottom: .6rem;
}

.cube-field {
  margin-bottom: 1rem;
}
.cube-field label {
  display: block;
  font-weight: 500;
  margin-bottom: .3rem;
}
.cube-required {
  color: #c0392b;
}
.cube-field input[type="text"],
.cube-field input[type="email"],
.cube-field input[type="tel"],
.cube-field input[type="url"],
.cube-field select,
.cube-field textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
  box-sizing: border-box;
}
.cube-field textarea {
  resize: vertical;
}

/* ── Radio groups ────────────────────────────────────────────────────────── */
.cube-radio-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.cube-radio {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}
.cube-radio--payment {
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  padding: .75rem 1rem;
  justify-content: space-between;
  transition: border-color .15s;
}
.cube-radio--payment:has(input:checked) {
  border-color: #3b82f6;
  background: #eff6ff;
}
.cube-radio__price {
  font-weight: 700;
  color: #1a1a1a;
}
.cube-radio__price small {
  font-weight: 400;
  color: #666;
  font-size: .8rem;
  display: block;
}

/* ── Checkbox ────────────────────────────────────────────────────────────── */
.cube-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.cube-btn,
a.cube-btn {
  display: inline-flex !important;
  align-items: center;
  padding: .6rem 1.4rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: background .15s;
  text-decoration: none !important;
  box-sizing: border-box;
}
.cube-btn--primary,
a.cube-btn--primary {
  background: #3b82f6 !important;
  color: #fff !important;
}
.cube-btn--primary:hover:not(:disabled),
a.cube-btn--primary:hover {
  background: #2563eb !important;
  color: #fff !important;
}
.cube-btn--primary:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.cube-btn--secondary,
a.cube-btn--secondary {
  background: #e5e7eb !important;
  color: #111 !important;
}
.cube-btn--secondary:hover,
a.cube-btn--secondary:hover {
  background: #d1d5db !important;
}
.cube-btn--ghost,
a.cube-btn--ghost {
  background: transparent !important;
  color: #555 !important;
  border: 1px solid #d0d0d0 !important;
}
.cube-btn--ghost:hover,
a.cube-btn--ghost:hover {
  background: #f3f4f6 !important;
  border-color: #b0b0b0 !important;
}

.cube-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}
/* Steps without a Back button (e.g. the first step) keep the primary
   action flush right instead of stretching it across the row. */
.cube-actions:has(> .cube-btn:only-child) {
  justify-content: flex-end;
}

/* ── Notices ─────────────────────────────────────────────────────────────── */
.cube-notice {
  padding: .65rem 1rem;
  border-radius: 5px;
  font-size: .9rem;
  margin: .75rem 0;
}
.cube-notice--warn {
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #713f12;
}
.cube-notice--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
.cube-notice--success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}
.cube-notice--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #c0392b;
}
.cube-error {
  color: #c0392b;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 5px;
  padding: .65rem 1rem;
  margin: .75rem 0;
}

/* ── Order summary ───────────────────────────────────────────────────────── */
.cube-order-summary {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.cube-order-number {
  font-size: 1.1rem;
  letter-spacing: .03em;
}
.cube-payment-purpose code {
  display: block;
  background: #f3f4f6;
  padding: .5rem .75rem;
  border-radius: 5px;
  font-size: .9rem;
  word-break: break-all;
  margin: .5rem 0;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.cube-wizard__spinner {
  display: none;
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: cube-spin .7s linear infinite;
  margin: 1rem auto;
}
.cube-wizard__spinner.htmx-request {
  display: block;
}
.cube-wizard__form.htmx-request {
  opacity: .5;
  pointer-events: none;
}
@keyframes cube-spin {
  to { transform: rotate(360deg); }
}
