/*
 * Insurensa authentication layout.
 *
 * Shared by the admin console and the partner portal: sign-in, registration,
 * the password flows and the portal access code.
 *
 * These deliberately avoid Bootstrap's `.modal-dialog`, which the theme caps at
 * `max-width: 500px` above 576px — a hard clamp no column class can override.
 * A modal is the wrong primitive for a full page anyway: it also sets
 * `pointer-events: none` and a translate transform.
 */


.auth-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh; /* accounts for mobile browser chrome */
  background: linear-gradient(365deg, #ebebeb, #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 16px 48px;
}

/* Short forms still look better optically centred. */
.auth-page--center {
  justify-content: center;
  padding-top: 24px;
}

.auth-container {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  /* Flex and grid items default to `min-width: auto`, which refuses to shrink
     below the content's intrinsic minimum — that is what pushed the card past
     the right edge on narrow phones. */
  min-width: 0;
}

/* Registration carries twelve fields; it needs room to pair them up. */
.auth-container--wide {
  max-width: 880px;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-brand img {
  height: clamp(68px, 14vw, 104px);
  width: auto;
  max-width: 100%;
}

.auth-card {
  max-width: 100%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow:
    0 2px 4px rgba(52, 58, 64, 0.06),
    0 8px 24px rgba(52, 58, 64, 0.10);
  overflow: hidden;
}

.auth-card__header {
  padding: 28px 28px 4px;
  text-align: center;
}

.auth-card__title {
  font-size: clamp(19px, 2.4vw, 23px);
  font-weight: 600;
  margin: 0 0 6px;
  color: #212529;
}

.auth-card__subtitle {
  color: #6c757d;
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

.auth-card__body {
  padding: 20px 28px 24px;
}

.auth-card__footer {
  padding: 18px 28px 24px;
  border-top: 1px solid #f0f1f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-legal {
  text-align: center;
  color: #6c757d;
  font-size: 12.5px;
  margin-top: 20px;
}

/* Field grid. One column by default; pairs up once there is room, which is a
   more predictable basis than Bootstrap's .form-row at these widths. */
.auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 18px;
}

@media (min-width: 640px) {
  .auth-grid {
    grid-template-columns: 1fr 1fr;
  }
  /* Street + postal code read better weighted rather than even. */
  .auth-grid--address {
    grid-template-columns: 2fr 1fr;
  }
}

.auth-grid__full {
  grid-column: 1 / -1;
}

/* Same reason as .auth-container: let the tracks shrink. Without this an input's
   default intrinsic width holds the column open and the row overflows. */
.auth-grid > * {
  min-width: 0;
}

/* Section headings inside the registration form. */
.auth-section {
  grid-column: 1 / -1;
  margin: 6px 0 10px;
  padding-top: 14px;
  border-top: 1px solid #f0f1f3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6c757d;
}

.auth-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

/* Inputs: 16px keeps iOS from zooming the viewport on focus, and 44px is the
   minimum comfortable touch target. */
.auth-card .form-control,
.auth-card .custom-select {
  font-size: 16px;
  min-height: 44px;
  max-width: 100%;
}

/* Long unbroken strings — a pasted address or registration number — wrap rather
   than widening the card. */
.auth-card,
.auth-card p,
.auth-card label,
.auth-card .form-text {
  overflow-wrap: break-word;
}

.auth-card .form-group {
  margin-bottom: 16px;
}

.auth-card label {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #495057;
}

.auth-card .form-control-file {
  font-size: 14px;
  width: 100%;
  padding: 10px 0;
}

.auth-card .btn-lg {
  min-height: 46px;
  font-size: 15px;
}

/* Phones: reclaim horizontal space and stack the footer actions. */
@media (max-width: 575.98px) {
  .auth-page {
    padding: 20px 12px 32px;
  }

  .auth-card {
    border-radius: 8px;
  }

  .auth-card__header {
    padding: 22px 18px 4px;
  }

  .auth-card__body {
    padding: 16px 18px 20px;
  }

  .auth-card__footer {
    padding: 16px 18px 20px;
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .auth-card__footer .btn {
    width: 100%;
    justify-content: center;
  }

  .auth-card__footer > div {
    width: 100%;
  }

  .auth-card__footer .btn-link {
    text-align: center;
  }
}

/* Landscape phones and small tablets in the middle band. */
@media (min-width: 576px) and (max-width: 767.98px) {
  .auth-container--wide {
    max-width: 560px;
  }
}

/* --- Access code entry ----------------------------------------------------
 * The four-box code screen in front of the portal. The legacy version sized
 * these at a fixed 50px with 10px margins, which overflowed narrow phones; they
 * now flex down to fit.
 */

.otp-inputs {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 16px);
}

.otp-input {
  width: clamp(48px, 18vw, 62px);
  height: clamp(52px, 18vw, 62px);
  padding: 0;
  text-align: center;
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 600;
  letter-spacing: 0;
}

/* Hide the number spinners some browsers add. */
.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

/* --- Language toggle -------------------------------------------------------
 *
 * On the sign-in and registration screens the toggle sits between the wordmark
 * and the card: a visitor who cannot read German needs it before they read
 * anything else, and it must not be buried in a menu.
 */
.auth-language {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.language-switcher .btn {
  min-width: 44px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* In the app header the toggle competes with the account block, so keep it
   visually quiet until it is hovered or carries the current language. */
.app-header .language-switcher .btn-outline-secondary {
  border-color: rgba(0, 0, 0, 0.12);
  color: #6c757d;
}

/* On a phone the header keeps the toggle: the rating widget and the account
 * name are already hidden at this width, so there is room, and a signed-in
 * partner on a phone would otherwise have no way to change language at all. */
@media (max-width: 575.98px) {
  .app-header .language-switcher {
    margin-right: 6px !important;
  }
  .app-header .language-switcher .btn {
    min-width: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }
}
