.mf-cart{
  --mf-radius: 16px;
  --mf-border: 1px solid rgba(0,0,0,.08);
  --mf-shadow: 0 12px 26px rgba(0,0,0,.08);
  --mf-yellow: #ebbd2f;
  --mf-muted: rgba(0,0,0,.55);
  --mf-muted2: rgba(0,0,0,.45);
}

/* Empty cart */
.mf-cart .bx-sbb-empty-cart-container{
  border: var(--mf-border);
  border-radius: var(--mf-radius);
  background: #fff;
  padding: 44px 18px;
  margin: 10px 0 20px;
  text-align: center;
}
.mf-cart .bx-sbb-empty-cart-image{
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, #f2f4f7, #e6eaef);
  border: 1px solid rgba(0,0,0,.06);
  display: grid;
  place-items: center;
}
.mf-cart .bx-sbb-empty-cart-image img{
  width: 54px;
  height: 54px;
  opacity: .65;
}
.mf-cart .bx-sbb-empty-cart-text{
  font-size: 22px;
  font-weight: 900;
  color: #000;
  margin: 0 0 8px;
}
.mf-cart .bx-sbb-empty-cart-desc{
  font-size: 14px;
  color: var(--mf-muted);
}
.mf-cart .bx-sbb-empty-cart-desc a{
  color: #000;
  font-weight: 900;
  text-decoration: underline;
}
.mf-cart .bx-sbb-empty-cart-desc a:hover{
  text-decoration: none;
}

/* Basket root: make it visible quickly and consistent */
.mf-cart #basket-root{
  border: 0;
}

/* Main list wrapper */
.mf-cart .basket-items-list-wrapper{
  border: var(--mf-border) !important;
  border-radius: var(--mf-radius);
  background: #fff;
  box-shadow: none;
}

/* Реально режет таблицу стандартный .basket-items-list-container { overflow: hidden }, а не обёртка выше. */
.mf-cart .basket-items-list-container{
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}
.mf-cart .basket-items-list{
  min-width: 0;
}

/* Стандартный шаблон прячет удаление до :hover; на тач-экранах при ширине ≥768px крестик не появляется. */
.mf-cart .basket-item-block-actions{
  opacity: 1 !important;
}
.mf-cart .basket-item-actions-remove{
  z-index: 2;
}
.mf-cart .basket-items-list-header{
  padding: 14px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: #fff;
}
.mf-cart .basket-items-search-field .form-control{
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
  box-shadow: none !important;
}
.mf-cart .basket-items-search-field .form-control:focus{
  border-color: rgba(0,0,0,.35);
  box-shadow: 0 0 0 3px rgba(235,189,47,.25) !important;
}
.mf-cart .basket-items-search-clear-btn{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 0;
  background: rgba(0,0,0,.04);
  color: rgba(0,0,0,.6);
}
.mf-cart .basket-items-search-clear-btn:hover{ background: rgba(0,0,0,.07); }

/* Items table spacing (row-cards) */
.mf-cart .basket-items-list-table{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-collapse: separate !important;
  border-spacing: 0 12px;
  padding: 12px;
}
.mf-cart .basket-item-block-properties,
.mf-cart .basket-item-property-value,
.mf-cart .basket-item-property-custom-value{
  overflow-wrap: anywhere;
  word-break: break-word;
}
.mf-cart .basket-items-list-item-container > td{
  background: #fff;
  border-top: var(--mf-border);
  border-bottom: var(--mf-border);
}
.mf-cart .basket-items-list-item-container > td:first-child{
  border-left: var(--mf-border);
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
}
.mf-cart .basket-items-list-item-container > td:last-child{
  border-right: var(--mf-border);
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
}

/* Requested: remove borders on basket rows/remove cell */
.mf-cart .basket-items-list-item-container > td{
  border: 0 !important;
}
.mf-cart .basket-items-list-item-container > td:first-child{
  border-left: 0 !important;
}
.mf-cart .basket-items-list-item-container > td:last-child{
  border-right: 0 !important;
}
.mf-cart td.basket-items-list-item-remove{
  border: 0 !important;
  min-width: 48px;
  width: 48px;
  box-sizing: border-box;
  vertical-align: middle;
}

