/* =========================================================
   HBS Garage · Account-Menü
   ========================================================= */

.account-menu {
    position: relative;
    flex: 0 0 auto;
}

.account-menu .nav-profile {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + .7rem);
    right: 0;
    z-index: 2200;

    width: min(340px, calc(100vw - 2rem));
    display: none;
    overflow: hidden;

    border: 1px solid var(--color-border);
    border-radius: 18px;

    background: #fff;

    box-shadow:
        0 22px 55px rgba(24, 48, 32, .16);
}

.account-menu-panel.is-open {
    display: block;
}

.account-menu-header {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .75rem;
    align-items: center;

    padding: .95rem;

    border-bottom: 1px solid var(--color-border);

    background:
        linear-gradient(
            135deg,
            rgba(246, 248, 242, .96),
            rgba(255, 255, 255, .98)
        );
}

.account-menu-avatar {
    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;
    overflow: hidden;

    border-radius: 50%;

    background: var(--color-primary-dark);
    color: #fff;

    font-size: 1rem;
    font-weight: 850;
}

.account-menu-avatar img,
.nav-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-menu-user {
    min-width: 0;
    display: grid;
}

.account-menu-user strong {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: .88rem;
}

.account-menu-user small {
    margin-top: .12rem;

    color: var(--color-text-muted);

    font-size: .7rem;
}

.account-menu-links {
    display: grid;
    padding: .45rem;
}

.account-menu-links a {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: .65rem;
    align-items: center;

    padding: .68rem .7rem;

    border-radius: 12px;

    color: var(--color-text);
    text-decoration: none;
}

.account-menu-links a:hover {
    background: var(--color-surface-muted);
}

.account-menu-icon {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background: var(--color-primary-light);

    font-size: .9rem;
}

.account-menu-links a > span:last-child {
    min-width: 0;
    display: grid;
}

.account-menu-links strong {
    font-size: .78rem;
}

.account-menu-links small {
    margin-top: .08rem;

    color: var(--color-text-muted);

    font-size: .64rem;
    line-height: 1.35;
}

.account-menu-divider {
    height: 1px;

    margin: .3rem .65rem;

    background: var(--color-border);
}

.account-menu-logout {
    display: flex;
    align-items: center;
    gap: .5rem;

    margin: 0 .45rem .45rem;
    padding: .72rem;

    border-top: 1px solid var(--color-border);

    color: #8a3333;

    text-decoration: none;

    font-size: .74rem;
    font-weight: 800;
}

.account-menu-logout:hover {
    border-radius: 10px;
    background: #fff5f5;
}


/* =========================================================
   Mobile Account Sheet
   ========================================================= */

.mobile-account-backdrop,
.mobile-account-sheet {
    display: none;
}

@media (max-width: 860px) {
    .desktop-account-menu {
        display: none;
    }

    .mobile-account-backdrop {
        position: fixed;
        inset: 0;
        z-index: 3000;

        display: block;

        border: 0;

        background: rgba(20, 28, 22, .34);

        opacity: 0;
        pointer-events: none;

        transition: opacity 180ms ease;
    }

    .mobile-account-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-account-sheet {
        position: fixed;

        right: .75rem;
        bottom: calc(
            var(--mobile-nav-height, 78px)
            + env(safe-area-inset-bottom)
            + .7rem
        );
        left: .75rem;

        z-index: 3010;

        display: block;

        overflow-x: hidden;
        overflow-y: auto;

        max-height: min(72vh, 560px);

        border: 1px solid var(--color-border);
        border-radius: 22px;

        background: #fff;

        box-shadow:
            0 24px 65px rgba(24, 48, 32, .22);

        transform: translateY(calc(100% + 2rem));
        opacity: 0;
        pointer-events: none;

        transition:
            transform 200ms ease,
            opacity 180ms ease;
    }

    .mobile-account-sheet.is-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-account-handle {
        width: 42px;
        height: 4px;

        margin: .55rem auto .15rem;

        border-radius: 999px;

        background: var(--color-border-strong);
    }

    .mobile-account-sheet .account-menu-header {
        padding-top: .65rem;
    }

    .mobile-account-sheet .account-menu-links {
        padding: .55rem;
    }

    .mobile-account-sheet .account-menu-links a {
        min-height: 58px;
    }

    .mobile-account-sheet .account-menu-logout {
        min-height: 48px;

        margin-bottom:
            max(.55rem, env(safe-area-inset-bottom));
    }
}
