:root {
    --bs-offcanvas-width: 400px;
    --permanent-menu-column-width: clamp(304px, 17vw, 336px);
    --permanent-menu-column-half-width: clamp(152px, 8.5vw, 168px);
    --permanent-menu-footer-space: 45px;
}
.navbar {
    /* Fixiert die Navbar am oberen Rand */
    position: fixed;
    top: 0;
    /* Stellt sicher, dass sie über die gesamte Breite geht */
    width: 100%;
    /* Hält sie über anderen Elementen, falls notwendig */
    z-index: 1030;
    /* Optional: dezente Trennlinie */
    border-bottom: var(--navbar-border);
    /* Setzt die Höhe der Navbar */
    height: var(--navbar-height);
}

.navbar-brand,
.navbar-brand-small {
    top: 0px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.navbar-brand img {
    /*height: 120px;    Für überstehendes Logo von Früchte Frick
    margin-top: 40px;*/
    height: 50px;
}

.navbar-brand-small img {
    height: 40px;
}

/* Sorgt mit .content dafür, dass die Fußzeile immer unten ist, aber bei größeren Seiten erst nach scrollen sichtbar wird */
html,
body {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding-top: var(--navbar-height);
}

.footer {
    padding: 10px 0;
    text-align: center;
    border-top: var(--navbar-border);
}

.footer a {
    margin: 0 15px;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
}

.footer a:hover {
    text-decoration: underline;
}

.offcanvas {
    margin-top: var(--navbar-height);
    width: var(--bs-offcanvas-width);
    /* Fußzeile ist nicht immer sichtbar, also nicht freilassen */
    /*padding-bottom: 45px;*/
}

#offcanvasMenu ul.list-group:not(:first-child)>li.list-group-item,
#offcanvasMenu ul.list-group:not(:first-child)

/* sonst sieht man die Abrundung während des collapse-Vorgangs wieder */
    {
    /* Bei verschachtelten Menüs werden die Ecken an den "falschen" Stellen abgerundet. Also erstmal entfernen und in JS korrekt abrunden */
    border-radius: 0;
}

#offcanvasMenu ul.list-group>li.list-group-item a {
    /* Damit das Icon rechts ist */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Links nicht als solche stylen */
    text-decoration: none;
    color: inherit;
}

#offcanvasMenu .menu-item-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

#offcanvasMenu .menu-item-label+i {
    flex: 0 0 auto;
    margin-left: 0.5rem;
}

#offcanvasMenu .menu-inline-button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border: 0;
    color: inherit;
    text-decoration: none;
}

#offcanvasMenu .menu-inline-button:hover,
#offcanvasMenu .menu-inline-button:focus {
    color: inherit;
    text-decoration: none;
}

#offcanvasMenu .menu-item-with-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#offcanvasMenu .menu-item-with-action>a {
    flex: 1 1 auto;
    min-width: 0;
}

#offcanvasMenu .menu-inline-icon-button {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    color: inherit;
    text-decoration: none;
}

#offcanvasMenu .menu-inline-icon-button:hover,
#offcanvasMenu .menu-inline-icon-button:focus {
    color: inherit;
    text-decoration: none;
}

.favorite-delete-modal-content {
    border: 0;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.16);
}

.favorite-delete-modal-body {
    padding: 1.4rem 1.25rem 1rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.9) 0%, rgba(255, 255, 255, 1) 100%);
}

.favorite-delete-icon {
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    font-size: 1.35rem;
}

.favorite-delete-title {
    font-weight: 700;
    color: #212529;
}

.favorite-delete-text {
    line-height: 1.45;
    color: rgba(33, 37, 41, 0.78);
}

.favorite-delete-modal-footer {
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.25rem 1.25rem;
    border-top: 0;
    background: #fff;
}

#offcanvasMenu>.offcanvas-body>ul.list-group li.list-group-item {
    cursor: pointer;
    background-color: var(--bs-custom-color-offcanvas-menu-list-group-item);
}

#offcanvasMenu>.offcanvas-body>ul.list-group li.list-group-item:hover {
    opacity: 0.8;
}

.dropdown-menu-custom-color-header-dropdown-item.dropdown-menu .dropdown-item:hover {
    /* Kundenspezifische Farbe */
    background-color: var(--bs-custom-color-header-dropdown-item);
    /*color: white;*/
}

.search-line {
    margin-top: 10px;
}

#searchInputGroup {
    /* Standardbreite für große Bildschirme */
    max-width: 300px;
}

/* Verkleinere das Suchfeld bei kleineren Viewports */
@media (max-width: 1024px) {
    #searchInputGroup {
        max-width: 200px;
    }
}

