/*
 * Triplan Website / Containers / Site Auth Popup
 * Shared sign-in and registration experience for public website pages.
 */

.tp-auth-popup {
  --tp-auth-text: var(--tp-900, #1a2b49);
  --tp-auth-muted: var(--tp-muted);
  --tp-auth-primary: var(--tp-primary, #40a1b7);
  --tp-auth-primary-dark: var(--tp-primary-dark, #29525d);
  --tp-auth-orange: var(--tp-accent, #1BBACA);
  --tp-auth-surface: #f4f7f8;
  --tp-auth-line: var(--tp-line);
  --tp-auth-danger: #c63838;
  --tp-auth-success: #14805e;
  --tp-auth-shadow: 0 28px 80px rgba(12, 31, 40, 0.22), 0 8px 24px rgba(12, 31, 40, 0.08);

  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--tp-auth-text);
  font-family: var(--tp-body-font, "Poppins", sans-serif);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.tp-auth-popup[hidden],
.tp-auth-popup [hidden] {
  display: none !important;
}

.tp-auth-popup.is-open {
  opacity: 1;
  visibility: visible;
}

.tp-auth-popup *,
.tp-auth-popup *::before,
.tp-auth-popup *::after {
  box-sizing: border-box;
}

.tp-auth-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 31, 41, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tp-auth-popup__dialog {
  position: relative;
  width: min(100%, 510px);
  max-height: min(840px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--tp-auth-shadow);
  transform: translateY(14px) scale(0.985);
  transition: transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.tp-auth-popup.is-open .tp-auth-popup__dialog {
  transform: translateY(0) scale(1);
}

.tp-auth-popup__header {
  position: relative !important;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 24px 68px 19px 26px;
  border-bottom: 1px solid rgba(219, 228, 232, 0.84);
  background: #fff;
}

.tp-auth-popup__brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(27, 186, 202, 0.12);
  color: var(--tp-auth-primary);
  font-size: 1.15rem;
}

.tp-auth-popup__heading {
  min-width: 0;
}

.tp-auth-popup__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--tp-auth-primary);
  font-size: 0.68rem;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tp-auth-popup__title {
  margin: 0;
  color: var(--tp-auth-text);
  font-family: var(--tp-heading-font, "Poppins", sans-serif);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.tp-auth-popup__subtitle {
  margin: 5px 0 0;
  color: var(--tp-auth-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.tp-auth-popup__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--tp-auth-line) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 5px 14px rgba(15, 32, 39, 0.06) !important;
  color: var(--tp-auth-text) !important;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.tp-auth-popup__close:hover,
.tp-auth-popup__close:focus-visible {
  border-color: rgba(27, 186, 202, 0.56) !important;
  background: rgba(27, 186, 202, 0.08) !important;
  color: var(--tp-auth-primary-dark) !important;
}

.tp-auth-popup__body {
  min-height: 0;
  padding: 20px 26px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 186, 202, 0.45) transparent;
}

.tp-auth-popup__tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid #e2eaed;
  border-radius: 13px;
  background: var(--tp-auth-surface);
}

.tp-auth-popup__tab {
  min-height: 42px;
  padding: 8px 12px;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--tp-auth-muted) !important;
  font-family: var(--tp-heading-font, "Poppins", sans-serif);
  font-size: 0.75rem;
  line-height: 1.25;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.tp-auth-popup__tab.is-active {
  background: #fff !important;
  box-shadow: 0 3px 10px rgba(21, 44, 55, 0.08) !important;
  color: var(--tp-auth-text) !important;
}

.tp-auth-popup__provider {
  min-width: 0;
}

.tp-auth-popup__google-shell {
  position: relative;
  width: min(100%, 400px);
  min-height: 44px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
  transition: opacity 160ms ease;
}

.tp-auth-popup__google-shell.is-loading {
  opacity: 0.64;
  pointer-events: none;
}

.tp-auth-popup__google-placeholder {
  position: absolute;
  inset: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  background: #fff;
  color: #3c4043;
  font-family: Arial, sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
}

.tp-auth-popup__google-placeholder i {
  color: #4285f4;
  font-size: 1rem;
}

.tp-auth-popup__google-button,
.tp-auth-popup__google-button > div {
  position: relative;
  width: 100% !important;
  min-height: 44px;
}

.tp-auth-popup__google-button iframe {
  margin: 0 auto !important;
}

.tp-auth-popup__provider-message,
.tp-auth-popup__message {
  margin: 0;
  color: var(--tp-auth-muted);
  font-size: 0.7rem;
  line-height: 1.45;
  font-weight: 600;
}

.tp-auth-popup__provider-message {
  margin-top: 7px;
  text-align: center;
}

.tp-auth-popup__provider-message:empty {
  display: none;
}

.tp-auth-popup__provider-message.is-error,
.tp-auth-popup__message.is-error {
  color: var(--tp-auth-danger);
}

.tp-auth-popup__provider-message.is-success,
.tp-auth-popup__message.is-success {
  color: var(--tp-auth-success);
}

.tp-auth-popup__divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  margin: 17px 0;
  color: #7b8797;
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 600;
}

.tp-auth-popup__divider::before,
.tp-auth-popup__divider::after {
  content: "";
  height: 1px;
  background: var(--tp-auth-line);
}

.tp-auth-popup__panel {
  display: none;
}

.tp-auth-popup__panel.is-active {
  display: block;
}

.tp-auth-popup__field {
  display: grid;
  gap: 7px;
  margin: 0 0 13px;
}

.tp-auth-popup__field-label {
  color: var(--tp-auth-text);
  font-size: 0.71rem;
  line-height: 1.25;
  font-weight: 650;
}

.tp-auth-popup__input-shell {
  min-width: 0;
  min-height: 49px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--tp-line);
  border-radius: 11px;
  background: #fff;
  color: #778495;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.tp-auth-popup__input-shell:focus-within {
  border-color: var(--tp-auth-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(27, 186, 202, 0.12);
  color: var(--tp-auth-primary);
}

.tp-auth-popup__input-shell > i {
  width: 18px;
  text-align: center;
  font-size: 0.78rem;
}

.tp-auth-popup__input-shell:has(.tp-auth-popup__password-toggle) {
  grid-template-columns: 18px minmax(0, 1fr) 36px;
  padding-right: 5px;
}

.tp-auth-popup__input-shell input {
  width: 100%;
  min-width: 0;
  min-height: 47px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--tp-auth-text) !important;
  font-family: var(--tp-body-font, "Poppins", sans-serif);
  font-size: 0.78rem;
  line-height: 1.3;
  font-weight: 500;
  outline: 0;
}

/* Composite fields own the focus ring; inner controls must not draw a second outline. */
.tp-auth-popup__input-shell input:focus,
.tp-auth-popup__input-shell input:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

.tp-auth-popup__input-shell input::placeholder {
  color: #9aa4b1;
  opacity: 1;
}

.tp-auth-popup__password-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #778495 !important;
  cursor: pointer;
}

