/* =========================================================
   ALHADDAD SHRED LAB — apply.css (Wizard)
   ========================================================= */

.wiz-page { background: var(--bg-soft); min-height: 100vh; }

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

/* ---------- Top bar ---------- */
.wiz-topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  border-bottom: 1px solid var(--line);
}
.wiz-topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 60px;
}
.wiz-topbar__left {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.wiz-topbar__logo { display: inline-flex; align-items: center; }
.wiz-topbar__logo img { height: 24px; width: auto; }
.wiz-topbar__right {
  display: flex; align-items: center; gap: 10px;
}

/* Top-bar "previous step" chevron — visually distinct from the X close
   button: it's a filled tinted pill rather than an outlined square. */
.wiz-backstep {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--orange);
  background: var(--orange-tint);
  border: 1px solid transparent;
  transition: color .2s ease, background-color .2s ease,
              border-color .2s ease, transform .2s var(--ease-spring);
}
.wiz-backstep:hover {
  background: var(--orange);
  color: #fff;
  transform: translateX(-2px);
}
.wiz-backstep svg { width: 18px; height: 18px; display: block; }
.wiz-backstep[hidden] { display: none; }
/* RTL: the chevron points the other way and the hover nudge mirrors. */
html[dir="rtl"] .wiz-backstep svg { transform: scaleX(-1); }
html[dir="rtl"] .wiz-backstep:hover { transform: translateX(2px); }
.wiz-close {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  border: 1px solid var(--line);
  background: #fff;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.wiz-close:hover { color: var(--orange); border-color: var(--orange); background: var(--orange-tint); }
.wiz-close svg { width: 16px; height: 16px; }

/* ---------- Progress bar ---------- */
.wiz-progress {
  height: 4px; width: 100%;
  background: var(--line);
  overflow: hidden;
}
.wiz-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #FF7D3F);
  border-radius: 0 4px 4px 0;
  width: 20%;
  transition: width .5s var(--ease-spring);
}
html[dir="rtl"] .wiz-progress__fill { border-radius: 4px 0 0 4px; }

/* ---------- Main + chip ---------- */
.wiz-main { padding-block: 24px 80px; }

.wiz-chip-wrap { margin-bottom: 16px; }
.wiz-chip {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  padding: 8px 14px;
  font-size: .88rem;
}
.wiz-chip__label { color: var(--ink-4); font-weight: 600; }
.wiz-chip__name { color: var(--ink); font-family: var(--font-display); font-weight: 700; letter-spacing: var(--track-tight); }

/* ---------- Form + steps ---------- */
.wiz-form { max-width: 720px; margin-inline: auto; }
.wiz-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow-card);
}
.wiz-step[hidden] { display: none; }
/* Subtle fade + slide each time a step becomes active. Direction-aware:
   forward enters from below (translateY 12px → 0), backward enters from
   above (translateY -12px → 0) so it reads as returning to a prior step. */
@media (prefers-reduced-motion: no-preference) {
  .wiz-step.is-enter-fwd  { animation: wiz-fade-fwd  .3s ease-out both; }
  .wiz-step.is-enter-back { animation: wiz-fade-back .3s ease-out both; }
}
@keyframes wiz-fade-fwd {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes wiz-fade-back {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}

.wiz-eyebrow {
  font-family: var(--font-body);
  font-weight: 700; font-size: .72rem;
  letter-spacing: var(--track-caps); text-transform: uppercase;
  color: var(--orange);
}
html[lang="ar"] .wiz-eyebrow { text-transform: none; font-size: .88rem; letter-spacing: 0; }

.wiz-step__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.6vw, 2.2rem);
  line-height: 1.15; letter-spacing: var(--track-tight);
  color: var(--ink); margin: 8px 0 10px;
}
html[lang="ar"] .wiz-step__title { line-height: 1.35; }

.wiz-step__sub {
  color: var(--ink-3); font-size: 1.02rem; line-height: 1.65;
  margin-bottom: 22px;
}

