/* ==========================================================================
   DELUXE 2026 — модалка корзины (deluxe27). Подключается на всех страницах
   магазина после media.css (Controller_Index::before, флаг enabled_cart в config/home2026.php).
   Разметка (v_overlayshopcart.php → v_shopcart.php, ct-*) и JS корзины прежние: файл только
   переодевает их в палитру и шрифты редизайна. Модалка остаётся по центру (centerModal в js.js),
   на телефоне — прежняя шторка снизу (cart.css, .alert--sheet), здесь у неё меняются только цвета.
   Все селекторы начинаются с #alert — страница /shopcart.html (.ct-wrap--page) не затрагивается.
   Раскладочные правила десктопа — только в @media (min-width: 701px): иначе #alert-специфичность
   перебила бы мобильные .alert--sheet правила cart.css.
   Цвета — брендбук: красный #DD1D1D, графит, кремовые подложки, зелёный только для «бесплатно».
   ========================================================================== */

@font-face {
    font-family: "Manrope";
    src: url("/media/fonts/manrope-cyrillic.woff2") format("woff2");
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Manrope";
    src: url("/media/fonts/manrope-latin.woff2") format("woff2");
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Unbounded";
    src: url("/media/fonts/unbounded-cyrillic.woff2") format("woff2");
    font-weight: 500 800;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Unbounded";
    src: url("/media/fonts/unbounded-latin.woff2") format("woff2");
    font-weight: 500 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Токены — те же значения, что в home2026.css (:root); здесь свои, потому что модалка
   открывается и на страницах без home2026.css (статьи, кабинет …) */
#alert {
    --c-red: #DD1D1D;
    --c-red-600: #C8171A;
    --c-red-50: #FDECEC;
    --c-green: #17884C;
    --c-green-50: #E7F3EC;
    --c-ink: #1F1D1E;
    --c-ink-2: #4A4648;
    --c-muted: #716C68;
    --c-muted-2: #9C968F;
    --c-line: #E8E3DC;
    --c-line-2: #D9D2C8;
    --c-cream: #F6F2EC;
    --c-cream-2: #EEE7DD;
    --c-photo-bg: #F7F6F4;
    --c-ff: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --c-ff-display: "Unbounded", "Manrope", system-ui, sans-serif;
    --c-ease: cubic-bezier(.2, .7, .2, 1);
    --c-ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* ---------- Затемнение: тёплый графит с размытием вместо чёрного 70 % ---------- */
body.cart-modal-open #overlay {
    background-color: rgba(31, 29, 30, .5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* ---------- Общая типографика и цвета (десктоп и шторка) ---------- */
#alert .ct-wrap,
#alert .empty-cart {
    font-family: var(--c-ff);
    color: var(--c-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
#alert .ct-wrap button,
#alert .ct-wrap input { font-family: inherit; }

#alert .ct-title {
    font-family: var(--c-ff-display);
    font-weight: 700;
    letter-spacing: -.035em;
    color: var(--c-ink);
}
#alert .ct-count-badge,
#alert.alert--sheet .ct-count-badge {
    background: var(--c-red);
    color: #fff;
    font-family: var(--c-ff);
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 0 0 0 4px rgba(221, 29, 29, .14);
}

/* Доставка: прогресс — кремовая плашка с красной шкалой, «бесплатно» — зелёная */
#alert .ct-delivery-progress {
    background: var(--c-cream);
    border: 0;
}
#alert .ct-delivery-label { color: var(--c-ink-2); font-weight: 700; }
#alert .ct-delivery-label svg path { fill: var(--c-red); }
#alert .ct-delivery-amount {
    font-family: var(--c-ff-display);
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--c-ink);
}
#alert .ct-progress-track { background: #fff; border-radius: 999px; }
#alert .ct-progress-fill {
    background: linear-gradient(90deg, #F2734B, var(--c-red));
    border-radius: 999px;
}
#alert .ct-delivery-bottom { color: var(--c-muted-2); font-weight: 700; }
#alert .ct-delivery-free {
    background: var(--c-green-50);
    border: 0;
}
#alert .ct-delivery-icon { box-shadow: none; }
#alert .ct-delivery-icon svg path { fill: var(--c-green); }
#alert .ct-delivery-text { color: var(--c-green); }
#alert .ct-delivery-congrats { font-weight: 800; }

