/* ==========================================================================
   Log In modal — popup overlay (uses variables from styles.css, form
   classes from register.css)
   ========================================================================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: rgba(18, 51, 57, 0.55);
  backdrop-filter: blur(2px);
}

.modal-overlay.is-open {
  display: flex;
}

.modal-overlay .auth-card {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalPop 0.22s ease;
}

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

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: var(--color-text-light);
  background-color: var(--color-bg-soft);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  background-color: var(--color-border);
  color: var(--color-text);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 520px) {
  .modal-overlay .auth-card {
    padding: 30px 20px 26px;
  }
}



/* Responsive completion — authentication modal and Google sign-in */
@media (max-width: 600px) {
  .modal-overlay { align-items: center; padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .modal-overlay > div, .modal-overlay .auth-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px);
    overflow-x: hidden;
    overflow-y: auto;
  }
  .google-btn, .google-login-btn, .btn-google, [class*="google"] button,
  button[id*="google"], a[id*="google"] { max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .modal-overlay { padding-left: 6px; padding-right: 6px; }
  .modal-overlay > div, .modal-overlay .auth-card { padding-left: 14px; padding-right: 14px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .modal-overlay { align-items: flex-start; overflow-y: auto; }
  .modal-overlay > div, .modal-overlay .auth-card { max-height: 88dvh; }
}


/* Login modal compact layout — modal only */
.modal-overlay .auth-card-center {
  width: min(100%, 390px);
  max-width: 390px;
  padding: 30px 28px 24px;
  max-height: min(82vh, 560px);
  max-height: min(82dvh, 560px);
  overflow-y: auto;
  border-radius: 18px;
}
.modal-overlay .auth-card-center::before {
  top: 12px;
  left: -38px;
  width: 118px;
  height: 21px;
}
.modal-overlay .auth-card-center .auth-eyebrow {
  margin-bottom: 5px;
  font-size: 11px;
}
.modal-overlay .auth-card-center h1 {
  margin-bottom: 5px;
  font-size: 23px;
}
.modal-overlay .auth-card-center > p.auth-sub {
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.45;
}
.modal-overlay .auth-card-center .form-field {
  margin-bottom: 12px;
}
.modal-overlay .auth-card-center .form-field label {
  margin-bottom: 5px;
  font-size: 12px;
}
.modal-overlay .auth-card-center .form-field input {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 14px;
}
.modal-overlay .auth-card-center .auth-footnote {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
  font-size: 12px;
}
.modal-overlay .auth-card-center .btn-auth-primary {
  min-height: 42px;
  padding: 10px 16px;
  font-size: 14px;
}
.modal-overlay .auth-card-center > .auth-footnote:last-child {
  margin-top: 15px !important;
  margin-bottom: 0 !important;
}
.modal-overlay .auth-card-center .modal-close {
  top: 10px;
  right: 12px;
  width: 29px;
  height: 29px;
  font-size: 19px;
}
@media (max-width: 520px) {
  .modal-overlay {
    padding: 12px;
  }
  .modal-overlay .auth-card-center {
    width: 100%;
    max-width: 360px;
    max-height: min(82dvh, 520px);
    padding: 27px 20px 20px;
  }
}
@media (max-width: 360px) {
  .modal-overlay .auth-card-center {
    max-width: 340px;
    padding: 25px 16px 18px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .modal-overlay {
    align-items: flex-start;
    overflow-y: auto;
  }
  .modal-overlay .auth-card-center {
    max-height: 90dvh;
    margin: auto;
  }
}
