/* ==========================================================================
   Корзина как в Тильде (T706 + попап товара T756). Размеры сняты с centrmehano.ru/shop при 1456 и 375.
   Разметку строит assets/js/cart.js, попап товара — template-parts/service/buy.php.
   ========================================================================== */

.cm-cart-lock,
.cm-cart-lock body { overflow: hidden; }

.cm-cart [hidden],
.cm-popup[hidden] { display: none !important; }

.cm-cart button { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.cm-cart.is-busy .cm-cart-products { opacity: .5; pointer-events: none; }

/* ── Значок: круг 60 #009fe3, счётчик 24, подсказка «= сумма» при наведении ── */

.cm-cart-icon {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9990;
    width: 60px;
    height: 60px;
}
.cm-cart-icon__img {
    display: block;
    width: 60px;
    height: 60px;
    padding: 12px 13px 14px;
    border-radius: 50%;
    background: #009fe3;
    box-shadow: 0 0 10px rgba(0, 0, 0, .2);
    box-sizing: border-box;
}
.cm-cart-icon__img svg { display: block; width: 100%; height: 100%; stroke: #fff; }
.cm-cart-icon__counter {
    position: absolute;
    top: 42px;
    left: 42px;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    border-radius: 30px;
    background: #fff;
    box-sizing: border-box;
    font: 14px/24px Arial, sans-serif;
    color: #009fe3;
    text-align: center;
}
.cm-cart-icon__text {
    position: absolute;
    top: 11px;
    right: 78px;
    padding: 9px 13px;
    border-radius: 3px;
    background: #292929;
    font: 600 15px/20px 'FuturaPT', Arial, sans-serif;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s;
}
.cm-cart-icon:hover .cm-cart-icon__text { opacity: 1; visibility: visible; }

/* ── Товары (общие для панели и страницы) ── */

.cm-cart-product { display: flex; align-items: center; min-height: 100px; }
.cm-cart-product + .cm-cart-product { margin-top: 10px; }
.cm-cart-product__thumb { flex: 0 0 90px; padding-right: 20px; box-sizing: border-box; }
.cm-cart-product__img { display: block; width: 70px; height: 70px; border-radius: 7px; background: #eee center / cover no-repeat; }
.cm-cart-product__title { flex: 1 1 auto; min-width: 0; padding: 15px 0; font: 600 16px/1.55 'FuturaPT', Arial, sans-serif; color: #000; }
.cm-cart-product__qty { display: flex; flex: 0 0 110px; align-items: center; padding: 13px 20px 16px 10px; box-sizing: border-box; font: 300 16px/16px 'FuturaPT', Arial, sans-serif; color: #000; }
.cm-cart-product__qty button { display: flex; width: 16px; height: 16px; }
.cm-cart-product__qty button img { opacity: .4; transition: opacity .2s; }
.cm-cart-product__qty button:hover img { opacity: 1; }
.cm-cart-product__qty span { padding: 2px 5px; }
.cm-cart-product__amount { flex: 0 0 80px; font: 300 16px/1.55 'FuturaPT', Arial, sans-serif; color: #000; white-space: nowrap; }
.cm-cart-product__del { flex: 0 0 35px; padding: 15px 0 15px 15px; box-sizing: border-box; }
.cm-cart-product__del button { display: flex; width: 20px; height: 20px; }
.cm-cart-product__del img { opacity: .4; transition: opacity .2s; }
.cm-cart-product__del button:hover img { opacity: 1; }

.cm-cart-btn {
    display: block;
    width: 100%;
    height: 60px;
    border-radius: 2px;
    background: #009fe3 !important;
    font: 400 16px/22.4px 'FuturaPT', Arial, sans-serif !important;
    color: #fff !important;
    text-align: center;
    transition: opacity .2s;
}
.cm-cart-btn:hover { opacity: .9; }
.cm-cart-btn.is-loading { opacity: .6; pointer-events: none; }

/* ── Панель «Ваш заказ» справа (ПК): 560, поля 40, затемнение 10% ── */

.cm-cart-side { position: fixed; inset: 0; z-index: 10000001; }
.cm-cart-side__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .1); }
.cm-cart-side__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 560px;
    max-width: 100%;
    padding: 40px;
    overflow-y: auto;
    background: #fff;
    box-sizing: border-box;
    transform: translateX(100%);
    transition: transform .3s ease-out;
}
.cm-cart-side.is-open .cm-cart-side__panel { transform: none; }
.cm-cart-side__top { padding-bottom: 16px; border-bottom: 1px solid rgba(0, 0, 0, .1); }
.cm-cart-side__heading { margin: 0; font: 600 24px/32.4px 'FuturaPT', Arial, sans-serif; color: #000; }
.cm-cart-side__close { position: absolute; top: 10px; right: 10px; display: flex; padding: 10px !important; }
.cm-cart-side .cm-cart-products { padding: 16px 0; border-bottom: 1px solid rgba(0, 0, 0, .1); }
.cm-cart-side__total { display: flex; justify-content: space-between; padding: 16px 0 50px; font: 600 16px/21.6px 'FuturaPT', Arial, sans-serif; color: #000; }

/* ── Страница оформления: полоса 51 сверху, форма 560 слева, заказ 560 справа ── */

.cm-cart-page { position: fixed; inset: 0; z-index: 10000002; overflow-y: auto; background: #fff; }
.cm-cart-page__top {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 51px;
    border-bottom: 1px solid rgba(0, 0, 0, .1);
    background: #fff;
    box-sizing: border-box;
}
.cm-cart-page__heading { margin: 0; font: 600 16px/21.6px 'FuturaPT', Arial, sans-serif; color: #000; }
.cm-cart-page__back { position: absolute; top: 11px; left: 16px; display: flex; align-items: center; height: 28px; padding: 1px 6px !important; }
.cm-cart-page__close { position: absolute; top: 14px; right: 16px; display: flex; padding: 0 16px !important; }
.cm-cart-page__close svg { width: 16px; height: 16px; }

.cm-cart-page__content { display: flex; justify-content: space-between; max-width: 1200px; margin: 48px auto 0; padding-bottom: 60px; }
.cm-cart-page__form,
.cm-cart-page__info { flex: 0 0 560px; margin: 0 20px; }
.cm-cart-page__form { padding-top: 40px; }
.cm-cart-page__info .cm-cart-products { padding: 0 12px; }
.cm-cart-page__total {
    display: flex;
    justify-content: space-between;
    margin: 0 12px;
    padding: 20px 0 24px;
    border-top: 1px solid rgba(0, 0, 0, .1);
    font: 600 16px/21.6px 'FuturaPT', Arial, sans-serif;
    color: #000;
}
.cm-cart-page__info .cm-cart-products + .cm-cart-page__total { margin-top: 24px; }

.cm-cart-page__next { display: none; }
.cm-cart-page.is-list .cm-cart-page__form { display: none; }
.cm-cart-page.is-list .cm-cart-page__next { display: block; margin-top: 10px; } /* + 50 снизу у «Итого» = 60, как в Тильде */

.cm-cart-form { display: flex; flex-direction: column; gap: 20px; }
.cm-cart-input {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    border: 1px solid #e6e6e6;
    border-radius: 2px;
    background: #fff;
    box-sizing: border-box;
    font: 400 16px/21.28px 'FuturaPT', Arial, sans-serif;
    color: #000;
    outline: none;
}
.cm-cart-input::placeholder,
.cm-cart-phone input::placeholder { color: #828282; opacity: .6; }
.cm-cart-input.is-invalid,
.cm-cart-phone.is-invalid { border-color: #f95d51; }
.cm-cart-phone { display: flex; align-items: center; gap: 5px; }
.cm-cart-phone__select { position: relative; display: flex; align-items: center; gap: 6px; flex: 0 0 59px; height: 54px; font: 400 16px 'FuturaPT', Arial, sans-serif; color: #828282; }
.cm-cart-phone__select select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cm-cart-phone__flag { width: 18px; height: 13px; background: linear-gradient(#fff 33.3%, #0039a6 33.3% 66.6%, #d52b1e 66.6%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.cm-cart-phone__flag[data-flag="BY"] { background: linear-gradient(#c8313e 66.6%, #4aa657 66.6%); }
.cm-cart-phone__flag[data-flag="KZ"] { background: #00afca; }
.cm-cart-phone__flag[data-flag="UA"] { background: linear-gradient(#0057b7 50%, #ffd700 50%); }
.cm-cart-phone__triangle { width: 0; height: 0; border-top: 5px solid #9a9a9a; border-right: 4px solid transparent; border-left: 4px solid transparent; }
.cm-cart-phone input { flex: 1 1 auto; min-width: 0; height: 54px; padding: 0; border: 0; background: none; font: 400 16px 'FuturaPT', Arial, sans-serif; color: #000; outline: none; }

.cm-cart-consent { position: relative; display: flex; gap: 10px; font: 300 14px/22px 'Montserrat', Arial, sans-serif; color: #737f84; cursor: pointer; }
.cm-cart-consent input { position: absolute; opacity: 0; }
.cm-cart-consent__box { flex: 0 0 16px; height: 16px; margin-top: 2px; border: 1px solid #878787; box-sizing: border-box; }
.cm-cart-consent input:checked + .cm-cart-consent__box { background: #000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8l3 3 6-6' stroke='%23fff' stroke-width='2' fill='none'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: #000; }
.cm-cart-consent.is-invalid .cm-cart-consent__box { border-color: #f95d51; }
.cm-cart-consent a { border-bottom: 1px solid #78b3cd; color: #0093d5; text-decoration: none; }
.cm-cart-form__error { margin: 0; font: 400 14px/20px 'FuturaPT', Arial, sans-serif; color: #f95d51; }
.cm-cart-form .cm-cart-btn { margin-top: 10px; }

/* ── Телефон и узкие экраны: сначала заказ, потом форма (как в Тильде ≤960) ── */

@media (max-width: 960px) {
    .cm-cart-page__top { height: 51px; }
    .cm-cart-page__heading { font-size: 14px; line-height: 18.9px; }
    .cm-cart-page__back { top: 9px; left: 12px; }
    .cm-cart-page__back svg { width: 30px; height: 20px; }
    .cm-cart-page__close { top: 17px; right: 0; }
    .cm-cart-page__content { flex-direction: column-reverse; justify-content: flex-start; margin-top: 35px; }
    .cm-cart-page__form,
    .cm-cart-page__info { flex: none; margin: 0; padding: 0 20px; }
    .cm-cart-page__form { padding-top: 40px; }
    .cm-cart-page__info .cm-cart-products { padding: 0; }
    .cm-cart-page__total { margin: 35px 0 0; padding: 12px 0 39px; border-top-color: rgba(0, 0, 0, .2); }
    .cm-cart-page__info .cm-cart-products + .cm-cart-page__total { margin-top: 35px; }

    .cm-cart-product { position: relative; flex-wrap: wrap; align-items: flex-start; }
    .cm-cart-product__thumb { flex-basis: 90px; }
    .cm-cart-product__title { flex: 0 0 calc(100% - 90px); padding: 0 30px 10px 0; box-sizing: border-box; font-size: 16px; line-height: 23.2px; }
    .cm-cart-product__qty { flex: 0 0 auto; margin-left: 90px; padding: 0 20px 0 0; font-size: 16px; }
    .cm-cart-product__qty span { padding: 2px 12px; }
    .cm-cart-product__amount { flex: 0 0 auto; padding-right: 20px; line-height: 23.2px; }
    .cm-cart-product__del { position: absolute; top: 0; right: 0; padding: 0; }

    .cm-cart-consent { font-size: 14px; line-height: 22px; }
    .cm-cart-form { padding-bottom: 20px; }
}

/* ── Карточка товара видеокурса (T756): 560, #f5f5f5, фото 530×350, круглая кнопка ── */

.cm-popup { position: fixed; inset: 0; z-index: 10000000; overflow-y: auto; }
.cm-popup__overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); }
.cm-popup__card { position: relative; width: 560px; max-width: 100%; margin: 65px auto; border-radius: 8px; overflow: hidden; background: #f5f5f5; }
.cm-popup__gallery { padding: 15px; }
.cm-popup__img { display: block; width: 100%; height: 350px; border-radius: 4px; object-fit: contain; }
.cm-popup__info { padding: 40px 60px; }
.cm-popup__title { margin: 0; font: 600 24px/28.08px 'Montserrat', Arial, sans-serif; color: #000; }
.cm-popup__price { margin: 12px 0 0; font: 700 18px/24.3px 'Montserrat', Arial, sans-serif; color: #0083be; }
.cm-popup__descr { margin-top: 20px; font: 400 16px/24.8px 'Montserrat', Arial, sans-serif; color: #67777e; }
.cm-popup__descr p { margin: 0; }
.cm-popup__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 65px;
    margin-top: 25px;
    padding: 0 94px;
    border: 0;
    border-radius: 50px;
    background: #009bdd;
    font: 500 15px/21px 'Montserrat', Arial, sans-serif;
    color: #fff;
    cursor: pointer;
    transition: background-color .2s;
}
.cm-popup__btn:hover { background: #0081b8; }
.cm-popup__btn.is-loading { opacity: .6; pointer-events: none; }
.cm-popup__close { position: fixed; top: 20px; right: 20px; z-index: 1; display: flex; padding: 0; border: 0; background: none; cursor: pointer; }

/* Телефон: сверху чёрная полоса с белым крестиком, карточка от 50px до низа экрана (как T756 в Тильде) */
@media (max-width: 560px) {
    .cm-popup__overlay { background: #000; }
    .cm-popup__card { min-height: calc(100vh - 50px); margin: 50px 0 0; border-radius: 8px 8px 0 0; }
    .cm-popup__close { top: 17px; right: 17px; }
    .cm-popup__close svg { width: 16px; height: 16px; }
    .cm-popup__img { height: auto; aspect-ratio: 530 / 350; }
    .cm-popup__info { padding: 30px 20px; }
    .cm-popup__btn { width: 100%; padding: 0 20px; }
}

/* Кнопка-товар в спецпредложениях главной выглядит как прежняя ссылка */
button.offers-home__btn { border: 0; font-family: inherit; cursor: pointer; }
