/*
 * Sign in / sign up pages (_login.php, _register.php, _start.php).
 * Loaded after tabbed_login.css. Restyles the existing form markup (the JS
 * switches views by id, so structure is untouched) and lays it out beside a
 * brand panel. Several rules need !important to beat !important in
 * tabbed_login.css.
 */

:root {
  --auth-ink: #1d2530;
  --auth-muted: #56636f;
  --auth-navy: #03446A;
  --auth-line: #d6dee6;
  --auth-bg: #f3f6f9;
  --auth-ring: rgba(0, 145, 255, 0.18);
}

body {
  background: var(--auth-bg);
}

/* Empty legacy spacer (100vh tall on large screens); nothing uses it. */
.main-nav {
  display: none;
}

/* ---------- Page layout: brand panel left, form right ---------- */
.user-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  max-width: none;
  height: auto;
  min-height: calc(100vh - 64px);
  margin: 0;
  padding: 0; /* the header include already reserves its 64px in the flow */
  overflow: visible;
  backdrop-filter: none;
}

/* ---------- Brand panel: full-height left half, pattern only ---------- */
/* Photo of rental gear (no people) with a navy fade so the text stays readable. */
.auth-brand {
  position: sticky;
  top: 64px;
  display: flex;
  align-items: center;       /* text centred on the photo, both ways */
  justify-content: center;
  height: calc(100vh - 64px);
  min-height: 520px;
  overflow: hidden;
  background-color: var(--auth-navy);
  background-image:
    linear-gradient(180deg, rgba(3, 40, 64, 0.55) 0%, rgba(3, 40, 64, 0.72) 100%),
    url("../images/auth_rentals.webp");
  background-size: cover;
  background-position: center;
  color: #fff;
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  padding: 48px 40px;
  text-align: center;
}

/* Benefits stay left-aligned as a block centred under the heading. */
.auth-brand-copy ul {
  width: fit-content;
  margin-inline: auto;
  text-align: left;
}

.auth-eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9fd4ff;
}

.auth-brand h1 {
  margin: 0 0 24px;
  font-size: clamp(1.8rem, 1.2rem + 1.8vw, 2.6rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: #fff;
  text-wrap: balance;
}

.auth-brand ul {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-brand li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
}

.auth-brand li i {
  display: inline-grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #9fd4ff;
}

/* ---------- Form side ---------- */
/* Centre the form card vertically and horizontally in the right half. */
.user-modal > .user-modal-container {
  align-self: center;
  justify-self: center;
}

/* ---------- Form card ---------- */
.user-modal-container,
.user-modal.is-visible .user-modal-container {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  justify-self: center;
  width: calc(100% - 48px);
  max-width: 460px;
  margin: 40px auto !important;
  border: 1px solid #e1e7ee;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(3, 68, 106, 0.12);
}

/* Tabs become a segmented control. */
.user-modal-container .switcher {
  display: flex;
  gap: 4px;
  margin: 20px 20px 4px;
  padding: 5px;
  border-radius: 12px;
  background: #eef2f6;
  list-style: none;
}

.user-modal-container .switcher li,
.switcher .switcher_item {
  flex: 1 1 0;
  float: none;
  width: auto !important;
}

.user-modal-container .switcher li:hover,
.user-modal-container .switcher li a:hover {
  background: transparent;
}

.user-modal-container .switcher li a,
.user-modal-container .switcher li:first-child a,
.user-modal-container .switcher li:last-child a {
  height: 42px;
  line-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--auth-muted);
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.user-modal-container .switcher li a:hover {
  color: var(--auth-navy);
}

.user-modal-container .switcher a.selected,
.user-modal-container .switcher li a.selected {
  background: #fff;
  color: var(--auth-navy);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14);
}

.user-modal .form-message {
  margin: 0;
  padding: 16px 24px 0;
  font-size: 0.95rem;
  color: var(--auth-muted);
  text-align: center;
}

.user-modal .form {
  padding: 16px 24px 24px;
}

.user-modal .form .fieldset {
  margin: 12px 0;
  text-align: left;
}

