/* =====================================================================
   PIRT Theme — Registration wizard
   Card-style radio tiles for step 1, plus the labelled step indicator,
   and shared chrome for steps 2-5 (page header, form card, actions row).
   ===================================================================== */

/* Wizard page wrapper — full-width hero header + content card. */
.wizard-page.page-header {
  padding: calc(var(--nav-height) + 32px) 0 32px;
}
.wizard-container {
  max-width: 880px;
  margin: -16px auto 80px;
  background: var(--white);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px 36px 36px;
  position: relative;
  z-index: 2;
}
body.skin .wizard-container {
  background: var(--sp-surface) !important;
  border-color: var(--sp-line) !important;
  box-shadow: 0 6px 24px rgba(0, 34, 66, 0.06);
}

/* Step indicator — labelled progress strip */
.wizard-steps {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 28px;
  list-style: none;
  padding: 0;
}
.wizard-steps .wizard-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white-05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--white-50);
  min-width: 0; /* allow label to truncate cleanly */
}
.wizard-steps .wizard-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--white-10);
  color: var(--white-70);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.wizard-steps .wizard-step__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wizard-steps .wizard-step.done {
  color: var(--teal);
  border-color: var(--teal);
}
.wizard-steps .wizard-step.done .wizard-step__num {
  background: var(--teal);
  color: var(--white);
  font-size: 0; /* hide the digit */
}
.wizard-steps .wizard-step.done .wizard-step__num::after {
  content: '✓';
  font-size: 13px;
}
.wizard-steps .wizard-step.active {
  background: linear-gradient(135deg, var(--teal), var(--green));
  color: var(--white);
  border-color: transparent;
}
.wizard-steps .wizard-step.active .wizard-step__num {
  background: rgba(255, 255, 255, 0.3);
  color: var(--white);
}

/* Category radio tiles — grid the radios as cards */
.wizard-form fieldset > legend,
.wizard-form .form-item-category > legend {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.wizard-form .form-radios.wizard-categories,
.wizard-form #edit-category--wrapper .form-radios,
.wizard-form #edit-category {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.wizard-form .form-item-category {
  margin: 0;
  position: relative;
}
.wizard-form .form-item-category input[type="radio"] {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.wizard-form .form-item-category label {
  display: block;
  padding: 16px 18px;
  background: var(--white-05);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  line-height: 1.5;
  color: var(--white);
  position: relative;
  min-height: 100%;
}
.wizard-form .form-item-category label:hover {
  background: var(--white-10);
  border-color: var(--teal);
}
.wizard-form .form-item-category:has(input:checked) label,
.wizard-form .form-item-category input:checked + label {
  background: rgba(42, 191, 179, 0.12);
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal);
}
/* Check-circle indicator in the top-right corner of selected tile (R7-023). */
.wizard-form .form-item-category label {
  padding-right: 40px; /* space for the check mark */
}
.wizard-form .form-item-category:has(input:checked) label::after,
.wizard-form .form-item-category input:checked + label::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* Skin variant */
body.skin .wizard-form .form-item-category:has(input:checked) label::after,
body.skin .wizard-form .form-item-category input:checked + label::after {
  background: var(--sp-primary);
}

/* Standard form fields inside the wizard (steps 2 / 3) */
.wizard-form .form-item {
  margin-bottom: 18px;
}
.wizard-form .form-item label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--sp-text);
  margin-bottom: 6px;
}
.wizard-form .form-item .description {
  font-size: 12px;
  color: var(--sp-muted);
  margin-top: 6px;
}

/* Checkbox / radio rows */
.wizard-form .form-type-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.wizard-form .form-type-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--sp-primary);
  flex-shrink: 0;
}
.wizard-form .form-type-checkbox label {
  margin-bottom: 0;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}

/* Action row — primary + back button */
.wizard-form .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--sp-line);
}
.wizard-form .form-actions .btn-outline {
  margin-right: auto;
}

/* Step 4 — review summary table */
.wizard-review-table {
  margin-bottom: 24px;
}
.wizard-review-table th {
  width: 30%;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  color: var(--sp-muted);
}