/* Фото на подложке, белый фон снимка растворяется в ней */
#alert .ct-photo-frame { background: var(--c-photo-bg); }
#alert .ct-td-photo img {
    object-fit: contain;
    mix-blend-mode: multiply;
}
#alert .ct-photo-placeholder { background: var(--c-cream-2); }

#alert .ct-product-link {
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--c-ink);
    -webkit-transition: color .2s;
    transition: color .2s;
}

#alert .ct-sale-badge {
    background: var(--c-red);
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: .04em;
}

/* Количество — кремовая пилюля, круглые белые кнопки, графитовый текст */
#alert .ct-qty {
    background: var(--c-cream);
    border: 0;
}
#alert .ct-qty-btn {
    background: #fff;
    color: var(--c-ink);
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(31, 29, 30, .08);
}
#alert .ct-qty-input {
    color: var(--c-ink);
    font-weight: 800;
}
#alert .ct-qty--busy .ct-qty-input { color: var(--c-muted-2); }

#alert .ct-td-price { color: var(--c-muted); font-weight: 600; }
#alert .ct-price-old { color: var(--c-muted-2); }
#alert .ct-unit { color: var(--c-muted); font-weight: 700; }
#alert .ct-line-sum-value {
    font-family: var(--c-ff-display);
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--c-ink);
}

#alert .ct-del-btn { color: var(--c-muted-2); }

/* Главная кнопка — красная пилюля, как «В корзину» на карточках */
#alert .ct-checkout-btn {
    border-radius: 999px;
    background: var(--c-red);
    font-family: var(--c-ff);
    font-weight: 800;
    letter-spacing: -.005em;
    box-shadow: 0 14px 30px -12px rgba(221, 29, 29, .85);
    -webkit-transition: background-color .2s, transform .2s var(--c-ease), box-shadow .25s;
    transition: background-color .2s, transform .2s var(--c-ease), box-shadow .25s;
}
#alert .ct-checkout-btn:active { transform: translateY(1px) scale(.99); box-shadow: 0 8px 18px -10px rgba(221, 29, 29, .85); }
#alert .ct-checkout-btn[disabled] { box-shadow: none; }
#alert .ct-checkout-sum {
    font-family: var(--c-ff-display);
    font-weight: 700;
    letter-spacing: -.02em;
}

#alert .ct-guest-note { color: var(--c-muted); font-weight: 600; }
#alert .ct-guest-note svg path { fill: var(--c-muted-2); }
#alert .ct-trust-item { color: var(--c-muted); font-weight: 600; }
#alert .ct-trust-item svg path { fill: var(--c-muted-2); }
#alert .ct-pay-icons img {
    -webkit-filter: grayscale(1);
    filter: grayscale(1);
    opacity: .5;
}

/* Удаление с отменой */
#alert .ct-undo-row {
    border-color: var(--c-line-2);
    background: var(--c-cream);
    color: var(--c-muted);
}
#alert .ct-undo-name { color: var(--c-ink); font-weight: 700; }
#alert .ct-undo-btn {
    border: 2px solid var(--c-ink);
    color: var(--c-ink);
    font-weight: 800;
}
#alert .ct-undo-progress { background: var(--c-red); }
#alert .ct-undo-row--error { border-color: #F0B44C; background: #FFF1DB; color: #9A5B00; }

#alert .cart-flash-error {
    border-left: 0;
    border-radius: 14px;
    background: #FFF1DB;
    color: #9A5B00;
    font-weight: 600;
}

