/* =============================================================================
   auth.css — sign in and sign up
   -----------------------------------------------------------------------------
   The split panel: form on one side, a coloured overlay on the other that
   invites you across to the page you are not on.

   Every colour here is from docs/BRAND-TOKENS.md. The reference design used a
   pink-to-red gradient; the nearest honest equivalent in this palette is the
   brand red #FF3300 into the band red #F60202, which is the same pairing the
   live site uses on its price and promo bands. No colour has been invented to
   match the mock.

   The panel slides with a CSS transform between two real pages rather than one
   page swapping state, because sign-in and registration are separate URLs and
   must stay separately linkable, bookmarkable and back-buttonable.
   ========================================================================== */

:root {
    --ccm-amber:      #FCB800;
    --ccm-red:        #FF3300;
    --ccm-band:       #F60202;
    --ccm-orange:     #F14705;
    --ccm-mint:       #EFFFF2;
    --ccm-link:       #0066CC;
    --ccm-ink:        #000000;
    --ccm-body:       #666666;
    --ccm-bg:         #FFFFFF;
    --ccm-rule:       #E1E1E1;
    --ccm-surface:    #FAFAFA;
    --ccm-rule-soft:  #EDEDED;
    --ccm-muted:      #8A8A8A;
}

* { box-sizing: border-box; }

body.auth-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--ccm-surface);
    font-family: 'Work Sans', Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--ccm-body);
    padding: 24px 16px;
}

/* --- The card ------------------------------------------------------------- */

.auth-shell {
    position: relative;
    width: 100%;
    max-width: 880px;
    min-height: 540px;
    background: var(--ccm-bg);
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
    overflow: hidden;
}

.auth-pane {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 44px;
    text-align: center;
    overflow-y: auto;
}

.auth-form-pane { left: 0; }

/* --- The overlay ---------------------------------------------------------- */

.auth-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, var(--ccm-red) 0%, var(--ccm-band) 100%);
    color: var(--ccm-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 44px;
    text-align: center;
}

.auth-overlay h2 {
    margin: 0 0 14px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ccm-bg);
}

.auth-overlay p {
    margin: 0 0 26px;
    font-size: 14px;
    line-height: 1.65;
    max-width: 280px;
    color: var(--ccm-bg);
}

/* --- Brand ---------------------------------------------------------------- */

.auth-logo { display: block; margin: 0 auto 18px; }
.auth-logo img { display: block; width: 190px; height: auto; }

/* On the red overlay the logo needs a light plate: its wordmark is dark ink
   and the trolley is red, so laying it straight onto red loses half of it.
   The mark itself is untouched — only what sits behind it changes. */
.auth-overlay-logo {
    display: inline-block;
    background: var(--ccm-bg);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 22px;
}
.auth-overlay-logo img { display: block; width: 168px; height: auto; }

/* --- Headings ------------------------------------------------------------- */

.auth-pane h1 {
    margin: 0 0 14px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ccm-ink);
}

.auth-hint {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--ccm-muted);
}

/* --- Google --------------------------------------------------------------- */

.auth-social { margin: 0 0 14px; }

.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--ccm-rule);
    background: var(--ccm-bg);
    color: var(--ccm-ink);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 22px;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.google-btn:hover,
.google-btn:focus-visible {
    border-color: var(--ccm-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.google-btn svg { width: 17px; height: 17px; flex: none; }

/* --- Form ----------------------------------------------------------------- */

.auth-form { width: 100%; }

.auth-form .field { margin-bottom: 10px; text-align: left; }

.auth-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ccm-ink);
    margin-bottom: 4px;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="tel"],
.auth-form input[type="password"] {
    width: 100%;
    border: 1px solid transparent;
    background: var(--ccm-rule-soft);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ccm-ink);
    border-radius: 4px;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--ccm-red);
    background: var(--ccm-bg);
}

.auth-form input[aria-invalid="true"] { border-color: var(--ccm-red); }

.auth-note {
    display: block;
    font-size: 11.5px;
    color: var(--ccm-muted);
    margin-top: 4px;
}

.field-error {
    display: block;
    font-size: 11.5px;
    color: var(--ccm-red);
    font-weight: 600;
    margin-top: 4px;
}

/* --- Account type --------------------------------------------------------- */

.role-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.role-choice input { position: absolute; opacity: 0; pointer-events: none; }

.role-choice label {
    display: block;
    border: 1px solid var(--ccm-rule);
    border-radius: 4px;
    padding: 10px 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ccm-body);
    text-align: center;
    cursor: pointer;
    margin: 0;
    transition: border-color .15s, background .15s, color .15s;
}

