/* 
 * BuddyUp Mobile Navigation Styles
 * Facebook-style bottom navigation + shelf menu drawer.
 */

/* Mobile navigation variables */
:root {
    --buddyup-mobile-nav-height: 68px;
    --buddyup-mobile-header-height: 56px;
    --buddyup-mobile-safe-top: env(safe-area-inset-top, 0px);
    --buddyup-mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
    --buddyup-mobile-nav-offset: 0px;
    --buddyup-mobile-usable-vh: 100dvh;
    --buddyup-shelf-width: calc(100% - 10%);
    --buddyup-nav-bg: #ffffff;
    --buddyup-nav-border: #e0e0e0;
    --buddyup-nav-active: var(--primary-color, #D93F0c);
    --buddyup-nav-inactive: #999999;
}

/*
   BOTTOM NAVIGATION BAR (Mobile)
*/

.buddyup-mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--buddyup-mobile-nav-height) + var(--buddyup-mobile-safe-bottom));
    padding-bottom: var(--buddyup-mobile-safe-bottom);
    background: var(--buddyup-nav-bg);
    border-top: 1px solid var(--buddyup-nav-border);
    display: none;
    flex-direction: row;
    align-items: stretch;
    z-index: 10000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    transition: none !important;
    transform: translateZ(0);
    will-change: transform;
}

@media only screen and (max-width: 1024px) {
    .buddyup-mobile-bottom-nav {
        display: flex;
    }
}

.buddyup-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--buddyup-nav-inactive);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.08 !important;
    padding: 6px 4px 5px;
    position: relative;
    transition: color 0.2s ease;
}

.buddyup-nav-item[data-buddyup-open-chats="1"] {
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    margin: 0;
}

.buddyup-mobile-bottom-nav .buddyup-auth-logged-out-only {
    min-height: 100%;
}

.buddyup-nav-tray-toggle {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: var(--buddyup-nav-inactive);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.08 !important;
    padding: 6px 4px 5px;
    cursor: pointer;
    position: relative;
    margin: 0;
    transition: color 0.2s ease;
}

