/*
 * Mehrere Warenkörbe (22.11.2026): Knopf im Letzdine-Kopf und Fenster „Deine Warenkörbe“ (letzdine-carts.js).
 * Form wie der Kopf „Tropfen“: rund mit spitzer Ecke unten links. Eigene Variablen, damit es auf allen Letzdine-Seiten
 * gleich aussieht. :is(…, #ld-carts) zählt wie eine ID und setzt sich gegen die alten Kopf-Stile durch.
 */
:root {
    --ld-carts-drop: 18px 18px 18px 6px;
    --ld-carts-blue: #39a8e0;
    --ld-carts-ink: #06263a;
    --ld-carts-chip: rgba(15, 23, 42, 0.065);
    --ld-carts-chip-hover: rgba(15, 23, 42, 0.1);
    --ld-carts-text: #0f172a;
    --ld-carts-muted: #64748b;
    --ld-carts-pop: #ffffff;
    --ld-carts-line: rgba(15, 23, 42, 0.08);
    --ld-carts-shadow: 0 18px 44px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.06);
}

html[data-letzdine-theme="dark"] {
    --ld-carts-chip: rgba(255, 255, 255, 0.07);
    --ld-carts-chip-hover: rgba(255, 255, 255, 0.11);
    --ld-carts-text: #eef2f7;
    --ld-carts-muted: #8b96a8;
    --ld-carts-pop: #161b23;
    --ld-carts-line: rgba(255, 255, 255, 0.09);
    --ld-carts-shadow: 0 22px 50px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ---------- Knopf im Kopf ---------- */
:is(.ld-carts-btn, #ld-carts) {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    min-width: 44px;
    padding: 0 12px 0 13px;
    border: 0;
    border-radius: var(--ld-carts-drop);
    background: var(--ld-carts-blue);
    color: var(--ld-carts-ink);
    font: inherit;
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
    transition: transform 160ms ease, filter 160ms ease;
}

:is(.ld-carts-btn, #ld-carts)[hidden] {
    display: none !important;
}

:is(.ld-carts-btn, #ld-carts):hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

:is(.ld-carts-btn, #ld-carts):focus-visible {
    outline: 2px solid var(--ld-carts-blue);
    outline-offset: 2px;
}

:is(.ld-carts-btn, #ld-carts) .fa {
    font-size: 1rem;
}

/* ---------- Fenster ---------- */
html.ld-carts-open,
html.ld-carts-open body {
    overflow: hidden !important;
}

.ld-carts-modal {
    position: fixed;
    inset: 0;
    z-index: 2050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: min(12vh, 110px) 16px 16px;
}

.ld-carts-modal[hidden] {
    display: none;
}

.ld-carts-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 20, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 200ms ease;
}

.ld-carts-modal__card {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - min(12vh, 110px) - 32px);
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--ld-carts-line);
    border-radius: 28px 28px 28px 9px;
    background: var(--ld-carts-pop);
    box-shadow: var(--ld-carts-shadow);
    color: var(--ld-carts-text);
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    transition: opacity 180ms ease, transform 240ms cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.ld-carts-modal.is-open .ld-carts-modal__backdrop {
    opacity: 1;
}

.ld-carts-modal.is-open .ld-carts-modal__card {
    opacity: 1;
    transform: none;
}

.ld-carts-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.ld-carts-modal__title {
    margin: 0;
    color: var(--ld-carts-text);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.ld-carts-modal__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: var(--ld-carts-drop);
    background: var(--ld-carts-chip);
    color: var(--ld-carts-text);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.ld-carts-modal__close:hover {
    background: var(--ld-carts-chip-hover);
}

/* Entfernen: nur das Symbol, ohne eigenen Kasten */
.ld-carts-row__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ld-carts-muted);
    cursor: pointer;
    transition: color 160ms ease;
}

.ld-carts-row__remove:hover {
    color: #e5484d;
}

.ld-carts-row__remove:disabled {
    opacity: 0.5;
}

.ld-carts-modal__list {
    display: grid;
}

.ld-carts-modal__empty {
    margin: 6px 0 2px;
    color: var(--ld-carts-muted);
}

/* Flache Liste mit Trennlinien, keine Kästen im Fenster (Nutzer 22.11.: keine Kachel in Kachel) */
.ld-carts-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--ld-carts-line);
}

.ld-carts-row:first-child {
    border-top: 0;
    padding-top: 4px;
}

.ld-carts-row.is-current .ld-carts-row__name {
    color: var(--ld-carts-blue);
}

.ld-carts-row__logo {
    width: 48px;
    height: 48px;
    border-radius: 14px 14px 14px 5px;
    object-fit: contain;
}

.ld-carts-row__info {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.ld-carts-row__name {
    overflow: hidden;
    color: var(--ld-carts-text);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ld-carts-row__meta {
    color: var(--ld-carts-muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.ld-carts-row__go {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--ld-carts-drop);
    background: var(--ld-carts-blue);
    color: #ffffff !important;
    font-weight: 800;
    font-size: 0.9rem;
    text-decoration: none !important;
    white-space: nowrap;
}

.ld-carts-row__go:hover {
    filter: brightness(1.05);
}

@media (max-width: 480px) {
    .ld-carts-row {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        grid-template-areas: "logo info remove" "go go go";
    }

    .ld-carts-row__logo { grid-area: logo; width: 44px; height: 44px; }
    .ld-carts-row__info { grid-area: info; }
    .ld-carts-row__remove { grid-area: remove; }
    .ld-carts-row__go { grid-area: go; justify-content: center; }
}

/* Desktop: „Deine Warenkörbe“ als Seitenleiste rechts, ganz oben bis ganz unten (wie der Warenkorb der Speisekarte) */
@media (min-width: 768px) {
    .ld-carts-modal {
        justify-content: flex-end;
        align-items: stretch;
        padding: 0;
    }

    .ld-carts-modal__card {
        width: 440px;
        max-width: 100vw;
        height: 100%;
        max-height: none;
        padding: 22px 24px;
        border: 0;
        border-left: 1px solid var(--ld-carts-line);
        border-radius: 0;
        transform: translateX(100%);
        transition: opacity 120ms ease, transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .ld-carts-modal.is-open .ld-carts-modal__card {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ld-carts-modal__backdrop,
    .ld-carts-modal__card,
    :is(.ld-carts-btn, #ld-carts) {
        transition: none !important;
    }
}
