/* ==========================================================================
   Member area: sign up, sign in, password recovery, account.

   Loaded only by those pages, on top of style.css, so the gym's tokens
   (--color-accent, --font-display, the spacing scale) are already in scope and
   nothing here redefines them.

   One card on the black ground, gold used once per screen -- on the thing to
   press -- so the eye goes to it rather than hunting. Everything is sized for
   a thumb first: 48px controls, 16px inputs so iOS does not zoom the page when
   a field takes focus.
   ========================================================================== */

.auth-shell {
    min-height: calc(100vh - var(--header-h) - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    /* Equal top and bottom. It was space-5 over and space-6 under, which on a
       phone reads as the card having slipped upwards. */
    padding: var(--space-6) var(--space-2);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(212, 160, 23, 0.07) 0%, transparent 60%),
        var(--color-bg-alt);
    box-shadow: var(--shadow-lg);
}
.auth-card--wide { max-width: 680px; }

.auth-eyebrow {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-1);
}
.auth-card h1 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 5vw, 2.1rem);
    line-height: 1.1;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.auth-lede {
    color: var(--color-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: var(--space-3);
}

/* ---- fields ---- */
.auth-form { display: grid; gap: var(--space-2); }
.auth-field { display: grid; gap: 6px; }
.auth-field label {
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-text);
}
.auth-optional {
    font-family: var(--font-body);
    font-size: 0.7rem;
    letter-spacing: 0.4px;
    text-transform: none;
    color: var(--color-muted);
}
.auth-field input,
.auth-field select,
.auth-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    /* 16px, because anything smaller makes iOS zoom the page on focus. */
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-field input::placeholder { color: rgba(156, 156, 159, 0.7); }
.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.18);
}
.auth-field input:focus-visible { outline: 2px solid transparent; }
.auth-hint { font-size: 0.82rem; color: var(--color-muted); }

/* ---- password field with a reveal button ---- */
.auth-password { position: relative; }
.auth-password input { padding-right: 78px; }
.auth-reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    min-height: 36px;
    padding: 0 12px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-muted);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.auth-reveal:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ---- strength meter: four blocks, filled as the password gets longer ---- */
.auth-strength { display: grid; gap: 6px; }
.auth-strength-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.auth-strength-track span {
    height: 4px;
    border-radius: 2px;
    background: var(--color-border);
    transition: background var(--transition);
}
.auth-strength[data-level="1"] .auth-strength-track span:nth-child(-n+1) { background: #c0563f; }
.auth-strength[data-level="2"] .auth-strength-track span:nth-child(-n+2) { background: #c8912f; }
.auth-strength[data-level="3"] .auth-strength-track span:nth-child(-n+3) { background: var(--color-accent); }
.auth-strength[data-level="4"] .auth-strength-track span { background: #7fb069; }
.auth-strength-label { font-size: 0.78rem; color: var(--color-muted); }

/* ---- photo ---- */
.auth-photo { display: flex; gap: var(--space-2); align-items: center; }
.auth-photo-preview {
    width: 72px;
    height: 72px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
}
.auth-photo-empty {
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--color-muted);
}

/* ---- messages ---- */
.auth-errors {
    border: 1px solid rgba(192, 86, 63, 0.5);
    background: rgba(192, 86, 63, 0.12);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    margin-bottom: var(--space-2);
}
.auth-errors p {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.auth-errors ul { margin: 0; padding-left: 18px; }
.auth-errors li { font-size: 0.9rem; line-height: 1.5; margin-bottom: 4px; }
.auth-errors li:last-child { margin-bottom: 0; }

.auth-note {
    /* A quiet tinted panel rather than a bar down one side: the card is already
       the object, and a second accent edge on top of it just adds noise. */
    border: 1px solid rgba(212, 160, 23, 0.28);
    background: rgba(212, 160, 23, 0.06);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--color-muted);
}
.auth-note strong { color: var(--color-text); }

/* ---- actions and links ---- */
.auth-actions { display: grid; gap: var(--space-1); margin-top: var(--space-1); }
.auth-actions .btn { width: 100%; min-height: 50px; margin-top: 0; }
.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-1) var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--hairline);
    font-size: 0.9rem;
    color: var(--color-muted);
}
.auth-links a { color: var(--color-accent); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ---- the "check your inbox" and "all done" states ---- */
.auth-done { text-align: center; }
.auth-done-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-2);
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--color-accent);
    background: rgba(212, 160, 23, 0.1);
}
.auth-done-mark svg { width: 28px; height: 28px; stroke: var(--color-accent); fill: none; stroke-width: 2; }

