/* ==========================================================================
   Customer auth UI: Login, Registration, Forgot Password (+ its dialogs)
   One shared stylesheet. Uses the customer design tokens (customer-ui.css):
   primary #ebadb8, ink #29252a, muted #625e65, border #e5e1e2, deep #82505d.
   Everything is scoped to #uni_modal .tm-auth so no other page is affected.
   ========================================================================== */
#uni_modal .tm-auth,
.tm-auth {
  --tm-primary: #ebadb8;
  --tm-ink: #29252a;
  --tm-muted: #625e65;
  --tm-border: #e5e1e2;
  --tm-soft: #faf8f7;
  --tm-deep: #82505d;
  --tm-danger: #c0392b;
  --tm-ok: #2f7d4f;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--tm-ink);
  line-height: 1.5;
}
#uni_modal .tm-auth *,
#uni_modal .tm-auth *::before,
#uni_modal .tm-auth *::after {
  box-sizing: border-box;
}

/* ---- Modal shell: the card is the visible surface ---- */
/* custom.css forces .mid-large to 50% width with !important, so the width is set here the same way */
#uni_modal .modal-dialog:has(.tm-auth) {
  width: 100% !important;
  max-width: 440px !important;
  margin: 1rem auto !important;
  padding: 0 12px;
}
#uni_modal .modal-dialog:has(#registration.tm-auth) {
  max-width: 600px !important;
}
#uni_modal .modal-content:has(.tm-auth) {
  background: #fff;
}

/* ---- Card ---- */
#uni_modal .tm-auth.tm-auth-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 32px 32px 28px;
  background: #fff;
  border: 0;
  border-radius: var(--tm-auth-radius, 20px) !important;
}
#uni_modal .tm-auth-head {
  margin: 0 0 24px;
  padding-right: 32px;
}
#uni_modal .tm-auth-title {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--tm-ink);
  text-align: left;
}
#uni_modal .tm-auth-sub {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--tm-muted);
  text-align: left;
}
#uni_modal .tm-auth .tm-auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tm-muted);
  font-size: 22px;
  line-height: 1;
  opacity: 1;
  float: none;
  text-shadow: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
#uni_modal .tm-auth .tm-auth-close:hover {
  background: var(--tm-soft);
  color: var(--tm-deep);
}

/* ---- Fields ---- */
#uni_modal .tm-auth .tm-field {
  margin: 0 0 16px;
  min-width: 0;
}
#uni_modal .tm-auth .tm-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tm-ink);
}
#uni_modal .tm-auth .tm-label .tm-opt {
  font-weight: 400;
  color: var(--tm-muted);
}
#uni_modal .tm-auth .tm-input {
  display: block;
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  line-height: 1.4;
  color: var(--tm-ink);
  background: #fff;
  border: 1px solid #d9d4d6;
  border-radius: var(--tm-auth-control-radius, 12px) !important;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
#uni_modal .tm-auth textarea.tm-input {
  height: auto;
  min-height: 84px;
  padding: 11px 14px;
  resize: vertical;
}
#uni_modal .tm-auth select.tm-input {
  padding-right: 38px;
  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 d='M1 1.5l5 5 5-5' fill='none' stroke='%23625e65' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
#uni_modal .tm-auth .tm-input::placeholder {
  color: #9b969a;
}
#uni_modal .tm-auth .tm-input:hover {
  border-color: #c9c3c6;
}
#uni_modal .tm-auth .tm-input:focus {
  outline: none;
  border-color: var(--tm-primary);
  box-shadow: 0 0 0 3px rgba(235, 173, 184, 0.35);
}
#uni_modal .tm-auth .tm-input.is-invalid,
#uni_modal .tm-auth .tm-input.input-error {
  border-color: var(--tm-danger) !important;
  background-image: none;
  box-shadow: none;
}
#uni_modal .tm-auth select.tm-input.is-invalid {
  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 d='M1 1.5l5 5 5-5' fill='none' stroke='%23625e65' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
#uni_modal .tm-auth .tm-input.is-invalid:focus,
#uni_modal .tm-auth .tm-input.input-error:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}
#uni_modal .tm-auth .tm-input.input-success {
  border-color: var(--tm-ok) !important;
}

/* ---- Password field with show/hide toggle ---- */
#uni_modal .tm-auth .tm-pw {
  position: relative;
}
#uni_modal .tm-auth .tm-pw .tm-input {
  padding-right: 48px;
}
#uni_modal .tm-auth .tm-pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tm-muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
#uni_modal .tm-auth .tm-pw-toggle:hover {
  color: var(--tm-deep);
  background: var(--tm-soft);
}
#uni_modal .tm-auth .tm-pw-toggle svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}
#uni_modal .tm-auth .tm-pw-toggle .tm-eye-off {
  display: none;
}
#uni_modal .tm-auth .tm-pw-toggle[aria-pressed="true"] .tm-eye {
  display: none;
}
#uni_modal .tm-auth .tm-pw-toggle[aria-pressed="true"] .tm-eye-off {
  display: block;
}

