/* Корзина и оформление заказа — современный вид (только стили, разметка темы и Simple не тронута).
   Подключается из checkout/cart.twig и checkout/simplecheckout.twig. Откат — убрать <link>. */
:root {
  --bu-blue: rgb(9, 110, 171);
  --bu-blue-soft: rgba(9, 110, 171, .07);
  --bu-text: #1f2633;
  --bu-muted: #7b8494;
  --bu-line: #e4e8ef;
  --bu-radius: 14px;
}

/* ---------- Общая карточка ---------- */
#checkout-cart .rm-cart,
.simplecheckout .simplecheckout-block {
  background: #fff;
  border: 1px solid var(--bu-line);
  border-radius: var(--bu-radius);
  box-shadow: 0 2px 10px rgba(31, 38, 51, .04);
}

/* ================= КОРЗИНА (checkout/cart) ================= */
#checkout-cart .rm-cart { padding: 24px 28px; }
#checkout-cart .rm-cart-title { display: none; } /* дубль заголовка страницы */

#checkout-cart .rm-cart-products-item {
  position: relative;
  padding: 18px 0;
  border-bottom: 1px solid var(--bu-line);
  gap: 16px;
}
#checkout-cart .rm-cart-products-item:first-child { padding-top: 4px; }
#checkout-cart .rm-cart-products-item-img {
  width: 96px; height: 96px; flex: 0 0 96px;
  border: 1px solid var(--bu-line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fff; margin: 0 18px 0 0;
}
#checkout-cart .rm-cart-products-item-img img { max-width: 88px; max-height: 88px; object-fit: contain; }
#checkout-cart .rm-cart-products-item-info-title a {
  color: var(--bu-text) !important; text-decoration: none !important;
  font-size: 16px; font-weight: 500; line-height: 1.35;
}
#checkout-cart .rm-cart-products-item-info-title a:hover { color: var(--bu-blue) !important; }
#checkout-cart .rm-cart-products-item-info-option { color: var(--bu-muted); font-size: 13px; margin-top: 4px; }

/* удалить — значок в углу */
#checkout-cart .rm-cart-products-item { padding-right: 48px !important; }
#checkout-cart .rm-btn-del {
  order: 9; position: absolute; right: 0; top: 50%; transform: translateY(-50%); margin: 0 !important;
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; opacity: .45; transition: opacity .15s, background .15s;
}
#checkout-cart .rm-btn-del:hover { opacity: 1; background: #fdecec; }

/* количество: − 1 + в одной «таблетке» */
#checkout-cart .rm-product-quantity {
  border: 1px solid var(--bu-line); border-radius: 10px; overflow: hidden; height: 40px;
}
#checkout-cart .rm-product-quantity .form-control {
  width: 46px; height: 38px; border: 0; text-align: center; font-weight: 600; box-shadow: none;
}
#checkout-cart .rm-cart-products-item-update { display: none; } /* количество применяется само (см. cart.twig) */
#checkout-cart .rm-cart-products-item-right { gap: 28px; margin-right: 46px; }
#checkout-cart .rm-cart-products-item-price { min-width: 150px; }
#checkout-cart .rm-cart-products-item-price-all { font-size: 18px; font-weight: 700; color: var(--bu-text); }
#checkout-cart .rm-cart-products-item-price-one { font-size: 12px; color: var(--bu-muted); margin-top: 2px; }

/* итог: «Итого» мелко, последняя строка — крупно */
#checkout-cart .rm-cart-block-total-price { font-size: 15px; color: var(--bu-muted); margin: 2px 0; }
#checkout-cart .rm-cart-block-total-price span { color: var(--bu-text); }
#checkout-cart .rm-cart-block-total-price:last-child { font-size: 24px; font-weight: 700; color: var(--bu-text); margin-top: 6px; }
#checkout-cart .rm-cart-block-total-price:last-child span { color: var(--bu-text); }