.wiz-list {
  display: grid; gap: 10px; margin-bottom: 12px;
}
.wiz-list li {
  position: relative; padding-inline-start: 26px;
  font-size: 1rem; line-height: 1.55; color: var(--ink-2);
}
.wiz-list li::before {
  content: ""; position: absolute; inset-inline-start: 4px; top: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-tint);
}

.wiz-divider {
  height: 1px; background: var(--line);
  margin-block: 24px;
}

.wiz-question {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.2rem; line-height: 1.4; color: var(--ink);
  margin-bottom: 20px;
}
html[lang="ar"] .wiz-question { line-height: 1.55; }
.wiz-question--lg { font-size: 1.32rem; }

/* ---------- Sub-section ---------- */
.wiz-sub {
  border: none; padding: 0;
  margin-block: 24px;
}
.wiz-sub:first-of-type { margin-top: 4px; }
.wiz-sub__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.06rem; color: var(--ink);
  margin-bottom: 14px;
  letter-spacing: var(--track-tight);
  padding: 0;
}
html[lang="ar"] .wiz-sub__title { font-size: 1.12rem; line-height: 1.5; }

/* ---------- Field / input ---------- */
.wiz-field { display: flex; flex-direction: column; gap: 6px; }
.wiz-label {
  font-family: var(--font-body);
  font-weight: 700; font-size: .72rem;
  letter-spacing: var(--track-caps); text-transform: uppercase;
  color: var(--ink-4);
}
html[lang="ar"] .wiz-label { text-transform: none; font-size: .88rem; letter-spacing: 0; }
.wiz-field input,
.wiz-field textarea,
.wiz-field select {
  width: 100%; font: inherit; font-size: 1rem;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.wiz-field textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.wiz-field input:hover, .wiz-field textarea:hover, .wiz-field select:hover { border-color: var(--line-2); }
.wiz-field input:focus, .wiz-field textarea:focus, .wiz-field select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,94,21,.10);
}
.wiz-field input.is-error, .wiz-field textarea.is-error, .wiz-field select.is-error {
  border-color: #DC2626; box-shadow: 0 0 0 4px rgba(220,38,38,.10);
}

.wiz-row {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}

