/*
 * Customer account: the sign-in screen and the profile.
 *
 * Separate file for now because the main stylesheet is being edited in
 * parallel; nothing here depends on being separate, only on the tokens
 * storefront.css defines. Fold it in once that settles.
 */

/* Sign in / register ----------------------------------------------------- */

.client-auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
    gap: 48px;
    align-items: start;
    padding-block: 36px 72px;
}

/* Inside the account page the shell above already carries the page spacing. */
.client-auth--inline { padding-block: 0; }

/*
 * The pitch is a card now, not loose text. The heading and lead moved up into
 * the page masthead, and what is left — three reasons and a way out for
 * someone who only wants to track a parcel — read as a stray paragraph beside
 * a bordered form until it got a surface of its own.
 */
.client-auth__intro {
    border: none;
    border-radius: var(--client-radius);
    background: linear-gradient(160deg, var(--client-surface) 0%, var(--client-soft) 100%);
    padding: 24px;
}

.client-auth__perks-title { font-size: 17px; margin: 0 0 16px; }

.client-auth__perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }

.client-auth__aside {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--client-line);
    font-size: 13.5px;
    color: var(--client-muted);
}

.client-auth__aside a { color: var(--client-accent); font-weight: 600; }

.client-auth__perks li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #46464e;
}

.client-auth__perks svg { flex: 0 0 auto; color: var(--client-accent); margin-top: 2px; }

.client-auth__panels {
    border: none;
    border-radius: var(--client-radius);
    background: var(--client-surface);
    box-shadow: none;
    overflow: hidden;
}

.client-auth__tabs {
    display: flex;
    border-bottom: 1px solid var(--client-line);
    padding: 1px 24px;
}

.client-auth__tab {
    flex: 1;
    padding: 16px 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--client-muted);
    cursor: pointer;
    margin-bottom: -1px;
}

.client-auth__tab.is-active { color: var(--client-accent); border-bottom-color: var(--client-accent); }
.client-auth__tab:hover { color: var(--client-ink); }

.client-auth__panel { padding: 24px; }

/*
 * The gradient CTA.
 *
 * Both stops come from --client-accent, which the shop sets from its own
 * settings, so the button follows a re-branded storefront instead of being
 * pinned to one pair of pinks. The light stop is mixed against white for the
 * same reason, and the mix is the only knob: lower it for a paler left end.
 *
 * 80% and not lower. The label is 14px at weight 600, so WCAG wants 4.5:1
 * against what is behind it, and the left stop is the palest point the text
 * ever crosses: at 80% white measures 4.69:1 there, 5.4:1 under the label and
 * 6.5:1 at the right. 78% looked fine sampled a couple of pixels in and was
 * 4.49:1 at the stop itself, which is why AccountAuthEntryTest recomputes the
 * ratio from this number rather than trusting a screenshot.
 *
 * The reference this copies starts from a much paler pink, where white
 * measures nearer 2.8:1 — readable-looking in a mockup, not on a screen.
 *
 * background-color first: where color-mix() is unsupported the gradient
 * declaration is dropped whole and the flat accent shows through, which is the
 * button's own hover colour and needs no separate fallback.
 */
.client-btn--gradient {
    --client-btn-gradient-mix: 80%;
    --client-btn-gradient: linear-gradient(
        103deg,
        color-mix(in srgb, var(--client-accent) var(--client-btn-gradient-mix), #fff) 0%,
        var(--client-accent) 100%
    );
    background-color: var(--client-accent);
    background-image: var(--client-btn-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(179, 25, 92, .22);
    transition: filter .16s ease, box-shadow .16s ease;
}

/*
 * Restated on hover because .client-btn:hover sets the `background`
 * shorthand, which resets background-image to none and would drop the
 * gradient at the moment the pointer arrives. The lift is a filter, which
 * animates; swapping one background-image for another would not.
 */
.client-btn--gradient:hover {
    background-color: var(--client-accent);
    background-image: var(--client-btn-gradient);
    color: #fff;
    filter: saturate(1.06) brightness(.95);
    box-shadow: 0 8px 22px rgba(179, 25, 92, .3);
}

.client-btn--gradient:active { filter: brightness(.92); box-shadow: none; }
.client-auth__forgot { margin-top: 16px; text-align: center; }

/* Profile ---------------------------------------------------------------- */

.client-account { padding-block: 28px 72px; }

.client-account__body {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.client-account__nav {
    border: 1px solid var(--client-line);
    border-radius: var(--client-radius);
    background: var(--client-surface);
    padding: 18px;
    /* Stays with the reader while a long order list scrolls past. */
    position: sticky;
    top: 96px;
}

.client-account__who {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--client-line);
}

.client-account__avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--client-accent-soft);
    color: var(--client-accent-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
}

.client-account__who strong { display: block; font-size: 15px; }

.client-account__email {
    display: block;
    font-size: 13px;
    color: var(--client-muted);
    /* An email is long and the column is not. */
    overflow-wrap: anywhere;
}

.client-account__menu { display: grid; gap: 2px; margin-bottom: 16px; }

.client-account__link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--client-ink);
    text-align: left;
    cursor: pointer;
}

.client-account__link:hover { background: var(--client-soft); }

.client-account__link.is-active {
    background: var(--client-accent-soft);
    color: var(--client-accent-ink);
}

.client-account__link svg { flex: 0 0 auto; opacity: .8; }

.client-account__count {
    margin-left: auto;
    min-width: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--client-accent);
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
}