.buddyup-nav-tray-toggle span {
    text-align: center;
    font-size: 0.7rem;
    line-height: 1.08 !important;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddyup-nav-tray-toggle:hover,
.buddyup-nav-tray-toggle[aria-expanded="true"] {
    color: var(--buddyup-nav-active);
}

.buddyup-nav-tray-toggle i {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform .2s ease;
}

.buddyup-nav-tray-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.buddyup-nav-item:hover,
.buddyup-nav-item.active {
    color: var(--buddyup-nav-active);
}

.buddyup-nav-item i {
    font-size: 1.2rem;
    line-height: 1;
}

.buddyup-nav-item.buddyup-nav-chats {
    position: relative;
}

.buddyup-nav-account .buddyup-nav-avatar-wrap {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    background: #e0e0e0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.14);
}

.buddyup-nav-account .buddyup-nav-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.buddyup-nav-item span {
    text-align: center;
    font-size: 0.7rem;
    line-height: 1.08 !important;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddyup-notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #ff0000;
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.buddyup-chat-badge {
    position: absolute;
    top: 7px;
    right: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #ff3434;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/*
   TOP MOBILE HEADER
*/

.buddyup-mobile-top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--buddyup-mobile-header-height) + var(--buddyup-mobile-safe-top));
    background: var(--buddyup-nav-bg);
    border-bottom: 1px solid var(--buddyup-nav-border);
    display: none;
    grid-template-columns: minmax(92px, auto) 1fr minmax(92px, auto);
    align-items: center;
    padding: var(--buddyup-mobile-safe-top) 12px 0 12px;
    z-index: 101;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media only screen and (max-width: 1024px) {
    .buddyup-mobile-top-header {
        display: flex;
    }
}

.buddyup-shelf-toggle,
.buddyup-header-action {
    background: none;
    border: none;
    color: var(--buddyup-nav-inactive);
    font-size: 1.25rem;
    padding: 8px 12px;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.buddyup-top-left-link,
.buddyup-mobile-notif-button {
    background: none;
    border: none;
    color: var(--buddyup-nav-inactive);
    font-size: .94rem;
    padding: 8px 10px;
    cursor: pointer;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 0;
    text-decoration: none;
    font-weight: 700;
    min-height: 44px;
}

.buddyup-top-left-link:hover,
.buddyup-top-left-link:focus,
.buddyup-mobile-notif-button:hover,
.buddyup-mobile-notif-button:focus {
    color: var(--buddyup-nav-active);
}

.buddyup-header-auth-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.buddyup-header-auth-link {
    font-size: 0.72rem;
    font-weight: 700;
    color: #555;
    text-decoration: none;
    border: 1px solid var(--buddyup-nav-border);
    border-radius: 999px;
    padding: 4px 8px;
    line-height: 1.2;
}

.buddyup-header-auth-link-primary {
    background: var(--primary-color, #D93F0c);
    border-color: var(--primary-color, #D93F0c);
    color: #fff;
}

.buddyup-shelf-toggle:hover,
.buddyup-header-action:hover {
    color: var(--buddyup-nav-active);
}

.buddyup-header-branding {
    flex: 1;
    text-align: center;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color, #D93F0c);
}

.buddyup-mobile-notif-wrap {
    position: relative;
    justify-self: end;
}

.buddyup-mobile-notif-button {
    position: relative;
    min-width: 44px;
}

.buddyup-mobile-notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #ff3434;
    color: #fff;
    font-size: .58rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.buddyup-mobile-notif-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(78vw, 290px);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 12px;
    box-shadow: 0 14px 26px rgba(0, 0, 0, .16);
    padding: .55rem .62rem;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 1002;
}

.buddyup-mobile-notif-popup.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.buddyup-mobile-notif-popup-title {
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .4rem;
    color: #385a87;
}

.buddyup-mobile-notif-content {
    display: grid;
    gap: .35rem;
}

.buddyup-mobile-notif-item {
    font-size: .83rem;
    line-height: 1.25;
    color: #2b2b2b;
    padding: .28rem .2rem;
    border-radius: 8px;
    background: rgba(244, 247, 251, .8);
}

.buddyup-mobile-notif-link {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .45rem;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
    width: 100%;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.buddyup-mobile-notif-link:hover,
.buddyup-mobile-notif-link:focus-visible {
    background: rgba(33, 93, 160, .12);
    color: inherit;
}

.buddyup-mobile-notif-link .fa-chevron-right {
    font-size: .68rem;
    opacity: .55;
}

.buddyup-mobile-notif-empty {
    font-size: .82rem;
    opacity: .84;
    padding: .15rem .1rem;
}

.buddyup-logo {
    letter-spacing: 0.5px;
}

.buddyup-header-branding .custom-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.buddyup-header-branding .custom-logo {
    max-height: 36px;
    width: auto;
    display: block;
}

/*
   SHELF DRAWER MENU
*/

.buddyup-shelf-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--buddyup-mobile-nav-height) + var(--buddyup-mobile-safe-bottom));
    top: auto;
    width: 100%;
    background: #ffffff;
    z-index: 9999;
    transform: translateY(calc(100% + 4px));
    transition: transform 0.28s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 16px 16px 0 0;
    /* No shadow when hidden — prevents bleed above the nav bar */
    box-shadow: none;
    pointer-events: none;
}

.buddyup-shelf-menu.open {
    transform: translateY(0);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
}

.buddyup-shelf-overlay {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.buddyup-shelf-menu.open ~ .buddyup-shelf-overlay,
.buddyup-shelf-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.buddyup-shelf-content {
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(70dvh - 60px);
}

.buddyup-shelf-footer {
    flex: 0 0 auto;
    background: #fff;
    padding-bottom: calc(var(--buddyup-mobile-safe-bottom) + 6px);
}

.buddyup-shelf-footer .buddyup-shelf-divider {
    margin: 0;
}

.buddyup-shelf-close {
    align-self: flex-end;
    margin-right: 12px;
    margin-bottom: 8px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--buddyup-nav-inactive);
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.buddyup-shelf-close:hover {
    color: var(--buddyup-nav-active);
}

/* Profile Section */
.buddyup-shelf-profile {
    padding: 0 12px 16px 12px;
    border-bottom: 1px solid var(--buddyup-nav-border);
}

.buddyup-shelf-profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 8px;
    border-radius: var(--buddyup-control-radius);
    transition: background 0.2s ease;
}

.buddyup-shelf-profile-link:hover {
    background: var(--buddyup-background);
}

.buddyup-shelf-profile-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #e0e0e0;
}

.buddyup-shelf-profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.buddyup-shelf-profile-info {
    flex: 1;
}

.buddyup-shelf-profile-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #000;
    margin-bottom: 2px;
}

.buddyup-shelf-profile-label {
    font-size: 0.75rem;
    color: var(--buddyup-nav-inactive);
}

@keyframes buddyup-skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-name,
.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-label {
    color: transparent;
    position: relative;
    overflow: hidden;
    border-radius: 999px;
    line-height: 1.2;
}

