/* Apply section styles: visa application CTA button + wizard/form.
   Relies on shared design tokens (--ink, --font-display, --font-primary) from sec1.css. */

body.wizard-open {
  overflow: hidden;
}

.apply-button {
  position: sticky;
  top: 50vh;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 4.4rem;
  padding: 0 1rem 0 2rem;
  border: 1px solid #ffffff;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  transition:
    background 0.35s ease,
    transform 0.35s ease,
    box-shadow 0.35s ease;
}

.apply-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(8, 10, 15, 0.08), transparent);
  transform: translateX(-110%);
  transition: transform 0.55s ease;
}

.apply-button:hover,
.apply-button:focus-visible {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.4);
}

.apply-button:hover::before,
.apply-button:focus-visible::before {
  transform: translateX(110%);
}

.apply-button__label {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
}

.apply-button__icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 1.25rem;
  line-height: 1;
}

/* Page-level apply button theme (overrides white default on page CTAs) */
.end-section .apply-button {
  border: 0;
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 28px 90px rgba(20, 20, 40, 0.28);
}

.end-section .apply-button::before {
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}

.end-section .apply-button__icon {
  background: linear-gradient(135deg, #08327E 0%, #E31E24 100%);
  color: #ffffff;
}

.application-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}

.application-shell.is-open {
  visibility: visible;
  pointer-events: auto;
}

.application-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.55);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.application-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  max-height: min(96dvh, calc(100dvh - 1.5rem));
  overflow: hidden;
  border: 0;
  border-radius: 32px 32px 0 0;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 -30px 90px rgba(0, 0, 0, 0.4);
}

.wizard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.4rem clamp(1.5rem, 5vw, 4rem) 1.4rem;
}

.wizard-route-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  width: fit-content;
  max-width: calc(100% - clamp(3rem, 10vw, 8rem));
  margin: 0 clamp(1.5rem, 5vw, 4rem) 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(8, 10, 15, 0.1);
  border-radius: 999px;
  background: #f4f7f6;
  color: rgba(8, 10, 15, 0.72);
  font-size: 0.84rem;
  line-height: 1;
  text-transform: none;
}

.wizard-route-summary__passport,
.wizard-route-summary__destination {
  overflow: hidden;
  max-width: 14rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-route-summary__arrow {
  color: rgba(8, 10, 15, 0.34);
}

/* Selects inside the compact route summary */
.wizard-route-summary select {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: #ffffff;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(8, 10, 15, 0.06);
  color: var(--ink);
  font: 500 0.92rem var(--font-primary);
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23343a70' d='M0 0 L5 6 L10 0 Z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 0.9rem 0.55rem;
}

.wizard-route-summary__passport,
.wizard-route-summary__destination {
  max-width: none;
}

.wizard-route-summary__passport select,
.wizard-route-summary__destination select {
  min-width: 11.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;
}

.wizard-kicker {
  margin-bottom: 0.55rem;
  color: rgba(8, 10, 15, 0.42);
  font-size: 0.76rem;
}

.wizard-header h2 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.5vw, 4.6rem);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.wizard-close {
  min-width: 5rem;
  height: 2.7rem;
  padding: 0 1.2rem;
  border: 0;
  border-radius: 999px;
  background: #f1f2f4;
  color: rgba(8, 10, 15, 0.7);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.wizard-close:hover,
.wizard-close:focus-visible {
  background: #e6e7ea;
  color: var(--ink);
}

.wizard-progress {
  padding: 0 clamp(1.5rem, 5vw, 4rem) 1rem;
}

.wizard-progress-track {
  position: relative;
  width: 100%;
  height: 2px;
  margin: 1rem 0 1.4rem;
  border-radius: 999px;
  background: #ececed;
}

.wizard-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: var(--ink);
  transition: width 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}

.wizard-progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.wizard-progress-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid #e6e7ea;
  border-radius: 12px;
  background: #f6f7f8;
  color: rgba(8, 10, 15, 0.42);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.wizard-progress-step span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-progress-step.active,
.wizard-progress-step.complete {
  border-color: var(--ink);
  color: var(--ink);
  background: #ffffff;
}

.wizard-body {
  position: relative;
  flex: 1;
  min-height: 380px;
  overflow-y: auto;
  padding: 1.6rem clamp(1.5rem, 5vw, 4rem);
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.wizard-step-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.wizard-step-heading p {
  color: rgba(8, 10, 15, 0.4);
  font-size: 0.78rem;
}

.wizard-step-heading h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.02em;
  text-align: right;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.5rem;
}

.form-field--wide,
.review-note {
  grid-column: 1 / -1;
}

.form-field span,
.upload-field span,
.addon-card span {
  color: rgba(8, 10, 15, 0.55);
  font-size: 0.75rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 14px;
  outline: none;
  background: #f4f5f6;
  color: var(--ink);
  font: 500 0.95rem var(--font-primary);
  letter-spacing: 0;
  text-transform: none;
}

.form-field textarea {
  resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: rgba(8, 10, 15, 0.35);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--ink);
  background: #ffffff;
}

.form-field select option {
  color: var(--ink);
}