.tp-auth-popup__password-toggle:hover,
.tp-auth-popup__password-toggle:focus-visible {
  outline: 0 !important;
  outline-offset: 0 !important;
  background: rgba(27, 186, 202, 0.1) !important;
  color: var(--tp-auth-primary-dark) !important;
}

.tp-auth-popup__field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tp-auth-popup__phone-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
}

.tp-auth-popup__phone-shell {
  grid-template-columns: minmax(104px, 0.3fr) minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: visible;
}

.tp-auth-popup__phone-shell > input[type="tel"] {
  min-width: 0;
  padding: 0 13px;
  border-radius: 0 10px 10px 0 !important;
}

.tp-auth-popup .tp-shared-phone__country {
  position: relative;
  align-self: stretch;
  display: block;
  border-right: 1px solid var(--tp-auth-line);
}

.tp-auth-popup .tp-shared-phone__toggle {
  width: 100%;
  min-height: 47px;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px;
  place-items: center;
  gap: 6px;
  padding: 0 11px !important;
  border: 0 !important;
  border-radius: 10px 0 0 10px !important;
  outline: 0 !important;
  background: var(--tp-auth-surface) !important;
  box-shadow: none !important;
  color: var(--tp-auth-text) !important;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.tp-auth-popup .tp-shared-phone__toggle:hover,
.tp-auth-popup .tp-shared-phone__toggle:focus-visible,
.tp-auth-popup__phone-shell.is-open .tp-shared-phone__toggle {
  background: rgba(27, 186, 202, 0.1) !important;
  color: var(--tp-auth-primary-dark) !important;
}

.tp-auth-popup .tp-shared-phone__toggle i {
  color: var(--tp-auth-primary-dark);
  font-size: 0.62rem;
  transition: transform 180ms ease;
}

.tp-auth-popup .tp-shared-phone__value {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tp-auth-popup .tp-shared-phone__flag {
  width: 22px;
  height: 16px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 27, 45, 0.12);
}

.tp-auth-popup__phone-shell.is-open .tp-shared-phone__toggle i {
  transform: rotate(180deg);
}

.tp-auth-popup .tp-shared-phone__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 12;
  width: min(310px, calc(100vw - 40px));
  padding: 13px;
  border: 1px solid var(--tp-auth-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 27, 45, 0.16);
}