/* ---- account page ---- */
.account-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.account-head img,
.account-head .auth-photo-empty {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-border);
}
.account-name { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: 1px; }
.account-email { color: var(--color-muted); font-size: 0.92rem; }
.account-status {
    display: inline-block;
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
}
.account-panels { display: grid; gap: var(--space-3); }
.account-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-alt);
    padding: var(--space-3);
}
.account-panel h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-2); }
.account-grid .auth-field--wide { grid-column: 1 / -1; }

@media (max-width: 560px) {
    /* Equal top and bottom on a phone too. */
    .auth-shell { padding: var(--space-4) var(--space-2); }
    .auth-card { padding: var(--space-3); }
    .auth-links { flex-direction: column; }
}

/* The line under the sign-up button. Quiet, but a real link: somebody should be
   able to read what they are agreeing to before they agree to it. */
.auth-fineprint {
    margin-top: var(--space-2);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--color-muted);
}
.auth-fineprint a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---- The file input ----
   The browser's own control is a white button with black text, which on a dark
   form reads as a piece of another website that fell in. Styling the button
   itself needs the vendor pseudo-element; everything else is the wrapper. */
.auth-field input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--color-border);
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    cursor: pointer;
}
.auth-field input[type="file"]:hover { border-color: rgba(212, 160, 23, 0.5); }
.auth-field input[type="file"]:focus-visible {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}
.auth-field input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 9px 16px;
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--gradient-accent);
    color: var(--color-accent-text);
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}
.auth-field input[type="file"]::-webkit-file-upload-button {
    margin-right: 12px;
    padding: 9px 16px;
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--gradient-accent);
    color: var(--color-accent-text);
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

/* The photo row stacks on a phone, where the control and its hint side by side
   left each about 40% of the width. */
@media (max-width: 560px) {
    .auth-photo { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
    /* Not the preview, which is also a div and would stretch into an oval. */
    .auth-photo > div:not(.auth-photo-preview) { width: 100%; }
}

/* ---- Accepting the terms ----
   This was a sentence saying you had already agreed, which is not a decision
   anybody made. A box you tick is. */
.auth-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: var(--space-3);
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    color: var(--color-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    cursor: pointer;
}
/* 20px and pinned to the first line of text: this is tapped with a thumb, and
   the browser default is a 13px square. */
.auth-consent input {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    flex: none;
    accent-color: var(--color-accent);
    cursor: pointer;
}
.auth-consent a { color: var(--color-accent); }

/* "Keep me signed in": a choice, not a declaration, so no box around it. */
.auth-remember {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: var(--space-3);
    cursor: pointer;
}
.auth-remember input {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    flex: none;
    accent-color: var(--color-accent);
    cursor: pointer;
}
.auth-consent.is-invalid { border-color: #e04b4b; background: rgba(224, 75, 75, 0.06); }

/* ---- Sign in / see rates, under the card ----
   Two gold links of equal weight sitting side by side, with nothing to say
   which one is the way on. They are a row of two buttons now: the quiet one
   is the alternative, the plain link is the aside. */
.auth-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--hairline);
    color: var(--color-muted);
    font-size: 0.9rem;
}
.auth-links .btn { flex: 0 1 auto; }
@media (max-width: 560px) {
    /* Stacked, full width, so neither is a small target beside the other. */
    .auth-links { flex-direction: column; align-items: stretch; text-align: center; }
    .auth-links .btn { width: 100%; }
}

