/*
 * The personal account dashboard (Замовлення/Профіль/Безпека), per the
 * Figma `AccountPage.tsx` design — reuses dehai-common's design tokens
 * (--ink/--paper/--line/--muted/--accent/--surface/--radius-*) and its
 * `.auth-form__field`/`.auth-form__error` classes for form fields, rather
 * than duplicating a second input style.
 */

/* `.account-page` deliberately carries no width or padding of its own. The
   plugin renders inside dehai-common's `.site-content`, which already caps
   the page at 1280px and pads it — repeating that here made the dashboard
   32px narrower than the catalog at every viewport. */

.account-page__breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 1.5rem;
}

.account-page__breadcrumb a {
    color: var(--muted);
}

.account-page__breadcrumb a:hover {
    color: var(--ink);
}

.account-page__breadcrumb-current {
    color: var(--ink);
    font-weight: 500;
}

/* ── User banner ───────────────────────────────────────────────── */

.account-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--ink);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.account-banner__identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.account-banner__identity .account-avatar {
    background: rgba(248, 245, 240, 0.15);
    color: var(--paper);
}

.account-banner__name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--paper);
    margin: 0;
    line-height: 1.2;
}

.account-banner__email {
    font-size: 0.875rem;
    color: rgba(248, 245, 240, 0.5);
    margin: 0.125rem 0 0;
}

.account-banner__joined {
    font-size: 0.75rem;
    color: rgba(248, 245, 240, 0.3);
    margin: 0.125rem 0 0;
}

.account-banner__logout button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(248, 245, 240, 0.2);
    border-radius: var(--radius-lg);
    background: transparent;
    color: rgba(248, 245, 240, 0.6);
    font-size: 0.875rem;
    font-weight: 500;
}

.account-banner__logout button:hover {
    border-color: rgba(248, 245, 240, 0.5);
    color: var(--paper);
}

.account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-display);
}

.account-avatar--lg {
    width: 4rem;
    height: 4rem;
    font-size: 1.125rem;
}

/* ── Layout: sidebar tabs + content ───────────────────────────────── */

.account-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .account-layout {
        grid-template-columns: 1fr;
    }
}

/* A `1fr` track's automatic minimum is its content's min-content width, and
   an order line's title is `white-space: nowrap` so it can end in an
   ellipsis — so the grid sized itself to the longest product name and took
   the page about 100px past a phone's viewport, scrollbar and all. */
.account-layout > * {
    min-width: 0;
}

.account-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

@media (max-width: 900px) {
    .account-tabs {
        flex-direction: row;
        overflow-x: auto;
    }
}

.account-tabs__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    text-align: left;
}

.account-tabs__item:hover {
    color: var(--ink);
    background: var(--surface-2);
}

.account-tabs__item.is-active {
    background: var(--ink);
    color: var(--paper);
}

/* ── Overview: the sections as cards ──────────────────────────────── */

.account-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.account-sections__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--paper);
    color: var(--ink);
    font-size: 0.9375rem;
    font-weight: 500;
}

.account-sections__card:hover {
    border-color: var(--ink);
}

.account-sections__chevron {
    color: var(--muted);
}

.account-content__heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.25rem;
    color: var(--ink);
    margin: 0 0 1.5rem;
}

.account-panel {
    display: none;
}

.account-panel.is-active {
    display: block;
}

/* ── Orders (empty state) ─────────────────────────────────────────── */

.account-orders-empty {
    padding: 4rem 1.5rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
}

.account-orders-empty__icon {
    font-size: 1.75rem;
    margin: 0 0 0.75rem;
}

.account-orders-empty__text {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}

.account-orders-empty__cta {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}

.account-orders-empty__cta:hover {
    background: var(--accent-dark);
}

/* ── Profile / Security forms ─────────────────────────────────────── */

.account-form,
.account-security {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.account-form__identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}

.account-form__identity-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.account-form__identity-email {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0.125rem 0 0;
}

.account-form__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .account-form__grid {
        grid-template-columns: 1fr;
    }
}

.account-form__readonly {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--muted);
    cursor: not-allowed;
}

.account-form__submit {
    align-self: flex-start;
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}

.account-form__submit:hover {
    background: var(--accent-dark);
}

.account-form__submit.is-saved {
    background: #10b981;
}

/* Security tab reuses .account-form's own card styling for its top
   (password) block, wrapped again in its own .account-security card so
   the "danger zone" below can sit inside the same bordered container,
   separated by a rule — matching the Figma source's single-card layout. */
.account-security__subheading {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.account-security__success {
    font-size: 0.8125rem;
    color: #10b981;
    margin: 0;
}

.account-security__danger {
    border-top: 1px solid var(--line);
    padding-top: 1.25rem;
    margin-top: 0.5rem;
}

.account-security__danger-text {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0.25rem 0 0.75rem;
}

.account-security__danger-button {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.account-security__danger-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Logged-out guard / deleted confirmation ──────────────────────── */

.account-guard {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 1rem;
}

.account-guard__text {
    color: var(--muted);
    margin: 0;
}

.account-guard__button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}

.account-guard__button:hover {
    background: var(--accent-dark);
}
