/* Kaiay — Login, Signup, Forgot & Reset password "PWA look" (phones only, <= 600px).
   Scoped to body.auth-page.pwa-auth (added by layouts/auth-head.php). Desktop/tablet layouts are untouched.
   Loaded AFTER the inline auth styles in layouts/auth-head.php so these rules win. */

/* The app-bar only exists visually on phones. */
.pwa-appbar { display: none; }

@media screen and (max-width: 600px) {

  /* ---------- App canvas ---------- */
  html:has(body.auth-page.pwa-auth) { background: #eaf2fe; height: auto; overflow-x: hidden; overflow-y: auto; }

  body.auth-page.pwa-auth {
    background: #eaf2fe !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Only the page (viewport) scrolls. The base CSS puts overflow-x:hidden on <body> too, which on
       iOS/Android WebViews turns body into its own scroll box and can freeze long forms. */
    overflow: visible !important;
    height: auto !important;
    touch-action: manipulation;
  }

  body.auth-page.pwa-auth .shell {
    display: block !important;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr) !important;
    overflow-x: clip;
    background: linear-gradient(180deg, #e3eeff 0, #f1f7ff 280px, #f1f7ff 100%) !important;
  }

  /* Marketing panel is replaced by the app-bar on phones. */
  body.auth-page.pwa-auth .shell > .panel { display: none !important; }

  body.auth-page.pwa-auth .shell > .card-side {
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto !important;
    margin: 0 !important;
    padding: calc(64px + env(safe-area-inset-top, 0px)) 0 0 !important;
    box-sizing: border-box !important;
  }

  /* ---------- Top app bar (logo + language) ---------- */
  body.auth-page.pwa-auth .pwa-appbar {
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    left: max(18px, calc((100vw - 480px) / 2));
    height: 64px;
    display: flex;
    align-items: center;
    z-index: 11;
    text-decoration: none;
  }
  body.auth-page.pwa-auth .pwa-appbar img { height: 30px; width: auto; display: block; }

  body.auth-page.pwa-auth .card-side > .lang-switch {
    position: absolute !important;
    top: calc(env(safe-area-inset-top, 0px) + 15px) !important;
    right: max(16px, calc((100vw - 480px) / 2)) !important;
    left: auto !important;
    z-index: 12;
  }
  body.auth-page.pwa-auth .lang-dropdown {
    gap: 6px;
    padding: 7px 10px 7px 11px;
    border-radius: 999px;
    border: 1px solid #d3e0f2;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 8px rgba(24, 60, 110, .06);
  }
  body.auth-page.pwa-auth .lang-dropdown svg { width: 16px; height: 16px; }
  body.auth-page.pwa-auth .lang-dropdown select { font-size: 13px; min-height: 0; }

  /* ---------- Bottom sheet (the form) ---------- */
  body.auth-page.pwa-auth .card-side > .card {
    order: 2;
    display: block !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 26px max(20px, calc((100vw - 480px) / 2)) 6px !important;
    box-sizing: border-box !important;
    background: #fff;
    border: 0 !important;
    border-radius: 28px 28px 0 0 !important;
    box-shadow: 0 -10px 34px rgba(20, 60, 120, .09) !important;
    animation: kaiayPwaSheet .38s cubic-bezier(.2, .8, .2, 1) backwards;
  }

  /* Footer continues the white sheet to the bottom edge of the screen. */
  body.auth-page.pwa-auth .global-footer {
    position: static !important;
    inset: auto !important;
    order: 3;
    display: block !important;
    flex: 1 0 auto !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10px max(20px, calc((100vw - 480px) / 2)) calc(112px + env(safe-area-inset-bottom, 0px)) !important; /* clears the fixed bottom nav */
    box-sizing: border-box !important;
    background: #fff;
    color: #8190a8;
    font-size: 11px !important;
    line-height: 1.55 !important;
    text-align: center !important;
    white-space: normal !important;
  }

  /* ---------- Headings ---------- */
  body.auth-page.pwa-auth .card-head { text-align: left; }
  body.auth-page.pwa-auth .card h1 {
    font-size: 26px;
    line-height: 1.12;
    letter-spacing: -.8px;
    text-align: left;
  }
  body.auth-page.pwa-auth .card .lead {
    text-align: left;
    font-size: 14px;
    line-height: 1.55;
    margin: 7px 0 18px;
    max-width: none;
  }
  body.auth-page.pwa-auth .auth-icon {
    width: 48px; height: 48px; margin: 0 0 12px; border-radius: 15px;
  }
  body.auth-page.pwa-auth .auth-icon svg { width: 25px; height: 25px; }

  /* Signup progress: compact app-style stepper */
  body.auth-page.pwa-auth .steps { max-width: none; margin: 4px 0 10px; }
  body.auth-page.pwa-auth .step { font-size: 11px; }
  body.auth-page.pwa-auth .step-dot { width: 26px; height: 26px; font-size: 12px; margin-bottom: 5px; }
  body.auth-page.pwa-auth .step:not(:last-child):after { top: 13px; }

  /* ---------- Form controls: big, rounded, thumb friendly ---------- */
  body.auth-page.pwa-auth form,
body.auth-page.pwa-auth .input-wrap { width: 100%; max-width: 100%; min-width: 0; }

  body.auth-page.pwa-auth label { margin: 14px 0 6px; font-size: 13px; }
  body.auth-page.pwa-auth .checkbox-row { font-size: 13px; gap: 10px; align-items: flex-start; line-height: 1.45; }
  body.auth-page.pwa-auth .checkbox-row input { width: 20px; height: 20px; flex: none; margin: 0; }

  body.auth-page.pwa-auth .row-2,
body.auth-page.pwa-auth .compact-auth-row {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0;
  }

  body.auth-page.pwa-auth .input-wrap input,
body.auth-page.pwa-auth .select-wrap select {
    height: 52px !important;
    border-radius: 14px !important;
    border: 1.5px solid #dde6f2 !important;
    background-color: #f5f8fd !important;
    font-size: 16px !important;   /* stops iOS zoom-on-focus */
    padding-left: 46px !important;
    min-width: 0;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
  }
  body.auth-page.pwa-auth .input-wrap input:focus,
body.auth-page.pwa-auth .select-wrap select:focus {
    background-color: #fff !important;
    border-color: #1264d8 !important;
    box-shadow: 0 0 0 4px rgba(18, 100, 216, .12) !important;
  }
  body.auth-page.pwa-auth .input-wrap input.has-error,
body.auth-page.pwa-auth .select-wrap select.has-error {
    border-color: #d83a4a !important;
    box-shadow: 0 0 0 4px rgba(216, 58, 74, .09) !important;
  }
  body.auth-page.pwa-auth .input-wrap > svg { left: 16px; width: 20px; height: 20px; }
  body.auth-page.pwa-auth .select-wrap:after { right: 16px; }

  body.auth-page.pwa-auth .toggle-visibility {
    right: 6px; width: 40px; height: 40px; padding: 0;
    display: grid; place-items: center; border-radius: 12px;
  }
  body.auth-page.pwa-auth .toggle-visibility svg { width: 20px; height: 20px; }

  body.auth-page.pwa-auth .label-row {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  }
  body.auth-page.pwa-auth .inline-link,
body.auth-page.pwa-auth .label-row a { font-size: 13px; font-weight: 800; color: #1264d8; text-decoration: none; }

  body.auth-page.pwa-auth .field-error { font-size: 12px; margin-top: 6px; }
  body.auth-page.pwa-auth .error,
body.auth-page.pwa-auth .success-banner,
body.auth-page.pwa-auth .warning-banner { border-radius: 13px; font-size: 13px; padding: 12px 14px; }

  /* ---------- Buttons ---------- */
  body.auth-page.pwa-auth button[type=submit] {
    height: 54px;
    margin-top: 20px;
    border-radius: 16px;
    font-size: 16px;
    letter-spacing: .1px;
    box-shadow: 0 10px 22px rgba(24, 166, 83, .26);
    transition: transform .12s ease, filter .12s ease;
  }
  body.auth-page.pwa-auth button[type=submit]:active { transform: scale(.985); filter: brightness(.96); }

  body.auth-page.pwa-auth .oauth-divider { margin: 18px 0 16px; }
  body.auth-page.pwa-auth .oauth-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; }
  body.auth-page.pwa-auth .oauth-btn {
    width: 100%;
    min-width: 0 !important;
    height: 52px !important;
    padding: 0 14px !important;
    border-radius: 14px;
    border: 1.5px solid #dde6f2;
    background: #fff;
    font-size: 15px;
    font-weight: 700;
    white-space: normal !important;
    transition: transform .12s ease, background .12s ease;
  }
  body.auth-page.pwa-auth .oauth-btn:active { transform: scale(.985); background: #f5f8fd; }

  body.auth-page.pwa-auth .foot-link { margin: 20px 0 12px; font-size: 14px; }
}

@media screen and (max-width: 360px) {
  body.auth-page.pwa-auth .card-side > .card { padding-left: 16px !important; padding-right: 16px !important; }
  body.auth-page.pwa-auth .card h1 { font-size: 24px; }
}

@keyframes kaiayPwaSheet {
  from { transform: translateY(22px); opacity: .0; }
  to { transform: translateY(0);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body.auth-page .card-side > .card { animation: none !important; }
}

/* =====================================================================
   Shared (all widths) — language toggle, single social button
   ===================================================================== */

/* EN | FR toggle switch (same look as the homepage on phones). */
body.auth-page .lang-switch .auth-lang-form { margin: 0; padding: 0; display: block; }
body.auth-page .lang-switch button.auth-lang-toggle[type=submit] {
  all: unset;
  box-sizing: border-box;
  display: block !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 999px !important;
  cursor: pointer;
  transform: none !important;
  filter: none !important;
  -webkit-tap-highlight-color: transparent;
}
body.auth-page .lang-switch button.auth-lang-toggle:focus-visible { outline: 2px solid #1264d8; outline-offset: 3px; }
.auth-switch {
  position: relative; display: block; width: 68px; height: 34px; box-sizing: border-box;
  border-radius: 999px; background: #eaf1fb; border: 1px solid #cfdbea;
  box-shadow: inset 0 1px 3px rgba(25, 60, 105, .08);
}
.auth-switch i {
  position: absolute; top: 0; bottom: 0; width: 50%;
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: #6b7c95; z-index: 2; transition: color .25s ease;
}
.auth-switch .sw-l { left: 0; }
.auth-switch .sw-r { right: 0; }
.auth-switch u {
  position: absolute; top: 3px; left: 3px; width: 29px; height: 26px; border-radius: 999px;
  background: #1264d8; box-shadow: 0 3px 8px rgba(18, 100, 216, .35);
  text-decoration: none; z-index: 1;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.auth-lang-toggle:not(.is-fr) .sw-l,
.auth-lang-toggle.is-fr .sw-r { color: #fff; }
.auth-lang-toggle.is-fr .auth-switch u { transform: translateX(100%); }

/* Only Google is left, so the social row is a single full-width button. */
body.auth-page.pwa-auth .oauth-grid { grid-template-columns: minmax(0, 1fr) !important; }

/* Bottom app navigation exists only on phones. */
.auth-app-nav { display: none; }

@media screen and (max-width: 600px) {
  body.auth-page.pwa-auth .auth-app-nav {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    left: 10px; right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 200;
    min-height: 62px;
    padding: 7px 5px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(213, 226, 240, .95);
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(17, 42, 77, .16);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
  body.auth-page .auth-app-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; min-height: 48px; text-decoration: none; color: #7b8ba4; border-radius: 13px;
  }
  body.auth-page .auth-app-nav a.active { color: #078c60; background: #e9f8f1; }
  body.auth-page .auth-app-nav-icon { font-size: 20px; line-height: 1.05; font-weight: 800; }
  body.auth-page .auth-app-nav small { font-size: 9px; font-weight: 750; white-space: nowrap; }
}
@media screen and (max-width: 370px) {
  .auth-switch { width: 60px; height: 32px; }
  .auth-switch u { width: 25px; height: 24px; }
  .auth-switch i { font-size: 10px; }
}

/* =====================================================================
   Forgot / Reset password (phones)
   ===================================================================== */
@media screen and (max-width: 600px) {
  body.auth-page.pwa-auth .back-link { margin: 0 0 14px; min-height: 36px; font-size: 14px; }
  body.auth-page.pwa-auth .back-link svg { width: 20px; height: 20px; }
  body.auth-page.pwa-auth .info-box { border-radius: 14px; font-size: 13px; padding: 13px 14px; margin-top: 4px; }
  body.auth-page.pwa-auth .password-rules { border-radius: 14px; padding: 14px 16px; margin-top: 16px; }
  body.auth-page.pwa-auth .password-rules ul { grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12px; }
  body.auth-page.pwa-auth .security-note { font-size: 12.5px; margin: 16px 0 12px; }
  body.auth-page.pwa-auth a.oauth-btn { text-decoration: none; }
  body.auth-page.pwa-auth a.oauth-btn svg { width: 19px; height: 19px; flex: none; }
  body.auth-page.reset .card h1,
  body.auth-page.forgot .card h1 { font-size: 26px; }
}