/* Inputs */
.user-modal .form input.has-border,
.user-modal .form select.has-border {
  height: 50px;
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  background: #fff;
  color: var(--auth-ink);
  font-size: 16px; /* no iOS zoom on focus */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-modal .form input.has-padding {
  padding: 0 16px 0 48px;
}

.user-modal .form input[type=password].has-padding {
  padding-right: 56px;
}

.user-modal .form select.has-padding {
  padding: 0 16px 0 48px;
}

.user-modal .form input.has-border::placeholder {
  color: #8a96a3;
}

.user-modal .form input.has-border:focus,
.user-modal .form select.has-border:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--auth-ring);
  outline: none;
}

.user-modal .form input.has-error {
  border-color: #d64545;
}

/* Field icons (background-image SVGs on the labels) */
.user-modal .form label.image-replace {
  left: 16px;
  width: 20px;
  height: 20px;
  background-position: center;
  background-size: 18px 18px;
  opacity: 0.45;
}

.user-modal .form label.image-replace::after {
  display: none;
}

/* Show/hide password toggles */
.user-modal .form .hide-password,
.user-modal .form .hide-login-password,
.user-modal .form .hide-confirm-password {
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-left: 0;
  transform: none; /* legacy rule lifts it by translateY(-50%) */
  color: #6b7785;
  cursor: pointer;
}

/* Google Places address widget: force its light theme and match the inputs.
   No overflow clipping: the suggestion list is drawn inside the widget, below
   its 42px box, and would be cut off. */
.user-modal gmp-place-autocomplete {
  position: relative;
  z-index: 5;
  display: block;
  width: 100%;
  color-scheme: light;
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  background: #fff;
  overflow: visible;
}

.user-modal .fieldset:has(gmp-place-autocomplete) label.image-replace {
  display: none;
}

/* Buttons */
.user-modal .form button.full-width {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 145, 255, 0.25);
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.user-modal .form button.full-width:hover,
.user-modal .form button.full-width:focus-visible {
  filter: brightness(0.95);
  box-shadow: 0 10px 24px rgba(0, 145, 255, 0.32);
  outline: none;
}

.user-modal .form button.full-width.google {
  border: 1px solid var(--auth-line);
  background: #fff;
  color: var(--auth-ink);
  box-shadow: none;
}

.user-modal .form button.full-width.google:hover,
.user-modal .form button.full-width.google:focus-visible {
  border-color: #b8c4cf;
  background: #f8fafc;
  filter: none;
}

/* "OR" divider */
.user-modal .textWithLineContainer .textWithLine {
  font-size: 0.8rem !important;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #8a96a3;
}

.user-modal .form-bottom-message {
  text-align: center;
}

.user-modal .form-bottom-message a,
.user-modal .form a.accept-terms {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.user-modal .form-bottom-message a:hover,
.user-modal .form a.accept-terms:hover {
  text-decoration: underline;
}

.user-modal .form p[style*="font-size: 12px"] {
  color: var(--auth-muted);
  line-height: 1.5;
}

.user-modal .g-recaptcha {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

/* Password strength bars */
.user-modal .strength-lines {
  margin: -4px 4px 4px;
}

/* Hover tooltips can't be triggered by touch and push the page wider. */
@media (hover: none) {
  .user-modal [data-tooltip]::before,
  .user-modal [data-tooltip]::after {
    display: none !important;
  }
}

/* ---------- Sign-up steps (built by js/signup_steps.js) ---------- */
.signup-progress {
  margin: 4px 0 8px;
}

.signup-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

.signup-progress-label {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--auth-muted);
}

.user-modal .signup-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}

.user-modal .signup-back[hidden] {
  display: none;
}

.signup-progress-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.signup-progress-bar span {
  height: 4px;
  border-radius: 999px;
  background: #e3e9ef;
  transition: background-color 0.3s ease;
}

.signup-progress-bar span.is-done {
  background: var(--primary);
}

.signup-step[hidden] {
  display: none !important;
}

.signup-nav {
  margin-top: 20px !important;
}

