/* Mobile layout for the public apply flow and the logged-in application wizard.
   Loaded only on those pages. Does not change form fields or behavior. */

.apply-page .container,
.apply-page .container-fluid,
.apply-page .registerbox:not(.apply-start-box) {
  max-width: 100%;
  box-sizing: border-box;
}

/* Keep the start card 350px and centered on desktop */
@media (min-width: 768px) {
  .register-container {
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
  }

  .register-container .registerbox.apply-start-box {
    margin-left: auto;
    margin-right: auto;
  }
}

.apply-page,
.apply-page p,
.apply-page span,
.apply-page label,
.apply-page li {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.apply-page .date-picker {
  max-width: 100%;
}

/* Logged-in application wizard: readable type and section rhythm */
#this_page {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

#this_page .id-upload-fields,
#this_page .id-upload-identity,
#this_page .step_5_names {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#this_page h1 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  color: #333;
}

#this_page h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: #333;
  margin-top: 1.4em;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

#this_page h3 {
  font-size: 16px;
  font-weight: 600;
  color: #444;
}

#this_page p,
#this_page li {
  line-height: 1.55;
}

#this_page .step {
  max-width: 100%;
}

#this_page .application-nav {
  gap: 12px;
}

#this_page #back_button,
#this_page #next_button {
  border-radius: 5px;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select > select {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

.custom-select-trigger {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 26px 8px 10px;
  font-size: 16px;
  line-height: 1.3;
  text-align: left;
  color: #555;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select.is-open .custom-select-trigger {
  position: relative;
  z-index: 21;
  border-color: #8bb4e0;
  border-bottom-color: #fff;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  outline: none;
}

.custom-select.open-up.is-open .custom-select-trigger {
  border-radius: 0 0 4px 4px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-color: #8bb4e0;
  border-top-color: #fff;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #8bb4e0;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.custom-select.open-up .custom-select-menu {
  top: auto;
  bottom: calc(100% - 1px);
  border-top: 1px solid #8bb4e0;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.12);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-menu li {
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.3;
  color: #333;
  cursor: pointer;
}

.custom-select-menu li.is-selected {
  background: #eef5fc;
  font-weight: 600;
}

.custom-select-menu li:hover,
.custom-select-menu li:focus {
  background: #f4f7fa;
}

.custom-select.is-disabled .custom-select-trigger {
  background-color: #eee;
  color: #888;
  cursor: not-allowed;
}

@media (min-width: 768px) {
  .custom-select-trigger {
    min-height: 34px;
    font-size: 14px;
    padding: 4px 22px 4px 8px;
  }

  .custom-select-menu li {
    padding: 6px 10px;
    font-size: 14px;
  }
}

/* Start-apply card: keep the desktop 400px height without an inline !important */
.register-container .registerbox.apply-start-box {
  height: 400px !important;
}

@media (max-width: 991px) {
  .apply-page .radio_holder {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .apply-page .radio_holder > span {
    flex: 1 1 100%;
  }

  .apply-page .radio_holder > div {
    margin-left: 0 !important;
    margin-top: 8px;
  }
}

@media (max-width: 767px) {
  .page-body {
    padding: 10px 8px 20px;
    overflow-x: hidden;
  }

  .page-body > .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .apply-page h1 {
    font-size: 22px;
    line-height: 1.3;
    text-align: center;
    margin: 0 0 8px;
  }

  .apply-page h2 {
    font-size: 18px;
    line-height: 1.3;
    margin-top: 22px;
    margin-bottom: 10px;
  }

  .apply-page h3 {
    font-size: 16px;
    margin-top: 16px;
  }

  .apply-page .registerbox {
    padding: 16px 12px !important;
  }

  .apply-page .container,
  .apply-page .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .apply-page .row,
  .apply-page .application-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    flex-wrap: wrap !important;
  }

  .apply-page .row > [class*="col-"],
  .apply-page .application-row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    float: none;
    margin-bottom: 10px;
  }

  /* Payment-method / residency radios: keep the control beside wrapping label text */
  .apply-page #payment_method_holder .row,
  .apply-page .residency_options_section .row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .apply-page #payment_method_holder .row > div:first-child,
  .apply-page .residency_options_section .row > div:first-child {
    flex: 0 0 28px;
    width: auto;
    max-width: 28px;
    padding-top: 3px;
    margin-bottom: 0;
  }

  .apply-page #payment_method_holder .row > [class*="col-"],
  .apply-page .residency_options_section .row > [class*="col-"] {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 100%;
    padding-left: 8px;
    margin-bottom: 0;
  }

  .apply-page .form-control:not(.date-picker),
  .apply-page textarea,
  .apply-page input[type="text"],
  .apply-page input[type="email"],
  .apply-page input[type="password"],
  .apply-page input[type="number"],
  .apply-page input[type="date"] {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
    height: auto;
    padding: 10px 12px;
  }

  .apply-page .date-picker,
  .apply-page .date-picker.form-control {
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .apply-page .date-picker-trigger {
    min-height: 48px;
    font-size: 16px;
  }

  .apply-page input[type="radio"],
  .apply-page input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
  }

  .apply-page .checkbox label {
    white-space: normal;
    display: block;
  }

  .apply-page #final_apply,
  .apply-page #applyButton,
  .apply-page .registerbox-submit,
  .apply-page .registerbox-submit .btn {
    width: 100%;
    max-width: 100%;
    float: none !important;
    display: block;
  }

  .apply-page #applyButton {
    padding: 12px 16px;
    font-size: 16px;
  }

  .apply-page textarea {
    width: 100% !important;
    max-width: 100%;
  }

  /* Start-apply / access-denied cards */
  .register-container {
    margin: 12px auto !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .register-container .registerbox,
  .register-container .registerbox.apply-start-box {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: 20px;
  }

  .register-container .registerbox-caption {
    overflow-wrap: anywhere;
  }

  .apply-notice {
    margin: 8px !important;
    padding: 16px !important;
  }

  /* Logged-in wizard previous / next */
  #this_page .application-nav,
  #this_page > div:first-child {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    margin: -8px -12px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #e6e6e6;
  }

  #this_page #back_button,
  #this_page #next_button {
    font-size: 14px;
    padding: 10px 12px;
    flex: 1 1 auto;
    min-height: 44px;
  }

  #this_page {
    padding: 12px !important;
    overflow-x: hidden;
    max-width: 100%;
  }

  #this_page .id-upload-fields,
  #this_page .id-upload-identity,
  #this_page .step_5_names,
  #this_page .id-upload-identity > [class*="col-"] {
    display: block;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
  }

  #this_page .id-upload-identity {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  #this_page span,
  #this_page p,
  #this_page li,
  #this_page label {
    font-size: 16px !important;
    line-height: 1.45;
  }

  #this_page h1 {
    font-size: 22px !important;
    line-height: 1.3;
    margin: 0 0 8px;
  }

  #this_page h2 {
    font-size: 18px !important;
    margin-top: 24px;
    margin-bottom: 10px;
  }

  #this_page h3 {
    font-size: 16px !important;
    margin-top: 18px;
  }

  #this_page [style*="scale(1.4)"] {
    transform: none !important;
    font-size: 14px !important;
    color: #666;
  }

  #this_page .radio_holder {
    flex-direction: column;
    align-items: flex-start;
  }

  #this_page .radio_holder > span {
    width: 100%;
  }

  #this_page .radio_holder > div {
    margin-left: 0 !important;
    margin-top: 8px;
  }

  #this_page input[type="radio"],
  #this_page input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    opacity: 1 !important;
  }

  #this_page .no-wrap {
    white-space: normal;
  }

  #this_page textarea {
    width: 100% !important;
    max-width: 100%;
  }

  #this_page p {
    text-indent: 0 !important;
  }

  #this_page .add_additional_resident,
  #this_page .add_pet,
  #this_page #applyButton {
    width: 100%;
    max-width: 100%;
  }

  #this_page input[type="file"] {
    max-width: 100%;
  }

  #this_page .file_1_holder,
  #this_page .upload_holder > div {
    flex-wrap: wrap;
    gap: 8px;
  }

  dialog.dialog-modal {
    padding: 8px !important;
  }

  .dialog-modal > div {
    width: 100%;
    max-height: 90vh;
  }

  .dialog-modal header,
  .dialog-modal main,
  .dialog-modal footer {
    padding: 16px !important;
  }

  .navbar .login-area section h2,
  .navbar .login-area .profile {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  .privacy-modal-overlay.active {
    align-items: flex-start;
    padding: 12px 0;
    height: 100%;
    min-height: 100vh;
    overflow-y: auto;
  }

  .privacy-modal {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    margin: 12px auto;
    padding: 20px 16px;
  }
}
