@import "./tokens.css";

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
}

.apply-shell {
  min-height: 100vh;
  padding: 12px 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Light index-style header for apply */
.apply-site-header {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 20;
}

.apply-site-header .site-header-rail {
  width: 100%;
  padding-top: 4px;
}

.apply-header-wrap {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.apply-site-header .site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 0 !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: none !important;
  outline: 0 !important;
}

.apply-site-header .header-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.apply-site-header .header-actions {
  display: flex;
  align-items: center;
}

.apply-site-header .brand-lockup {
  display: inline-flex;
  align-items: center;
}

.apply-brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.apply-site-header .header-cta.lang-toggle {
  min-width: 120px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 0 !important;
  background: rgba(15, 23, 42, 0.08);
  color: #3f4553;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: none !important;
  outline: 0 !important;
}

.apply-site-header .header-cta.lang-toggle:hover {
  background: rgba(15, 23, 42, 0.14);
}

.apply-site-header a:focus,
.apply-site-header a:focus-visible,
.apply-site-header button:focus,
.apply-site-header button:focus-visible {
  outline: 0 !important;
  box-shadow: none !important;
}

.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.lang-toggle {
  min-width: 140px;
}

.apply-card {
  width: 100%;
  max-width: 900px;
  background: var(--surface);
  padding: 24px 12px 24px;
  margin-top: 8px;
}

.apply-card.is-confirmed .card-intro,
.apply-card.is-confirmed .progressbar {
  display: none;
}

.apply-card.is-confirmed #applyForm {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-panel {
  max-width: 680px;
  width: 100%;
  text-align: center;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 28px 20px;
}

.success-panel h2 {
  margin: 0 0 10px;
  color: #1f2937;
}

.success-panel p {
  margin: 8px 0;
  color: #4b5563;
}

.success-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.success-download-link:hover {
  background: #0b5f58;
  color: #fff;
}

.success-close-note {
  margin-top: 14px;
  font-size: 13px;
  color: #6b7280;
}

.card-intro {
  text-align: center;
  margin-bottom: 20px;
}

.card-intro h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}

.card-intro p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.progressbar {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  counter-reset: step;
}

.progressbar li {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #99a2a8;
  position: relative;
  text-transform: capitalize;
}

.progressbar li::before {
  content: counter(step);
  counter-increment: step;
  width: 28px;
  height: 28px;
  line-height: 28px;
  display: block;
  background: #eaf0f4;
  border-radius: 50%;
  margin: 0 auto 8px;
  color: #333;
  font-size: 12px;
}

.progressbar li::after {
  content: "";
  width: 100%;
  height: 4px;
  background: #eaf0f4;
  position: absolute;
  left: -50%;
  top: 12px;
  z-index: -1;
}

.progressbar li:first-child::after {
  content: none;
}

.progressbar li.active {
  color: var(--accent);
}

.progressbar li.active::before {
  background: var(--accent);
  color: #fff;
}

.progressbar li.active + li::after {
  background: var(--accent);
}

.form-step {
  display: none;
  border: 0;
  padding: 0 8px;
  margin: 0;
}

.form-step.is-active {
  display: block;
  animation: fadeIn 180ms ease;
}

.form-step h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #3f4553;
}

.form-step h6 {
  font-size: 13px;
  font-weight: 400;
  color: #5f6771;
  margin: 0 0 18px;
}

.legal-note {
  font-size: 13px;
  color: #4b5563;
  margin: 0 0 14px;
}

.legal-note a,
.legal-panel a {
  color: #0f766e;
  font-weight: 600;
}

.legal-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.legal-panel h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #1f2937;
}

.legal-panel p {
  margin: 0 0 8px;
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

.legal-panel p:last-child {
  margin-bottom: 0;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.col-md-4 {
  flex: 1 1 100%;
}
.col-md-6 {
  flex: 1 1 100%;
}
.col-md-8 {
  flex: 1 1 100%;
}
.col-md-12 {
  flex: 1 1 100%;
}

@media (min-width: 768px) {
  .col-md-4 { flex: 0 0 calc(33.333% - 8px); }
  .col-md-6 { flex: 0 0 calc(50% - 6px); }
  .col-md-8 { flex: 0 0 calc(66.666% - 6px); }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  padding-bottom: 18px;
}

.field-label {
  font-size: 12px;
  color: #5f6771;
}

input,
select,
textarea {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-muted);
  height: 37px;
}

textarea {
  height: auto;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.2);
}

.form-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: 37px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  position: relative;
  margin-top: 18px;
}

.form-check.form-field {
  padding-bottom: 0;
}

.form-check-input {
  width: 16px;
  height: 16px;
  margin: 0 8px 0 0;
}

.form-check-label {
  font-size: 13px;
  color: var(--text-muted);
}

.form-check-label a {
  color: #0f766e;
  font-weight: 600;
  text-decoration: underline;
}

.collapsible {
  display: none;
}

.collapsible.show {
  display: flex;
}

.image-card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.doc-card {
  flex: 1 1 calc(50% - 8px);
  width: 100%;
  max-width: none;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.doc-card.ssn {
  max-width: none;
}

.doc-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #3f4553;
}

.image-upload-card {
  position: relative;
  border: 2px dashed #cfd7df;
  border-radius: var(--radius-lg);
  text-align: center;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--surface);
}

.image-upload-input {
  opacity: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
}