/* ---------- Pills (Y/N + choices) ---------- */
.wiz-pills {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.wiz-pills--3 { grid-template-columns: repeat(3, 1fr); }
.wiz-pills--grid { grid-template-columns: 1fr 1fr; }
.wiz-pill {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-weight: 700;
  font-size: .98rem;
  min-height: 56px; padding: 12px 16px;
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  transition: all .22s var(--ease-spring);
  text-align: center; line-height: 1.3;
}
.wiz-pill:hover {
  background: #fff;
  border-color: var(--orange);
  color: var(--orange);
}
.wiz-pill.is-active {
  background: var(--orange); color: #fff;
  border-color: var(--orange);
  box-shadow: 0 8px 18px -8px rgba(255,94,21,.55);
  transform: translateY(-1px);
}
.wiz-pill.is-error { border-color: #DC2626; }

/* ---------- Callouts ---------- */
.wiz-callout {
  display: flex; gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #FFF8E6;
  border: 1px solid #F2D88A;
  border-inline-start: 4px solid var(--orange);
  color: #6E5618;
  font-size: .94rem; line-height: 1.55;
}
.wiz-callout svg {
  width: 22px; height: 22px; flex-shrink: 0;
  color: var(--orange); margin-top: 1px;
}
.wiz-callout--info {
  background: #EFF6FF; border-color: #BFDBFE;
  border-inline-start-color: #3B82F6;
  color: #1E3A8A;
}
.wiz-callout--info svg { color: #3B82F6; }
.wiz-callout p { margin: 0; }

/* ---------- Conditional reveals ---------- */
.wiz-condition {
  overflow: hidden;
  animation: wiz-grow .35s var(--ease-spring);
}
.wiz-condition[hidden] { display: none; }
@keyframes wiz-grow {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Phone ---------- */
.wiz-phone {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
}
html[dir="rtl"] .wiz-phone {
  /* RTL: visually keep selector on the LEFT and number on the RIGHT.
     In RTL, grid columns are auto-mirrored, so we explicitly restore LTR order
     by forcing direction:ltr on the row and letting each cell handle its own dir. */
  direction: ltr;
}
html[dir="rtl"] .wiz-phone__num input {
  direction: rtl;
  text-align: right;
}

.wiz-phone__cc {
  position: relative;
  display: block;
}
.wiz-phone__num input {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px;
  font: inherit;
  font-size: 1rem;
  width: 100%;
  height: 52px;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

/* ---------- Custom country trigger ---------- */
.cc-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  width: 100%; height: 52px;
  padding-inline: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 1rem; font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
  text-align: start;
  position: relative;
}
.cc-trigger:hover {
  border-color: var(--line-2);
  background: var(--bg-soft);
}
.cc-trigger:focus-visible {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,94,21,.10);
}
.cc-trigger[aria-expanded="true"] {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,94,21,.10);
}
.cc-trigger.is-error {
  border-color: #DC2626;
  box-shadow: 0 0 0 4px rgba(220,38,38,.10);
}
.cc-trigger__dial {
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* Flag image (in trigger + in rows) */
.cc-flag {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--bg-soft);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(10,10,10,.08);
  display: inline-block;
}
/* Plain text fallback shown when <img> swaps itself out (network error) */
.cc-flag-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 16px; border-radius: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .62rem;
  letter-spacing: .04em;
  color: var(--ink-3);
  flex-shrink: 0;
}

/* SVG chevron — overlay, rotates when panel open */
.wiz-phone__chevron {
  margin-inline-start: auto;
  width: 16px;
  height: 16px;
  color: var(--ink-4);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s var(--ease-spring), color .2s ease;
}
.wiz-phone__chevron svg {
  width: 16px;
  height: 16px;
  display: block;
}
.cc-trigger[aria-expanded="true"] .wiz-phone__chevron {
  transform: rotate(180deg);
  color: var(--orange);
}

/* ---------- Country panel ---------- */
.cc-panel {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 60;
  width: min(340px, calc(100vw - 40px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 36px -10px rgba(10,10,10,.18), 0 4px 12px -4px rgba(10,10,10,.08);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.cc-panel:not([hidden]) {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.cc-panel[hidden] { display: none; }

.cc-panel__search {
  position: relative;
  display: flex; align-items: center;
}
.cc-search__icon {
  position: absolute;
  inset-inline-start: 10px;
  width: 14px; height: 14px;
  color: var(--ink-4);
  pointer-events: none;
}
.cc-search {
  width: 100%; height: 40px;
  padding-inline-start: 32px;
  padding-inline-end: 12px;
  font: inherit;
  font-size: .94rem;
  background: var(--bg-soft);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.cc-search:focus {
  outline: none;
  background: #fff;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,94,21,.10);
}

.cc-list {
  list-style: none; padding: 0; margin: 0;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.cc-list li { margin: 0; padding: 0; }
.cc-list li[hidden] { display: none; }

.cc-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: .94rem;
  color: var(--ink-2);
  cursor: pointer;
  text-align: start;
  transition: background-color .12s ease;
}
.cc-row:hover,
.cc-row.is-highlight {
  background: var(--bg-soft);
}
.cc-row[aria-selected="true"] {
  background: var(--orange-tint);
  color: var(--ink);
}
.cc-row[aria-selected="true"] .cc-row__name {
  font-weight: 700;
  color: var(--orange);
}
.cc-row__name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-row__dial {
  color: var(--ink-4);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  white-space: nowrap;
}

.cc-empty {
  padding: 14px 12px;
  margin: 0;
  text-align: center;
  font-size: .9rem;
  color: var(--ink-4);
}

/* Backdrop for mobile sheet mode */
.cc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,.4);
  z-index: 55;
  opacity: 0;
  transition: opacity .15s ease;
}
.cc-backdrop:not([hidden]) {
  opacity: 1;
}
.cc-backdrop[hidden] { display: none; }

/* Number input focus / error */
.wiz-phone__num input:hover { border-color: var(--line-2); }
.wiz-phone__num input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,94,21,.10);
}
.wiz-phone__num input.is-error {
  border-color: #DC2626;
  box-shadow: 0 0 0 4px rgba(220,38,38,.10);
}

/* ---------- Mobile: country panel becomes a centered sheet ---------- */
@media (max-width: 599px) {
  .cc-panel {
    position: fixed;
    top: 50%;
    inset-inline-start: 50%;
    transform: translate(-50%, -50%);
    width: 92vw;
    max-width: 420px;
    max-height: 80vh;
    padding: 14px;
    z-index: 70;
  }
  .cc-panel:not([hidden]) {
    transform: translate(-50%, -50%);
  }
  .cc-list { max-height: 60vh; }
}

/* Reduced-motion: kill the open/close transition */
@media (prefers-reduced-motion: reduce) {
  .cc-panel { transition: none; }
  .cc-backdrop { transition: none; }
}

.wiz-phone__hint {
  margin-top: 8px;
  font-size: .86rem;
  color: var(--ink-4);
  line-height: 1.4;
  min-height: 1.2em;
}
.wiz-phone__hint.is-error {
  color: #DC2626;
  font-weight: 600;
}

.wiz-hint {
  margin-top: 8px;
  font-size: .86rem;
  color: var(--ink-4);
  line-height: 1.4;
}

/* ---------- Date helper ---------- */
.wiz-field--date input[type="date"] {
  font-variant-numeric: tabular-nums;
}
.wiz-helper {
  margin-top: 10px;
  color: var(--orange); font-weight: 700; font-size: .96rem;
}
.wiz-disclaimer {
  margin-top: 8px;
  color: var(--ink-4); font-size: .88rem; line-height: 1.55;
}

/* ---------- CTA / nav ---------- */
/* One full-width primary button per step. "Previous step" lives on the
   top-bar back chevron, so the bottom nav holds a single button. */
.wiz-cta { width: 100%; margin-top: 16px; }
.wiz-nav {
  display: flex; gap: 12px; align-items: center;
  margin-top: 28px;
  justify-content: stretch;
}
.wiz-nav .wiz-cta { margin-top: 0; flex: 1; width: 100%; }
.wiz-nav--single { justify-content: stretch; }
.wiz-nav--single .wiz-cta { width: 100%; flex: 1; }

/* ---------- Error ---------- */
.wiz-error {
  text-align: center; color: #DC2626; font-weight: 700;
  margin-top: 12px; min-height: 1.4em;
}

/* ---------- Thanks ---------- */
.wiz-thanks { text-align: center; padding: clamp(40px, 7vw, 72px) clamp(24px, 5vw, 48px); }
.wiz-thanks__check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 96px; height: 96px;
  color: var(--orange);
  background: var(--orange-tint);
  border-radius: 50%;
  margin-bottom: 24px;
}
.wiz-thanks__check svg { width: 64px; height: 64px; }
.wiz-thanks__title { margin-bottom: 12px; }
.wiz-thanks__sub { color: var(--ink-3); font-size: 1.04rem; line-height: 1.65; max-width: 44ch; margin: 0 auto 28px; }
.wiz-thanks__actions {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.wiz-thanks__home {
  color: var(--ink-4); font-weight: 700; font-size: .92rem;
  border-bottom: 1.5px solid transparent;
  padding-bottom: 1px;
  transition: color .2s ease, border-color .2s ease;
}
.wiz-thanks__home:hover { color: var(--orange); border-bottom-color: var(--orange); }

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
  .wiz-row { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .wiz-step, .wiz-step.is-enter-fwd, .wiz-step.is-enter-back,
  .wiz-condition { animation: none; }
  .wiz-progress__fill { transition: none; }
  .wiz-backstep { transition: none; }
}