.upload-grid,
.addon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.upload-field,
.addon-card {
  position: relative;
  display: grid;
  min-height: 11rem;
  align-content: end;
  gap: 0.5rem;
  padding: 1.15rem;
  border: 1px solid #e6e7ea;
  border-radius: 16px;
  background: #f6f7f8;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.upload-field:hover,
.addon-card:hover {
  border-color: var(--ink);
  background: #ffffff;
}

.upload-field::before {
  content: "+";
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
}

.upload-field input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-field small,
.addon-card small {
  color: rgba(8, 10, 15, 0.42);
  font-size: 0.72rem;
  line-height: 1.3;
}

.addon-card {
  min-height: 9rem;
}

.addon-card input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--ink);
}

.review-note {
  margin-top: 1rem;
}

.wizard-review-note {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(227, 30, 36, 0.08);
  color: rgba(8, 10, 15, 0.68);
  font-size: 0.82rem;
  line-height: 1.5;
  text-transform: none;
}

.wizard-success {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 3rem clamp(1.5rem, 5vw, 4rem) 2.5rem;
  text-align: center;
}

.wizard-success[hidden] {
  display: none;
}

.wizard-success__icon {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(227, 30, 36, 0.14);
  color: var(--brand-navy);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.wizard-success h3 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.wizard-success p {
  max-width: 34rem;
  color: rgba(8, 10, 15, 0.62);
  font-size: 0.95rem;
  line-height: 1.6;
  text-transform: none;
}

.application-panel.is-submitted .wizard-route-summary,
.application-panel.is-submitted .wizard-progress,
.application-panel.is-submitted .wizard-body,
.application-panel.is-submitted .wizard-actions {
  display: none;
}

.wizard-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem clamp(1.5rem, 5vw, 4rem) 2rem;
  border-top: 1px solid #ededee;
}

.wizard-action {
  min-height: 3.6rem;
  padding: 0 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.wizard-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.wizard-action--secondary {
  justify-self: start;
  border: 1px solid #d9dadd;
  background: #ffffff;
  color: rgba(8, 10, 15, 0.7);
}

.wizard-action--secondary:not(:disabled):hover {
  border-color: var(--ink);
  color: var(--ink);
}

.wizard-action--primary {
  justify-self: end;
  background: var(--ink);
  color: #ffffff;
}

.wizard-action--primary:hover {
  background: #1c1f27;
}

.wizard-count {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3.8rem;
  min-width: 8rem;
  color: rgba(8, 10, 15, 0.6);
  font-size: 0.78rem;
}

.wizard-count::before {
  content: "";
  position: absolute;
  width: 3rem;
  height: 1px;
  margin-left: 1.55rem;
  background: rgba(8, 10, 15, 0.22);
}

@media (max-width: 900px) {
  .application-panel {
    max-height: calc(100dvh - 2rem);
  }

  .wizard-progress-steps {
    grid-template-columns: repeat(4, minmax(4.8rem, 1fr));
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .wizard-progress-step {
    min-width: 4.8rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-grid,
  .addon-grid {
    grid-template-columns: 1fr;
  }

  .upload-field,
  .addon-card {
    min-height: 7.6rem;
  }
}

@media (max-width: 640px) {
  .apply-button {
    min-height: 3.9rem;
    padding-left: 1.35rem;
  }

  .apply-button__label {
    font-size: 0.9rem;
  }

  .apply-button__icon {
    width: 2.55rem;
    height: 2.55rem;
  }

  .application-panel {
    max-height: 94dvh;
    border-radius: 24px 24px 0 0;
  }

  .wizard-header {
    align-items: flex-start;
    padding: 1.6rem 1.15rem 1rem;
  }

  .wizard-route-summary {
    flex-wrap: wrap;
    width: 100%;
    max-width: none;
    margin-right: 1.15rem;
    margin-left: 1.15rem;
  }

  .wizard-route-summary__passport,
  .wizard-route-summary__destination {
    flex: 1 1 9rem;
  }

  .wizard-route-summary__passport select,
  .wizard-route-summary__destination select {
    width: 100%;
    min-width: 0;
  }

  .wizard-header h2 {
    font-size: 2rem;
  }

  .wizard-close {
    min-width: 4rem;
    height: 2.2rem;
    padding: 0 0.8rem;
    font-size: 0.72rem;
  }

  .wizard-progress,
  .wizard-body,
  .wizard-actions {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .wizard-progress-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: visible;
  }

  .wizard-progress-step {
    min-width: 0;
    align-items: center;
    padding: 0.7rem 0.35rem;
  }

  .wizard-progress-step span:last-child {
    display: none;
  }

  .wizard-body {
    min-height: 360px;
  }

  .wizard-step-heading {
    display: grid;
    align-items: start;
  }

  .wizard-step-heading h3 {
    text-align: left;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .wizard-actions {
    grid-template-columns: 1fr;
  }

  .wizard-action,
  .wizard-action--secondary,
  .wizard-action--primary {
    justify-self: stretch;
    width: 100%;
  }

  .wizard-count {
    justify-content: center;
    order: -1;
  }
}