.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-name {
    min-height: 16px;
    width: 72%;
    margin-bottom: 6px;
}

.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-label {
    min-height: 12px;
    width: 48%;
}

.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-name::after,
.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-label::after,
.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #ececec 0%, #f7f7f7 50%, #ececec 100%);
    background-size: 200% 100%;
    animation: buddyup-skeleton-shimmer 1.2s ease-in-out infinite;
}

.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-image {
    position: relative;
}

.buddyup-shelf-profile.is-loading .buddyup-shelf-profile-image img {
    opacity: 0;
}

/* Auth state visibility toggles */
.buddyup-auth-logged-out-only {
    display: none !important;
}

html[data-buddyup-auth="1"] .buddyup-auth-logged-out-only {
    display: none !important;
}

html[data-buddyup-auth="0"] .buddyup-auth-logged-in-only {
    display: none !important;
}

html[data-buddyup-auth="0"] .buddyup-auth-logged-out-only {
    display: block !important;
}

html[data-buddyup-auth="0"] .buddyup-mobile-bottom-nav .buddyup-auth-logged-out-only {
    display: flex !important;
}

/* Signed-out shelf actions */
.buddyup-shelf-auth-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 8px;
}

.buddyup-shelf-auth-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: #000;
    border: 1px solid var(--buddyup-nav-border);
    border-radius: var(--buddyup-control-radius);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    background: #fff;
}

.buddyup-shelf-auth-link-primary {
    background: var(--primary-color, #D93F0c);
    color: #fff;
    border-color: var(--primary-color, #D93F0c);
}

/* Grid Section — matches bottom nav item style exactly */
.buddyup-shelf-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    padding: 8px 4px 4px;
}

.buddyup-shelf-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 2px 6px;
    text-decoration: none;
    color: var(--buddyup-nav-inactive);
    background: none;
    border-radius: 0;
    transition: color 0.2s ease;
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
}

.buddyup-shelf-grid-item:hover {
    color: var(--buddyup-nav-active);
    background: none;
}

.buddyup-shelf-grid-item i {
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
}

.buddyup-shelf-grid-item span {
    font-size: 0.7rem;
    line-height: 1.08;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddyup-shelf-grid-item-full {
    grid-column: 1 / -1;
}

.buddyup-shelf-grid.is-loading {
    pointer-events: none;
}

.buddyup-shelf-grid.is-loading .buddyup-shelf-grid-item {
    position: relative;
    overflow: hidden;
    color: transparent;
}

.buddyup-shelf-grid.is-loading .buddyup-shelf-grid-item i,
.buddyup-shelf-grid.is-loading .buddyup-shelf-grid-item span {
    opacity: 0;
}

.buddyup-shelf-grid.is-loading .buddyup-shelf-grid-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #ececec 0%, #f7f7f7 50%, #ececec 100%);
    background-size: 200% 100%;
    animation: buddyup-skeleton-shimmer 1.2s ease-in-out infinite;
}

/* Support Section */
.buddyup-shelf-divider {
    height: 1px;
    background: var(--buddyup-nav-border);
    margin: 8px 0;
}

.buddyup-shelf-events,
.buddyup-shelf-groups {
    padding: 8px 0;
}

.buddyup-shelf-quick-header {
    padding: 0 16px 6px 16px;
}

.buddyup-shelf-quick-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--buddyup-nav-inactive);
    text-decoration: none;
}

.buddyup-shelf-quick-list {
    display: flex;
    flex-direction: column;
}

.buddyup-shelf-quick-item {
    font-size: 0.85rem;
}

.buddyup-shelf-quick-empty {
    margin: 0;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--buddyup-nav-inactive);
}

.buddyup-shelf-quick-loading {
    padding: 0 16px 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.buddyup-shelf-quick-loading-row {
    display: block;
    width: 100%;
    height: 16px;
    border-radius: 999px;
    position: relative;
    overflow: hidden;
}

.buddyup-shelf-quick-loading-row::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #ececec 0%, #f7f7f7 50%, #ececec 100%);
    background-size: 200% 100%;
    animation: buddyup-skeleton-shimmer 1.2s ease-in-out infinite;
}

.buddyup-shelf-support {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.buddyup-shelf-support-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #000;
    transition: background 0.2s ease;
    font-size: 0.9rem;
}

.buddyup-shelf-support-item:hover {
    background: var(--buddyup-background);
}

.buddyup-shelf-support-item i {
    font-size: 1.1rem;
    color: var(--buddyup-nav-inactive);
    min-width: 24px;
    text-align: center;
}

