/* Warenkorb-Menü und Hinweis „Zum Einkaufswagen hinzugefügt!".

   Beides sitzt in der Kopfzeile und steht damit auf jeder Seite — deshalb wird
   diese Datei in base.html geladen, nicht über {% block extra_css %}. Sie kommt
   nach main.css und gewinnt dort, wo sie dieselbe Klasse anfasst.

   Nur Tokens aus dem Design-System (var(--…)), keine neuen Farben.

   Stapelung (Leiter aus input.css: .header-suche 39, .site-header 40,
   .mobile-menu 60, .tk-schleier 70, .skip-link 100): Menü 45 und Hinweis 50
   liegen über dem Inhalt der Kopfzeile und unter dem mobilen Menü. Beide sind
   Kinder von .site-header und stehen damit in derselben Stapelebene wie
   .header-suche und .mobile-menu — die Zahlen sind also vergleichbar. */

/* --- Zahl am Warenkorb-Symbol --------------------------------------------- */

/* Aus dem Punkt wird eine Blase mit der Anzahl. Der Ring in Seitenfarbe hebt
   sie vom Symbol darunter ab; ohne ihn verschwimmen Ziffer und Wagen. */
.wk-zahl {
  position: absolute;
  top: 5px;
  right: 3px;
  min-width: 18px;
  height: 18px;
  padding-inline: 5px;
  box-sizing: border-box;
  border-radius: var(--radius-xl);
  background: var(--color-accent);
  color: var(--color-primary-foreground);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--color-background);
  pointer-events: none;
}

/* --- Menü ----------------------------------------------------------------- */

.wk-anker {
  position: relative;
  display: inline-flex;
}

.wk-menue {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 45;
  width: 360px;
  /* Auf schmalen Geräten steht rechts vom Symbol noch der Menüknopf: 24 px
     Containerrand + 44 px Knopf + 4 px Abstand. Zusammen mit 12 px Luft links
     kann die Tafel damit auf keiner Breite seitlich hinauslaufen. */
  max-width: calc(100vw - 84px);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

.wk-menue:focus { outline: none; }

.wk-menue-inhalt {
  display: flex;
  flex-direction: column;
}

/* Zwischen Aufklappen und eingetroffener Liste liegt eine Anfrage. Ohne
   Mindesthöhe wäre die Tafel in dieser Spanne ein Strich und spränge dann auf. */
.wk-menue-inhalt:empty {
  min-height: 96px;
}

/* Zuoberst der Weg zum Warenkorb — die Liste darunter ist zum Sortieren da,
   nicht zum Abschließen. */
.wk-weiter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-muted);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  text-decoration: none;
}

@media (hover: hover) {
  .wk-weiter:hover {
    background: var(--color-primary);
    color: var(--color-primary-foreground);
  }
}

/* Gedeckelte Höhe: Das Menü soll den Blick auf die Produkte dahinter nicht
   verstellen — was nicht hineinpasst, wird gescrollt. */
.wk-zeilen {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wk-zeile {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-sm);
}

@media (hover: hover) {
  .wk-zeile:hover { background: var(--color-muted); }
}

.wk-zeile-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wk-zeile-titel {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--color-foreground);
  /* Zwei Zeilen genügen; ein langer Titel darf die Zeile nicht auseinander
     ziehen, sonst passt weniger Ware ins sichtbare Feld. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wk-zeile-preis {
  margin: 0;
}

.wk-zeile-preis .price {
  font-size: 14px;
  line-height: 20px;
}

.wk-zeile-aktionen {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wk-stufen {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-card);
}

.wk-stufe {
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-xl);
}

@media (hover: hover) {
  .wk-stufe:hover { background: var(--color-muted); }
}

.wk-stufe-wert {
  min-width: 22px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.wk-entfernen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  color: var(--color-muted-foreground);
  cursor: pointer;
  border-radius: var(--radius-xl);
}

@media (hover: hover) {
  .wk-entfernen:hover {
    background: var(--color-muted);
    color: var(--color-notice);
  }
}

.wk-summe {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

.wk-summe-wort {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 18px;
  color: var(--color-muted-foreground);
}

.wk-summe-preis {
  font-size: 16px;
  line-height: 22px;
}

.wk-leer {
  padding: 16px;
}

.wk-leer .empty-state {
  margin: 0;
}

/* --- Hinweis nach dem Hinzufügen ------------------------------------------ */

/* Fest rechts oben, direkt unter der Kopfzeile: Die Hülle hängt am Header, der
   selbst sticky ist — der Hinweis wandert damit beim Scrollen mit und liegt nie
   über der Kopfzeile. Leer nimmt sie keine Klicks weg. */
.wk-hinweis-huelle {
  position: absolute;
  top: 100%;
  right: 24px;
  z-index: 50;
  width: 320px;
  max-width: calc(100vw - 48px);
  pointer-events: none;
}

.wk-hinweis {
  pointer-events: auto;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
}

.wk-hinweis-kopf {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.wk-hinweis-meldung {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
  color: var(--color-foreground);
}

.wk-hinweis-meldung svg {
  flex: none;
  color: var(--color-accent);
}

.wk-hinweis-zu {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -3px -4px 0 0;
  border: 0;
  background: none;
  color: var(--color-muted-foreground);
  cursor: pointer;
  border-radius: var(--radius-xl);
}

@media (hover: hover) {
  .wk-hinweis-zu:hover { background: var(--color-muted); }
}

.wk-hinweis-produkt {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.wk-hinweis-text {
  min-width: 0;
}

.wk-hinweis-titel {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--color-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wk-hinweis-menge {
  margin: 2px 0 0;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  color: var(--color-muted-foreground);
  font-variant-numeric: tabular-nums;
}

/* --- Cover-Miniatur (Menü und Hinweis) ------------------------------------ */

.wk-bild {
  display: block;
  position: relative;
  width: 56px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-muted);
  color: var(--color-foreground);
}

.wk-bild img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wk-bild-marke {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

/* --- Schmale Geräte ------------------------------------------------------- */

@media (max-width: 639.98px) {
  /* Die Tafel darf höher werden, weil neben ihr nichts steht — aber nie so
     hoch, dass sie die Seite ganz zudeckt. */
  .wk-zeilen {
    max-height: min(50vh, 320px);
  }
  /* Nebeneinander bliebe für den Titel eine Spalte von gut 60 px — zu wenig,
     um ein Produkt zu erkennen. Mengenschalter und Entfernen rücken deshalb
     unter den Titel, und das Bild wird schmaler. */
  .wk-zeile {
    grid-template-columns: 48px 1fr;
    row-gap: 6px;
  }
  .wk-zeile .wk-bild {
    width: 48px;
  }
  .wk-zeile-aktionen {
    grid-column: 2;
  }
  .wk-hinweis-huelle {
    right: 16px;
    max-width: calc(100vw - 32px);
  }
}
