.top-menu {
    width: 100%;
    padding: 1rem;
    background-color: var(--background-primary);
    border-bottom: 1px solid var(--border-color);
}

.nav-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.nav-item {
    text-align: right;
    flex-shrink: 0;
}

/* Center the search bar; allow it to shrink so nav labels stay on one line */
.nav-item.search-bar-item {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-shrink: 1;
    min-width: 0;
}

@media (max-width: 991.98px) {
    .navbar-toggler {
        order: 2;
        margin-left: auto;
    }

    .nav-item.search-bar-item {
        order: 1;
        margin-left: auto;
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-end;
        gap: 8px;
    }

    .nav-list:has(.search-bar-item) .navbar-toggler {
        margin-left: 0;
    }

    #navbarNav {
        order: 3;
        flex-basis: 100%;
    }

    #navbarNav .nav-link {
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    .nav-item.settings-container {
        text-align: right;
        justify-content: flex-end;
        display: flex;
    }

    .top-menu.search-expanded .top-brand-stack {
        display: none;
    }

    .top-menu.search-expanded .navbar-toggler {
        display: none;
    }

    .top-menu.search-expanded .nav-item.search-bar-item {
        flex: 1 1 0%;
        width: auto;
        min-width: 0;
        margin-left: 0;
        justify-content: flex-start;
    }
}

@media (min-width: 992px) {
    .navbar-expand-lg .navbar-collapse#navbarNav {
        display: contents !important;
    }

    #navbarNav > .nav-item {
        order: 10;
    }

    #navbarNav > .nav-item.settings-container {
        order: 60;
        margin-left: auto;
    }

    .nav-item.search-bar-item {
        order: 50;
        width: auto;
        flex: 1 1 0%;
        min-width: 0;
        margin-left: 0;
        justify-content: flex-start;
    }

    .navbar-toggler {
        order: 100;
    }
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1rem;
    white-space: nowrap;
}

button.nav-link.nav-link-button {
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    /* Buttons shrink-wrap even when display:block; match <a.nav-link> in the mobile menu */
    width: 100%;
    text-align: inherit;
}

.nav-link:hover {
    color: #1a73e8;
}

.nav-link.active {
    color: #1a73e8;
    font-weight: 600;
}

.settings-fieldset {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.settings-legend {
    float: left;
    width: 100%;
    margin: 0 0 0.75rem 0;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-fieldset::after {
    content: "";
    display: table;
    clear: both;
}

.navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
}

/* Animation for the hamburger icon */
.animated-icon {
    width: 30px;
    height: 20px;
    position: relative;
    margin: 0px;
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
    -webkit-transition: .5s ease-in-out;
    -moz-transition: .5s ease-in-out;
    -o-transition: .5s ease-in-out;
    transition: .5s ease-in-out;
    cursor: pointer;
}

.animated-icon span {
    background: var(--hamburger-menu-color);
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    border-radius: 9px;
    opacity: 1;
    left: 0;
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
    -webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;
    transition: .25s ease-in-out;
}

.animated-icon span:nth-child(1) {
    top: 0px;
}

.animated-icon span:nth-child(2),
.animated-icon span:nth-child(3) {
    top: 10px;
}

.animated-icon span:nth-child(4) {
    top: 20px;
}

.animated-icon.open span:nth-child(1) {
    top: 11px;
    width: 0%;
    left: 50%;
}

.animated-icon.open span:nth-child(2) {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
}

.animated-icon.open span:nth-child(3) {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
}

.animated-icon.open span:nth-child(4) {
    top: 11px;
    width: 0%;
    left: 50%;
}

.navbar-toggler:focus,
.navbar-toggler:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.35);
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}


/** Theme Toggle Styling **/
.theme-toggle-container {
    margin-left: auto;
}
.theme-toggle {
    /*change size of toggle with font-size*/
    font-size: 15%;
    position: relative;
    height: var(--toggleHeight);
    /* Need both min and max width to avoid issues with the search bar and in the hamburger menu*/
    min-width: var(--toggleWidth);
    max-width: var(--toggleWidth);
    border-radius: var(--toggleHeight);
    transition: all 500ms ease-in-out;
    background: var(--bgColor--night);
    cursor: pointer;
    margin-left: auto;
}

/** Brand / logo (header) **/
.top-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    order: 0;
}

.top-brand:hover {
    color: inherit;
    text-decoration: none;
}

.top-brand-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.top-brand-fallback {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #0fae67, #1358ff);
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}

.top-brand.logo-slot.has-fallback .top-brand-fallback {
    display: flex;
}

.top-brand.logo-slot.has-fallback .top-brand-img {
    display: none;
}

.top-brand-stack {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.15;
    min-width: 0;
}

