/* ==========================================================================
   login.html — one clean stylesheet (loaded LAST, replaces 02-signup-redesign)
   Layout:  1. page + topbar   2. card + heading   3. form controls
            4. Google parts    5. step visibility   6. referral card + misc
   The page is one screen with three steps, driven by body[data-step]:
     start  -> Continue with Google        setup  -> phone + location + referral
     legacy -> phone + password (old accounts)
   ========================================================================== */

/* ---------- 1. page (header + font come from the shared redesign-global.css) ---------- */
body[data-page="account"] .layout { max-width: 440px; padding: 20px 16px 56px; }

/* ---------- 2. card + heading ---------- */
body[data-page="account"] .auth-card {
  background: var(--eb57-surface-ffffff,#fff); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 1px 2px var(--eb57-shadow-123829-50000,rgba(18, 56, 41, .05)), 0 12px 32px var(--line);
}
body[data-page="account"] .auth-card::before { display: none; }
body[data-page="account"] .auth-body { padding: 28px 24px 24px; }

.auth-head { margin: 0 0 22px; }
.auth-card #authTitle {
  margin: 0 0 6px; font-size: 1.6rem; line-height: 1.2; letter-spacing: -.01em; color: var(--forest);
}
.auth-card #authSubtitle { margin: 0; font-size: .95rem; line-height: 1.5; color: var(--ink-soft); }

.auth-card .error-box { margin: 0 0 16px; border-radius: 12px; }

/* ---------- 3. form controls (login form AND the "finish profile" form) ---------- */
.auth-card .field { margin: 0 0 18px; }
.auth-card .field > label,
.auth-card .ref-card > #refAskBody > label {
  display: block; margin: 0 0 7px; font-size: .84rem; font-weight: 600; color: var(--forest);
}
.auth-card .opt { font-weight: 400; color: var(--ink-soft); }