@media (max-width: 900px) {
    #searchInputGroup {
        max-width: 150px;
    }
}

@media (max-width: 820px) {
    #searchInputGroup {
        max-width: 100px;
    }
}

/* Für kleine Bildschirme (nur das Such-Icon als Dropdown anzeigen) */
@media (max-width: 700px) {
    #searchInputGroup {
        display: none;
    }

    /*.search-dropdown {
        display: inline-block !important;
    }*/

    /* Überschreibe die Variable für kleinere Bildschirme */
    body.logged-in {
        --navbar-height: calc(var(--navbar-height-orig) + 50px);
        /* Größere Navbar für Suchleiste */
    }

    .search-line {
        display: inline-block !important;
    }
}

/* Für sehr kleine Bildschirme (Alle Icons in ein Menü packen) */
/* @media (max-width: 620px) { */
@media (max-width: 480px) {
    .navbar-icons {
        /* Versteckt die einzelnen Icons */
        display: none !important;
    }

    .compact-menu {
        /* Zeigt das kompakte Dropdown */
        display: inline-block !important;
    }
}

/* Für sehr kleine Bildschirme (Logo verkleinern) */
@media (max-width: 400px) {
    .navbar-brand {
        /* Standard-Logo verstecken */
        display: none !important;
    }

    .navbar-brand-small {
        /* Kleineres Logo einblenden */
        display: inline-block !important;
        top: 5px;
    }

    /* Überschreibe die Variable für kleinere Bildschirme */
    body {
        --navbar-height: calc(var(--navbar-height-orig) - 10px);
        /* Kleinere Navbar wegen kleinerem Logo */
    }

    /* Überschreibe die Variable für kleinere Bildschirme */
    body.logged-in {
        --navbar-height: calc(var(--navbar-height-orig) + 40px);
        /* Größere Navbar für Suchleiste, aber nicht ganz so viel größer wegen kleinerem Logo */
    }

    .search-line {
        margin-top: 5px;
    }
}