/* Product title */
.mf-cart .basket-item-info-name{
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 6px;
}
.mf-cart .basket-item-info-name-link{
  color: #000;
  text-decoration: none;
}
.mf-cart .basket-item-info-name-link:hover{ text-decoration: none; }

.mf-cart .mf-cart-store-meta{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,.10);
}
.mf-cart .mf-cart-store-meta__line{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(0,0,0,.74);
}
.mf-cart .mf-cart-store-meta__line + .mf-cart-store-meta__line{
  margin-top: 2px;
}
.mf-cart .mf-cart-store-meta__label{
  font-weight: 900;
  color: rgba(0,0,0,.58);
}
.mf-cart .mf-cart-store-meta__value{
  color: #000;
}
.mf-cart .mf-cart-store-meta__switch{
  margin-top: 10px;
}
.mf-cart .mf-cart-store-meta__switch-title{
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(0,0,0,.58);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.mf-cart .mf-cart-store-meta__switch-controls{
  display: flex;
  align-items: center;
  gap: 8px;
}
.mf-cart .mf-cart-store-meta__select{
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  color: #000;
}
.mf-cart .mf-cart-store-meta__apply{
  flex: 0 0 auto;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--mf-yellow);
  color: #000;
  font-weight: 900;
}
.mf-cart .mf-cart-store-meta__apply:disabled{
  opacity: .6;
}

/* Product image */
.mf-cart .basket-item-block-image{
  flex: 0 0 78px;
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  padding-right: 20px;
  padding-bottom: 0;
  margin-right: 4px;
}
.mf-cart .basket-item-block-info{
  padding-left: 2px;
}
.mf-cart .basket-item-image{
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
}
.mf-cart .basket-item-block-image--placeholder{
  position: relative;
  overflow: hidden;
  height: 78px;
  background-color: #fff;
  background-image: url("/bitrix/templates/eshop_bootstrap_v4/images/mf-no-photo.svg?v=2");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% auto;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.06);
}
.mf-cart .basket-item-block-image--placeholder .basket-item-image,
.mf-cart .basket-item-block-image--placeholder .basket-item-image-link{
  display: block;
  width: 78px;
  height: 78px;
}
.mf-cart .basket-item-block-image--placeholder .basket-item-image.mf-img--placeholder{
  opacity: 0;
  background: none;
  border: 0;
  pointer-events: none;
}

/* Price typography */
.mf-cart .basket-item-price-current,
.mf-cart .basket-coupon-block-total-price-current{
  font-weight: 900;
  color: #000;
  white-space: nowrap;
}
.mf-cart .basket-item-price-current{ font-size: 16px; }
.mf-cart .basket-coupon-block-total-price-current{ font-size: 22px; }
.mf-cart .basket-item-price-old,
.mf-cart .basket-coupon-block-total-price-old{
  color: var(--mf-muted2);
  text-decoration: line-through;
}

/* Quantity controls */
.mf-cart .basket-item-amount-filed-block{
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 6px 10px;
  background: #fff;
}
.mf-cart .basket-item-amount-filed{
  height: 34px;
  border: 0 !important;
  outline: none !important;
  font-weight: 800;
  box-shadow: none !important;
}
.mf-cart .basket-item-amount-btn-plus,
.mf-cart .basket-item-amount-btn-minus{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(0,0,0,.04);
}
.mf-cart .basket-item-amount-btn-plus:hover,
.mf-cart .basket-item-amount-btn-minus:hover{
  background: rgba(0,0,0,.07);
}

/* Checkout summary (rendered into data-entity=basket-total-block) */
.mf-cart [data-entity="basket-total-block"] .basket-checkout-container{
  border: var(--mf-border);
  border-radius: var(--mf-radius);
  background: #fff;
  padding: 14px;
}
.mf-cart [data-entity="basket-total-block"] .basket-coupon-section{
  margin-bottom: 12px;
}
.mf-cart [data-entity="basket-total-block"] .basket-coupon-block-field-description{
  color: var(--mf-muted);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}