/* Logout Button */
.buddyup-shelf-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
    padding: 12px 16px;
    width: 100%;
    background: #fff;
    border: none;
    color: #000;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease;
    border-radius: 0;
}

.buddyup-shelf-logout:hover {
    background: var(--buddyup-background);
}

.buddyup-shelf-logout i {
    font-size: 1.1rem;
    color: var(--buddyup-nav-inactive);
}

/*
   BODY/CONTENT ADJUSTMENTS FOR MOBILE
*/

@media only screen and (max-width: 1024px) {
    :root {
        --buddyup-mobile-nav-offset: calc(var(--buddyup-mobile-nav-height) + var(--buddyup-mobile-safe-bottom));
        --buddyup-mobile-usable-vh: calc(100dvh - var(--buddyup-mobile-nav-offset));
    }

    /* Add padding to body to account for fixed headers/footers */
    body.buddyup-mobile-nav-active {
        overflow: hidden;
    }

    /* Bottom nav Chats tab handles chat on mobile — hide the floating bubble toggle */
    #buddyUpChatSidebar .buddyUpChatSidebarToggle {
        display: none !important;
    }

    #buddyUpChatSidebar {
        z-index: 9999;
    }

    #buddyUpChatSidebar .buddyUpChatSidebarPanel {
        top: auto !important;
        bottom: calc(var(--buddyup-mobile-nav-offset) + 8px) !important;
        height: calc(100dvh - var(--buddyup-mobile-header-height) - var(--buddyup-mobile-safe-top) - var(--buddyup-mobile-nav-offset) - 24px) !important;
        max-height: calc(100dvh - var(--buddyup-mobile-header-height) - var(--buddyup-mobile-safe-top) - var(--buddyup-mobile-nav-offset) - 24px) !important;
        border-radius: 16px 16px 0 0;
    }

    #buddyUpChatSidebarScrim {
        bottom: calc(var(--buddyup-mobile-nav-offset) + 8px);
        z-index: 9998;
    }

    body.buddyUpChatSidebarOpen > .buddyup-mobile-nav-tray {
        transform: translateZ(0);
    }
    
    /* Size content between fixed top header and bottom nav to avoid empty-page overflow */
    html,
    body {
        min-height: var(--buddyup-mobile-usable-vh, 100dvh);
        height: auto;
        max-height: none;
    }

    .pageContent {
        min-height: calc(100dvh - var(--buddyup-mobile-header-height) - var(--buddyup-mobile-nav-offset) - var(--buddyup-mobile-safe-top));
        height: auto;
        max-height: none;
    }

    body:not(.buddyup-home-onboarding-active) {
        padding-top: calc(var(--buddyup-mobile-header-height) + var(--buddyup-mobile-safe-top));
        padding-bottom: calc(var(--buddyup-mobile-nav-offset) + 14px);
    }

    .pageContent,
    .buddyUpPjaxContainer,
    .container,
    .buddyUpContainer {
        padding-bottom: calc(var(--buddyup-mobile-nav-offset) + 14px) !important;
    }

    body.buddyup-home-onboarding-active {
        padding-top: 0;
        padding-bottom: calc(var(--buddyup-mobile-nav-offset) + 14px);
    }

    body::before {
        content: '';
        display: block;
        width: 100%;
        height: calc(var(--buddyup-mobile-nav-offset) + 14px);
        pointer-events: none;
    }

    footer,
    .bottomFooterWrapper,
    .top-footer {
        display: none !important;
    }
    
    /* Keep account profile sidebar visible on mobile; hide other sidebars by default */
    #accountWrapper aside:not(#profileSidebar) {
        display: none;
    }

    #accountWrapper #profileSidebar {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0 12px;
        box-sizing: border-box;
    }

    #accountWrapper #profileSidebar .buddyUpElWrapper {
        margin: 0;
    }

    #accountWrapper #profileSidebar .imageWrapper {
        height: clamp(220px, 58vw, 340px);
        max-height: 340px;
    }

    #accountWrapper #profileSidebar .buddyUpProfileInfoWrapper {
        padding: 0 12px 14px;
    }

    #accountWrapper #profileSidebar #buddyUpUserNavigation {
        display: none;
    }

    #accountWrapper #profileSidebar #buddyUpUserNavigation > a,
    #accountWrapper #profileSidebar #buddyUpUserNavigation > button,
    #accountWrapper #profileSidebar #buddyUpUserNavigation > span {
        width: 100%;
        margin: 0;
    }

    #accountWrapper #profileSidebar #buddyUpUserNavigation > span > a {
        width: 100%;
    }

    #accountWrapper #profileSidebar #buddyUpUserNavigation .buddyUpUserNavigationViewSubscriptionTiers {
        left: 0;
        width: 100%;
        padding-left: .5rem;
    }

    #accountWrapper #accountInformation {
        width: 100%;
        max-width: 100%;
        margin-bottom: var(--buddyup-mobile-nav-offset);
    }
    
    /* Make main content full width on mobile */
    #accountWrapper {
        flex-direction: column;
    }
    
    #accountInformation {
        width: 100%;
    }
    
    /* Shelf menu should use dynamic viewport height */
    .buddyup-shelf-menu {
        max-height: min(76dvh, calc(100dvh - var(--buddyup-mobile-header-height) - var(--buddyup-mobile-safe-top) - var(--buddyup-mobile-nav-height) - var(--buddyup-mobile-safe-bottom) - 10px));
    }
}

