/* ==========================================================================
   CrysMed — Member login / register page (member-auth.html only), 2026-10-09
   Loaded after the shared head-links (so after auth.css). auth.css is shared with
   provider-auth.html and is NOT edited; everything here is scoped to this page by being
   linked from member-auth.html alone.

   Desktop: two client-approved tweaks only (readable "Forgot password?", "Coming soon"
   social buttons). Everything else below 1024px / touch tablets, same approach as the home
   page (crysmed-audit/APPROACH.md). Content, order of fields and form behaviour unchanged.
   ========================================================================== */

/* ---------- All sizes (approved desktop tweaks) ---------- */

/* "Forgot password?" was still styled as the 10px dashed "under development" pill (.dev-tag)
   although the link works — now a normal readable link, same place and colour. */
.auth-row a.dev-tag {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--brand-700);
  cursor: pointer;
}
.auth-row a.dev-tag:hover { color: var(--brand-900); text-decoration: underline; }

/* Google / Apple are disabled ("out of scope for this phase") but looked clickable. */
.auth-social__btn[disabled] {
  position: relative;
  opacity: .6;
  cursor: not-allowed;
  background: var(--surface);
}
.auth-social__btn[disabled]:hover { border-color: var(--line-strong); }
.auth-social__soon {
  margin-left: 4px;
  padding: 0 7px;
  line-height: 14px; /* 14 + 2px border = 16px, the button's own text height: buttons stay 42px */
  border-radius: var(--r-full);
  background: var(--white);
  border: 1px solid var(--line-strong);
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: .02em;
  color: var(--ink-500);
  white-space: nowrap;
}

/* ---------- Phones, tablets and touch tablets in landscape ---------- */
@media (max-width: 1023.98px), (min-width: 1024px) and (max-width: 1366px) and (hover: none) and (pointer: coarse) {
  /* Touch-friendly fields: 48px tall, 16px text (stops iOS Safari zooming in on focus) */
  .auth-card .field input:not([type="checkbox"]):not([type="hidden"]),
  .auth-card .field select,
  .auth-card .phone-input__prefix {
    min-height: 48px;
    font-size: 16px;
  }
  .auth-card .password-toggle { width: 44px; height: 44px; }
  .auth-card .password-input input { padding-right: 48px; }

  /* Log in / Create account switch: 44px segments */
  .auth-tabs { margin-bottom: 20px; }
  .auth-tab { min-height: 40px; font-size: 14px; }

  /* Checkboxes: 20px box, whole row tappable */
  .auth-card .checkbox-field {
    min-height: 36px;
    align-items: center;
    gap: 10px;
    font-size: 14px;
  }
  .auth-card .checkbox-field input[type="checkbox"] { width: 20px; height: 20px; flex: none; }

  .auth-card .btn-block { min-height: 48px; font-size: 15px; }
  .auth-row a.dev-tag { font-size: 14px; padding: 8px 0; } /* bigger tap area, same look */
  .auth-switch { font-size: 14px; }
  .auth-switch button { padding: 8px 4px; }
  .auth-legal { font-size: 12px; }
  .auth-social__btn { min-height: 48px; font-size: 14px; }
}

/* ---------- Stacked layout (where auth.css stacks the two cards, ≤980px):
   the form comes FIRST — people open this page to log in. The Member access panel follows
   below it, complete and a little more compact. ---------- */
@media (max-width: 980px) {
  .auth-shell__grid > .auth-card { order: -1; }
  .auth-aside { padding: 28px 24px; }
  .auth-aside h1 { font-size: 26px; line-height: 1.15; }
  .auth-aside__sub { margin-bottom: 16px; }
  .auth-benefits { margin-top: 8px; margin-bottom: 20px; gap: 14px; }
  .auth-benefits b { font-size: 14px; }
  .auth-benefits span { font-size: 12px; }
  .auth-stats { padding-top: 16px; }
  .auth-stats span { font-size: 12px; }
}

/* ==========================================================================
   UI/UX POLISH (2026-10-09, pilot page). All motion respects "reduce motion".
   A) All sizes incl. PC (approved 2026-10-09, visual only — no size/position change):
      sliding Log in / Create account switch, smooth form switch, clear field focus,
      messages ease in, loading state on submit (member-auth.js).
   B) Phones + touch tablets only: press feedback instead of the grey tap flash,
      no "stuck" hover effects.
   ========================================================================== */

/* ---------- A) All sizes ---------- */
.auth-shell {
  --press-ease: cubic-bezier(.2, .8, .2, 1);       /* quick, springy-feeling settle */
  --sheet-ease: cubic-bezier(.32, .72, 0, 1);      /* iOS-like slide */
}