.auth-card .field input:not([type="hidden"]),
.auth-card .field select,
.auth-card .field textarea,
.auth-card .ref-card input[type="text"] {
  width: 100%; height: 48px; padding: 0 14px; font-size: 1rem; color: var(--ink);
  background: var(--eb57-surface-ffffff,#fff); border: 1.5px solid var(--line); border-radius: 12px; outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.auth-card .field textarea { height: auto; min-height: 76px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.auth-card .field input:focus,
.auth-card .field select:focus,
.auth-card .field textarea:focus,
.auth-card .ref-card input[type="text"]:focus {
  border-color: var(--leaf-deep); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
.auth-card .hint { margin: 7px 0 0; font-size: .8rem; line-height: 1.45; color: var(--ink-soft); }

.auth-card .phone-row { display: flex; gap: 8px; }
.auth-card .phone-row select { flex: 0 0 96px; padding: 0 8px; background: var(--bg-tint); }
.auth-card .phone-row input { flex: 1; }

/* delivery location: two equal buttons above the address box */
.auth-card .loc-row { display: flex; gap: 8px; margin: 0 0 10px; }
.auth-card .loc-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 10px; font-size: .86rem; font-weight: 600; cursor: pointer;
  color: var(--leaf-deep); background: var(--eb57-surface-ffffff,#fff); border: 1.5px solid var(--brand-mid); border-radius: 12px;
}
.auth-card #useLocationBtn { background: var(--leaf-pale); border-color: var(--brand-mid); }
.auth-card .loc-btn:hover { border-color: var(--leaf-deep); }
.auth-card #locationStatus { color: var(--leaf-deep); font-weight: 600; }

/* primary action */
.auth-card .primary-btn {
  display: block; width: 100%; height: 52px; margin: 6px 0 0; font-size: 1rem; font-weight: 600;
  border-radius: 14px; cursor: pointer;   /* colours come from the shared theme */
}
.auth-card .primary-btn:disabled { opacity: .6; cursor: progress; }

.text-btn {
  display: block; width: 100%; padding: 12px 6px; font-size: .86rem; color: var(--ink-soft);
  background: none; border: 0; cursor: pointer; text-align: center;
}
.text-btn u { color: var(--leaf-deep); font-weight: 600; text-underline-offset: 3px; }
.forgot-row { margin: -6px 0 14px; text-align: right; }
.forgot-row a { font-size: .84rem; font-weight: 600; color: var(--leaf-deep); }
.legacy-row { margin: 14px 0 0; }

/* ---------- 4. Google parts ---------- */
.auth-card .google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 52px; margin: 0; font-size: .98rem; font-weight: 600; color: var(--eb57-text-1f1f1f,#1F1F1F);
  background: var(--eb57-surface-ffffff,#fff); border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer;
}
.auth-card .google-btn:hover { background: var(--bg-tint); border-color: var(--muted-light); }
.auth-card .google-btn[hidden] { display: none; }
.g-ico { flex: none; width: 20px; height: 20px; }
#googleBtnWrap { display: flex; justify-content: center; }

.auth-card .g-chip {
  display: flex; align-items: center; gap: 12px; margin: 0 0 20px; padding: 12px 14px;
  background: var(--leaf-pale); border: 1px solid var(--brand-mid); border-radius: 14px;
}
.g-chip-ico {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--eb57-surface-ffffff,#fff); border-radius: 50%;
}
.g-chip-ico .g-ico { width: 18px; height: 18px; }
.g-chip-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: .8rem; color: var(--ink-soft); }
.g-chip-txt b { font-size: .95rem; color: var(--forest); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-chip-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-chip-undo {
  flex: none; padding: 6px 10px; font-size: .84rem; font-weight: 600; color: var(--leaf-deep);
  background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.g-chip-undo:hover { background: var(--brand-light); }

/* ---------- 5. step visibility ---------- */
#loginForm .for-setup,
#loginForm .for-legacy,
#loginForm .for-psignup,
#loginForm .f-phone,
#loginForm #loginSubmit,
#loginForm #legacyRow,
#loginForm #legacyBack { display: none; }

body[data-step="start"]  #loginForm #legacyRow { display: block; }
body[data-step="setup"]  #loginForm .for-setup,
body[data-step="legacy"] #loginForm .for-legacy { display: block; }
body[data-step="setup"]  #loginForm .f-phone,
body[data-step="legacy"] #loginForm .f-phone,
body[data-step="setup"]  #loginForm #loginSubmit,
body[data-step="legacy"] #loginForm #loginSubmit { display: block; }
body[data-step="setup"]  #loginForm #profileFields[hidden] { display: none; }

/* iPhone/iPad: phone + password create-account step */
body[data-step="psignup"] #loginForm .for-setup,
body[data-step="psignup"] #loginForm .for-psignup,
body[data-step="psignup"] #loginForm .f-phone,
body[data-step="psignup"] #loginForm .f-pass,
body[data-step="psignup"] #loginForm #loginSubmit { display: block; }
body[data-step="psignup"] #loginForm #forgotRow,
body[data-step="psignup"] #loginForm #toPsignup,
body[data-step="psignup"] #loginForm #legacyBack { display: none; }
body:not(.is-ios) #loginForm .ios-only { display: none !important; }
body.is-ios #loginForm #legacyBack,
body.is-ios #loginForm #legacyRow { display: none !important; }

/* the Google block only belongs to step 1 */
body[data-step="setup"]  #loginForm #altAuth,
body[data-step="legacy"] #loginForm #altAuth,
body[data-step="psignup"] #loginForm #altAuth,
body.is-ios #loginForm #altAuth { display: none !important; }

/* ---------- 6. referral card ---------- */
.auth-card .ref-card {
  margin: 0 0 16px; padding: 14px; background: var(--bg-tint); border: 1px solid var(--line); border-radius: 14px;
}
.ref-card .ref-skip {
  margin: 6px 0 0; padding: 4px 0; font-size: .84rem; font-weight: 600; color: var(--leaf-deep);
  background: none; border: 0; cursor: pointer;
}
.ref-card .ref-applied { display: none; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--leaf-deep); }
.ref-card.is-applied { background: var(--leaf-pale); border-color: var(--brand-mid); }
.ref-card.is-applied #refAskBody { display: none; }
.ref-card.is-applied .ref-applied { display: flex; }

@media (max-width: 380px) {
  body[data-page="account"] .auth-body { padding: 22px 16px 20px; }
  .auth-card #authTitle { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { .auth-card * { transition: none !important; } }