/* Step 5 — total + payment note */
.wizard-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  background: linear-gradient(135deg, var(--sp-secondary-d), var(--sp-secondary));
  color: #fff;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.wizard-total__label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}
.wizard-total__amount {
  font-family: 'Lexend', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
}
.wizard-payment-note {
  background: rgba(238, 176, 146, 0.12);
  border: 1px solid var(--sp-peach);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--sp-text);
  line-height: 1.6;
  margin: 0 0 24px;
}

/* ===== Skin (SPREP white) overrides ===== */
body.skin .wizard-page.page-header {
  background: linear-gradient(135deg, var(--sp-secondary-d) 0%, var(--sp-secondary) 60%, var(--sp-primary) 100%);
  color: #fff;
}
body.skin .wizard-page.page-header h1 {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
}
body.skin .wizard-page.page-header p {
  color: rgba(255, 255, 255, 0.85) !important;
}
body.skin .wizard-page.page-header .section-tag {
  color: var(--sp-peach) !important;
}
body.skin .wizard-steps .wizard-step {
  background: var(--sp-bg) !important;
  border-color: var(--sp-line) !important;
  color: var(--sp-muted) !important;
}
body.skin .wizard-steps .wizard-step__num {
  background: var(--sp-line) !important;
  color: var(--sp-muted) !important;
}
body.skin .wizard-steps .wizard-step.done {
  color: var(--sp-primary) !important;
  border-color: var(--sp-primary) !important;
}
body.skin .wizard-steps .wizard-step.done .wizard-step__num {
  background: var(--sp-primary) !important;
  color: #fff !important;
}
body.skin .wizard-steps .wizard-step.active {
  background: var(--sp-primary) !important;
  color: #fff !important;
  border-color: transparent !important;
}
body.skin .wizard-form .form-item-category label {
  background: var(--sp-surface) !important;
  border-color: var(--sp-line) !important;
  color: var(--sp-text) !important;
}
body.skin .wizard-form .form-item-category label:hover {
  background: var(--sp-bg) !important;
  border-color: var(--sp-primary) !important;
}
body.skin .wizard-form .form-item-category:has(input:checked) label,
body.skin .wizard-form .form-item-category input:checked + label {
  background: rgba(1, 128, 129, 0.06) !important;
  border-color: var(--sp-primary) !important;
  box-shadow: 0 0 0 2px var(--sp-primary) !important;
}

/* Skin overrides for fields */
body.skin .wizard-form .form-input,
body.skin .wizard-form input.form-text,
body.skin .wizard-form input.form-email,
body.skin .wizard-form input.form-tel,
body.skin .wizard-form textarea,
body.skin .wizard-form select {
  width: 100%;
  padding: 10px 14px;
  background: var(--sp-bg) !important;
  border: 1px solid var(--sp-line) !important;
  border-radius: 6px;
  color: var(--sp-text) !important;
  font-size: 14px;
}
body.skin .wizard-form .form-input:focus,
body.skin .wizard-form input.form-text:focus,
body.skin .wizard-form input.form-email:focus,
body.skin .wizard-form input.form-tel:focus,
body.skin .wizard-form textarea:focus {
  outline: none;
  border-color: var(--sp-primary) !important;
  box-shadow: 0 0 0 3px rgba(1, 128, 129, 0.12);
}

/* Skin overrides for review table */
body.skin .wizard-review-table th {
  color: var(--sp-muted) !important;
  border-bottom: 1px solid var(--sp-line);
}
body.skin .wizard-review-table td {
  color: var(--sp-text) !important;
  border-bottom: 1px solid var(--sp-line);
}

/* =====================================================================
   AUTOFILL DROPDOWN — dev/QA aid, only renders for users with the
   `use pirt registration autofill` permission. Lives inside the
   form_actions row, sits to the LEFT of the Next button.
   Dashed amber styling so it can't be confused with real UI.
   ===================================================================== */