@media only screen and (max-width: 480px) {
    #accountWrapper #profileSidebar {
        padding: 0 8px;
    }

    #accountWrapper #profileSidebar .imageWrapper {
        height: min(82vw, 300px);
    }

    #accountWrapper #profileSidebar #buddyUpUserNavigation {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/*
   EXPANDABLE BOTTOM TRAY
   The primary row and expanded grid are children of one fixed aside.
*/

.buddyup-mobile-nav-tray {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    background: var(--buddyup-nav-bg);
    border-top: 1px solid var(--buddyup-nav-border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.14);
    transform: translateZ(0);
}

.buddyup-nav-primary {
    order: 1;
    min-height: calc(var(--buddyup-mobile-nav-height) + var(--buddyup-mobile-safe-bottom));
    padding-bottom: var(--buddyup-mobile-safe-bottom);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    background: var(--buddyup-nav-bg);
}

.buddyup-nav-more {
    order: 2;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    background: var(--buddyup-nav-bg);
    transition: max-height 0.26s ease, opacity 0.18s ease, visibility 0s linear 0.26s;
}

.buddyup-nav-more.open {
    max-height: min(
        70dvh,
        calc(100dvh - var(--buddyup-mobile-header-height) - var(--buddyup-mobile-safe-top) - var(--buddyup-mobile-nav-height) - var(--buddyup-mobile-safe-bottom) - 12px)
    );
    overflow-y: auto;
    visibility: visible;
    opacity: 1;
    border-bottom: 1px solid var(--buddyup-nav-border);
    transition: max-height 0.26s ease, opacity 0.18s ease;
    -webkit-overflow-scrolling: touch;
}

.buddyup-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding: 10px 4px;
}

.buddyup-mobile-nav-tray .buddyup-nav-item {
    min-width: 0;
    min-height: 58px;
}

.buddyup-mobile-nav-tray .buddyup-auth-logged-out-only {
    display: none !important;
}

html[data-buddyup-auth="1"] .buddyup-mobile-nav-tray .buddyup-auth-logged-out-only {
    display: none !important;
}

html[data-buddyup-auth="0"] .buddyup-mobile-nav-tray .buddyup-auth-logged-in-only {
    display: none !important;
}

html[data-buddyup-auth="0"] .buddyup-mobile-nav-tray .buddyup-auth-logged-out-only {
    display: flex !important;
}

html[data-buddyup-auth="0"] .buddyup-nav-primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.buddyup-mobile-nav-tray .buddyup-nav-button {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.buddyup-mobile-nav-tray .buddyup-nav-button:hover,
.buddyup-mobile-nav-tray .buddyup-nav-button:focus,
.buddyup-mobile-nav-tray .buddyup-nav-button.active {
    color: var(--buddyup-nav-active);
    background: transparent;
}

.buddyup-mobile-nav-tray[data-expanded="true"] #buddyUpNavTrayToggle {
    color: var(--buddyup-nav-active);
}

.buddyup-mobile-nav-tray[data-expanded="true"] #buddyUpNavTrayToggle i {
    transform: rotate(90deg);
}

body.buddyup-home-onboarding-active .buddyup-mobile-nav-tray {
    display: none !important;
}

@media only screen and (max-width: 1024px) {
    .buddyup-mobile-nav-tray {
        display: flex;
    }
}

/*
   DESKTOP VIEW (Hide mobile nav)
*/

@media only screen and (min-width: 1025px) {
    .buddyup-mobile-nav-tray,
    .buddyup-mobile-bottom-nav,
    .buddyup-mobile-top-header,
    .buddyup-shelf-menu,
    .buddyup-shelf-overlay {
        display: none !important;
    }
}
