/* ==========================================================================
   Header mini-cart dropdown (inc/mini_cart_dropdown.php) — opens right
   below the header cart icon on hover (desktop) / tap (touch).
   Same tokens, radius and buttons as the add-to-cart popup
   (css/mini-cart-new.css). Everything is scoped under .koop-mc.
   Position (top/right + caret) is set inline by js/mini-cart-dropdown.js.
   ========================================================================== */

.koop-mc {
  --mc-surface:     #ffffff;
  --mc-ink:         #231f26;
  --mc-ink-2:       #6b6470;
  --mc-line:        #ebe6f0;
  --mc-line-strong: #ded7e6;
  --mc-primary:     #8b5594;
  --mc-primary-ink: #ffffff;
  --mc-radius:      18px;
  --mc-caret-right: 24px;

  display: none;
  color: var(--mc-ink);
}
.koop-mc.is-open { display: block; }

/* Outside-click catcher: transparent on desktop, light dim on touch. */
.koop-mc__scrim {
  position: fixed;
  inset: 0;
  z-index: 999990;
  background: transparent;
}
.koop-mc--touch .koop-mc__scrim { background: rgba(35, 31, 38, .32); }
/* Desktop hover mode: no catcher, so the page under it stays hoverable. */
.koop-mc--hover .koop-mc__scrim { display: none; }

.koop-mc__panel {
  position: fixed;
  top: 80px;  /* overwritten by JS */
  right: 16px; /* overwritten by JS */
  z-index: 999991;
  width: 380px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  /* Fallback only — JS sets max-height from the real top so the panel
     always ends >= 24px above the bottom of the screen (cap 640px). */
  max-height: min(640px, calc(100vh - 140px));
  background: var(--mc-surface);
  border: 1px solid var(--mc-line);
  border-radius: var(--mc-radius);
  box-shadow: 0 24px 60px -18px rgba(35, 31, 38, .45);
  animation: koop-mc-drop .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes koop-mc-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
/* Caret pointing up at the cart icon. */
.koop-mc__panel::before {
  content: "";
  position: absolute;
  top: -7px;
  right: var(--mc-caret-right);
  width: 12px;
  height: 12px;
  background: var(--mc-surface);
  border-left: 1px solid var(--mc-line);
  border-top: 1px solid var(--mc-line);
  transform: rotate(45deg);
}
/* Invisible bridge over the gap between icon and panel, so moving the
   mouse down from the icon never counts as leaving the dropdown. */
.koop-mc__panel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

/* ── Head ─────────────────────────────────────────────────────────────── */
.koop-mc__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px 20px;
  border-bottom: 1px solid var(--mc-line);
}
.koop-mc__title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.koop-mc__x {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--mc-ink-2);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
}
.koop-mc__x:hover { background: rgba(35, 31, 38, .08); color: var(--mc-ink); }
.koop-mc__x svg { width: 20px; height: 20px; }

/* ── Body (cart fragment) ─────────────────────────────────────────────── */
.koop-mc__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.koop-mc__loading,
.koop-mc__empty {
  padding: 22px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--mc-ink-2);
}
.koop-mc__empty p { margin: 0 0 14px; font-weight: 600; }

.koop-mc__items {
  list-style: none;
  margin: 0;
  padding: 4px 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Thin light-gray scrollbar. Chrome ignores ::-webkit-scrollbar once the
   standard scrollbar-* props are set, so those are Firefox-only here. */
@supports not selector(::-webkit-scrollbar) {
  .koop-mc__items { scrollbar-width: thin; scrollbar-color: #dcd8e0 transparent; }
}
.koop-mc__items::-webkit-scrollbar { width: 5px; }
.koop-mc__items::-webkit-scrollbar-track { background: transparent; }
.koop-mc__items::-webkit-scrollbar-thumb { background: #dcd8e0; border-radius: 5px; }
.koop-mc__items::-webkit-scrollbar-thumb:hover { background: #c9c4cf; }
.koop-mc__items::-webkit-scrollbar-button { display: none; height: 0; }
.koop-mc__item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin: 0;
  border-bottom: 1px solid var(--mc-line);
}
.koop-mc__item:last-child { border-bottom: none; }

.koop-mc__thumb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--mc-line);
  background: #fff;
  overflow: hidden;
  padding: 4px;
  box-sizing: border-box;
}
.koop-mc__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: 0;
}

.koop-mc__info { min-width: 0; }
.koop-mc__name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--mc-ink);
  text-decoration: none;
}
a.koop-mc__name:hover { color: var(--mc-primary); }
.koop-mc__info dl.variation {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--mc-ink-2);
}
.koop-mc__info dl.variation dt,
.koop-mc__info dl.variation dd,
.koop-mc__info dl.variation p { display: inline; margin: 0; }
.koop-mc__line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
  font-size: 13.5px;
}
.koop-mc__qty { color: var(--mc-ink-2); font-weight: 600; }
.koop-mc__price { font-weight: 800; }

a.koop-mc__remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--mc-ink-2);
  background: transparent;
  transition: background .15s, color .15s;
  text-decoration: none;
}
a.koop-mc__remove:hover { background: rgba(35, 31, 38, .08); color: #c62828; }
a.koop-mc__remove svg { width: 17px; height: 17px; }

/* ── Foot ─────────────────────────────────────────────────────────────── */
.koop-mc__foot {
  flex: none;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--mc-line);
}
.koop-mc__subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
}
.koop-mc__subtotal small { font-size: 12px; font-weight: 600; color: var(--mc-ink-2); }
.koop-mc__subtotal strong { font-size: 17px; font-weight: 900; }

.koop-mc__actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}
.koop-mc__btn {
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
  border-radius: 12px;
  padding: 13px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform .12s, background .15s, border-color .15s, color .15s;
}
.koop-mc__btn:active { transform: translateY(1px); }
.koop-mc__btn--primary {
  background: var(--mc-primary);
  color: var(--mc-primary-ink);
}
.koop-mc__btn--primary:hover { background: #7a4a82; color: var(--mc-primary-ink); }
.koop-mc__btn--primary svg { width: 18px; height: 18px; }
.koop-mc__btn--secondary {
  background: var(--mc-surface);
  color: var(--mc-primary);
  border-color: var(--mc-line-strong);
}
.koop-mc__btn--secondary:hover { border-color: var(--mc-primary); color: var(--mc-primary); }

/* ── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .koop-mc__items { padding: 4px 16px; }
  .koop-mc__head { padding-left: 16px; }
  .koop-mc__foot { padding: 12px 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .koop-mc *,
  .koop-mc *::before,
  .koop-mc *::after { animation: none !important; transition: none !important; }
}