.wizard-autofill {
  position: relative;
  font-size: 13px;
  color: #92400e;
  /* sits inline in form-actions; Back's existing `margin-right:auto`
     already pushes Autofill + Next to the right edge. */
}
.wizard-autofill__summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  padding: 9px 14px;
  background: rgba(245, 158, 11, 0.10);
  border: 1.5px dashed rgba(245, 158, 11, 0.55);
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: #92400e;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.wizard-autofill__summary:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.85);
}
.wizard-autofill__summary::-webkit-details-marker { display: none; }
.wizard-autofill__summary::after {
  content: '▾';
  font-size: 11px;
  opacity: 0.7;
  transition: transform 0.15s;
}
.wizard-autofill[open] .wizard-autofill__summary::after {
  transform: rotate(180deg);
}
.wizard-autofill__body {
  position: absolute;
  bottom: calc(100% + 6px);     /* dropdown opens UPWARD so it doesn't push Next button */
  left: 0;
  width: 540px;
  max-width: calc(100vw - 48px);
  max-height: 360px;
  overflow-y: auto;
  background: #fff;
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 100;
}
.wizard-autofill__hint {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(245, 158, 11, 0.30);
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}
.wizard-autofill__reset {
  color: #b45309;
  text-decoration: underline;
  font-weight: 500;
  margin-left: 4px;
}
.wizard-autofill__group { margin-bottom: 10px; }
.wizard-autofill__group:last-child { margin-bottom: 0; }
.wizard-autofill__label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #92400e;
  margin-bottom: 6px;
  opacity: 0.7;
}
.wizard-autofill__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wizard-autofill__chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: #fff;
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 20px;
  color: #92400e;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.wizard-autofill__chip:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}
.wizard-autofill__chip.is-used {
  background: rgba(245, 158, 11, 0.10);
  color: #b45309;
  text-decoration: line-through;
  cursor: default;
  opacity: 0.65;
}
.wizard-autofill__chip.is-used:hover {
  background: rgba(245, 158, 11, 0.10);
  color: #b45309;
}
.wizard-autofill__empty {
  margin: 0;
  font-style: italic;
  color: #92400e;
  opacity: 0.7;
}

/* Mobile — drop the dropdown above OR below depending on viewport */
@media (max-width: 640px) {
  .wizard-autofill__body {
    width: 92vw;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .wizard-container {
    padding: 24px 20px;
  }
  .wizard-steps {
    flex-wrap: wrap;
  }
  .wizard-steps .wizard-step {
    flex: 1 1 calc(50% - 6px);
  }
  .wizard-form .form-radios.wizard-categories,
  .wizard-form #edit-category--wrapper .form-radios,
  .wizard-form #edit-category {
    grid-template-columns: 1fr;
  }
  .wizard-total {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* ===== Step 5 confirmation panel (E02 ISSUE-0046) ===== */
.wizard-confirmation {
  text-align: center;
  padding: 32px 28px 36px;
  background: var(--white, #fff);
  border-radius: var(--radius-lg, 12px);
}
.wizard-confirmation__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sp-primary, #018081), var(--sp-mint, #5BC2A9));
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  margin: 0 auto 18px;
  box-shadow: 0 8px 24px rgba(1, 128, 129, 0.18);
}
.wizard-confirmation__title {
  font-family: 'Lexend', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--sp-secondary-d, #002242);
  margin: 0 0 8px;
}
.wizard-confirmation__intro {
  font-size: 15px;
  line-height: 1.6;
  color: var(--sp-text, #002242);
  max-width: 540px;
  margin: 0 auto 22px;
}
.wizard-confirmation__meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--sp-bg, #fafbfb);
  border: 1px solid var(--sp-line, #E6E9EB);
  border-radius: 999px;
  padding: 8px 18px;
  margin: 0 0 24px;
}
.wizard-confirmation__meta dt,
.wizard-confirmation__meta dd {
  margin: 0;
  font-size: 13px;
}
.wizard-confirmation__meta dt {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sp-muted, #606060);
  font-weight: 600;
}
.wizard-confirmation__ref {
  font-family: 'Lexend', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--sp-secondary-d, #002242);
  background: none;
  padding: 0;
}
.wizard-confirmation__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0;
}