#checkout-cart .rm-cart-buttons { justify-content: flex-end !important; }
#checkout-cart .rm-cart-buttons .rm-btn.dark,
.simplecheckout #simplecheckout_button_confirm {
  background: var(--bu-blue) !important; border: 0 !important; color: #fff !important;
  border-radius: 12px; padding: 15px 34px; font-size: 16px; font-weight: 600; line-height: 1.2;
  box-shadow: 0 6px 16px rgba(9, 110, 171, .25); transition: transform .1s, box-shadow .15s, filter .15s;
}
#checkout-cart .rm-cart-buttons .rm-btn.dark:hover,
.simplecheckout #simplecheckout_button_confirm:hover { filter: brightness(1.08); box-shadow: 0 8px 20px rgba(9, 110, 171, .32); }
#checkout-cart .rm-cart-buttons .rm-btn.dark:active,
.simplecheckout #simplecheckout_button_confirm:active { transform: translateY(1px); }

/* купоны/доставка — компактно и тише */
#checkout-cart .rm-cart-block { padding: 14px 0; border-bottom: 1px solid var(--bu-line); }
#checkout-cart .rm-cart-title-bold { font-size: 15px; font-weight: 600; }
#checkout-cart .rm-cart-text { font-size: 13px; color: var(--bu-muted); }
#checkout-cart .rm-cart-block-title { font-size: 15px; cursor: pointer; }

/* ================= ОФОРМЛЕНИЕ (Simple) ================= */
.simplecheckout { counter-reset: bu-step; }
.simplecheckout .simplecheckout-block { padding: 22px 24px; margin-bottom: 20px; }
.simplecheckout .simplecheckout-left-column,
.simplecheckout .simplecheckout-right-column { padding-top: 0; }

/* заголовки блоков: номер шага вместо серой плашки с зелёной рамкой */
.simplecheckout .checkout-heading,
.simplecheckout .checkout-heading.panel-heading {
  background: none !important; border: 0 !important; padding: 0 0 14px !important; margin: 0 !important;
  font-size: 18px; font-weight: 600; color: var(--bu-text);
  display: flex; align-items: center; gap: 10px; min-height: 0; line-height: 1.3;
}
.simplecheckout .simplecheckout-block:not(#simplecheckout_cart) > .checkout-heading::before {
  counter-increment: bu-step; content: counter(bu-step);
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--bu-blue); color: #fff; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.simplecheckout .checkout-heading-button { margin-left: auto; font-size: 14px; font-weight: 400; }
.simplecheckout .simplecheckout-block-content { padding: 0 !important; border: 0 !important; background: none !important; }

