/* Desktop mini-cart — Uff palette (white / black / orange) */
.desktop-header,
.desktop-header-actions,
.mainheader {
  overflow: visible;
}

.desktop-header-actions {
  position: relative;
  z-index: 1200;
  display: flex !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.desktop-header-actions .e-cart,
.desktop-header-actions .header-cart-wrap {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  margin: 0 !important;
  padding: 0 !important;
  position: relative;
}

.desktop-header-actions .cart-bar {
  width: 28px;
  max-width: 28px;
  min-height: 28px;
  margin: 0;
  justify-content: center;
}

.desktop-header-actions .cart-bar span img {
  margin-right: 0 !important;
  width: 18px;
  height: 18px;
  display: block;
}

.desktop-header-actions .cart-count {
  top: -4px;
  right: -4px;
  left: auto;
  width: 18px;
  height: 18px;
}

.desktop-header-actions .button-block,
.desktop-header-actions .button-fn-rp-1 {
  flex: 0 1 auto;
  white-space: nowrap;
  max-width: 100%;
}

.header-cart-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  /* чтобы :hover не рвался на пути к дропдауну */
  padding-bottom: 0;
  z-index: 10040;
}

.header-cart-preview {
  position: absolute;
  top: 100%;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  /* прозрачный «мост» вместо gap — курсор не теряет hover */
  padding-top: 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  z-index: 10050;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  transition: opacity 0.15s ease, visibility 0.15s;
}

.header-cart-preview__actions,
.header-cart-preview__btn {
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
  cursor: pointer;
}

.header-cart-preview__panel {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #ececec;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 14px;
}

.header-cart-wrap:hover .header-cart-preview,
.header-cart-wrap.is-open .header-cart-preview,
.header-cart-wrap:focus-within .header-cart-preview {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.header-cart-preview__empty {
  padding: 18px 8px;
  text-align: center;
  color: #808080;
  font-size: 14px;
}

.header-cart-preview__loading {
  position: relative;
  color: #98a2b3;
}

.header-cart-preview__loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid #e5e5e5;
  border-top-color: #ff6f3a;
  border-radius: 50%;
  vertical-align: -2px;
  animation: header-cart-spin 0.7s linear infinite;
}

@keyframes header-cart-spin {
  to { transform: rotate(360deg); }
}

.header-cart-preview__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.header-cart-preview__item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.header-cart-preview__item:last-child {
  border-bottom: 0;
}

.header-cart-preview__thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #f5f5f5;
  border: 1px solid #eee;
}

.header-cart-preview__name {
  display: block;
  color: #1f1f1f;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  margin-bottom: 4px;
}

.header-cart-preview__name:hover {
  color: #ff6f3a;
}

.header-cart-preview__meta {
  font-size: 12px;
  color: #808080;
}

.header-cart-preview__remove {
  border: 0;
  background: transparent;
  color: #1f1f1f;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  font-size: 16px;
  opacity: 0.55;
}

.header-cart-preview__remove:hover {
  opacity: 1;
  color: #ff6f3a;
}

.header-cart-preview__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #ececec;
  font-size: 14px;
  color: #1f1f1f;
}

.header-cart-preview__total strong {
  color: #1f1f1f;
  font-size: 16px;
}

.header-cart-preview__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.header-cart-preview__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
}

.header-cart-preview__btn--cart {
  background: #1f1f1f;
  color: #fff;
}

.header-cart-preview__btn--checkout {
  background: #ff6f3a;
  color: #fff;
}

.header-cart-preview__btn:hover {
  filter: brightness(1.06);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 991px) {
  .header-cart-preview {
    display: none !important;
  }
}

/* Mobile sticky checkout CTA — Uff palette */
.mobile-checkout-bar {
  display: none;
}

@media (max-width: 991px) {
  .mobile-checkout-bar {
    display: none;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 2147482990;
    background: #fff;
    color: #1f1f1f;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-checkout-bar.is-visible {
    display: flex;
  }

  .mobile-checkout-bar__total {
    font-size: 13px;
    line-height: 1.2;
    color: #808080;
  }

  .mobile-checkout-bar__total strong {
    display: block;
    font-size: 15px;
    margin-top: 2px;
    color: #1f1f1f;
  }

  .mobile-checkout-bar__btn {
    flex: 0 0 auto;
    background: #ff6f3a;
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-checkout-bar__btn:hover {
    color: #fff;
    text-decoration: none;
    filter: brightness(1.05);
  }

  body.has-mobile-checkout-bar {
    padding-bottom: 140px;
  }
}