/* ---- Messages ---- */
#uni_modal .tm-auth .tm-msg {
  display: none;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--tm-danger);
}
#uni_modal .tm-auth .tm-msg.show,
#uni_modal .tm-auth .tm-msg.is-visible {
  display: block;
}
#uni_modal .tm-auth .tm-msg.tm-msg-ok {
  color: var(--tm-ok);
}
#uni_modal .tm-auth .password-match,
#uni_modal .tm-auth .password-mismatch {
  margin: 6px 0 0;
  font-size: 12.5px;
}
#uni_modal .tm-auth .err-msg,
#uni_modal .tm-auth .alert.err-msg {
  margin: 0 0 16px;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #8f2a1f;
  background: #fdf1ef;
  border: 1px solid #f3cdc8;
  border-radius: var(--tm-auth-control-radius, 12px);
}

/* ---- Layout helpers ---- */
#uni_modal .tm-auth .tm-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
}
#uni_modal .tm-auth .tm-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 20px;
}

/* ---- Links & buttons ---- */
#uni_modal .tm-auth .tm-link {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tm-deep);
  text-decoration: none;
  cursor: pointer;
}
#uni_modal .tm-auth .tm-link:hover {
  text-decoration: underline;
}
#uni_modal .tm-auth .tm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 0 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--tm-ink);
  background: var(--tm-primary);
  border: 1px solid var(--tm-primary);
  border-radius: var(--tm-auth-control-radius, 12px) !important;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
#uni_modal .tm-auth .tm-btn:hover {
  background: #e49caa;
  border-color: #e49caa;
}
#uni_modal .tm-auth .tm-btn:active {
  transform: translateY(1px);
}
#uni_modal .tm-auth .tm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
#uni_modal .tm-auth .tm-btn-ghost {
  color: var(--tm-deep);
  background: #fff;
  border-color: var(--tm-border);
}
#uni_modal .tm-auth .tm-btn-ghost:hover {
  background: var(--tm-soft);
  border-color: #d9d4d6;
}
#uni_modal .tm-auth :is(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--tm-deep);
  outline-offset: 2px;
}
#uni_modal .tm-auth .tm-input:focus-visible {
  outline: none;
}
#uni_modal .tm-auth .tm-foot {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--tm-border);
  font-size: 13.5px;
  color: var(--tm-muted);
  text-align: center;
}
#uni_modal .tm-auth .tm-foot .tm-link {
  margin-left: 4px;
}

/* ---- Forgot-password flow: recovery card + follow-up dialogs ---- */
#uni_modal .account-recovery-container.tm-auth {
  display: none;
}
#uni_modal .tm-auth-overlay.modal {
  /* these are in-page overlays (not Bootstrap modals); keep them above the shell */
  background: rgba(41, 37, 42, 0.45);
  z-index: 1070;
}
#uni_modal .tm-auth-overlay .login-ui-overlay-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 16px;
}
#uni_modal .tm-auth-overlay .tm-auth-card {
  max-width: 400px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  animation: tmAuthIn 0.2s ease;
}
@keyframes tmAuthIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Registration: terms + verification dialogs ---- */
#uni_modal .tm-auth .tm-terms {
  max-height: 240px;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--tm-ink);
  background: var(--tm-soft);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-auth-control-radius, 12px);
}
#uni_modal .tm-auth .tm-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}
#uni_modal .tm-auth .tm-radio input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #82505d;
}
#uni_modal .tm-auth .tm-actions {
  margin-top: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 575.98px) {
  #uni_modal .modal-dialog:has(.tm-auth) {
    max-width: 100% !important;
    margin: 0.5rem auto !important;
    padding: 0 8px;
  }
  #uni_modal .tm-auth.tm-auth-card {
    padding: 24px 20px 22px;
  }
  #uni_modal .tm-auth-title {
    font-size: 20px;
  }
  #uni_modal .tm-auth .tm-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  #uni_modal .tm-auth-overlay .login-ui-overlay-inner {
    padding: 10px;
  }
}
@media (max-height: 520px) {
  #uni_modal .tm-auth-overlay .login-ui-overlay-inner {
    align-items: flex-start;
  }
}
@media (prefers-reduced-motion: reduce) {
  #uni_modal .tm-auth *,
  #uni_modal .tm-auth-overlay .tm-auth-card {
    animation: none !important;
    transition: none !important;
  }
}
