/* ============================================================
   Auth pages — phone layout
   ------------------------------------------------------------
   Loaded last by login.html, signup.html, forgot-password.html and
   reset-password.html. Everything here is inside a phone-width query so
   the desktop cards (and the 768px tablet rules) are untouched.

   Goals:
   - one comfortable reading column with real 16px form text (no iOS zoom)
   - 44px+ touch targets on every control, including the inline links
   - a calmer background: the blurred orbs are toned down and kept away
     from the edges so they never widen the viewport
   - a soft top accent so the card still reads as Oletrak without sitting
     on a screenshot-like glass panel
   ============================================================ */

@media (max-width: 640px) {
  body {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
    background:
      radial-gradient(520px 320px at 110% -10%, rgba(255, 138, 43, 0.14), transparent 62%),
      radial-gradient(420px 300px at -20% 105%, rgba(0, 150, 255, 0.12), transparent 60%),
      linear-gradient(170deg, var(--neutral-50) 0%, #eef3f9 100%);
  }

  .web-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
      calc(20px + env(safe-area-inset-top, 0px))
      12px
      calc(28px + env(safe-area-inset-bottom, 0px));
  }

  /* No blurred colour blobs on a phone: they were three different hues
     (orange, pink, cyan) behind a form that only needs one. */
  .orb {
    display: none;
  }

  .login-card,
  .signup-card {
    width: calc(100vw - 24px);
    max-width: 420px;
    padding: 24px 18px 22px;
    border-radius: 24px;
    border: 1px solid rgba(11, 60, 93, 0.08);
    background: rgba(255, 255, 255, 0.94);
    box-shadow:
      0 20px 50px rgba(2, 42, 70, 0.16),
      0 2px 8px rgba(2, 42, 70, 0.05);
    margin: 0 auto;
  }

  /* Stacked, centred identity block. */
  .brand-chip {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    text-align: center;
    border-bottom: 1px solid rgba(11, 60, 93, 0.1);
  }

  .brand-chip img {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(11, 60, 93, 0.22);
  }

  .login-card .brand-chip-text h2,
  .signup-card .brand-chip-text h2 {
    font-size: 2.4rem;
    line-height: 1.16;
    margin: 0;
    text-align: center;
  }

  .login-card .brand-chip-text p,
  .signup-card .brand-chip-text p {
    font-size: 1.34rem;
    line-height: 1.5;
    margin: 6px 0 0;
    text-align: center;
    opacity: 0.9;
  }

  /* Form fields: 52px tall, 16px text, soft filled style. */
  .form-group {
    margin-bottom: 12px;
  }

  .form-group input {
    height: 52px;
    padding: 0 44px 0 46px;
    font-size: 16px;
    line-height: 1.3;
    border: 1px solid var(--line, #e4e6ea);
    border-radius: 14px;
    background: #f7f9fc;
    color: #0f172a;
  }

  .form-group input:focus {
    background: #ffffff;
    border-color: #ff8011;
    box-shadow: 0 0 0 4px rgba(255, 128, 17, 0.16);
  }

  .form-group input::placeholder {
    color: rgba(11, 60, 93, 0.48);
  }

  .input-icon {
    left: 16px;
  }

  .input-icon svg {
    width: 21px;
    height: 21px;
  }

  /* Names stay side by side on phones; tighten the icon gutter just enough
     for both placeholders to fit at 320px without shrinking the 16px text
     (which would trigger iOS focus zoom). */
  .signup-name-row {
    gap: 10px;
    margin-bottom: 12px;
  }

  .signup-name-row .form-group input {
    padding: 0 8px 0 32px;
    font-size: 16px;
  }

  .signup-name-row .input-icon {
    left: 9px;
  }

  .signup-name-row .input-icon svg {
    width: 18px;
    height: 18px;
  }

  .password-wrapper .toggle-password {
    top: 50%;
    right: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
  }

  .password-wrapper .toggle-password svg {
    width: 21px;
    height: 21px;
  }

  .login-btn,
  .signup-btn {
    height: 52px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
    letter-spacing: 0.01em;
  }

  .login-btn svg,
  .signup-btn svg {
    width: 19px;
    height: 19px;
  }

  /* Remember / forgot row: keep one line but give both a real tap area. */
  .form-row {
    gap: 10px;
    margin: 6px 0 14px;
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .remember-me,
  .forgot-link {
    min-height: 32px;
    align-items: center;
  }

  .remember-me {
    font-size: 1.35rem;
    gap: 8px;
  }

  .remember-me input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .forgot-link {
    display: inline-flex;
    font-size: 1.35rem;
  }

  /* Links become comfortable thumb targets without breaking the
     "Back to Login | Sign Up" single-line pattern. */
  .extra-links {
    margin-top: 14px;
    text-align: center;
  }

  .extra-links > a,
  .extra-links > p > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 8px;
    font-size: 1.45rem;
    line-height: 1.3;
  }

  .extra-links > p {
    font-size: 1.35rem;
    line-height: 1.5;
    margin: 0;
  }

  .extra-links > div {
    justify-content: center;
  }

  .oauth-divider {
    margin: 18px 0 12px;
    font-size: 1.2rem;
  }

  .oauth-buttons {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .oauth-btn {
    height: 50px;
    font-size: 1.5rem;
    border-radius: 14px;
    border-color: rgba(11, 60, 93, 0.16);
    background: #ffffff;
  }

  /* Signup extras */
  .terms-check {
    gap: 10px;
    font-size: 1.34rem;
    line-height: 1.55;
  }

  .terms-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 1px;
  }

  .terms-group,
  .marketing-group {
    margin-bottom: 12px;
  }

  .strength-wrap {
    gap: 10px;
    margin-top: 8px;
  }

  .strength-text {
    min-width: 68px;
    font-size: 1.25rem;
  }

  .pw-match,
  .field-error,
  .field-success {
    font-size: 1.3rem;
    line-height: 1.45;
  }

  /* The channel radios are authored with inline 0.85rem labels; on a phone
     that works out to 8.5px, so lift every inline-sized label in the cards. */
  .login-card label[style],
  .signup-card label[style] {
    font-size: 1.35rem !important;
  }

  .login-card label[style] input[type="radio"],
  .signup-card label[style] input[type="radio"] {
    width: 18px;
    height: 18px;
  }

  /* OTP inputs: wider spacing reads well but must not overflow narrow phones. */
  #verify-code,
  #2fa-code,
  #fp-2fa-code {
    font-size: 18px;
    letter-spacing: 0.28rem;
    padding-left: 12px;
  }

  .captcha-widget,
  .captcha-panel {
    max-width: 100%;
  }

  [data-theme="dark"] body {
    background:
      radial-gradient(520px 320px at 110% -10%, rgba(255, 138, 43, 0.14), transparent 62%),
      radial-gradient(420px 300px at -20% 105%, rgba(0, 150, 255, 0.12), transparent 60%),
      linear-gradient(170deg, #0a101d 0%, #0d1626 100%);
  }

  [data-theme="dark"] .login-card,
  [data-theme="dark"] .signup-card {
    background: rgba(13, 22, 38, 0.96);
    border-color: rgba(255, 255, 255, 0.1);
  }

  [data-theme="dark"] .brand-chip {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }

  [data-theme="dark"] .form-group input {
    background: rgba(255, 255, 255, 0.06);
    border-color: #2a3854;
    color: #eef4fb;
  }

  [data-theme="dark"] .form-group input:focus {
    background: #14203a;
    border-color: #ff8011;
  }

  [data-theme="dark"] .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.42);
  }

  [data-theme="dark"] .input-icon {
    color: rgba(219, 230, 243, 0.52);
  }

  [data-theme="dark"] .remember-me {
    color: #c7d4e4;
  }

  [data-theme="dark"] .oauth-btn {
    background: rgba(219, 230, 243, 0.06);
    border-color: rgba(219, 230, 243, 0.2);
  }
}