.client-account__subtitle {
    font-size: 15px;
    margin: 26px 0 4px;
    padding-top: 20px;
    border-top: 1px solid var(--client-line);
}

/* Addresses -------------------------------------------------------------- */

.client-addresses {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.client-address {
    border: 1px solid var(--client-line);
    border-radius: 12px;
    padding: 14px 16px;
}

.client-address__head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; flex-wrap: wrap; }
.client-address p { margin: 0 0 4px; }
.client-address__actions { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }

/* Saved products -------------------------------------------------------- */

.client-wish__remove { margin-top: 10px; width: 100%; }

/* Orders ---------------------------------------------------------------- */

.client-orders { display: grid; gap: 14px; margin-top: 14px; }

.client-order {
    border: 1px solid var(--client-line);
    border-radius: 12px;
    padding: 16px;
}

.client-order__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.client-order__status { display: flex; gap: 6px; flex-wrap: wrap; }

.client-order__items {
    list-style: none;
    margin: 0;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--client-line);
    font-size: 15px;
}

.client-order__items li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }

.client-order__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    font-weight: 700;
    flex-wrap: wrap;
}

/* Responsive ------------------------------------------------------------ */

@media (max-width: 1024px) {
    .client-auth { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    /* The pitch belongs under the form once they stack: the shopper came to
       sign in, not to read why they should. */
    .client-auth__intro { order: 2; }
    .client-auth__panels { order: 1; }

    .client-account__body { grid-template-columns: minmax(0, 1fr); }

    .client-account__nav { position: static; }

    /* A row of pills reads better than a tall stack above the content. */
    .client-account__menu { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
    .client-account__link { justify-content: center; padding: 10px 6px; }
    .client-account__link span:not(.client-account__count) { display: none; }
}

/* Voucher offers (checkout) ---------------------------------------------- */

/*
 * The codes the shop is running, listed on the checkout screen.
 *
 * Bounded and scrolled on purpose. The server puts the usable codes first, so
 * the box opens on what this order can actually have, and the ones it cannot
 * are a scroll away rather than a wall between the customer and the pay
 * button. Unlike the catalogue sidebar, the scrollbar here is left visible: it
 * is the only thing saying there is more below.
 */
.client-vouchers {
    margin-top: 14px;
    border: 1px solid var(--client-line);
    border-radius: var(--client-radius);
    background: var(--client-soft);
    padding: 12px 12px 4px;
}

.client-vouchers__lead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 2px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--client-ink);
}

.client-vouchers__hint { font-weight: 400; color: var(--client-muted); }

.client-vouchers__list {
    list-style: none;
    margin: 0;
    padding: 0 4px 8px 0;
    display: grid;
    gap: 8px;
    /*
     * A fallback height only. checkout.js sizes the box to the usable rows
     * once they are drawn — the requirement is that the codes this order
     * qualifies for are on screen without scrolling, and how tall that is
     * depends on how many there are.
     */
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--client-line) transparent;
}

.client-vouchers__list::-webkit-scrollbar { width: 8px; }
.client-vouchers__list::-webkit-scrollbar-track { background: transparent; }

.client-vouchers__list::-webkit-scrollbar-thumb {
    background: var(--client-line);
    border-radius: 999px;
}

/*
 * A container query, not a viewport one: this list lives in the checkout
 * summary column, which is about 300px wide on a desktop and the full width of
 * a phone. The row has to answer to the column it is in rather than to the
 * window, or the desktop case — the narrower of the two — is the one that
 * breaks.
 */
.client-vouchers__list { container-type: inline-size; }

.client-voucher {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--client-line);
    border-radius: 10px;
    background: var(--client-surface);
}

.client-voucher__main { min-width: 0; flex: 1; }

/*
 * Only for a genuinely cramped placement. At the checkout column's ~300px the
 * button still fits beside a name allowed to wrap to two lines, and keeping it
 * there is what keeps a row short enough for two of them to be on screen at
 * once — which is the whole point of the ordering.
 */
@container (max-width: 250px) {
    .client-voucher { flex-wrap: wrap; align-items: flex-start; }
    .client-voucher__main { flex: 1 1 100%; }
    .client-voucher__use { width: 100%; margin-top: 4px; }
}

.client-voucher__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.client-voucher__code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--client-accent);
    /* A dashed edge is the shape of a coupon everywhere else, so it reads as
       one without a picture of a ticket. */
    border: 1px dashed var(--client-accent);
    border-radius: 6px;
    padding: 2px 7px;
}

.client-voucher__save { font-size: 13px; font-weight: 700; color: var(--client-ink); }

.client-voucher__name {
    margin: 6px 0 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--client-ink);
    /* Two lines, then clipped: enough for any real promotion name, and a
       bounded row height keeps the list's own scroll predictable. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.client-voucher__note { margin: 3px 0 0; font-size: 12px; color: var(--client-muted); }

.client-voucher__use { flex: 0 0 auto; }

/*
 * A code that cannot be used yet. Dimmed rather than hidden — "mua thêm
 * 40.000 ₫" is a reason to add something to the basket, and a code that has
 * run out of uses is at least an answer.
 */
.client-voucher.is-locked {
    background: transparent;
    border-style: dashed;
}

.client-voucher.is-locked .client-voucher__code {
    color: var(--client-muted);
    border-color: var(--client-line);
}

.client-voucher.is-locked .client-voucher__save,
.client-voucher.is-locked .client-voucher__name { color: var(--client-muted); }

/* The reason reads as the row's own line once the button is gone. */
.client-voucher.is-locked .client-voucher__note { color: var(--client-accent-ink); opacity: .75; }