/* Состояния */
@media (hover: hover) {
    #alert .ct-product-link:hover { color: var(--c-red); }
    #alert .ct-qty-btn:hover { background: var(--c-ink); color: #fff; }
    #alert .ct-del-btn:hover { color: var(--c-red); background: var(--c-red-50); }
    #alert .ct-checkout-btn:hover {
        background: var(--c-red-600);
        box-shadow: 0 18px 34px -12px rgba(221, 29, 29, .9);
        transform: translateY(-1px);
    }
    #alert .ct-undo-btn:hover { background: var(--c-ink); color: #fff; }
}
#alert .ct-qty-btn:active { background: var(--c-cream-2); }

#alert .ct-checkout-btn:focus-visible,
#alert .ct-qty-btn:focus-visible,
#alert .ct-qty-input:focus-visible,
#alert .ct-del-btn:focus-visible,
#alert .ct-product-link:focus-visible,
#alert .ct-back-link:focus-visible,
#alert .ct-undo-btn:focus-visible,
#alert .ct-sheet-close:focus-visible,
#alert .empty-cart__btn:focus-visible {
    outline: 2px solid var(--c-red);
    outline-offset: 3px;
}

/* ---------- Пустая корзина в модалке ---------- */
#alert .empty-cart { padding: 40px 24px 36px; margin: 0; }
#alert .empty-cart__icon { background: var(--c-cream); }
#alert .empty-cart__icon svg { stroke: var(--c-muted-2); }
#alert .empty-cart__title {
    font-family: var(--c-ff-display);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -.035em;
    color: var(--c-ink);
}
#alert .empty-cart__text { color: var(--c-muted); }
#alert .empty-cart__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 30px;
    border-radius: 999px;
    background: var(--c-red);
    font-family: var(--c-ff);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -.005em;
    box-shadow: 0 14px 30px -12px rgba(221, 29, 29, .85);
}
#alert .empty-cart__btn:hover { background-color: var(--c-red-600); }

/* В пустой модалке закрыть было нечем (кроме клика мимо): прежняя скрытая
   ссылка .try_shopping из v_overlayshopcart.php становится круглым крестиком */
#alert .popup-css:has(> .empty-cart) { position: relative; }
#alert .popup-css:has(> .empty-cart) > .try_shopping {
    display: block;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--c-cream) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%231F1D1E' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / 16px no-repeat;
    cursor: pointer;
    -webkit-transition: background-color .2s;
    transition: background-color .2s;
}
#alert .popup-css:has(> .empty-cart) > .try_shopping:hover { background-color: var(--c-cream-2); }
#alert .popup-css:has(> .empty-cart) > .try_shopping span {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ==========================================================================
   Десктоп и планшет: модалка по центру (геометрию top/left ставит centerModal)
   ========================================================================== */