/* navbar-toggler lässt sich nicht richtig einfärben. Also eigene Klasse, die das optisch angleicht */
.navbar-toggler-custom-color>i {
    /* Exakte Breite setzen */
    width: 30px;
    /* Exakte Höhe setzen */
    height: 30px;
    /* Icon an sich vergrößern */
    font-size: 2em;

    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-badge-0 {
    display: none;
}

.cart-badge-1 {
    top: 0 !important;
    left: calc(100% - 0px);
}

.cart-badge-2 {
    top: 0 !important;
    left: calc(100% - 4px);
}

.cart-badge-3 {
    top: 0 !important;
    left: calc(100% - 8px);
}

@keyframes badgeUpdate {
    0% {
        box-shadow: 0 0 5px 2px #dc3545;
        border-color: gold;
    }

    50% {
        box-shadow: 0 0 25px 10px #ff6666;
        border-color: orangered;
    }

    100% {
        box-shadow: 0 0 5px 2px #dc3545;
        border-color: gold;
    }
}

.badge-animate {
    animation: badgeUpdate 1.2s ease-in-out;
}

.modal-md {
    max-width: 450px;
}

@media (min-width: 1280px) {
    body.menu-permanent #offcanvasMenu .btn-close {
        display: none;
    }

    /* Das Offcanvas reserviert Platz, bleibt selbst aber vollständig transparent. */
    body.menu-permanent #offcanvasMenu {
        --bs-offcanvas-width: var(--permanent-menu-column-width);
        width: var(--permanent-menu-column-width);
        max-width: none;
        bottom: var(--permanent-menu-footer-space);
        left: 0;
        visibility: visible;
        background: transparent !important;
        border: 0;
        box-shadow: none;
        transform: none;
        transition: none;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-header {
        display: none;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body {
        display: flex;
        align-items: flex-start;
        position: relative;
        padding: 4px 16px 16px;
        overflow: hidden;
        color: var(--bs-body-color) !important;
        background: transparent !important;
    }

    /* Nur die Menüliste bildet eine kompakte, in sich geschlossene Oberfläche. */
    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group {
        width: 100%;
        max-height: calc(100vh - var(--navbar-height) - var(--permanent-menu-footer-space) - 20px);
        max-height: calc(100dvh - var(--navbar-height) - var(--permanent-menu-footer-space) - 20px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.48) transparent;
        background: #fff;
        border: 1px solid rgba(33, 37, 41, 0.18);
        border-top: 4px solid rgb(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51));
        border-radius: 4px;
        box-shadow: 0 0.25rem 0.9rem rgba(33, 37, 41, 0.1);
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group::-webkit-scrollbar {
        width: 7px;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group::-webkit-scrollbar-thumb {
        background-color: rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.48);
        background-clip: padding-box;
        border: 2px solid transparent;
        border-radius: 999px;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body.has-scroll-continuation::after {
        content: "";
        position: absolute;
        z-index: 2;
        right: 16px;
        bottom: 16px;
        left: 16px;
        height: 34px;
        pointer-events: none;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.97) 72%);
        border-radius: 0 0 4px 4px;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body.has-scroll-continuation::before {
        content: "";
        position: absolute;
        z-index: 3;
        bottom: 21px;
        left: 50%;
        width: 8px;
        height: 8px;
        pointer-events: none;
        border-right: 2px solid rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.55);
        border-bottom: 2px solid rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.55);
        transform: translateX(-50%) rotate(45deg);
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group li.list-group-item {
        min-height: 42px;
        padding: 0.65rem 0.9rem;
        font-size: 0.9rem;
        line-height: 1.25;
        position: relative;
        color: var(--bs-body-color);
        background-color: #fff !important;
        border: 0;
        border-radius: 0 !important;
        opacity: 1;
        transition: background-color 0.15s ease, box-shadow 0.15s ease;
    }

    /* Jede Ebene rückt ihre Inhalte und damit auch den Linienbeginn um 24 px ein. */
    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group > ul.list-group,
    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group > ul.list-group > ul.list-group {
        margin-left: 24px !important;
    }

    /* Normale Trennlinien beginnen an der linken Kante ihrer jeweiligen Ebene. */
    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group ul.list-group > li.list-group-item::before {
        content: "";
        position: absolute;
        z-index: 0;
        top: 0;
        right: 0;
        left: 0;
        height: 1px;
        pointer-events: none;
        background-color: rgba(33, 37, 41, 0.22);
    }

    /* Grenzen zwischen Oberpunkten laufen über die volle Breite und sind etwas kräftiger. */
    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group > li.list-group-item::before {
        content: "";
        position: absolute;
        z-index: 0;
        top: 0;
        right: 0;
        left: 0;
        height: 1px;
        pointer-events: none;
        background-color: rgba(33, 37, 41, 0.32);
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group > li.list-group-item:first-child::before {
        display: none;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group > li.list-group-item {
        font-weight: 600;
    }

    body.menu-permanent #offcanvasMenu #produkteMenu > li.list-group-item {
        font-weight: 500;
    }

    body.menu-permanent #offcanvasMenu #favoritenMenu > li.list-group-item,
    body.menu-permanent #offcanvasMenu #produkteMenu > ul.list-group > li.list-group-item {
        font-weight: 400;
    }

    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group li.list-group-item i {
        flex: 0 0 auto;
        color: rgb(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51));
        font-size: 0.95rem;
        opacity: 1;
    }


    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group li.list-group-item:hover,
    body.menu-permanent #offcanvasMenu > .offcanvas-body > ul.list-group li.list-group-item:focus-within {
        background-color: rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.08) !important;
    }

    body.menu-permanent #offcanvasMenu li.list-group-item[data-bs-toggle="collapse"]:focus-visible,
    body.menu-permanent #offcanvasMenu a:focus-visible,
    body.menu-permanent #offcanvasMenu button:focus-visible {
        position: relative;
        z-index: 1;
        outline: 2px solid rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.55);
        outline-offset: -2px;
    }

    body.logged-in.menu-permanent div.content {
        min-width: 0;
        margin-left: var(--permanent-menu-column-width);
    }

    body.logged-in.menu-permanent .navbar-toggler-custom-color {
        visibility: hidden;
        pointer-events: none;
    }

    body.logged-in.menu-permanent .navbar-brand,
    body.logged-in.menu-permanent .navbar-brand-small {
        left: calc(50% + var(--permanent-menu-column-half-width));
    }

    body.logged-in.menu-permanent .footer > .container {
        width: calc(100% - var(--permanent-menu-column-width));
        max-width: none;
        margin-right: 0;
        margin-left: var(--permanent-menu-column-width);
    }

    body.menu-permanent #offcanvasMenu li.list-group-item.active-menu-branch {
        background-color: #fff !important;
        box-shadow: none;
    }

    body.menu-permanent #offcanvasMenu li.list-group-item.active-warengruppe {
        background-color: rgba(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51), 0.1) !important;
        box-shadow: inset 4px 0 0 rgb(var(--bs-custom-color-offcanvas-bg-rgb, 51, 51, 51));
        font-weight: 600;
    }
}
