﻿/* Apply page — Apple-inspired form design */
.page-apply {
  padding: 48px 20px 96px;
  background: #f5f5f7;
  color: #1d1d1f;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page-apply .apply__hero {
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
}

.page-apply .apply__title,
.page-apply .title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.page-apply .apply__content,
.page-apply .content {
  max-width: 640px;
  margin: 16px auto 0;
  color: #6e6e73;
  font-size: 1.05rem;
  line-height: 1.65;
}

.apply__form-card {
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 28px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 24px 80px rgba(0, 0, 0, 0.06);
  padding: 40px 36px;
}

.apply__section {
  margin-bottom: 40px;
}

.apply__section:last-of-type {
  margin-bottom: 32px;
}

.apply__section--compact {
  margin-bottom: 28px;
}

.apply__section-title,
.apply__area-title,
.page-apply .title-2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1d1d1f;
}

.apply__subsection-title,
.page-apply .title-3 {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d1d1f;
}

.apply__section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #437b62;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.apply__area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) {
  .apply__area {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.apply__area--full {
  grid-template-columns: 1fr;
  align-items: flex-end;
}

@media (min-width: 720px) {
  .apply__area--full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-item--full {
  grid-column: 1 / -1;
}

.form-item__label,
.form-item label {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1d1d1f;
  line-height: 1.4;
}

.form-item label .required,
.apply__form-note .required,
.form-item__label .required {
  color: #ff3b30;
  margin-left: 2px;
}

.form-item input[type="date"] {
  cursor: pointer;
}

.form-item input,
.form-item select,
.form-item textarea,
.page-apply .form-group input,
.page-apply .form-group textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1.5px solid #d2d2d7;
  border-radius: 12px;
  background: #fbfbfd;
  color: #1d1d1f;
  font-size: 1.3rem;
  font-family: inherit;
  line-height: 1.4;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  box-sizing: border-box;
}

.form-item select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'%3E%3Cpath fill='none' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 11px 7px;
  padding-right: 40px;
  cursor: pointer;
}

.form-item textarea,
.page-apply .form-group textarea {
  min-height: 120px;
  resize: vertical;
  padding-top: 14px;
}

.form-item input::placeholder,
.form-item textarea::placeholder {
  color: #aeaeb2;
}

.form-item input:hover,
.form-item select:hover,
.form-item textarea:hover {
  border-color: #aeaeb2;
}

.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus,
.page-apply .form-group input:focus,
.page-apply .form-group textarea:focus {
  outline: none;
  border-color: #437b62;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(67, 123, 98, 0.15);
}

.form-item.is-error input,
.form-item.is-error select,
.form-item.is-error textarea {
  border-color: #ff3b30;
  background: #fff8f7;
}

.form-item.is-error input:focus,
.form-item.is-error select:focus,
.form-item.is-error textarea:focus {
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.12);
}

.form-item.is-valid input,
.form-item.is-valid select,
.form-item.is-valid textarea {
  border-color: #34c759;
}

.f-note {
  margin: 4px 0 0;
  font-size: 1.3rem;
  color: #86868b;
  line-height: 1.5;
}

.f-note strong {
  color: #1d1d1f;
  font-weight: 600;
}

/* Radio & checkbox — modern pill/card style */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-group--stack {
  flex-direction: column;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 1.5px solid #d2d2d7;
  border-radius: 980px;
  background: #fbfbfd;
  cursor: pointer;
  user-select: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.radio-option--card {
  border-radius: 14px;
  width: 100%;
  padding: 16px 18px;
}

.radio-option:hover {
  border-color: #aeaeb2;
  background: #f5f5f7;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.radio-option__control {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid #d2d2d7;
  border-radius: 50%;
  background: #fff;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease;
}

.radio-option__control::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease;
}

.radio-option input:checked + .radio-option__control {
  border-color: #437b62;
  background: #437b62;
}

.radio-option input:checked + .radio-option__control::after {
  transform: translate(-50%, -50%) scale(1);
}

.radio-option input:focus-visible + .radio-option__control {
  box-shadow: 0 0 0 4px rgba(67, 123, 98, 0.2);
}

.radio-option:has(input:checked) {
  border-color: #437b62;
  background: rgba(67, 123, 98, 0.06);
}

.radio-option__text {
  font-size: 1.3rem;
  color: #1d1d1f;
  line-height: 1.4;
}

/* Validation messages */
.f-message,
.form-group-error {
  display: block;
  font-size: 1.2rem;
  color: #ff3b30;
  line-height: 1.4;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.25s ease,
    opacity 0.2s ease,
    margin 0.2s ease;
  margin: 0;
}

.f-message.show,
.form-group-error.show {
  max-height: 60px;
  opacity: 1;
  margin-top: 2px;
}

.f-message.error,
.form-group-error.error {
  color: #ff3b30;
}

.f-message.success,
.form-group-error.success {
  color: #34c759;
}