/* Sliding Log in / Create account switch: one white pill glides between the two
   (the tabs themselves become transparent and only change text colour) */
.auth-tabs { position: relative; isolation: isolate; }
.auth-tabs::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px - 2px); /* half the track minus padding and the 4px gap's share */
  border-radius: var(--r-sm);
  background: var(--white);
  box-shadow: var(--shadow-1);
  transition: transform .32s var(--sheet-ease);
}
.auth-tabs:has(.auth-tab:nth-child(2).is-active)::before { transform: translateX(calc(100% + 4px)); }
.auth-tab, .auth-tab.is-active { background: transparent; box-shadow: none; transition: color .25s ease, transform .14s var(--press-ease); }

/* Switching forms: the newly shown form fades + rises in instead of popping */
.auth-panel:not([hidden]) { animation: auth-panel-in .32s var(--sheet-ease) both; }

/* Field focus: brand border + soft glow, label tint — clear "you are here" */
.auth-card .field { transition: color .2s ease; }
.auth-card .field:focus-within { color: var(--brand-700); }
.auth-card .field :is(input, select) {
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.auth-card .field :is(input, select):focus {
  outline: none;
  border-color: var(--brand-700);
  box-shadow: 0 0 0 4px var(--brand-tint);
}
.auth-card .field :is(input, select):focus::placeholder { color: var(--ink-300); }
.auth-card :focus-visible { outline: 2px solid var(--brand-700); outline-offset: 2px; }
.auth-card .field :is(input, select):focus-visible { outline: none; } /* glow already shows focus */

/* Messages ease in (errors/success after a submit) */
.auth-card .form-alert { animation: auth-panel-in .3s var(--sheet-ease) both; }

/* Submit loading state (class set by member-auth.js): spinner, no double submit */
.auth-card .btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.auth-card .btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(255, 255, 255, .45);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}

/* ---------- B) Phones + touch tablets only ---------- */
@media (max-width: 1023.98px), (min-width: 1024px) and (max-width: 1366px) and (hover: none) and (pointer: coarse) {

  /* 1. No grey/blue system tap flash — our own press states below replace it */
  .auth-shell :is(a, button, label, input, select) { -webkit-tap-highlight-color: transparent; }

  /* 2. Press feedback: a quick, subtle shrink + tint on everything tappable */
  .auth-card .btn,
  .auth-tab,
  .auth-switch button,
  .auth-row a,
  .auth-social__btn:not([disabled]) {
    transition: transform .14s var(--press-ease), background-color .2s ease, box-shadow .2s ease, color .2s ease;
  }
  .auth-card .btn:active { transform: scale(.97); filter: brightness(.94); }
  .auth-tab:active { transform: scale(.96); }
  .auth-switch button:active,
  .auth-row a:active { opacity: .6; }
  .auth-social__btn:not([disabled]):active { transform: scale(.97); background: var(--surface); }
  .password-toggle { border-radius: 50%; transition: background-color .15s ease, color .15s ease; }
  .password-toggle:active { background: var(--surface); color: var(--ink-900); }
  .auth-card .checkbox-field { border-radius: 10px; transition: background-color .15s ease; }
  .auth-card .checkbox-field:active { background: var(--surface); }
  .auth-card .checkbox-field input[type="checkbox"] { transition: transform .14s var(--press-ease); }
  .auth-card .checkbox-field:active input[type="checkbox"] { transform: scale(.9); }
}

/* No "stuck" hover effects on touch screens: a tap shouldn't leave a hover style behind */
@media (hover: none) {
  .auth-shell .btn-primary:hover { background: var(--premium-500); }
  .auth-shell .auth-row a:hover,
  .auth-shell .auth-switch button:hover { color: var(--brand-700); text-decoration: none; }
  .auth-shell .password-toggle:hover { color: var(--ink-300); }
  .auth-shell .auth-social__btn:hover { border-color: var(--line-strong); }
}

@keyframes auth-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .auth-panel:not([hidden]), .auth-card .form-alert { animation: none; }
  .auth-tabs::before { transition: none; }
  .auth-card .btn:active, .auth-tab:active, .auth-social__btn:active { transform: none; }
  .auth-card .btn.is-loading::after { animation-duration: 1.6s; }
}

/* ---------- Phones ---------- */
@media (max-width: 599.98px) {
  .auth-shell { padding-block: 12px 24px; }
  .auth-shell__grid { gap: 16px; }
  /* card used 32px inner padding: fields were only 262px wide on a 360px phone */
  .auth-card { padding: 18px 16px 20px; border-radius: 16px; }
  .auth-aside { padding: 24px 20px; border-radius: 16px; }
  .auth-aside h1 { font-size: 24px; }
  .auth-stats b { font-size: 20px; }
}
