/* webasyst-shops, 2026-09-21 — ТЗ ads-analytics 50: корзина отдельно от оформления (nazarklinok.ru). docs/nazarklinok.ru.md, «ТЗ 50».
   Подключается в index.html после main.min.css. Поведение — assets/js/tz50-cart.js.
   ⚠ В main.min.css (старая вёрстка) есть общее .btn{width:190px;height:40px;padding:14px 0} — перебивает Bootstrap; из-за него на телефоне
   «−» и «+» были по 190 px, а поле количества — 10 px (ТЗ 46). Здесь размеры кнопок задаются явно. */

/* ---------- п. 2.3 услуги в строке товара (/cart/ и /order/) ---------- */
.tz50-svcs .tz50-svc--more { display: none; }
.tz50-svcs.is-open .tz50-svc--more,
.tz50-svcs .tz50-svc--more.is-added,
.tz50-svcs .tz50-svc--more.is-active { display: block; }
.tz50-svc__price { white-space: nowrap; color: var(--bs-secondary-color, #6c757d); transition: color .15s ease; }
/* цена включённой услуги подсвечена (заказчик 21.09) — /cart/ и /order/ (там цена — <span> в подписи) */
.tz50-svc.is-added .tz50-svc__price,
.wa-service.tz50-svc.is-active .wa-label > span { color: #2fb54a; font-weight: 700; }
.tz50-svc .tz50-svc__vprice { display: none; }
.tz50-svc.is-added .tz50-svc__vprice { display: inline; }
.tz50-svcs .s-service + .s-service { margin-top: 4px; }
/* переключатель — в потоке, а не на отрицательном отступе Bootstrap (.form-switch: padding-left 2.5em, поле margin-left −2.5em):
   иначе он вылезал влево на колонку фото (замечание заказчика 21.09) */
.tz50-svcs .form-check.form-switch { display: flex; align-items: flex-start; gap: 10px; padding-left: 0; margin-bottom: 0; min-height: 0; }
.tz50-svcs .form-check.form-switch .form-check-input { float: none; flex: 0 0 auto; margin: 2px 0 0; }
.tz50-svcs .form-check-label { flex: 1 1 auto; min-width: 0; }
.tz50-svcs .s-service > select { margin-left: 46px; width: calc(100% - 46px); }
/* выбор варианта (гравировка: именная / логотип) — пока услуга не включена, он неактивен (так в теме и приложении); прячем до включения */
.tz50-svc:not(.is-added) > select { display: none; }
.wa-service.tz50-svc:not(.is-active) .wa-variant { display: none; }
.tz50-more {
    display: inline-flex; align-items: center; min-height: 36px; margin-top: 4px; padding: 4px 0;
    background: none; border: 0; color: var(--bs-link-color, #cd200a); font-size: 14px; font-weight: 600; cursor: pointer;
    text-decoration: underline dotted; text-underline-offset: 3px;
}
.tz50-more::after { content: ""; width: 7px; height: 7px; margin-left: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); }
.tz50-svcs.is-open > .tz50-more::after { transform: rotate(-135deg) translateY(-1px); }

/* фото в строке товара: шаблон берёт разметку плитки (.card-product__img — 235×350 на ПК из main.min.css), на ПК фото вылезало за свою
   колонку на название и услуги и само задавало высоту строки (~350 px; ТЗ 46). Вписываем в колонку. */
.tz50-cart .s-image-column .card-product__img { width: 100%; max-width: 140px; height: auto; aspect-ratio: 1 / 1; }
.tz50-cart .s-image-column .card-product__img img { width: 100%; height: 100%; object-fit: contain; }
/* отступ от фото до названия и услуг (заказчик 21.09) */
.tz50-cart .s-content-column { padding-left: 16px; }

/* ---------- п. 2.5 количество и удаление (/cart/) ---------- */
/* «− [поле] +» в одну строку на всех ширинах (на ПК было столбиком в 3 строки — замечание заказчика 21.09) */
.tz50-cart .b-cart-quantity .input-group { flex-wrap: nowrap; width: auto; max-width: 168px; }
.tz50-cart .b-cart-quantity .btn {
    flex: 0 0 44px; width: 44px; min-width: 44px; max-width: 64px; height: 44px; padding: 0; border-radius: 8px; font-size: 20px; line-height: 1;
    /* контур, как у поля (у темы кнопки без рамки — на тёмном фоне их не видно; заказчик 21.09) */
    border: 1px solid rgba(255, 255, 255, .35);
}
.tz50-cart .b-cart-quantity .btn:hover { border-color: rgba(255, 255, 255, .6); }
.tz50-cart .b-cart-quantity .js-quantity-field { border-color: rgba(255, 255, 255, .35); }
.tz50-cart .b-cart-quantity .input-group > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tz50-cart .b-cart-quantity .input-group > .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tz50-cart .b-cart-quantity .js-quantity-field { flex: 1 1 auto; width: 56px; min-width: 48px; height: 44px; font-size: 17px; }
@media (max-width: 991.98px) {
    .tz50-cart .b-cart-quantity .input-group { max-width: 180px; }
    .tz50-cart .b-cart-quantity .btn { flex-basis: 48px; width: 48px; height: 48px; }
    .tz50-cart .b-cart-quantity .js-quantity-field { height: 48px; }
}
.tz50-del {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 0; min-height: 36px;
    background: none; border: 0; color: var(--bs-secondary-color, #6c757d); font-size: 14px; cursor: pointer;
}
.tz50-del:hover { color: var(--bs-link-color, #cd200a); }
.tz50-del__icon { display: inline-flex; width: 24px; height: 24px; }
.tz50-del__icon svg { width: 24px; height: 24px; }
.tz50-undo {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 16px; padding: 12px 16px;
    border: 1px dashed var(--bs-border-color, #ced4da); border-radius: 8px; background: var(--bs-tertiary-bg, #f8f9fa); font-size: 15px;
}
.tz50-undo__btn {
    min-height: 44px; padding: 0 4px; background: none; border: 0; font-weight: 700; font-size: 15px;
    color: var(--bs-link-color, #cd200a); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.tz50-empty .tz50-undo { margin-bottom: 20px; }

/* ---------- п. 2.6 пустая корзина ---------- */
.tz50-empty[hidden] { display: none !important; }
.tz50-empty__btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }
.tz50-empty__btns .btn { width: auto; height: auto; min-height: 48px; padding: 12px 24px; line-height: 1.2; }
/* отступы блока и рамка второй кнопки — свои: py-md-10 в теме нет, а общее .btn из main.min.css снимает рамку у btn-outline-theme */
.tz50-empty__box { padding: 40px 20px 44px !important; }
.tz50-empty__box .icon { width: 56px; height: 56px; }
.tz50-empty__box .icon svg { width: 100%; height: 100%; }
.tz50-empty__box .h2 { margin: 0; }
.tz50-empty__btns .btn-outline-theme { border: 2px solid currentColor; }
.tz50-viewed { margin-top: 32px; }
.tz50-viewed__title { margin-bottom: 16px; }
.tz50-viewed__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (min-width: 768px) { .tz50-viewed__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .tz50-viewed__list { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tz50-viewed__item { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.tz50-viewed__img { display: block; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--bs-tertiary-bg, #f8f9fa); }
.tz50-viewed__img img { width: 100%; height: 100%; object-fit: contain; }
.tz50-viewed__name { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tz50-viewed__price { font-weight: 700; }

/* ---------- п. 2.7 доставка и условия ---------- */
.tz50-terms { margin-top: 16px; font-size: 14px; line-height: 1.45; text-align: left; color: var(--bs-secondary-color, #555); }
.tz50-terms ul { list-style: none; margin: 0 0 8px; padding: 0; }
.tz50-terms li { position: relative; padding-left: 16px; margin-bottom: 4px; }
.tz50-terms li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.tz50-terms p { margin: 0; }

/* ---------- п. 2.4 полоса «Итого + Оформить заказ» (телефон, планшет) ---------- */
.tz50-bar { display: none; }
@media (max-width: 991.98px) {
    .tz50-bar {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: fixed; left: 0; right: 0; bottom: var(--tz50-cookie-h, 0px); z-index: 1030;
        padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
        background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #141c23); box-shadow: 0 -2px 14px rgba(0, 0, 0, .14);
    }
    .tz50-bar[hidden] { display: none !important; }
    .tz50-bar__sum { font-size: 15px; line-height: 1.2; }
    .tz50-bar__total { display: block; font-size: 20px; font-weight: 700; white-space: nowrap; }
    .tz50-bar .tz50-bar__btn { flex: 0 0 auto; width: auto; height: 48px; padding: 0 20px; line-height: 1; }
    html.tz50-has-bar body { padding-bottom: calc(76px + var(--tz50-cookie-h, 0px)); }
}

/* ---------- п. 2.2 мини-корзина ---------- */
.tz50-mini {
    position: fixed; z-index: 1065; padding: 18px 18px 16px; outline: none;
    background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #141c23);
    border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
    opacity: 0; transform: translateY(-6px); transition: opacity .15s ease, transform .15s ease;
}
.tz50-mini.is-shown { opacity: 1; transform: none; }
.tz50-mini--drop { width: 380px; max-width: calc(100vw - 24px); }
.tz50-mini--sheet { left: 0; right: 0; bottom: 0; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateY(24px); }
.tz50-mini-back { position: fixed; inset: 0; z-index: 1064; background: rgba(0, 0, 0, .4); }
html.tz50-mini-open { overflow: hidden; }
.tz50-mini__x {
    position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; padding: 0;
    background: none; border: 0; font-size: 28px; line-height: 1; color: var(--bs-secondary-color, #6c757d); cursor: pointer;
}
.tz50-mini__head { font-size: 15px; font-weight: 700; margin: 0 36px 12px 0; }
.tz50-mini__head::before { content: "✓"; display: inline-block; margin-right: 8px; color: #2e8b3a; }
.tz50-mini__item { display: flex; gap: 12px; align-items: center; }
.tz50-mini__img { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--bs-tertiary-bg, #f8f9fa); }
.tz50-mini__img img { width: 100%; height: 100%; object-fit: contain; }
.tz50-mini__info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tz50-mini__name { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tz50-mini__price { font-weight: 700; }
.tz50-mini__sum { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--bs-border-color, #e5e5e5); font-size: 14px; }
.tz50-mini__btns { display: flex; gap: 10px; margin-top: 14px; }
.tz50-mini__btns .btn { flex: 1 1 0; width: auto; height: auto; min-height: 44px; padding: 10px 12px; line-height: 1.2; white-space: normal; }
.tz50-mini--sheet .tz50-mini__btns .btn { min-height: 48px; }

/* ---------- п. 2.8 корзина в /order/ ---------- */
.tz50-order-sum {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 14px 20px;
    background: none; border: 0; text-align: left; font-size: 17px; font-weight: 600; color: inherit; cursor: pointer;
}
.tz50-order-sum__act { flex: 0 0 auto; font-weight: 600; font-size: 15px; color: var(--bs-link-color, #cd200a); text-decoration: underline dotted; text-underline-offset: 3px; }
.tz50-order-cart:not(.tz50-collapsed) .tz50-order-sum { border-bottom: 1px solid var(--bs-border-color, #e5e5e5); }
/* !important — у заголовка карточки класс d-flex (Bootstrap, display:flex !important) */
.tz50-order-cart.tz50-collapsed > .card-header,
.tz50-order-cart.tz50-collapsed > .card-body { display: none !important; }
/* телефон и планшет: отступы над свёрнутой корзиной и между ней и формой — меньше, чтобы форма начиналась в первой половине экрана
   (ТЗ 50 п. 2.8: первое поле — не ниже 0,5 экрана на Pixel 7) */
@media (max-width: 991.98px) {
    .s-checkout-order-page.mt-6 { margin-top: 12px !important; }
    .s-checkout-order-page #js-order-form { margin-top: 0; }
    .s-checkout-order-page .row > .col-12.mt-6 { margin-top: 12px !important; }
    .s-checkout-order-page #js-order-form > .card-header { padding-top: 10px; padding-bottom: 10px; }
    .s-checkout-order-page #js-order-form > .card-header .s-header { font-size: 24px; line-height: 1.2; }
    .s-checkout-order-page #js-order-form > .card-body { padding-top: 8px; }
    .s-checkout-order-page #js-order-form .wa-step-auth-section .wa-section-body form > .wa-line:first-child { padding-top: 8px; }
}