.image-upload-card img {
  max-width: 100%;
  max-height: 100%;
  position: relative;
  z-index: 1;
  object-fit: cover;
}

.overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: rgba(255, 255, 255, 1);
  font-weight: 700;
  font-size: 16px;
  z-index: 2;
  text-shadow: -1px -1px 0 #555, 1px -1px 0 #555, -1px 1px 0 #555, 1px 1px 0 #555;
}

.signature-block {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  display: grid;
  gap: 10px;
  border: none;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  position: relative;
  margin-top: 12px;
}

#signatureCanvas {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  display: block;
  touch-action: none;
}

.btn-primary,
.btn-secondary {
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  min-width: 130px;
  text-transform: uppercase;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fff;
}

.btn-primary.is-loading .btn-spinner {
  display: inline-block;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  display: none;
  animation: spin 0.8s linear infinite;
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.06);
  color: #5f6771;
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 0.12);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}


.muted {
  color: #5f6771;
  font-size: 12px;
}

.field-error {
  border-color: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 0 0.15rem rgba(220, 38, 38, 0.2);
}

.field-error-msg {
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: 12px;
  color: rgba(200, 38, 38, 0.9);
  pointer-events: none;
}

.form-check.has-error-msg {
  margin-bottom: 18px;
}

.form-check .field-error-msg {
  left: 12px;
  top: 100%;
  bottom: auto;
  margin-top: 4px;
}

.form-check .field-error-msg {
  left: 12px;
}

.hidden {
  display: none;
}

.signature-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  color: #3f4553;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 22px 24px;
  width: min(560px, 94vw);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
  overflow: visible;
}

#addressLookupModal.is-opening {
  animation: modalOverlayIn 180ms ease both;
}

#addressLookupModal.is-opening .modal-content {
  animation: modalContentIn 200ms ease both;
}

#addressLookupModal.is-closing {
  animation: modalOverlayOut 160ms ease both;
}

#addressLookupModal.is-closing .modal-content {
  animation: modalContentOut 160ms ease both;
}

.modal-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.modal-list button {
  text-align: left;
  background: rgba(15, 23, 42, 0.04);
  border: none;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 2px 0;
}

.modal-body {
  max-height: min(55vh, 520px);
  overflow-y: auto;
  overflow-x: visible;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  margin-top: 8px;
  padding: 0 2px;
}

.address-lookup-input-wrap {
  position: relative;
  margin-right: 4px;
}

.address-lookup-input-wrap input {
  padding-right: 34px;
}

.address-lookup-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #5f6771;
  font-size: 16px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
}

.address-lookup-clear.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.address-lookup-clear:hover {
  background: rgba(15, 23, 42, 0.08);
}

.modal-body p {
  margin: 0 0 10px;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.noscript {
  background: rgba(255, 178, 102, 0.12);
  color: #6b3f0e;
  padding: 12px 16px;
  margin: 20px;
  border-radius: 5px;
}

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalContentIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalContentOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}
.lang-toggle {
  min-width: 140px;
}
.form-check--aligned {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  background: transparent;
  align-self: flex-start;
  position: relative;
  padding-top: 0;
}

.form-check--aligned.has-error-msg {
  margin-bottom: 18px;
}


.form-check--aligned .field-label.spacer {
  height: 0;
  margin: 0;
  visibility: hidden;
}

@media (min-width: 768px) {
  .form-row > .form-check {
    margin-top: 18px;
  }
}

.form-check--aligned .form-check-label {
  background: transparent;
  padding: 0;
}

.form-check--aligned .form-check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  width: 100%;
  height: 37px;
  line-height: 37px;
  margin-top: 0;
}

@media (min-width: 768px) {
  .address-license-row {
    align-items: flex-start;
  }

  .license-field .form-check-inline {
    margin-top: 0;
  }

  .license-field.form-check {
    margin-top: 0;
  }

  .license-field .field-label.spacer {
    height: 18px;
  }
}

@media (max-width: 767px) {
  .address-license-row {
    flex-direction: column;
  }

  .license-field {
    width: 100%;
  }

  .license-field.form-check--aligned {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    height: 37px;
    padding: 0 12px;
    margin-top: 0;
    padding-bottom: 0;
  }

  .license-field.form-check--aligned.form-field {
    padding-bottom: 0;
  }

  .license-field .form-check-inline {
    display: contents;
  }

  .license-field .field-label.spacer {
    display: none;
  }
}


.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
}

.address-modal-item {
  text-align: left;
  background: rgba(15, 23, 42, 0.04);
  border: none;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.address-modal-item:hover,
.address-modal-item.is-active {
  background: rgba(0, 166, 81, 0.14);
}

.address-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  width: 100%;
}

@media (min-width: 768px) {
  .address-group {
    grid-template-columns: minmax(0, 1fr) 140px;
  }
}

.address-group .form-field {
  width: 100%;
}

@media (max-width: 767px) {
  .form-check,
  .form-check--aligned {
    margin-bottom: 12px;
  }

  .address-group {
    grid-template-columns: 1fr;
  }

  .image-card-container {
    flex-direction: column;
  }

  .doc-card {
    flex: 1 1 100%;
  }

  .doc-card.ssn {
    align-self: stretch;
    max-width: none;
    width: 100%;
  }

  .doc-card.ssn .image-upload-card {
    height: auto;
    min-height: 200px;
    aspect-ratio: 1 / 1;
  }
}

.hidden {
  display: none;
}

.signature-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  color: #3f4553;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
