/* Quiz / application wizard — sits on top of the shared tokens in styles.css */

.apply-body {
  background: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.apply-main {
  flex: 1;
  padding: clamp(28px, 7vw, 88px) 0 clamp(36px, 9vw, 120px);
  position: relative;
  overflow: hidden;
}
.apply-main::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(50% 50% at 50% 0%, rgba(79, 210, 225, 0.06), transparent 60%),
    radial-gradient(40% 30% at 80% 90%, rgba(0, 114, 127, 0.08), transparent 70%);
  pointer-events: none;
}

.apply-wrap {
  position: relative;
  max-width: 720px;
}

.apply-back {
  display: inline-block;
  font-size: 13px;
  color: var(--text-soft);
  transition: color var(--t-fast);
}
.apply-back:hover { color: var(--cyan); }

/* Header + progress */
.apply-header {
  padding-bottom: clamp(20px, 4vw, 40px);
  margin-bottom: clamp(20px, 3.5vw, 36px);
  border-bottom: 1px solid var(--border-soft);
}
.apply-header-row { height: 64px !important; }
.apply-title {
  font-size: clamp(22px, 3.6vw, 40px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 24px 0;
  color: var(--text);
}

.apply-progress {
  display: flex;
  align-items: center;
  gap: 16px;
}
.apply-progress-track {
  position: relative;
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.apply-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 20%;
  background: linear-gradient(90deg, var(--teal), var(--cyan));
  border-radius: 999px;
  transition: width 360ms cubic-bezier(.4,0,.2,1);
}
.apply-progress-meta {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
#step-current { color: var(--cyan); font-weight: 500; }

/* Step layout */
.apply-step {
  display: none;
  animation: stepIn 320ms cubic-bezier(.2,.7,.2,1) both;
}
.apply-step.is-active { display: block; }

@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.apply-question {
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin: 0 0 8px 0;
}
.apply-sub {
  font-size: 14px;
  color: var(--text-soft);
  margin: 0 0 28px 0;
}

/* Choice cards */
.apply-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 32px;
}
.apply-choices-4 {
  grid-template-columns: repeat(2, 1fr);
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(79, 210, 225, 0.02), transparent 70%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 56px 18px 20px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  width: 100%;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.choice:hover {
  border-color: rgba(79, 210, 225, 0.4);
  background:
    linear-gradient(180deg, rgba(79, 210, 225, 0.05), transparent 70%),
    var(--panel-2);
  transform: translateY(-1px);
}
.choice.is-selected {
  border-color: rgba(79, 210, 225, 0.6);
  background:
    linear-gradient(180deg, rgba(79, 210, 225, 0.10), transparent 70%),
    var(--panel-active);
  box-shadow:
    0 22px 60px -28px rgba(79, 210, 225, 0.45),
    0 0 0 1px rgba(79, 210, 225, 0.2) inset;
}
.choice-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  opacity: 0.85;
}
.choice-icon svg { width: 100%; height: 100%; }
.choice.is-selected .choice-icon { opacity: 1; }
.choice-label {
  flex: 1;
  font-size: clamp(17px, 1.5vw, 22px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--text);
}
.choice-check {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.choice-check::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 8px;
  width: 5px;
  height: 10px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(45deg) scale(0);
  transition: transform 200ms cubic-bezier(.4,0,.2,1);
}
.choice.is-selected .choice-check {
  background: var(--cyan);
  border-color: var(--cyan);
}
.choice.is-selected .choice-check::after { transform: rotate(45deg) scale(1); }

/* 4-column budget tier — same-row icon stack */
.apply-choices-4 .choice {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 18px 18px;
  gap: 12px;
}
.apply-choices-4 .choice-icon {
  width: 44px;
  height: 44px;
}
.apply-choices-4 .choice-label {
  font-size: clamp(15px, 1.4vw, 19px);
  font-weight: 500;
}
.apply-choices-4 .choice-check {
  position: static;
  transform: none;
  margin-top: 6px;
}

/* Inputs */
.apply-field { margin-bottom: 24px; }
.apply-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.apply-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color var(--t-fast), background var(--t-fast);
  outline: none;
}
.apply-input::placeholder { color: var(--muted); }
.apply-input:focus {
  border-color: var(--cyan);
  background: var(--panel-2);
}
.apply-error {
  margin-top: 6px;
  font-size: 12px;
  color: #ff7a7a;
  min-height: 14px;
}