/* ---- What is wrong with this field ----
   These rules existed only in admin.css, which the member pages do not load,
   so the message rendered as unstyled body text and the field it belonged to
   looked no different from any other. */
.field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 6px 0 0;
    color: #ff9a9a;
    font-size: 0.84rem;
    line-height: 1.45;
    text-align: left;
}
/* The warning glyph carries the meaning when the colour cannot -- on a poor
   screen, in sunlight, or for a red-green colour blind reader. */
.field-error::before {
    content: "!";
    flex: none;
    width: 15px;
    height: 15px;
    margin-top: 1px;
    border-radius: 50%;
    background: #ff6b6b;
    color: #1a0000;
    font-family: var(--font-display);
    font-size: 0.68rem;
    line-height: 15px;
    text-align: center;
}

/* Red, and distinct from the gold focus ring -- otherwise a field that is
   merely focused looks exactly like a field that is wrong. The invalid border
   survives focus; only the glow changes, so you can see both at once. */
.auth-form input[aria-invalid="true"],
.auth-form select[aria-invalid="true"],
.auth-form textarea[aria-invalid="true"] {
    border-color: #e04b4b;
    background: rgba(224, 75, 75, 0.05);
}
.auth-form input[aria-invalid="true"]:focus,
.auth-form select[aria-invalid="true"]:focus,
.auth-form textarea[aria-invalid="true"]:focus {
    border-color: #e04b4b;
    box-shadow: 0 0 0 3px rgba(224, 75, 75, 0.18);
}

/* ---- Under the card ----
   This was a sentence, an outlined button and a gold link in one row: three
   different weights competing, and the button shouting louder than anything
   on the form except the submit. Two quiet lines instead, the main way on
   first. */
.auth-links {
    display: block;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--hairline);
    color: var(--color-muted);
    font-size: 0.9rem;
    line-height: 1.9;
    text-align: center;
}
.auth-links > * { display: block; }
.auth-links a { color: var(--color-accent); }
.auth-links a:hover { text-decoration: underline; }
/* The second line is the afterthought, and reads like one. */
.auth-links .auth-links-aside { font-size: 0.85rem; }
.auth-links .auth-links-aside a { color: var(--color-muted); text-decoration: underline; }
.auth-links .auth-links-aside a:hover { color: var(--color-accent); }

/* The native calendar button is a dim grey square on a dark field, easy to
   miss and a small target. The whole field opens the picker (see auth.js), so
   this only has to stop the icon disappearing into the background. */
/* Safari on a phone sizes a date field from its own contents and ignores the
   width it is given, so it spilled over its neighbours and past the card.
   Without its native look it obeys the same rules as every other field; the
   date wheel still opens on a tap. */
.auth-form input[type="date"] {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
}
.auth-form input[type="date"]::-webkit-date-and-time-value { text-align: left; min-height: 1.5em; }
/* A grid cell is as wide as its widest content unless told otherwise. */
.account-grid > * { min-width: 0; }
.auth-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.55;
    cursor: pointer;
    padding: 4px;
}
.auth-form input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* 16px of text is a small thing to hit with a thumb. The links keep their
   place in the sentence and gain a target around them. */
.auth-links a {
    display: inline-block;
    padding: 6px 2px;
}

/* ---------------------------------------------------------------------------
   The account page on a phone

   It is a card inside a card. With both sets of padding, the page gutter and
   two borders, a 375px screen left the "Your details" form 243px, and its
   mobile number field 75px to be read in -- two digits short of a number, so
   a member could not see the whole of their own. The sides give some of that
   back; top and bottom are left alone.
   --------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .auth-card--wide { padding-left: 14px; padding-right: 14px; }
    .account-panel { padding-left: 14px; padding-right: 14px; }
}

/* What still has to be added before this account can buy anything. */
.account-needed {
    margin: 0 0 var(--space-3);
    padding: 12px 14px;
    border: 1px solid rgba(212, 160, 23, 0.45);
    border-radius: 10px;
    background: rgba(212, 160, 23, 0.08);
    font-size: 0.92rem;
    line-height: 1.5;
}