/* Short phones (landscape or a small viewport): start at the top so the card
   is never pushed under the browser chrome, and trim the identity block. */
@media (max-width: 640px) and (max-height: 700px) {
  .web-container {
    justify-content: flex-start;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }

  .login-card,
  .signup-card {
    padding-top: 20px;
  }

  .brand-chip {
    flex-direction: row;
    text-align: left;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .brand-chip img {
    width: 44px;
    height: 44px;
  }

  .login-card .brand-chip-text h2,
  .signup-card .brand-chip-text h2 {
    font-size: 2.05rem;
    text-align: left;
  }

  .login-card .brand-chip-text p,
  .signup-card .brand-chip-text p {
    font-size: 1.24rem;
    text-align: left;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .login-card,
  .signup-card,
  .orb {
    animation: none;
  }
}

/* ==================================================================
   SIMPLE AUTH SHELL — every width, every auth page
   ------------------------------------------------------------------
   Login, sign-up, forgot/reset password, the staff OTP step, the staff
   login and the super-admin sign-in all share this file, so all of them
   get the same shell:

   - one centred column, card capped at 420px and centred horizontally
     and vertically (short screens scroll instead of clipping)
   - a plain white (or dark navy) card with a hairline border and one
     soft shadow — no glass, no gradient rule across the top
   - no floating orbs: the three coloured blobs were decoration that
     made every page look different
   - one flat brand accent for the primary button, not a gradient

   Loaded after login.css / signup.css, so these win without !important.
   ================================================================== */
.web-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  box-sizing: border-box;
}

.orb {
  display: none;
}

body {
  background: linear-gradient(170deg, var(--neutral-50, #f5f7fa) 0%, #eef2f7 100%);
  background-attachment: fixed;
}

.login-card,
.signup-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 22px;
  border: 1px solid rgba(11, 60, 93, 0.1);
  border-radius: 18px;
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 10px 30px rgba(11, 26, 42, 0.1);
}

/* Any leftover decorative rules on the card are gone. */
.login-card::before,
.login-card::after,
.signup-card::before,
.signup-card::after {
  content: none;
}

/* One flat accent for the primary action. */
.login-btn,
.signup-btn {
  background: var(--brand-orange-500, #ff7f11);
  color: #ffffff;
  border: 0;
  box-shadow: none;
}

.login-btn:hover,
.signup-btn:hover {
  background: var(--brand-orange-600, #d9660a);
  box-shadow: 0 6px 16px rgba(255, 127, 17, 0.28);
  transform: none;
}

/* Selected remember-me / terms boxes: one colour, no gradient. */
.remember-me input[type="checkbox"]:checked,
.terms-check input[type="checkbox"]:checked {
  background: var(--brand-orange-500, #ff7f11);
  border-color: var(--brand-orange-500, #ff7f11);
  box-shadow: none;
}

/* Password strength: same hue at four weights instead of red/amber/green. */
.strength-bar span {
  background: var(--brand-orange-500, #ff7f11);
}

[data-theme="dark"] body {
  background: linear-gradient(170deg, #0a101d 0%, #0d1626 100%);
  background-attachment: fixed;
}

[data-theme="dark"] .login-card,
[data-theme="dark"] .signup-card {
  background: #121a2b;
  border-color: #263449;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

/* Phones: the card fills the column it already has; the shell keeps the
   vertical centring and breathing room from the phone query above. */
@media (max-width: 640px) {
  .web-container {
    padding:
      calc(18px + env(safe-area-inset-top, 0px))
      12px
      calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .login-card,
  .signup-card {
    max-width: 100%;
    border-radius: 20px;
  }
}

/* ==================================================================
   DESKTOP FORM DENSITY
   ------------------------------------------------------------------
   The shell above caps the *card*; this caps the controls inside it and
   gives the desktop form the same comfortable field height the phones
   already get. login.css / signup.css ship a 40px field with 14px text,
   which reads cramped once the card is the only thing on a 1440px
   screen — the desktop form now uses 50px fields, 15px text and the
   same 12px radius, and nothing inside the card can grow wider than it.

   `width: min(100%, 440px)` rather than `width: 100%` + `max-width`:
   a browser with a raised default font size, a zoomed page or a very
   wide monitor can never push the card (or the fields) past 440px, so
   the form cannot stretch again.
   ================================================================== */
@media (min-width: 769px) {
  .web-container {
    padding: 32px 20px;
  }

  .login-card,
  .signup-card {
    width: min(100%, 440px);
    max-width: 440px;
    padding: 28px 26px;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    max-width: 100%;
    height: 50px;
    font-size: 15px;
    border-radius: 12px;
    box-sizing: border-box;
  }

  /* Two equal columns for the name pair, at any card width. */
  .signup-name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
  }

  .signup-name-row .form-group {
    margin-bottom: 0;
    min-width: 0;
  }

  .signup-name-row .form-group input {
    width: 100%;
    min-width: 0;
  }

  /* The reveal control has to stay inside the taller field. */
  .password-wrapper .toggle-password {
    height: 40px;
  }

  .login-btn,
  .signup-btn {
    width: 100%;
    max-width: 100%;
    height: 50px;
    font-size: 15px;
    border-radius: 12px;
  }

  .strength-meter {
    margin-top: 10px;
  }
}
