/* ============================================================
   Мини-корзина (флайаут) в стиле Strauss
   Подключается в header.php. Тема — через [data-theme="dark"].
   Все классы с префиксом .mc- чтобы не пересекаться с cart.php.
   ============================================================ */

.mini-cart {
  --mc-accent: #e67e22;
  --mc-accent-h: #d46f14;
  --mc-surface: #ffffff;
  --mc-surface-2: #f6f6f7;
  --mc-ink: #1c1c1e;
  --mc-muted: #8a8a8f;
  --mc-line: #e6e6e8;
  --mc-panel-w: 600px;

  position: fixed;
  inset: 0;
  z-index: 10001; /* выше шапки и липкого меню (.hero-info / .dopmenu = 9999) */
  visibility: hidden;
  pointer-events: none;
  font-family: "Akrobat", Arial, sans-serif;
}
.mini-cart.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* затемнение фона */
.mini-cart__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.mini-cart.is-open .mini-cart__overlay {
  opacity: 1;
}

/* сама панель справа */
.mini-cart__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: var(--mc-panel-w);
  max-width: 100%;
  background: var(--mc-surface);
  color: var(--mc-ink);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.mini-cart.is-open .mini-cart__panel {
  transform: translateX(0);
}

/* шапка панели */
.mini-cart__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--mc-line);
}
.mini-cart__title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.mini-cart__title span {
  color: var(--mc-muted);
  font-weight: 500;
}
.mini-cart__close {
  border: none;
  background: transparent;
  color: var(--mc-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
}
.mini-cart__close:hover {
  color: var(--mc-ink);
  background: var(--mc-surface-2);
}

/* тело со списком */
.mini-cart__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 22px;
  overscroll-behavior: contain;
}

/* строка товара */
.mc-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  grid-template-areas:
    "img info remove"
    "img qty  sub";
  gap: 4px 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--mc-line);
}
.mc-item__img {
  grid-area: img;
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--mc-surface-2);
  border-radius: 8px;
}
.mc-item__info {
  grid-area: info;
  min-width: 0;
}
.mc-item__title {
  display: block;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--mc-ink);
  text-decoration: none;
  margin-bottom: 14px;
}
.mc-item__title:hover {
  color: var(--mc-accent);
}
.mc-item__sku,
.mc-item__price {
  font-size: 16px;
  color: var(--mc-muted);
  margin-top: 2px;
  margin-bottom: 14px;
}
.mc-item__remove {
  grid-area: remove;
  align-self: start;
  justify-self: end;
  border: none;
  background: transparent;
  color: var(--mc-muted);
  line-height: 0;
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
}
.mc-item__remove svg {
  width: 18px;
  height: 18px;
  display: block;
}
.mc-item__remove:hover {
  color: #c0392b;
  background: var(--mc-surface-2);
}

/* количество */
.mc-item__qty {
  grid-area: qty;
  align-self: end;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--mc-line);
  overflow: hidden;
  height: 40px;
}
.mc-qty-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--mc-surface-2);
  color: var(--mc-ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.mc-qty-btn:hover {
  background: var(--mc-line);
}
.mc-qty-val {
  min-width: 54px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}
.mc-item__sub {
  grid-area: sub;
  align-self: end;
  justify-self: end;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

/* пусто */
.mc-empty {
  text-align: center;
  color: var(--mc-muted);
  padding: 56px 20px;
}
.mc-empty svg {
  width: 46px;
  height: 46px;
  opacity: 0.35;
  margin-bottom: 14px;
}
.mc-empty p {
  margin: 0 0 18px;
  font-size: 14px;
}
.mc-empty a {
  color: var(--mc-accent);
  font-weight: 600;
  text-decoration: none;
}

/* подвал с итогом и кнопками */
.mini-cart__foot {
  flex: 0 0 auto;
  padding: 18px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--mc-line);
  background: var(--mc-surface);
}
.mini-cart__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.mini-cart__total span:first-child {
  font-size: 14px;
  color: var(--mc-muted);
}
.mini-cart__total span:last-child {
  font-size: 20px;
  font-weight: 800;
}
.mini-cart__checkout {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 0;
  background: var(--mc-accent);
  color: #fff;
  font-size: 20px;
  font-weight: 400;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}
.mini-cart__checkout:hover {
  background: var(--mc-accent-h);
}
.mini-cart__continue {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--mc-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}
.mini-cart__continue:hover {
  color: var(--mc-ink);
}

/* лёгкая подсветка бейджа при добавлении */
@keyframes mc-badge-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}
.cart-badge.mc-pop,
.dop-cart-badge.mc-pop {
  animation: mc-badge-pop 0.35s ease;
}

/* ---------- бейдж количества на иконке корзины в липком меню (.dopmenu) ----------
   В проекте у .dop-cart-badge не было своего стиля (только основной .cart-badge
   в main.css), поэтому цифра была невидима. Оформляем так же — оранжевый кружок. */
.dopmenu .dop-icon-btn {
  position: relative;
}
.dop-cart-badge {
  position: absolute;
  top: -3px;
  right: 0px;
  min-width: 20px;
  height: 20px;
  width: 20px;
  padding: 7px 1px;
  border-radius: 999px;
  background: transparent;
  color: #d46f14;
  font-size: 16px;
  font-weight: 600;
  line-height: 8px;
  text-align: center;
  pointer-events: none;
}

[data-theme="light"] .dop-cart-badge {
  background: transparent;
}

.dop-cart-badge[hidden] {
  display: none;
}

/* ---------- тёмная тема ---------- */
[data-theme="dark"] .mini-cart {
  --mc-surface: #2d2d31;
  --mc-surface-2: #333338;
  --mc-ink: #f0f0f2;
  --mc-muted: #b5b5ba;
  --mc-line: #3a3a40;
}
[data-theme="dark"] .mini-cart__panel {
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.55);
}

/* ---------- мобильные ---------- */
@media (max-width: 480px) {
  .mini-cart {
    --mc-panel-w: 100%;
  }
  .mini-cart__panel {
    box-shadow: none;
  }
}
