:root {
    --spa-topbar-min-height: 35px;
}

.spa-topbar-shell {
    display: none;
    width: 100%;
}

.spa-topbar-shell.is-active {
    display: block;
}

.spa-topbar-shell__inner {
    box-sizing: border-box;
    width: 100%;
    padding: var(--space-md) 0;
}

.spa-topbar-shell__root {
    width: 100%;
}

.spa-topbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    width: 100%;
    min-height: var(--spa-topbar-min-height);
    background: transparent;
}

.spa-topbar__leading,
.spa-topbar__center,
.spa-topbar__profile {
    min-width: 0;
}

.spa-topbar__leading {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spa-topbar__center {
    grid-column: 2 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.spa-topbar__center>* {
    min-width: 0;
    max-width: 100%;
}

.spa-topbar__profile {
    grid-column: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spa-topbar__profile .spa-topbar-profile-slot {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 35px;
}

.spa-topbar-profile-slot .profile-trigger {
    display: flex;
    justify-content: center;
    width: 100%;
}

.spa-topbar-profile-slot .profile-trigger__button {
    display: inline-flex;
}

.profile-trigger__button {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.profile-avatar {
    width: 35px;
    height: 35px;
    border-radius: var(--radius-pill);
    padding: 0;
    background: transparent;
    box-sizing: border-box;
    display: grid;
    place-items: center;
}

.profile-avatar-image {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-pill);
    object-fit: cover;
    display: block;
    background: var(--text-primary);
    border: 0.5px solid var(--text-muted);
    padding: var(--space-xs);
}

.profile-avatar.plan-individual,
.profile-avatar.plan-family,
.profile-avatar.plan-lifetime {
    padding: 2px;
    background: conic-gradient(var(--color-category-calisthenics-banner),
            var(--color-category-lifting-banner),
            var(--color-category-mobility-banner),
            var(--color-category-endurance-banner),
            var(--color-category-calisthenics-banner));
}

.spa-topbar-calendar-button {
    width: 20px;
    height: 20px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.spa-topbar-calendar-button--selectable {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-pill);
    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.spa-topbar .save-button {
    flex-shrink: 0;
    min-width: 0;
}

.spa-topbar-calendar-button:focus-visible,
.spa-topbar-title-link:focus-visible,
.spa-topbar-title-button:focus-visible,
.spa-topbar-input:focus-visible,
.spa-topbar-search-input:focus-visible,
.profile-trigger__button:focus-visible {
    outline: none;
}

.spa-topbar-calendar-button__icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: invert(1);
    transition: filter var(--transition-fast);
}

.spa-topbar-calendar-button--selectable.is-selected {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

.spa-topbar-calendar-button--selectable.is-selected .spa-topbar-calendar-button__icon {
    filter: none;
}

.spa-topbar-title-button,
.spa-topbar-title-link,
.spa-topbar-title {
    margin: 0;
    border: none;
    padding: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-tight);
    text-align: center;
    text-decoration: none;
}

.spa-topbar-title-button,
.spa-topbar-title-link {
    cursor: pointer;
}

.spa-topbar-search {
    display: flex;
    align-items: center;
    width: 100%;
}

.spa-topbar-input,
.spa-topbar-search-input {
    --input-bg: var(--bg-secondary);
    --input-bg-hover: var(--bg-tertiary);
    --input-bg-focus: var(--bg-secondary);
    --pad-top: calc(var(--space-sm) - (var(--space-xs) / 2));
    --pad-bottom: calc(var(--space-sm) - (var(--space-xs) / 2));

    width: 100%;
    min-width: 0;
}

body.spa-topbar-shell-active .content-wrapper {
    --content-wrapper-top-mobile-current: 0px;
    margin-top: 0;
}

@media (hover: hover) and (pointer: fine) {

    .spa-topbar-calendar-button:hover,
    .spa-topbar .save-button:hover:not(:disabled) {
        transform: translateY(-1px);
    }
}

@media (max-width: 768px) {
    .spa-topbar-shell__inner {
        padding-top: calc(var(--space-md) + var(--safe-area-top));
        padding-bottom: var(--space-md);
    }

    body.spa-topbar-shell-active .content-wrapper {
        padding-top: 0;
    }
}
