/* ELALAN profile form modals
   Mobile behaviour follows the MobileKit modalbox component; desktop uses a
   contained dialog while retaining the existing account form visual language. */
.elp-form-modal {
  z-index: 2200;
}

.elp-form-modal + .modal-backdrop,
.modal-backdrop.show {
  z-index: 2190;
}

.elp-form-modal .modal-header {
  gap: 16px;
}

.elp-form-modal .modal-title {
  font-weight: 700;
  letter-spacing: -.02em;
}

.elp-form-modal .elp-modal-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5d6258;
  background: #f3f6ec;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.elp-form-modal .elp-modal-close:hover,
.elp-form-modal .elp-modal-close:focus-visible {
  color: #58743f;
  background: #e8efdc;
}

.elp-form-modal .elp-modal-close:active {
  transform: scale(.96);
}

.elp-form-modal .elp-modal-intro {
  padding-bottom: 2px;
}

.elp-form-modal .elp-modal-intro h3 {
  margin: 5px 0 6px;
}

.elp-form-modal .elp-modal-actions {
  position: sticky;
  bottom: -20px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px -16px -20px;
  padding: 16px;
  border-top: 1px solid #e5e7e1;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.elp-form-modal .elp-modal-actions .elp-btn {
  min-width: 120px;
}

.elp-form-modal .elp-modal-form {
  min-width: 0;
}

.elp-form-modal .elp-modal-form > .elp-grid,
.elp-form-modal .elp-modal-form > .elp-stack {
  min-width: 0;
}

@media (max-width: 767.98px) {
  .elp-form-modal .modal-body {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .elp-form-modal .elp-modal-actions {
    bottom: calc(-20px - env(safe-area-inset-bottom));
    margin-bottom: calc(-20px - env(safe-area-inset-bottom));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .elp-form-modal .elp-modal-actions .elp-btn {
    min-width: 0;
    flex: 1 1 0;
  }
}

@media (min-width: 768px) {
  .elp-form-modal.modalbox {
    padding-top: 0;
    overflow: visible;
  }

  .elp-form-modal.modalbox .modal-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    width: calc(100% - 48px);
    min-width: 0;
    max-width: 620px;
    max-height: calc(100vh - 64px);
    margin: 0;
    margin-top: 0;
    opacity: 0;
    transform: translate(-50%, calc(-50% + 18px)) scale(.985) !important;
    transition: transform .22s ease, opacity .22s ease !important;
  }

  .elp-form-modal.modalbox.elp-form-modal-lg .modal-dialog {
    max-width: 820px;
  }

  .elp-form-modal.modalbox.show .modal-dialog {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) !important;
  }

  .elp-form-modal.modalbox .modal-dialog .modal-content {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 64px);
    padding-top: 0;
    border: 1px solid rgba(42, 49, 35, .1);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(28, 37, 19, .2);
  }

  .elp-form-modal.modalbox .modal-dialog .modal-content .modal-header {
    position: relative;
    inset: auto;
    width: auto;
    min-height: 64px;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7e1;
    border-radius: 14px 14px 0 0;
    background: #fff;
  }

  .elp-form-modal.modalbox .modal-dialog .modal-content .modal-body {
    min-height: 0;
    padding: 22px 20px 20px;
    overflow: auto;
  }

  .elp-form-modal .elp-modal-actions {
    bottom: -20px;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 0 0 14px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .elp-form-modal.modalbox .modal-dialog,
  .elp-form-modal .elp-modal-close {
    transition: none !important;
  }
}