.tp-auth-popup__phone-shell.is-above .tp-shared-phone__menu {
  top: auto;
  bottom: calc(100% + 8px);
}

.tp-auth-popup .tp-shared-phone__menu > strong {
  display: block;
  margin: 0 2px 10px;
  color: var(--tp-auth-text);
  font-size: 0.76rem;
  line-height: 1.25;
}

.tp-auth-popup .tp-shared-phone__menu > input[type="search"] {
  width: 100%;
  min-height: 42px;
  margin: 0 0 9px;
  padding: 0 11px;
  border: 1px solid var(--tp-auth-line) !important;
  border-radius: 9px !important;
  outline: 0 !important;
  background: var(--tp-auth-surface) !important;
  box-shadow: none !important;
  color: var(--tp-auth-text) !important;
}

.tp-auth-popup .tp-shared-phone__menu > input[type="search"]:focus {
  border-color: var(--tp-auth-primary) !important;
  box-shadow: 0 0 0 3px rgba(27, 186, 202, 0.12) !important;
}

.tp-auth-popup .tp-shared-phone__options {
  max-height: 218px;
  display: grid;
  gap: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tp-auth-popup .tp-shared-phone__options > button {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 32px 0 10px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--tp-auth-text) !important;
  font: inherit;
  font-size: 0.74rem;
  text-align: left;
  cursor: pointer;
}

.tp-auth-popup .tp-shared-phone__options > button:hover,
.tp-auth-popup .tp-shared-phone__options > button:focus-visible,
.tp-auth-popup .tp-shared-phone__options > button.is-selected {
  outline: 0 !important;
  background: rgba(27, 186, 202, 0.1) !important;
}

.tp-auth-popup .tp-shared-phone__options > button.is-selected::after {
  content: "\f00c";
  position: absolute;
  right: 11px;
  color: var(--tp-auth-primary-dark);
  font-family: "Font Awesome 7 Free", "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
}

.tp-auth-popup .tp-shared-phone__options b {
  min-width: 42px;
  color: var(--tp-auth-primary-dark);
}

.tp-auth-popup__forgot {
  display: block;
  width: fit-content;
  margin: -2px 0 14px auto;
  color: var(--tp-auth-primary-dark) !important;
  font-size: 0.7rem;
  line-height: 1.3;
  font-weight: 700;
  text-decoration: none !important;
  text-underline-offset: 3px;
}

.tp-auth-popup__forgot:hover,
.tp-auth-popup__forgot:focus-visible {
  color: var(--tp-auth-primary) !important;
  text-decoration: underline !important;
}