.top-brand-name {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.top-brand-tagline {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

@media (max-width: 360px) {
    .top-brand-name {
        font-size: 15px;
    }

    .top-brand-tagline {
        font-size: 10.5px;
    }
}

.moon {
    position: absolute;
    display: block;
    border-radius: 50%;
    transition: all 400ms ease-in-out;

    top: 3em;
    left: 3em;
    transform: rotate(-75deg);
    width: var(--toggleBtnRadius);
    height: var(--toggleBtnRadius);
    background: var(--bgColor--night);
    box-shadow: 
        3em 2.5em 0 0em var(--mooncolor) inset,
        rgba(255, 255, 255, 0.1) 0em -7em 0 -4.5em,
        rgba(255, 255, 255, 0.1) 3em 7em 0 -4.5em,
        rgba(255, 255, 255, 0.1) 2em 13em 0 -4em,
        rgba(255, 255, 255, 0.1) 6em 2em 0 -4.1em,
        rgba(255, 255, 255, 0.1) 8em 8em 0 -4.5em,
        rgba(255, 255, 255, 0.1) 6em 13em 0 -4.5em,
        rgba(255, 255, 255, 0.1) -4em 7em 0 -4.5em,
        rgba(255, 255, 255, 0.1) -1em 10em 0 -4.5em;
}
.sun {
    top: 4.5em;
    left: 18em;
    transform: rotate(0deg);
    width: 7em;
    height: 7em;
    background: #fff;
    box-shadow: 3em 3em 0 5em #fff inset,
        0 -5em 0 -2.7em #fff,
        3.5em -3.5em 0 -3em #fff,
        5em 0 0 -2.7em #fff,
        3.5em 3.5em 0 -3em #fff,
        0 5em 0 -2.7em #fff,
        -3.5em 3.5em 0 -3em #fff,
        -5em 0 0 -2.7em #fff,
        -3.5em -3.5em 0 -3em #fff;
}

/** Settings Button Styling **/
.settings-container {
    margin-left: auto;
}

.settings-button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-button:hover {
    background-color: var(--background-secondary);
}

.gear-icon {
    width: 32px;
    height: 32px;
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.settings-button:hover .gear-icon {
    transform: rotate(90deg);
}

/** Settings Modal Styling **/
.settings-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.settings-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal-content {
    background-color: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 1000px;
    max-height: 80vh;
    max-height: min(80vh, calc(100dvh - 24px));
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.settings-modal-close {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
}

.settings-modal-close:hover {
    background-color: var(--background-secondary);
}

.settings-modal-close svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.settings-modal-body {
    padding: 1.5rem;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.setting-item.theme-setting {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.setting-row-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.setting-row-label small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.4;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.setting-item .form-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-background-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.setting-item .form-select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.website-filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.filters-ship-to .form-label {
    color: var(--text-primary);
}

.ship-to-select {
    background-color: var(--input-background-color, var(--background-secondary));
    border-color: var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

#settings-website-filters-list .website-filters-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 16rem;
    overflow-y: auto;
}

.website-filter-select-all {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease;
}

.website-filter-select-all:hover {
    background-color: var(--background-secondary);
}

.website-filter-select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a73e8;
    cursor: pointer;
}

.website-filter-select-all label {
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.website-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (max-width: 480px) {
    .website-filters-grid {
        grid-template-columns: 1fr;
    }
}

.website-filter-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.website-filter-item:hover {
    background-color: var(--background-secondary);
}

.website-filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a73e8;
    cursor: pointer;
}

.website-filter-item label {
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.website-filter-item label:hover {
    color: var(--text-primary);
}

.settings-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background-color: #1557b0;
}

.btn-secondary {
    background-color: var(--background-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--background-tertiary);
}

/** Settings Theme Toggle Styling **/
.theme-toggle-container-settings {
    /* Remove margin-left: auto to position it next to the label */
}

.theme-toggle-settings {
    /*change size of toggle with font-size*/
    display: block;
    font-size: 17.2%;
    position: relative;
    height: var(--toggleHeight);
    /* Need both min and max width to avoid issues with the search bar and in the hamburger menu*/
    min-width: var(--toggleWidth);
    max-width: var(--toggleWidth);
    min-height: 44px;
    border: none;
    padding: 0;
    border-radius: var(--toggleHeight);
    transition: all 500ms ease-in-out;
    background: var(--bgColor--night);
    cursor: pointer;
    margin-left: auto;
}

.moon-settings {
    position: absolute;
    display: block;
    border-radius: 50%;
    transition: all 400ms ease-in-out;

    top: 3em;
    left: 3em;
    transform: rotate(-75deg);
    width: var(--toggleBtnRadius);
    height: var(--toggleBtnRadius);
    background: var(--bgColor--night);
    box-shadow: 
        3em 2.5em 0 0em var(--mooncolor) inset,
        rgba(255, 255, 255, 0.1) 0em -7em 0 -4.5em,
        rgba(255, 255, 255, 0.1) 3em 7em 0 -4.5em,
        rgba(255, 255, 255, 0.1) 2em 13em 0 -4em,
        rgba(255, 255, 255, 0.1) 6em 2em 0 -4.1em,
        rgba(255, 255, 255, 0.1) 8em 8em 0 -4.5em,
        rgba(255, 255, 255, 0.1) 6em 13em 0 -4.5em,
        rgba(255, 255, 255, 0.1) -4em 7em 0 -4.5em,
        rgba(255, 255, 255, 0.1) -1em 10em 0 -4.5em;
}

.moon-settings.sun {
    top: 4.5em;
    left: 18em;
    transform: rotate(0deg);
    width: 7em;
    height: 7em;
    background: #fff;
    box-shadow: 3em 3em 0 5em #fff inset,
        0 -5em 0 -2.7em #fff,
        3.5em -3.5em 0 -3em #fff,
        5em 0 0 -2.7em #fff,
        3.5em 3.5em 0 -3em #fff,
        0 5em 0 -2.7em #fff,
        -3.5em 3.5em 0 -3em #fff,
        -5em 0 0 -2.7em #fff,
        -3.5em -3.5em 0 -3em #fff;
}

@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
    }
    
    .settings-modal-header {
        padding: 1rem 1rem 0.75rem 1rem;
    }
    
    .settings-modal-body {
        padding: 1rem;
    }
    
    .settings-modal-footer {
        padding: 0.75rem 1rem 1rem 1rem;
    }
}