.role-choice label:hover { border-color: var(--ccm-muted); }

.role-choice input:checked + label {
    border-color: var(--ccm-red);
    background: var(--ccm-mint);
    color: var(--ccm-ink);
}

.role-choice input:focus-visible + label { outline: 2px solid var(--ccm-link); outline-offset: 2px; }

.role-note {
    font-size: 11.5px;
    color: var(--ccm-muted);
    text-align: left;
    margin: 0 0 12px;
    line-height: 1.55;
}

/* --- Buttons -------------------------------------------------------------- */

.auth-btn {
    display: inline-block;
    border: 0;
    border-radius: 22px;
    padding: 12px 44px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s;
}

/* Amber with black text: the live site's primary button, unchanged. */
.auth-btn-primary {
    background: var(--ccm-amber);
    color: var(--ccm-ink);
    margin-top: 14px;
}

.auth-btn-primary:hover { filter: brightness(.94); }

/* On the red overlay a filled button would fight the ground, so the ghost
   variant borrows the white it already sits on. */
.auth-btn-ghost {
    background: transparent;
    border: 1px solid var(--ccm-bg);
    color: var(--ccm-bg);
}

.auth-btn-ghost:hover { background: var(--ccm-bg); color: var(--ccm-red); }

/* --- Links ---------------------------------------------------------------- */

.auth-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--ccm-body);
    text-decoration: none;
}

.auth-link:hover { color: var(--ccm-red); text-decoration: underline; }

/* Back to website — the way out for someone who only wanted to look. */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ccm-body);
    text-decoration: none;
}

.auth-back:hover { color: var(--ccm-red); }
.auth-back svg { width: 13px; height: 13px; }

/* The same link on the overlay side, where the ground is red. */
.auth-overlay .auth-back { color: var(--ccm-bg); opacity: .92; }
.auth-overlay .auth-back:hover { color: var(--ccm-bg); opacity: 1; text-decoration: underline; }

/* --- Alerts --------------------------------------------------------------- */

.auth-alert {
    width: 100%;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 12.5px;
    margin-bottom: 12px;
    text-align: left;
}

.auth-alert-error { background: var(--ccm-mint); border-left: 3px solid var(--ccm-red); color: var(--ccm-ink); }
.auth-alert-ok    { background: var(--ccm-mint); border-left: 3px solid var(--ccm-amber); color: var(--ccm-ink); }

/* --- Sign-up needs the taller side ---------------------------------------- */

.auth-shell.is-register { min-height: 620px; }
.auth-shell.is-register .auth-form-pane { left: 50%; }
.auth-shell.is-register .auth-overlay { right: auto; left: 0; }

/* --- Small screens: stack, drop the overlay to a footer ------------------- */

@media (max-width: 760px) {
    .auth-shell,
    .auth-shell.is-register { min-height: 0; }

    .auth-pane,
    .auth-shell.is-register .auth-form-pane {
        position: static;
        width: 100%;
        padding: 32px 24px;
    }

    .auth-overlay,
    .auth-shell.is-register .auth-overlay {
        position: static;
        width: 100%;
        padding: 30px 24px;
    }

    .auth-overlay h2 { font-size: 24px; }
}
/* =============================================================================
   Password reveal
   -----------------------------------------------------------------------------
   A password nobody can read is a password typed wrong, especially on a phone
   keyboard. The toggle is a real <button> so it is reachable by keyboard, and
   it never submits the form.
   ========================================================================== */

.password-field { position: relative; display: block; }

.password-field input { width: 100%; padding-right: 44px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--ccm-muted);
    cursor: pointer;
}

.password-toggle:hover { color: var(--ccm-ink); }
.password-toggle:focus-visible { outline: 2px solid var(--ccm-link); outline-offset: 1px; }
.password-toggle svg { width: 19px; height: 19px; }

/* Two icons, one shown at a time — swapped by the button's aria-pressed state,
   so the visual and the announced state cannot drift apart. */
.password-toggle .icon-hide { display: none; }
.password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: block; }

/* -----------------------------------------------------------------------------
   [hidden] must actually hide.
   -----------------------------------------------------------------------------
   Any rule that sets `display` on an element beats the browser's built-in
   `[hidden] { display: none }`, because that default has the lowest possible
   precedence. `.add-live { display: flex }` therefore showed every quantity
   stepper on every product at once, whether the shopper had added it or not.
   This one line makes the attribute mean what it says, everywhere.
   -------------------------------------------------------------------------- */
[hidden] { display: none !important; }