/* ---------- Tablet: narrower brand panel ---------- */
@media screen and (max-width: 991.98px) {
  .user-modal {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  }

  .user-modal [data-tooltip]::before,
  .user-modal [data-tooltip]::after {
    display: none !important;
  }

  .auth-brand-copy {
    padding: 32px 28px;
  }

  .auth-brand h1 {
    font-size: 1.6rem;
  }

  .user-modal-container,
  .user-modal.is-visible .user-modal-container {
    width: calc(100% - 32px);
    margin: 32px 0 !important;
  }
}

/* ---------- Phone: brand band on top, form below ---------- */
@media screen and (max-width: 767.98px) {
  .user-modal {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-brand {
    position: relative;
    top: auto;
    height: auto;
    min-height: 180px;
    background-image:
      linear-gradient(180deg, rgba(3, 40, 64, 0.1) 20%, rgba(3, 40, 64, 0.85) 85%),
      url("../images/auth_rentals_wide.webp");
  }

  .auth-brand-copy {
    padding: 28px 20px 24px;
    text-align: center;
  }

  .auth-brand h1 {
    margin: 0;
    font-size: 1.35rem;
  }

  .auth-brand ul {
    display: none;
  }

  .user-modal-container,
  .user-modal.is-visible .user-modal-container {
    width: calc(100% - 32px);
    margin: 20px 0 32px !important;
  }
}

@media screen and (max-width: 480px) {
  .user-modal .form {
    padding: 12px 18px 20px;
  }

  .user-modal .form-message {
    padding: 14px 18px 0;
  }

  .user-modal-container .switcher {
    margin: 16px 16px 4px;
  }

  /* reCAPTCHA's widget is a fixed 304px; shrink it on very narrow screens. */
  .user-modal .g-recaptcha {
    transform: scale(0.92);
    transform-origin: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .user-modal *,
  .auth-brand {
    transition: none !important;
  }
}

/* ---------- Inline alerts inside the form panel (js/auth_alerts.js) ---------- */
.auth-alert {
  --alert-ink: #9b1c1c;
  --alert-bg: #fef2f2;
  --alert-line: #fbd5d5;
  --alert-accent: #e02424;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 4px 0 18px;
  padding: 14px 44px 14px 14px;
  overflow: hidden;
  border: 1px solid var(--alert-line);
  border-radius: 12px;
  background: var(--alert-bg);
  color: var(--alert-ink);
  text-align: left;
  box-shadow: 0 8px 20px -12px rgba(155, 28, 28, 0.35);
  animation: auth-alert-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.auth-alert-warning {
  --alert-ink: #8a4b08;
  --alert-bg: #fffbeb;
  --alert-line: #fde68a;
  --alert-accent: #d97706;
  box-shadow: 0 8px 20px -12px rgba(138, 75, 8, 0.35);
}

.auth-alert-success {
  --alert-ink: #046c4e;
  --alert-bg: #f0fdf4;
  --alert-line: #bbf7d0;
  --alert-accent: #0e9f6e;
  box-shadow: 0 8px 20px -12px rgba(4, 108, 78, 0.35);
}

.auth-alert-info,
.auth-alert-question {
  --alert-ink: #03446a;
  --alert-bg: #eff8ff;
  --alert-line: #c3e3ff;
  --alert-accent: #0091ff;
  box-shadow: 0 8px 20px -12px rgba(3, 68, 106, 0.35);
}

.auth-alert.is-leaving {
  animation: auth-alert-out 0.2s ease forwards;
}

/* error: a small shake once it has landed */
.auth-alert-error {
  animation:
    auth-alert-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2) both,
    auth-alert-shake 0.36s ease 0.42s;
}

.auth-alert-icon {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 20px;
  color: var(--alert-accent);
}

.auth-alert-body {
  flex: 1 1 auto;
  min-width: 0;
}

.auth-alert .auth-alert-title,
.auth-alert .auth-alert-text {
  margin: 0;
  padding: 0;
  font-size: 0.93rem;
  line-height: 1.45;
  text-align: left;
  color: inherit;
  overflow-wrap: anywhere;
}

.auth-alert .auth-alert-title {
  margin-bottom: 2px;
  font-weight: 700;
}

.auth-alert .auth-alert-text {
  font-weight: 500;
}

.auth-alert .auth-alert-title + .auth-alert-text {
  font-weight: 400;
}

.auth-alert .auth-alert-action {
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 10px 0 0;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--alert-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
}

.auth-alert .auth-alert-action:hover {
  filter: brightness(0.92);
}

.auth-alert .auth-alert-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--alert-ink);
  font-size: 15px;
  opacity: 0.6;
  cursor: pointer;
  box-shadow: none;
}