/* Submit area */
.apply__submit {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

@media (min-width: 600px) {
  .apply__submit {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.apply__form-note {
  margin: 0;
  font-size: 1.4rem;
  color: #86868b;
  line-height: 1.5;
}

.apply__submit-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

@media (min-width: 600px) {
  .apply__submit-actions {
    width: auto;
    min-width: 280px;
  }
}

.form-group-error.message-responsive {
  width: 100%;
  text-align: right;
  max-height: none;
  opacity: 1;
  margin: 0;
  font-size: 0.875rem;
}

.form-group-error.message-responsive:empty {
  display: none;
}

.form-group-error.message-responsive.success {
  color: #248a3d;
  background: rgba(52, 199, 89, 0.1);
  padding: 10px 14px;
  border-radius: 10px;
}

.form-group-error.message-responsive.error {
  color: #d70015;
  background: rgba(255, 59, 48, 0.08);
  padding: 10px 14px;
  border-radius: 10px;
}

/* Submit button */
.apply__btn-submit,
button[name="funcApplyV2"],
button#func-submit-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 200px;
  padding: 0 28px;
  border: none;
  border-radius: 980px;
  background: #437b62;
  color: #fff;
  font-size: 1.7rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.apply__btn-submit:hover:not(:disabled),
button[name="funcApplyV2"]:hover:not(:disabled),
button#func-submit-apply:hover:not(:disabled) {
  background: #35624e;
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(67, 123, 98, 0.28);
}

.apply__btn-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.apply__btn-submit:disabled,
button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.apply__btn-submit .isloading,
button .isloading {
  display: none;
  align-items: center;
  gap: 5px;
}

.apply__btn-submit .isloading.icon-loading,
button .isloading.icon-loading {
  display: inline-flex;
}

.apply__btn-submit .isloading span,
button .isloading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.4;
  animation: apply-loading-dot 0.9s infinite ease-in-out;
}

.apply__btn-submit .isloading span:nth-child(2),
button .isloading span:nth-child(2) {
  animation-delay: 0.1s;
}

.apply__btn-submit .isloading span:nth-child(3),
button .isloading span:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes apply-loading-dot {
  0%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* Success overlay */
.apply-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.apply-success-overlay.is-visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.apply-success-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.apply-success-overlay__card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 40px 32px 32px;
  background: #fff;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.apply-success-overlay.is-visible .apply-success-overlay__card {
  transform: scale(1) translateY(0);
}

.apply-success-overlay__icon {
  margin: 0 auto 20px;
  width: 52px;
  height: 52px;
}

.apply-success-overlay__circle {
  stroke: #34c759;
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: apply-stroke 0.5s cubic-bezier(0.65, 0, 0.45, 1) 0.2s forwards;
}

.apply-success-overlay__check {
  stroke: #34c759;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: apply-stroke 0.35s cubic-bezier(0.65, 0, 0.45, 1) 0.55s forwards;
}

@keyframes apply-stroke {
  to {
    stroke-dashoffset: 0;
  }
}

.apply-success-overlay__title {
  margin: 0 0 8px;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.apply-success-overlay__text {
  margin: 0 0 24px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #6e6e73;
}

.apply-success-overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 120px;
  padding: 0 24px;
  border: none;
  border-radius: 980px;
  background: #437b62;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

.apply-success-overlay__close:hover {
  background: #0077ed;
  transform: scale(1.02);
}

/* Legacy form (BAOTN) overrides */
.page-apply .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 720px) {
  .page-apply .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.page-apply .col-lg-6,
.page-apply .col-sm-6,
.page-apply .col-xs-12 {
  width: 100%;
}

.page-apply .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-apply .form-group.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.page-apply .text-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}

.page-apply .content img,
.page-apply .content table {
  max-width: 100%;
}

/* Override legacy common.css green styles inside apply card */
.page-apply .apply__form-card .form-group input[type="text"],
.page-apply .apply__form-card .form-group input[type="date"],
.page-apply .apply__form-card .form-group input[type="email"],
.page-apply .apply__form-card .form-group input[type="tel"],
.page-apply .apply__form-card .form-group textarea {
  border: 1.5px solid #d2d2d7 !important;
  border-radius: 12px !important;
  background: #fbfbfd !important;
  height: auto !important;
  line-height: 1.4 !important;
  padding: 12px 16px !important;
}

.page-apply .apply__form-card button {
  border-radius: 980px !important;
  background: #437b62 !important;
  height: auto !important;
  text-transform: none !important;
  box-shadow: none !important;
}

@media (max-width: 640px) {
  .page-apply {
    padding: 32px 16px 72px;
  }

  .apply__form-card {
    padding: 28px 20px;
    border-radius: 22px;
  }

  .apply__btn-submit,
  button[name="funcApplyV2"],
  button#func-submit-apply {
    width: 100%;
    min-width: 0;
  }

  .apply__submit-actions {
    align-items: stretch;
  }
}