@-webkit-keyframes ct26In {
    from { opacity: 0; -webkit-transform: translateY(14px) scale(.985); }
    to   { opacity: 1; -webkit-transform: none; }
}
@keyframes ct26In {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

@media (min-width: 701px) {
    #alert:has(.ct-wrap--overlay),
    #alert:has(> #al > .cart-popup .empty-cart) {
        width: min(940px, calc(100vw - 48px));
        background: transparent;
    }
    #alert:has(> #al > .cart-popup .empty-cart) { width: min(520px, calc(100vw - 48px)); }

    /* Карточка модалки: анимацию вешаем на неё, а не на #alert — у того inline transform от centerModal */
    #alert .cart-popup:has(.ct-wrap--overlay),
    #alert .cart-popup:has(.empty-cart) {
        overflow: hidden;
        border-radius: 28px;
        background: #fff;
        box-shadow: 0 30px 80px -24px rgba(31, 29, 30, .45), 0 2px 6px rgba(31, 29, 30, .06);
        -webkit-animation: ct26In .35s var(--c-ease-out);
        animation: ct26In .35s var(--c-ease-out);
    }
    #alert .cart-popup:has(.ct-wrap--overlay) > .popup-css { padding: 32px 36px 28px; background: #fff; }
    #alert .cart-popup:has(.empty-cart) > .popup-css { padding: 8px; background: #fff; }

    #alert .ct-wrap--overlay {
        max-width: none;
        padding: 0;
    }

    /* Шапка: заголовок Unbounded, справа — пилюля «Продолжить покупки» со стрелкой */
    #alert .ct-head { margin-bottom: 22px; }
    #alert .ct-title { gap: 12px; font-size: 30px; line-height: 1.1; }
    #alert .ct-count-badge { min-width: 30px; height: 30px; padding: 0 9px; font-size: 14px; }

    #alert .ct-back-link {
        gap: 8px;
        min-height: 44px;
        padding: 0 18px 0 14px;
        border: 2px solid var(--c-line-2);
        border-radius: 999px;
        font-size: 14px;
        font-weight: 800;
        color: var(--c-ink);
        text-decoration: none;
        -webkit-transition: border-color .2s, background-color .2s, color .2s;
        transition: border-color .2s, background-color .2s, color .2s;
    }
    #alert .ct-back-link::before {
        content: "";
        width: 16px;
        height: 16px;
        background: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 12H5m6-6l-6 6 6 6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 12H5m6-6l-6 6 6 6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
        -webkit-transition: -webkit-transform .25s var(--c-ease);
        transition: transform .25s var(--c-ease);
    }

    /* Доставка */
    #alert .ct-delivery-bar { padding: 16px 20px; border-radius: 18px; margin-bottom: 18px; }
    #alert .ct-delivery-icon { width: 44px; height: 44px; }
    #alert .ct-progress-track { height: 8px; }

    /* Таблица: шапка и строки — одна сетка */
    #alert .ct-table-header,
    #alert .ct-row {
        grid-template-columns: 76px minmax(0, 1fr) 84px 120px 84px 104px 40px;
        gap: 14px;
    }
    #alert .ct-table-header {
        padding: 0 22px 10px;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .14em;
        color: var(--c-muted-2);
    }
    #alert .ct-th-photo { visibility: hidden; }   /* «Фото» над фотографиями ничего не сообщает */
    #alert .ct-th-sum { justify-content: flex-end; }

    #alert .ct-products {
        padding: 0 22px;
        border: 1px solid var(--c-line);
        border-radius: 22px;
    }
    #alert .ct-row {
        padding: 14px 0;
        border-bottom-color: var(--c-line);
    }

    #alert .ct-photo-frame,
    #alert .ct-td-photo img {
        width: 76px;
        height: 76px;
        border-radius: 16px;
    }
    #alert .ct-td-photo img { padding: 4px; }

    #alert .ct-product-link { font-size: 16px; line-height: 1.3; }

    /* Фасовка — кремовый чип; justify-self сжимает ячейку сетки до содержимого */
    #alert .ct-td-weight {
        justify-self: center;
        min-height: 30px;
        padding: 0 12px;
        border-radius: 999px;
        background: var(--c-cream);
        font-size: 13px;
        font-weight: 700;
        color: var(--c-ink-2);
        white-space: nowrap;
    }

    #alert .ct-qty { padding: 4px; gap: 2px; }
    #alert .ct-qty-btn { width: 32px; height: 32px; font-size: 17px; }
    #alert .ct-qty-input { width: 30px; height: 32px; line-height: 32px; font-size: 15px; }

    #alert .ct-td-price { font-size: 14px; }
    #alert .ct-td-sum { text-align: right; white-space: nowrap; }
    #alert .ct-line-sum-value { font-size: 18px; }

    #alert .ct-del-btn {
        width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        -webkit-transition: color .2s, background-color .2s;
        transition: color .2s, background-color .2s;
    }

    #alert .ct-undo-row { margin: 10px 0; padding: 12px 16px; border-radius: 16px; }
    #alert .ct-undo-btn { min-height: 40px; }

    /* Итог: кнопка во всю ширину, под ней гарантии одной строкой с иконками оплаты */
    #alert .ct-summary { gap: 14px; margin-top: 18px; }
    #alert .ct-checkout-btn { min-height: 62px; padding: 0 24px; font-size: 17px; }
    #alert .ct-checkout-sum { font-size: 18px; margin-left: 2px; }
    #alert .ct-guest-note { font-size: 13px; }
    #alert .ct-trust { gap: 8px; padding-top: 4px; }
    #alert .ct-trust-item {
        min-height: 32px;
        padding: 0 12px;
        border-radius: 999px;
        background: var(--c-cream);
        font-size: 12.5px;
        color: var(--c-ink-2);
    }
    #alert .ct-pay-icons { gap: 16px; padding-top: 2px; }
    #alert .ct-pay-icons img { height: 20px; }

    @media (hover: hover) {
        #alert .ct-back-link:hover { border-color: var(--c-ink); text-decoration: none; }
        #alert .ct-back-link:hover::before { -webkit-transform: translateX(-3px); transform: translateX(-3px); }
    }
}