.apply-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 560px) {
  .apply-grid-2 { grid-template-columns: 1fr; }
}

/* Phone field with country-code picker */
.apply-phone-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  position: relative;
}
.apply-cc { position: relative; }
.apply-cc-trigger {
  width: 100%;
  height: 100%;
  min-height: 48px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.apply-cc-trigger:hover { border-color: var(--cyan); }
.apply-cc-trigger:focus-visible { outline: none; border-color: var(--cyan); background: var(--panel-2); }
.cc-flag { font-size: 18px; line-height: 1; }
.cc-code {
  font-size: 15px;
  flex: 1;
  text-align: left;
  letter-spacing: 0.01em;
}
.cc-chev {
  width: 10px;
  height: 7px;
  color: var(--text-soft);
  flex-shrink: 0;
  transition: transform var(--t-fast);
}
.apply-cc.is-open .cc-chev { transform: rotate(180deg); color: var(--cyan); }

.apply-cc-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--panel-2);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.5);
  z-index: 30;
  overflow: hidden;
}
.apply-cc-panel[hidden] { display: none !important; }
.apply-cc-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
}
.apply-cc-search {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-fast);
}
.apply-cc-search:focus { border-color: var(--cyan); }
.apply-cc-search::placeholder { color: var(--muted); }

.apply-cc-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 280px;
  overflow-y: auto;
}
.apply-cc-list::-webkit-scrollbar { width: 6px; }
.apply-cc-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.apply-cc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background var(--t-fast);
}
.apply-cc-item:hover,
.apply-cc-item.is-active { background: rgba(79, 210, 225, 0.10); }
.apply-cc-item .cc-item-flag { font-size: 16px; line-height: 1; flex-shrink: 0; }
.apply-cc-item .cc-item-name { flex: 1; color: var(--text); }
.apply-cc-item .cc-item-code { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.apply-cc-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

/* Controls row */
.apply-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.apply-controls .btn-ghost { padding: 12px 18px; }
.apply-controls .btn-primary { padding: 13px 26px; }
.apply-controls .btn-primary:only-child { margin-left: auto; }

.apply-fineprint {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}

/* Loading state */
.apply-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 64px 0;
  color: var(--text-soft);
}
.apply-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  animation: spin 800ms linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .apply-choices-4 { grid-template-columns: 1fr; }
  .apply-choices-4 .choice {
    flex-direction: row;
    text-align: left;
    padding: 14px 50px 14px 16px;
  }
  .apply-choices-4 .choice-check {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    margin-top: 0;
  }
  .apply-choices-4 .choice-icon {
    width: 32px;
    height: 32px;
  }
  .apply-choices-4 .choice-label {
    font-size: 16px;
  }
}

/* Aggressive mobile compression so the form fits one screen per step */
@media (max-width: 720px) {
  .apply-main {
    padding-top: 12px;
    padding-bottom: 16px;
  }
  .apply-header {
    padding-bottom: 14px;
    margin-bottom: 16px;
  }
  .apply-title {
    font-size: 19px;
    margin-bottom: 14px;
  }
  .apply-question {
    font-size: 20px;
    margin-bottom: 6px;
  }
  .apply-sub {
    font-size: 13px;
    margin-bottom: 14px;
  }
  .apply-choices { gap: 8px; margin-bottom: 16px; }
  .choice { padding: 12px 46px 12px 14px; gap: 12px; }
  .choice-icon { width: 28px; height: 28px; }
  .choice-label { font-size: 15px; line-height: 1.3; }
  .choice-check { width: 18px; height: 18px; right: 14px; }
  .apply-field { margin-bottom: 14px; }
  .apply-input { padding: 11px 12px; font-size: 16px; }
  .apply-label { font-size: 11px; margin-bottom: 6px; }
  .apply-controls { margin-top: 8px; }
  .apply-controls .btn { padding: 11px 18px; }
  .apply-progress-meta { font-size: 11px; }
  .apply-fineprint { font-size: 11px; margin-top: 14px; }
}
