/* Apply Flow Modal */

.af-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
}

.af-modal[hidden] {
  display: none;
}

.af-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 51, .72);
  backdrop-filter: blur(5px);
}

.af-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: calc(100svh - 8px);
  border-radius: 28px 28px 0 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(2, 7, 51, .18);
  /* Establish a containing block so children can use height: 100% */
  height: calc(100svh - 8px);
}

@media (min-width: 640px) {
  .af-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  .af-panel {
    width: 100%;
    max-width: 540px;
    height: auto;
    max-height: 90vh;
    border-radius: 20px;
  }
}

/* Header */
.af-header {
  display: flex;
  flex-direction: column;
  padding: 16px 20px 0;
  border-bottom: 1px solid #e5eaf2;
  flex: 0 0 auto;
  gap: 12px;
}

/* Top row: close + title + step label */
.af-progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.af-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #e5eaf2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #08244a;
  transition: background .15s;
  flex-shrink: 0;
}

.af-close:hover {
  background: #d0d8e8;
}

.af-close:focus-visible {
  outline: 3px solid rgba(8, 36, 74, .25);
  outline-offset: 2px;
}

.af-progress-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: #08244a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.af-step-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Segmented progress bar */
.af-progress-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding-bottom: 16px;
}

.af-progress-segment {
  height: 5px;
  border-radius: 999px;
  background: #e5eaf2;
  transition: background .2s;
}

.af-progress-segment.is-active,
.af-progress-segment.is-complete {
  background: #08244a;
}

/* Body scroll area */
.af-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  outline: none;
  display: flex;
  flex-direction: column;
}

/* Step heading */
.af-step-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--navy-2);
  letter-spacing: -.02em;
}

.af-job-label {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
}

/* Step wrapper — fills .af-body; footer pushed to bottom via margin-top: auto */
.af-step-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Form */
.af-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

/* Footer sticks to the bottom when step content is short */
.af-step-wrap > .af-footer,
.af-form > .af-footer {
  margin-top: auto;
}

/* City + State side-by-side */
.af-form-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 10px;
}


.af-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-2);
}

.af-form input,
.af-form select {
  height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

.af-form select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23536070' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
  font-family: inherit;
}

.af-form input:focus,
.af-form select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, .12);
}

.af-form input[aria-invalid="true"],
.af-form select[aria-invalid="true"] {
  border-color: #b42318;
}

.af-required {
  color: #d71920;
  font-weight: 700;
}

.af-field-optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

/* Radio group (work auth) */
.af-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.af-fieldset-legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-2);
  margin-bottom: 8px;
  display: block;
}

.af-radio-group {
  display: flex;
  gap: 10px;
}

.af-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  padding: 10px 18px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, background .15s;
  flex: 1;
  justify-content: center;
}

.af-radio-label:has(input:checked) {
  border-color: #08244a;
  background: rgba(8, 36, 74, .05);
  color: #08244a;
  font-weight: 700;
}

.af-radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: #08244a;
  flex-shrink: 0;
}

.af-radio-label input[aria-invalid="true"] {
  outline: 2px solid #b42318;
  outline-offset: 1px;
}

/* Resume skip helper */
.af-resume-skip {
  margin: 18px 0 0;
  text-align: left;
}

.af-resume-skip-text {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.af-resume-skip-button {
  border: 0;
  background: transparent;
  color: #08244a;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.af-resume-skip-button:hover,
.af-resume-skip-button:focus-visible {
  color: #d71920;
}

/* Status message */
.af-status {
  font-size: 13px;
  color: #b42318;
  margin-top: 4px;
}

.af-status[hidden] {
  display: none;
}

/* Footer row */
.af-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* Buttons */
.af-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--navy-2);
  color: #fff;
  padding: 0 22px;
  height: 44px;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .15s;
  white-space: nowrap;
}

.af-btn-primary:hover {
  background: var(--navy);
  transform: translateY(-1px);
}

.af-btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.af-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--navy-2);
  border: 1.5px solid var(--line);
  padding: 0 18px;
  height: 44px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  white-space: nowrap;
}

.af-btn-ghost:hover {
  border-color: var(--navy-2);
  transform: translateY(-1px);
}

/* Dropzone */
.af-dropzone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}

.af-dropzone:hover,
.af-dropzone:focus-visible,
.af-dropzone.is-drag-over {
  border-color: var(--blue);
  background: rgba(47, 128, 237, .04);
  outline: none;
}

.af-dropzone svg {
  display: block;
  margin: 0 auto 10px;
  color: var(--muted);
}

.af-dropzone p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--navy-2);
  font-weight: 600;
}

.af-dropzone-link {
  color: var(--blue);
  text-decoration: underline;
}

.af-dropzone-hint {
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--muted) !important;
}

.af-file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid #9bdc28;
  border-radius: 10px;
  background: rgba(155, 220, 40, .06);
  margin-top: 12px;
}

.af-file-preview[hidden] {
  display: none;
}

.af-file-name {
  font-size: 13px;
  color: var(--navy-2);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.af-file-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .08);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.af-file-remove:hover {
  background: rgba(0, 0, 0, .15);
}

/* Review step */
.af-review-subtitle {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

/* Position header (review step) */
.af-position-head {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.af-position-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.af-position-title {
  margin: 5px 0 3px;
  font-size: 17px;
  font-weight: 800;
  color: var(--navy-2);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.af-position-location {
  font-size: 12px;
  color: var(--muted);
}

/* Review list */
.af-review-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 4px;
}

.af-review-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.af-review-icon {
  font-size: 16px;
  color: var(--navy-2);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  margin-top: 2px;
}

.af-review-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.af-review-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-2);
}

.af-review-value {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.af-review-file-size {
  font-weight: 400;
  color: var(--muted);
}

.af-review-value-muted {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.af-review-edit-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.af-review-edit-link:hover {
  color: #d71920;
}

/* Security badge */
.af-security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
}

.af-security-icon {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.af-security-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: center;
}

.af-security-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.af-security-sub {
  font-size: 11px;
  color: var(--muted);
  opacity: .75;
}

/* Full-width submit button */
.af-btn-full {
  width: 100%;
  justify-content: center;
}

/* Review step footer */
.af-footer--review {
  flex-direction: column;
  align-items: stretch;
}

/* Loading / submitting state */
.af-submitting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.af-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--navy-2);
  border-radius: 50%;
  animation: af-spin .7s linear infinite;
  margin: 0 auto 20px;
}

@keyframes af-spin {
  to { transform: rotate(360deg); }
}

/* Mobile overrides */
@media (max-width: 639px) {
  .af-modal {
    align-items: stretch;
    padding: 0;
  }

  .af-panel {
    position: fixed;
    inset: 10px 8px 8px;
    height: calc(100dvh - 18px);
    max-height: calc(100dvh - 18px);
    width: auto;
    max-width: none;
    border-radius: 20px;
    z-index: 1101;
  }

  .af-body {
    padding: 22px 24px 24px;
  }

  .af-footer {
    justify-content: space-between;
  }

  .af-btn-primary {
    flex: 1;
  }
}

/* Stack city/state on small screens */
@media (max-width: 480px) {
  .af-form-row {
    grid-template-columns: 1fr;
  }
}

/* Body scroll lock */
body.apply-modal-open {
  overflow: hidden;
}