/* Узкий планшет: колонки «Вес» и «Цена» сжимаем, чтобы название не схлопывалось */
@media (min-width: 701px) and (max-width: 860px) {
    #alert .cart-popup:has(.ct-wrap--overlay) > .popup-css { padding: 24px 22px 22px; }
    #alert .ct-table-header,
    #alert .ct-row {
        grid-template-columns: 64px minmax(0, 1fr) 70px 112px 70px 90px 36px;
        gap: 10px;
    }
    #alert .ct-photo-frame,
    #alert .ct-td-photo img { width: 64px; height: 64px; }
    #alert .ct-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    #alert .cart-popup { -webkit-animation: none !important; animation: none !important; }
}

/* ==========================================================================
   Телефон: шторка снизу (раскладка — cart.css), здесь только оформление
   ========================================================================== */
@media (max-width: 700px) {
    #alert.alert--sheet {
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -16px 48px rgba(31, 29, 30, .22);
    }
    #alert.alert--sheet .ct-head { border-bottom-color: var(--c-line); }
    #alert.alert--sheet .ct-head::before { background: var(--c-line-2); }
    #alert.alert--sheet .ct-title { font-size: 19px; }
    #alert.alert--sheet .ct-count-badge { box-shadow: 0 0 0 3px rgba(221, 29, 29, .14); }
    #alert.alert--sheet .ct-sheet-close { background: var(--c-cream); color: var(--c-ink); }
    #alert.alert--sheet .ct-sheet-close:active { background: var(--c-cream-2); }

    #alert.alert--sheet .ct-delivery-bar { border-radius: 16px; }
    #alert.alert--sheet .ct-row { border-bottom-color: var(--c-line); }
    #alert.alert--sheet .ct-photo-frame { border-radius: 14px; }
    #alert.alert--sheet .ct-td-photo img { border-radius: 14px; padding: 3px; }
    #alert.alert--sheet .ct-product-link { font-size: 15px; }
    #alert.alert--sheet .ct-mobile-chip { color: var(--c-muted); font-weight: 600; }
    #alert.alert--sheet .ct-mobile-chip--price { color: var(--c-ink); font-weight: 700; }
    #alert.alert--sheet .ct-mobile-chip--muted { color: var(--c-muted-2); }
    #alert.alert--sheet .ct-mobile-chip + .ct-mobile-chip::before { background: var(--c-line-2); }
    #alert.alert--sheet .ct-td-sum .ct-unit { color: var(--c-muted); }

    #alert.alert--sheet .ct-summary { border-top-color: var(--c-line); }
    #alert.alert--sheet .ct-checkout-btn {
        border-radius: 999px;
        min-height: 54px;
        padding: 0 18px;
        box-shadow: 0 12px 26px -12px rgba(221, 29, 29, .85);
    }
    #alert.alert--sheet .ct-checkout-sum { font-size: 16px; }
    #alert.alert--sheet .ct-undo-row { border-radius: 14px; }
}
@media (max-width: 700px) and (max-height: 640px) {
    #alert.alert--sheet .ct-checkout-btn { min-height: 48px; }
}