.mf-cart [data-entity="basket-total-block"] .basket-coupon-block-field .form-control{
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
}
.mf-cart [data-entity="basket-total-block"] .basket-btn-checkout{
  width: 100%;
  border-radius: 12px;
  background: var(--mf-yellow) !important;
  border: 0 !important;
  color: #000 !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: .8px !important;
}
.mf-cart [data-entity="basket-total-block"] .basket-btn-checkout:hover{ opacity: .92; }
.mf-cart [data-entity="basket-total-block"] .basket-btn-checkout:active{ opacity: .85; }

.mf-cart [data-entity="basket-total-block"] .basket-checkout-section-inner{
  flex-wrap: wrap;
  gap: 10px;
}
.mf-cart [data-entity="basket-total-block"] .basket-btn-checkout-selected{
  width: 100%;
  border-radius: 12px;
  font-weight: 800;
}

.mf-cart-partial-select-cell{
  width: 2.75rem;
  vertical-align: middle !important;
  text-align: center;
}
.mf-cart-partial-select-label{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}
.mf-cart-partial-checkbox{
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* У grid/flex-потомков иначе min-content таблицы блокирует сжатие — последние td уезжают за overflow. */
.mf-cart #basket-root > .row > .col.mf-cart__items{
  min-width: 0;
}

/* Two-column layout on desktop */
@media (min-width: 992px){
  .mf-cart #basket-root{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "warn warn"
      "items total";
    gap: 18px;
    align-items: start;
  }

  /* Bootstrap rows have negative margins + clearfix pseudo-elements.
     Turn rows into "transparent wrappers" so grid stays stable. */
  .mf-cart #basket-root > .row{
    display: contents;
  }
  .mf-cart #basket-root > .row::before,
  .mf-cart #basket-root > .row::after{
    content: none !important;
    display: none !important;
  }

  /* Grid items are columns */
  .mf-cart #basket-root > .row > .col{
    padding: 0;
    grid-column: 1 / 2;
  }
  .mf-cart #basket-root > .row > .col[data-entity="basket-total-block"]{
    grid-column: 2 / 3;
    margin: 0;
  }

  /* Explicit placement (added by mf-cart.js) */
  .mf-cart #basket-root > .row > .col.mf-cart__warn{ grid-area: warn; }
  .mf-cart #basket-root > .row > .col.mf-cart__items{ grid-area: items; }
  .mf-cart #basket-root > .row > .col.mf-cart__total{ grid-area: total; }
}

@media (max-width: 767.98px){
  .mf-cart .mf-cart-store-meta__switch-controls{
    flex-direction: column;
    align-items: stretch;
  }
  .mf-cart .mf-cart-store-meta__apply{
    width: 100%;
  }
}

/* Доставка до СПБ: индикатор в кружке (мета по складу в корзине) */
.mf-cart .mf-store-delivery-spb{
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  vertical-align: middle;
  box-sizing: border-box;
}
.mf-cart .mf-store-delivery-spb--ok{
  background: #198754;
}
.mf-cart .mf-store-delivery-spb--bad{
  background: #e67e22;
}
.mf-cart .mf-cart-store-meta__value--delivery-spb{
  display: inline-flex;
  align-items: center;
}

/* Bitrix sale.basket.basket: checkStickyHeaders() вешает position:fixed на фильтр и блок итого.
   Вместе с display:contents у .mf-cart #basket-root > .row сетка ломается — блоки «уезжают» при скролле. */
.mf-cart .basket-items-list-header.basket-items-list-header-fixed{
  position: static !important;
  top: auto !important;
  left: auto !important;
  width: auto !important;
  max-width: none !important;
  z-index: auto !important;
  margin-left: 0 !important;
  border-bottom: 1px solid #e2dfdf;
}
.mf-cart .basket-checkout-container.basket-checkout-container-fixed{
  position: static !important;
  top: auto !important;
  left: auto !important;
  width: auto !important;
  max-width: none !important;
  z-index: auto !important;
}
.mf-cart .basket-checkout-container.basket-checkout-container-fixed-hide{
  opacity: 1 !important;
}

