/* ============================================================
   CTLS COMPONENT: SHOP MINI-WARENKORB (Teil B)
   ------------------------------------------------------------
   Header-Icon + Zähler-Badge, Overlay und Slide-out-Lade von
   rechts (Positionen, Stepper, Zwischensumme, „Zur Kasse").
   Eigenständige Klassen – bb-*-Styles (shop-buybox.css) laden
   nur auf Produktseiten, der Drawer aber global.
   ============================================================ */

/* ---------- Header-Icon + Badge ---------- */
.gh-cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 0.75rem;
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: 50%;
  color: #1c1d1f;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.gh-cart:hover {
  background: rgba(0, 79, 158, 0.08);
  color: var(--color-primary);
}

.gh-cart-badge {
  position: absolute;
  top: 1px;
  right: -1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

/* Mobil: gh-nav-cta ist display:none, das Icon bleibt sichtbar –
   fixiert neben dem Burger-Menü (menu-toggle: fixed, right 1.5rem). */
@media (max-width: 995px) {
  .gh-cart {
    position: fixed;
    top: 11px;
    right: 4rem;
    z-index: 9999;
    background: #fff;
  }
}

/* ---------- Overlay ---------- */
.ctls-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 14, 15, 0.45);
  z-index: 10000;
}

/* ---------- Drawer (Slide-out von rechts) ---------- */
.ctls-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100vw);
  background: #fff;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
  transform: translateX(105%);
  transition: transform 0.28s ease;
  outline: none;
}

.ctls-cart-drawer.is-open { transform: translateX(0); }

body.ctls-cart-open { overflow: hidden; }

.ctls-cart-drawer .cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #e7e8ea;
}

.ctls-cart-drawer .cart-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.cart-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 0.4rem;
  line-height: 0;
  border-radius: 4px;
}

.cart-close:hover { color: #000; background: #f2f3f4; }

.ctls-cart-drawer .cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 1.4rem;
}

.cart-empty {
  color: #777;
  font-size: 0.92rem;
  padding: 1.5em 0;
  text-align: center;
}

.cart-invalid-hint {
  font-size: 0.78rem;
  color: #8a6d3b;
  background: #fcf8e3;
  border-radius: 6px;
  padding: 0.6em 0.8em;
}

/* Kleiner Hinweis-Link zur Shop-Übersicht (für Besucher von außerhalb) */
.cart-shop-link {
  margin: 0.9rem 0 0.4rem;
  text-align: center;
  font-size: 0.8rem;
}

.cart-shop-link a {
  color: #777;
  text-decoration: underline;
}

.cart-shop-link a:hover { color: var(--color-primary); }

/* ---------- Positionen ---------- */
.cart-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid #eee;
}

.cart-item.is-invalid { opacity: 0.6; }

.cart-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.cart-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1c1d1f;
  line-height: 1.35;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 0;
  flex-shrink: 0;
}

.cart-item-remove:hover { color: var(--color-accent); }

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.cart-step {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d4d5d7;
  border-radius: 6px;
  overflow: hidden;
}

.cart-step button {
  width: 28px;
  height: 28px;
  background: #f7f8f9;
  border: none;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: #333;
}

.cart-step button:hover { background: #e9ecef; }

.cart-step .cart-qty {
  min-width: 32px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
}

.cart-qty-fixed {
  font-size: 0.8rem;
  color: #777;
}

.cart-item-prices {
  text-align: right;
  font-size: 0.9rem;
  white-space: nowrap;
}

.cart-item-prices small {
  display: block;
  color: #888;
  font-size: 0.74rem;
}

/* ---------- Fußbereich ---------- */
.ctls-cart-drawer .cart-foot {
  border-top: 1px solid #e7e8ea;
  padding: 1rem 1.4rem 1.3rem;
  background: #fafbfc;
}

.cart-subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.95rem;
}

.cart-subtotal strong { font-size: 1.15rem; }

.cart-hint {
  margin: 0.3rem 0 0.9rem;
  font-size: 0.74rem;
  color: #888;
}

.cart-checkout {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: var(--color-primary);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.cart-checkout:hover { filter: brightness(1.1); }

.cart-continue {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: #555;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.45rem;
}

.cart-continue:hover { color: var(--color-primary); }