.auth-alert .auth-alert-close:hover,
.auth-alert .auth-alert-close:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  opacity: 1;
  outline: none;
}

.auth-alert-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--alert-accent);
  opacity: 0.5;
  transform-origin: left;
  animation: auth-alert-timer linear forwards;
}

@keyframes auth-alert-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes auth-alert-out {
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes auth-alert-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

@keyframes auth-alert-timer {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-alert,
  .auth-alert-error,
  .auth-alert.is-leaving {
    animation: none;
  }
}

/* ---------- Sign-up: user type radio cards + required markers ---------- */
.user-modal-container .req {
  color: #e02424;
  font-weight: 700;
}

.user-modal-container .signup-required-note {
  margin: 0 0 10px;
  padding: 0;
  font-size: 0.8rem;
  color: #6b7785;
  text-align: right;
}

.user-type-field {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.user-modal-container .user-type-legend {
  margin: 0 0 8px;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1d2530;
  text-align: left;
}

.user-type-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.user-type-option {
  position: relative;
  display: block;
  margin: 0;
  padding: 0 !important;
  cursor: pointer;
}

/* The native radio stays in the tab order and in forms; the card is its face. */
.user-type-option input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.user-type-option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 10px 6px;
  border: 1.5px solid #d9e1ea;
  border-radius: 12px;
  background: #fff;
  color: #34414f;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.user-type-option span i {
  font-size: 18px;
  color: #7a8898;
  transition: color 0.15s ease, transform 0.2s ease;
}

.user-type-option:hover span {
  border-color: #9ccfff;
}

.user-type-option input:checked + span {
  border-color: var(--primary, #0091ff);
  background: #eef7ff;
  color: #03446a;
  box-shadow: 0 0 0 3px rgba(0, 145, 255, 0.15);
}

.user-type-option input:checked + span i {
  color: var(--primary, #0091ff);
  transform: scale(1.1);
}

.user-type-option input:focus-visible + span {
  outline: 2px solid var(--primary, #0091ff);
  outline-offset: 2px;
}

.user-type-field.has-error .user-type-option span {
  border-color: #f5a3a3;
}

@media (max-width: 420px) {
  .user-type-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-type-option span {
    flex-direction: row;
    min-height: 48px;
  }
}

/* Red asterisk inside the right edge of every required text field (left of
   the show-password eye on the password fields). */
#RegistrationForm .fieldset:has(> input[required]:not([type="radio"]):not([type="checkbox"])) {
  position: relative;
}

#RegistrationForm .fieldset:has(> input[required]:not([type="radio"]):not([type="checkbox"]))::after {
  content: "*";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-40%);
  z-index: 2;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: #e02424;
  pointer-events: none;
}

#RegistrationForm .fieldset:has(> .hide-password, > .hide-confirm-password)::after {
  right: 46px;
}

/* Business / organization / school name shown for those user types */
.user-modal-container .rz-type-extra[hidden] { display: none !important; }
.user-modal-container .rz-type-extra { margin: 0 0 14px; animation: rz-type-extra-in 0.25s ease both; }
.user-modal-container .rz-type-extra-label {
  display: block;
  margin: 0 0 6px;
  padding: 0 !important;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  color: #1d2530;
}
@keyframes rz-type-extra-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.user-modal-container .rz-type-extra input.full-width {
  padding-left: 16px !important;   /* these have a visible label, no icon */
}