/* поля */
.simplecheckout .form-group { margin: 0 0 14px; }
.simplecheckout .control-label {
  display: block; width: 100%; text-align: left !important; float: none;
  font-size: 13px; color: var(--bu-muted); padding: 0 0 6px !important; margin: 0;
}
.simplecheckout .form-horizontal .col-sm-4,
.simplecheckout .form-horizontal .col-sm-8 { width: 100%; max-width: 100%; flex: 0 0 100%; float: none; padding-left: 0; padding-right: 0; }
.simplecheckout .form-horizontal .form-group { margin-left: 0; margin-right: 0; }
.simplecheckout .form-control {
  height: 46px; border: 1px solid #d5dbe4; border-radius: 10px; padding: 10px 14px;
  font-size: 15px; color: var(--bu-text); background: #fff; box-shadow: none;
  transition: border-color .15s, box-shadow .15s;
}
.simplecheckout textarea.form-control { height: auto; min-height: 96px; resize: vertical; }
.simplecheckout .form-control:focus { border-color: var(--bu-blue); box-shadow: 0 0 0 3px rgba(9, 110, 171, .15); outline: 0; }
.simplecheckout .has-error .form-control,
.simplecheckout .form-control.simplecheckout-error { border-color: #e0524f; }
.simplecheckout .simplecheckout-error-text { font-size: 12px; color: #d9403c; margin-top: 4px; }
.simplecheckout .required .control-label::after { content: " *"; color: #e0524f; }
.simplecheckout .required .control-label::before { display: none; }

/* «Зарегистрироваться: Да/Нет» — в строку */
.simplecheckout .row-customer_register .col-sm-8 > div { display: flex; gap: 8px; }
.simplecheckout .row-customer_register .radio { flex: 1 1 0; }

/* выбор доставки и оплаты — плитки */
.simplecheckout .radio { margin: 0 0 8px; }
.simplecheckout .radio label {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 12px 14px !important; margin: 0;
  border: 1px solid var(--bu-line); border-radius: 10px; background: #fff;
  font-size: 15px; line-height: 1.35; color: var(--bu-text); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.simplecheckout .radio label:hover { border-color: #b9c6d8; }
.simplecheckout .radio label:has(input:checked) { border-color: var(--bu-blue); background: var(--bu-blue-soft); box-shadow: inset 0 0 0 1px var(--bu-blue); }
.simplecheckout .radio input[type=radio] {
  position: static !important; margin: 1px 0 0 !important; flex: 0 0 18px; opacity: 1 !important; appearance: auto; width: 18px; height: 18px; accent-color: var(--bu-blue);
}
.simplecheckout #simplecheckout_shipping p { margin: 14px 0 8px; font-size: 13px; color: var(--bu-muted); text-transform: uppercase; letter-spacing: .04em; }
.simplecheckout #simplecheckout_shipping p b { font-weight: 600; }

/* ---------- товары в оформлении ---------- */
.simplecheckout #simplecheckout_cart .table-responsive { overflow: visible; border: 0; margin: 0; }
.simplecheckout table.simplecheckout-cart { width: 100%; border: 0 !important; border-collapse: collapse; margin: 0; }
.simplecheckout table.simplecheckout-cart thead { display: none; }
.simplecheckout table.simplecheckout-cart td { border: 0 !important; border-bottom: 1px solid var(--bu-line) !important; padding: 14px 8px !important; vertical-align: middle; background: none !important; }
.simplecheckout table.simplecheckout-cart tr:last-child td { border-bottom: 0 !important; }
.simplecheckout table.simplecheckout-cart td.image { width: 84px; padding-left: 0 !important; }
.simplecheckout table.simplecheckout-cart td.image img {
  width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--bu-line); border-radius: 10px; padding: 4px; background: #fff;
}
.simplecheckout table.simplecheckout-cart td.name { text-align: left !important; }
.simplecheckout table.simplecheckout-cart td.name > .image { display: none !important; }
.simplecheckout table.simplecheckout-cart td.name a { color: var(--bu-text) !important; text-decoration: none !important; font-size: 15px; font-weight: 500; }
.simplecheckout table.simplecheckout-cart td.name a:hover { color: var(--bu-blue) !important; }
.simplecheckout table.simplecheckout-cart td.name .options small { color: var(--bu-muted); }
.simplecheckout table.simplecheckout-cart td.model,
.simplecheckout table.simplecheckout-cart td.remove,
.simplecheckout table.simplecheckout-cart col.model,
.simplecheckout table.simplecheckout-cart col.remove { display: none; }
.simplecheckout table.simplecheckout-cart td.price { color: var(--bu-muted); font-size: 13px; white-space: nowrap; text-align: right; }
.simplecheckout table.simplecheckout-cart td.total { font-weight: 700; font-size: 16px; white-space: nowrap; text-align: right; padding-right: 0 !important; color: var(--bu-text); }

/* количество − 1 + и удалить */
.simplecheckout td.quantity .input-group { display: flex; align-items: center; flex-wrap: nowrap; width: auto; max-width: none !important; gap: 0; }
.simplecheckout td.quantity .input-group-btn { display: flex; width: auto; }
.simplecheckout td.quantity .btn-primary {
  width: 34px; height: 36px; padding: 0; border: 1px solid var(--bu-line) !important;
  background: #f6f8fb !important; color: var(--bu-text) !important; box-shadow: none; font-size: 12px;
}
.simplecheckout td.quantity .input-group-btn:first-child .btn-primary { border-radius: 10px 0 0 10px !important; }
.simplecheckout td.quantity .input-group-btn:last-child .btn-primary { border-radius: 0 10px 10px 0 !important; }
.simplecheckout td.quantity .btn-primary:hover { background: #eaf1f8 !important; color: var(--bu-blue) !important; }
.simplecheckout td.quantity .form-control {
  width: 44px; height: 36px; border-radius: 0; border-left: 0; border-right: 0; text-align: center; font-weight: 600; padding: 0;
}
.simplecheckout td.quantity .btn-danger {
  width: 34px; height: 34px; margin-left: 10px; padding: 0; border: 0 !important; border-radius: 50% !important;
  background: transparent !important; color: #aab2bf !important; font-size: 18px; box-shadow: none;
}
.simplecheckout td.quantity .btn-danger:hover { background: #fdecec !important; color: #d9403c !important; }

/* суммы — аккуратный столбик справа */
.simplecheckout .simplecheckout-cart-total {
  display: flex; justify-content: flex-end; align-items: baseline; gap: 16px;
  padding: 4px 0 !important; border: 0 !important; background: none !important; font-size: 15px; color: var(--bu-muted);
}
.simplecheckout .simplecheckout-cart-total b { font-weight: 400; }
.simplecheckout .simplecheckout-cart-total-value { min-width: 130px; text-align: right; color: var(--bu-text); }
.simplecheckout .simplecheckout-cart-total-remove:empty { display: none; }
.simplecheckout #total_total { margin-top: 6px; padding-top: 12px !important; border-top: 1px solid var(--bu-line) !important; }
.simplecheckout #total_total, .simplecheckout #total_total b { font-size: 20px; font-weight: 700; color: var(--bu-text); }
.simplecheckout #total_total .simplecheckout-cart-total-value { font-size: 22px; }

/* согласие и кнопка */
.simplecheckout .simplecheckout-button-block { background: none !important; border: 0 !important; padding: 4px 0 0 !important; }
.simplecheckout .simplecheckout-button-right { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; float: none; text-align: right; }
.simplecheckout #agreement_checkbox .checkbox label, .simplecheckout #agreement_checkbox .checkbox { padding: 0 !important; }
.simplecheckout #agreement_checkbox .checkbox label { font-size: 13px; color: var(--bu-muted); line-height: 1.45; padding-left: 0; display: inline-flex; gap: 8px; align-items: flex-start; text-align: left; max-width: 640px; }
.simplecheckout #agreement_checkbox input[type=checkbox] { position: static !important; margin: 2px 0 0 !important; flex: 0 0 16px; width: 16px; height: 16px; accent-color: var(--bu-blue); }
.simplecheckout #agreement_checkbox a, .simplecheckout #agreement_checkbox a b { font-weight: 400; color: var(--bu-blue); }
.simplecheckout #simplecheckout_button_confirm { min-width: 260px; text-align: center; }

/* ================= ТЕЛЕФОН ================= */
@media (max-width: 767px) {
  #checkout-cart .rm-cart { padding: 14px 16px; border-radius: 12px; }
  #checkout-cart .rm-cart-products-item { display: grid !important; grid-template-columns: 76px minmax(0, 1fr); gap: 10px 14px; padding: 16px 0; }
  #checkout-cart .rm-cart-products-item-left { display: contents !important; }
  #checkout-cart .rm-cart-products-item-img { width: 76px; height: 76px; margin: 0; grid-row: span 2; }
  #checkout-cart .rm-cart-products-item-img img { max-width: 68px; max-height: 68px; }
  #checkout-cart .rm-cart-products-item-info { padding-right: 34px; }
  #checkout-cart .rm-cart-products-item-info-title a { font-size: 15px; }
  #checkout-cart .rm-cart-products-item-right { grid-column: 2; padding-right: 0; margin-right: 0; gap: 12px; align-items: center !important; justify-content: space-between; width: 100%; }
  #checkout-cart .rm-cart-products-item-price { min-width: 0; text-align: right; }
  #checkout-cart .rm-cart-products-item-price-all { font-size: 14px; white-space: nowrap; }
  #checkout-cart .rm-cart-products-item-right { gap: 8px !important; }
  #checkout-cart .rm-cart-products-item-right { width: auto !important; min-width: 0; }
  #checkout-cart .rm-product-quantity { flex: 0 0 auto !important; display: flex !important; }
  #checkout-cart .rm-product-quantity > .d-flex { flex: 0 0 24px; }
  #checkout-cart .rm-cart-products-item { padding-right: 0 !important; }
  #checkout-cart .rm-btn-del { top: 12px !important; right: 0 !important; left: auto !important; transform: none; }
  #checkout-cart .rm-cart-products-item-right {
    flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; justify-content: space-between !important;
  }
  #checkout-cart .rm-cart-products-item-right > * { margin: 0 !important; }
  #checkout-cart .rm-cart-products-item-info,
  #checkout-cart .rm-cart-products-item-right,
  #checkout-cart .rm-cart-products-item-img { margin: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; }
  #checkout-cart .rm-cart-products-item-img { grid-row: 1 / span 2; align-self: start; }
  #checkout-cart .rm-cart-products-item-info { align-self: start; }
  #checkout-cart .rm-cart-products-item-price { text-align: right !important; margin-left: auto !important; }
  #checkout-cart .rm-cart-products-item-price-one { display: none; }
  #checkout-cart .rm-cart-block-total-price { text-align: right; }
  #checkout-cart .rm-cart-buttons .rm-btn.dark { width: 100%; text-align: center; }

  .simplecheckout .simplecheckout-block { padding: 16px; border-radius: 12px; margin-bottom: 14px; }
  .simplecheckout .checkout-heading { font-size: 17px; }
  /* строка товара — карточка: фото | название, ниже количество и сумма */
  .simplecheckout table.simplecheckout-cart,
  .simplecheckout table.simplecheckout-cart tbody { display: block; }
  .simplecheckout table.simplecheckout-cart colgroup { display: none; }
  .simplecheckout table.simplecheckout-cart tr {
    display: grid; grid-template-columns: 68px 1fr auto; grid-template-areas: "img name name" "img qty total";
    gap: 8px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--bu-line);
  }
  .simplecheckout table.simplecheckout-cart tr:last-child { border-bottom: 0; }
  .simplecheckout table.simplecheckout-cart td { display: block; border: 0 !important; padding: 0 !important; width: auto !important; }
  .simplecheckout table.simplecheckout-cart td.image { grid-area: img; display: block !important; }
  .simplecheckout table.simplecheckout-cart td.image img { width: 64px; height: 64px; }
  .simplecheckout table.simplecheckout-cart td.name { grid-area: name; }
  .simplecheckout table.simplecheckout-cart td.name a { font-size: 14px; }
  .simplecheckout table.simplecheckout-cart td.quantity { grid-area: qty; }
  .simplecheckout table.simplecheckout-cart td.price { display: none !important; }
  .simplecheckout table.simplecheckout-cart td.total { grid-area: total; font-size: 15px; }
  .simplecheckout table.simplecheckout-cart td.model,
  .simplecheckout table.simplecheckout-cart td.remove { display: none !important; }
  .simplecheckout .simplecheckout-cart-total-value { min-width: 0; }
  /* Simple на телефоне прячет «−/+» — возвращаем */
  .simplecheckout table.simplecheckout-cart td.quantity [data-onclick*=increase],
  .simplecheckout table.simplecheckout-cart td.quantity [data-onclick*=decrease] { display: inline-flex !important; align-items: center; justify-content: center; }
  .simplecheckout td.quantity .btn-primary { width: 30px; height: 32px; }
  .simplecheckout td.quantity .form-control { width: 36px; height: 32px; }
  .simplecheckout table.simplecheckout-cart tr { position: relative; }
  .simplecheckout table.simplecheckout-cart td.quantity, .simplecheckout td.quantity .input-group, .simplecheckout td.quantity .input-group-btn { position: static !important; }
  .simplecheckout td.quantity .btn-danger { position: absolute; top: 8px; right: -6px; margin: 0; width: 30px; height: 30px; }
  .simplecheckout table.simplecheckout-cart td.name { padding-right: 30px !important; }
  .simplecheckout .checkout-heading-button { font-size: 13px; white-space: nowrap; }
  .simplecheckout #simplecheckout_customer .checkout-heading { flex-wrap: wrap; }
  .simplecheckout .simplecheckout-button-right { align-items: stretch; }
  .simplecheckout #simplecheckout_button_confirm { width: 100%; min-width: 0; }
}

/* кружки/галочки темы рисуются псевдо-элементом у label — у нас нативные, с отступом */
.simplecheckout .radio label::before, .simplecheckout .radio label::after,
.simplecheckout #agreement_checkbox label::before, .simplecheckout #agreement_checkbox label::after { display: none !important; }
.simplecheckout .radio input[type=radio], .simplecheckout #agreement_checkbox input[type=checkbox] { margin-right: 4px !important; }