.tp-auth-popup__message {
  min-height: 0;
  margin: 0 0 9px;
  text-align: left;
}

.tp-auth-popup__message:not(:empty) {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--tp-auth-surface);
}

.tp-auth-popup__message.is-error:not(:empty) {
  background: #fff2f2;
}

.tp-auth-popup__message.is-success:not(:empty) {
  background: #edf9f5;
}

.tp-auth-popup__submit {
  width: 100%;
  min-height: 49px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1px solid var(--tp-auth-primary) !important;
  border-radius: 11px !important;
  background: var(--tp-auth-primary) !important;
  box-shadow: 0 8px 20px rgba(27, 186, 202, 0.22) !important;
  color: #fff !important;
  font-family: var(--tp-heading-font, "Poppins", sans-serif);
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tp-auth-popup__submit:hover,
.tp-auth-popup__submit:focus-visible {
  border-color: var(--tp-auth-primary-dark) !important;
  background: var(--tp-auth-primary-dark) !important;
  box-shadow: 0 8px 18px rgba(8, 124, 137, 0.2) !important;
  color: #fff !important;
}

.tp-auth-popup__submit[disabled] {
  opacity: 0.66;
  cursor: wait;
}

.tp-auth-popup__privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid #e8edef;
  color: var(--tp-auth-muted);
  font-size: 0.64rem;
  line-height: 1.5;
}

.tp-auth-popup__privacy i {
  margin-top: 2px;
  color: var(--tp-auth-success);
}

.tp-auth-popup button:focus-visible,
.tp-auth-popup a:focus-visible {
  outline: 3px solid rgba(27, 186, 202, 0.3);
  outline-offset: 2px;
}

.tp-auth-popup-lock,
.tp-auth-popup-lock body {
  overflow: hidden;
}

@media (max-width: 560px) {
  .tp-auth-popup {
    align-items: end;
    padding: 10px;
  }

  .tp-auth-popup__backdrop {
    background: rgba(13, 31, 41, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .tp-auth-popup__dialog {
    width: 100%;
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
    transform: translateY(24px);
  }

  .tp-auth-popup.is-open .tp-auth-popup__dialog {
    transform: translateY(0);
  }

  .tp-auth-popup__header {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 11px;
    padding: 18px 58px 15px 17px;
  }

  .tp-auth-popup__brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 0.96rem;
  }

  .tp-auth-popup__eyebrow {
    font-size: 0.6rem;
  }

  .tp-auth-popup__title {
    font-size: 1.14rem;
  }

  .tp-auth-popup__subtitle {
    margin-top: 3px;
    font-size: 0.67rem;
  }

  .tp-auth-popup__close {
    top: 15px;
    right: 14px;
    width: 40px;
    height: 40px;
  }

  .tp-auth-popup__body {
    padding: 16px 17px calc(17px + env(safe-area-inset-bottom));
  }

  .tp-auth-popup__tabs {
    margin-bottom: 14px;
  }

  .tp-auth-popup__tab {
    min-height: 40px;
    padding-inline: 7px;
    font-size: 0.69rem;
  }

  .tp-auth-popup__divider {
    margin: 14px 0;
  }

  .tp-auth-popup__field {
    margin-bottom: 11px;
  }

  .tp-auth-popup__input-shell,
  .tp-auth-popup__submit {
    min-height: 48px;
  }

  .tp-auth-popup__input-shell input {
    min-height: 46px;
    font-size: 0.76rem;
  }
}

@media (max-width: 430px) {
  .tp-auth-popup__field-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .tp-auth-popup__phone-row {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tp-auth-popup,
  .tp-auth-popup__dialog,
  .tp-auth-popup__tab,
  .tp-auth-popup__close,
  .tp-auth-popup__input-shell,
  .tp-auth-popup__submit {
    scroll-behavior: auto;
    transition: none !important;
  }
}
