/* ============================================================
   Всплывающая корзина (#cartpopup)
   Палитра сайта: акцент #2DC5FF, текст #00364A, подложки #eef2f5, линии #e3e9ee

   Иерархия: главное — список корзины, итог и «Оформить заказ» (верхняя половина
   окна, крупно); апсейл («Добавить к заказу», «Рекомендуем») — второстепенная
   зона ниже на светлой подложке, компактные карточки.
   ============================================================ */

#cartpopup {
    width: 1100px;
    /* От ширины обёртки плагина (без полосы прокрутки), с запасом под пробел между
       inline-block'ами: иначе окно переносится на вторую строку и снизу висит пустота */
    max-width: calc(100% - 40px);
    display: none;
    position: relative;
    margin: 24px 0;
    text-align: left;
}
#cartpopup * {
    box-sizing: border-box;
}
/* Градиентная линия по верхнему краю окна */
#cartpopup::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #A8E7FF 0%, #C1ADFF 50%, #00B9FF 100%);
    z-index: 11;
}

#cartpopup.well {
    background-color: #ffffff;
    border: 0;
    border-radius: 0 0 21px 21px;
    margin-bottom: 0;
    min-height: 0;
    padding: 28px 32px 0;
    box-shadow: none;
    overflow: hidden;
}

#cartpopup a {
    color: #00364A;
    text-decoration: none;
    font-weight: normal;
}

/* --- Заголовок --- */
#cartpopup h4 {
    margin: 0;
    font-family: 'Intro Caps', 'Arial', sans-serif;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
    text-transform: uppercase;
    color: #00364A;
}
/* Разделитель под заголовком только когда он есть: попап из шапки открывается без текста */
#cartpopup h4 #text-added:not(:empty) {
    display: block;
    padding: 0 40px 14px 0;
    border-bottom: 1px solid #e3e9ee;
}
/* Попап из шапки идёт без заголовка — первая строка списка не должна попадать под крестик */
#cartpopup .cart {
    padding-top: 12px;
}

/* --- Крестик закрытия --- */
#cartpopup .modal-close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: #eef2f5;
    color: #00364A;
    font-size: 22px;
    line-height: 1;
}
#cartpopup .modal-close:hover {
    background: #dfe6ea;
    color: #00364A;
}

/* ============================================================
   Список позиций — главный блок
   ============================================================ */
#cartpopup .mini-cart-info {
    margin: 0;
}
/* Строка: фото | название | количество | цена, под ценой — «Удалить» */
#cartpopup .mini-cart-info .one-product {
    display: grid;
    /* Колонка цены фиксированная: каждая строка — свой грид, и с auto колонка
       у «48600 ₽» и «8900 ₽» получалась разной ширины — плюс-минус гулял по строкам */
    grid-template-columns: 96px minmax(0, 1fr) auto 160px;
    grid-template-rows: auto auto;
    column-gap: 24px;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid #e3e9ee;
    padding: 18px 0;
}
#cartpopup .mini-cart-info .image,
#cartpopup .mini-cart-info .name,
#cartpopup .mini-cart-info .total {
    grid-row: span 2;
}
#cartpopup .mini-cart-info .image {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#cartpopup .mini-cart-info .image img {
    max-width: 100%;
    max-height: 100%;
    padding: 0;
}
#cartpopup .mini-cart-info .name {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 17px;
    line-height: 1.4;
    color: #00364A;
}
#cartpopup .mini-cart-info .name a {
    font-size: inherit;
    font-weight: 500;
}
#cartpopup .mini-cart-info .name small {
    font-size: 13px;
    color: #707070;
}
#cartpopup .mini-cart-info .cart-product-reward {
    display: inline-block;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    color: #707070;
    margin-top: 4px;
}
#cartpopup .mini-cart-info .total {
    justify-self: center;
}
#cartpopup .mini-cart-info .total .frame-change-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 110px;
    height: 34px;
    margin: 0 8px;
}
#cartpopup .mini-cart-info .total input {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    width: 36px;
    height: 100%;
    outline: none;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 15px;
    text-align: center;
    margin: 0;
    padding: 0;
}
#cartpopup .mini-cart-info .total .btn-plus {
    width: 28px;
    height: 28px;
}
#cartpopup .mini-cart-info .total-sum {
    grid-column: 4;
    grid-row: 1;
    align-self: end;
    justify-self: stretch;
    text-align: right;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #00364A;
    white-space: nowrap;
}
#cartpopup .mini-cart-info .remove {
    grid-column: 4;
    grid-row: 2;
    justify-self: end;
    align-self: start;
}
#cartpopup .cart-remove-link {
    border: 0;
    padding: 0;
    background: none;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: #8a9aa5;
    cursor: pointer;
}
#cartpopup .cart-remove-link:hover {
    color: #00364A;
    text-decoration: underline;
}

/* Итог под списком */
#cartpopup .cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 18px 0 0;
    font-family: 'Inter', Arial, sans-serif;
    color: #00364A;
}
#cartpopup .cart-summary__count {
    font-size: 15px;
    color: #707070;
}
#cartpopup .cart-summary__total {
    font-size: 18px;
}
#cartpopup .cart-summary__total b {
    font-size: 30px;
    font-weight: 700;
    margin-left: 6px;
}

/* --- Кнопки под итогом --- */
#cartpopup .btn2-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 0 28px;
}

/* ============================================================
   Кнопки: единый формат
   ============================================================ */
#cartpopup .cartpopup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
#cartpopup .cartpopup-btn--primary {
    min-height: 56px;
    padding: 14px 40px;
    font-size: 18px;
    color: #fff;
    background: #2DC5FF;
}
#cartpopup .cartpopup-btn--primary:hover {
    background: #14b7f5;
    color: #fff;
}
#cartpopup .cartpopup-btn--secondary {
    min-height: 56px;
    padding: 14px 32px;
    font-size: 17px;
    color: #00364A;
    background: #eef2f5;
}
#cartpopup .cartpopup-btn--secondary:hover {
    background: #dfe6ea;
    color: #00364A;
}
#cartpopup .cartpopup-btn--card {
    width: 100%;
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
    color: #00364A;
    background: #eef2f5;
}
#cartpopup .cartpopup-btn--card:hover {
    background: #2DC5FF;
    color: #fff;
}

/* ============================================================
   Апсейл: «Добавить к заказу» / «Рекомендуем» — второстепенная зона
   ============================================================ */
#cartpopup .cartrelated {
    position: relative;
}
/* Светлая подложка во всю ширину окна (компенсируем боковые поля .well) */
#cartpopup .cartpopup-upsell {
    margin: 0 -32px;
    padding: 4px 32px 24px;
    background: #f6f8fa;
    border-top: 1px solid #e3e9ee;
}
/* Класс ставит addCartRelated(), когда related-блоков не пришло (главная, категории) */
#cartpopup .cartpopup-upsell.is-empty {
    display: none;
}
#cartpopup .cartpopup-section {
    padding-top: 18px;
}
#cartpopup .cartpopup-section__title {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #707070;
    margin-bottom: 10px;
}
#cartpopup .cartpopup-carousel {
    position: relative;
}
#cartpopup .cartpopup-carousel .swiper {
    overflow: hidden;
}
#cartpopup .cartpopup-carousel .swiper-slide {
    height: auto;
}
/* Стрелки каруселей: на полях окна, чуть меньше стандартных */
#cartpopup .cartpopup-carousel .swiper-btn-prev,
#cartpopup .cartpopup-carousel .swiper-btn-next {
    width: 30px;
    height: 30px;
    top: calc(50% - 15px);
}
#cartpopup .cartpopup-carousel .swiper-btn-prev svg,
#cartpopup .cartpopup-carousel .swiper-btn-next svg {
    width: 20px;
    height: 20px;
}
#cartpopup .cartpopup-carousel .swiper-btn-prev {
    left: -22px;
}
#cartpopup .cartpopup-carousel .swiper-btn-next {
    right: -22px;
}

/* Плейсхолдер на время загрузки сопутствующих блоков */
#cartpopup .cartrelated-wrapper {
    padding: 18px 0 0;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 13px;
    color: #707070;
}

/* Компактная карточка */
#cartpopup .cartpopup-card {
    display: flex;
    flex-direction: column;
    /* .swiper-slide на сайте — flex-контейнер, без width карточка ужимается по контенту */
    width: 100%;
    height: 100%;
    padding: 10px;
    border: 1px solid #e3e9ee;
    border-radius: 12px;
    background: #fff;
    transition: border-color .15s ease;
}
#cartpopup .cartpopup-card:hover {
    border-color: #2DC5FF;
}
#cartpopup .cartpopup-card__image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 76px;
    margin-bottom: 8px;
}
#cartpopup .cartpopup-card__image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
#cartpopup .cartpopup-card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(12px * 1.35 * 2);
    font-family: 'Inter', Arial, sans-serif;
    font-size: 12px;
    line-height: 1.35;
    color: #00364A;
    margin-bottom: 6px;
}
#cartpopup .cartpopup-card__name:hover {
    color: #2DC5FF;
}
#cartpopup .cartpopup-card__price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    margin-bottom: 8px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #00364A;
    white-space: nowrap;
}
#cartpopup .cartpopup-card__price-old {
    font-size: 11px;
    font-weight: 400;
    color: #8a9aa5;
    text-decoration: line-through;
}

/* ============================================================
   Пустая корзина: компактное окно-сообщение
   ============================================================ */
#cartpopup.cart-is-empty {
    width: 420px;
}
#cartpopup.cart-is-empty h4,
#cartpopup.cart-is-empty .cartrelated,
#cartpopup.cart-is-empty .cartpopup-btn--primary {
    display: none;
}
#cartpopup.cart-is-empty .mini-cart-info .empty {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 20px;
    color: #00364A;
    text-align: center;
    padding: 10px 0 5px;
}
#cartpopup.cart-is-empty .btn2-container {
    justify-content: center;
    padding: 16px 0 28px;
}

/* ============================================================
   Невысокие экраны (ноутбуки): ужимаем вертикаль
   ============================================================ */
@media (min-width: 768px) and (max-height: 960px) {
    #cartpopup {
        margin: 12px 0;
    }
    #cartpopup.well {
        padding-top: 22px;
    }
    #cartpopup h4 {
        font-size: 22px;
    }
    #cartpopup h4 #text-added:not(:empty) {
        padding-bottom: 10px;
    }
    #cartpopup .mini-cart-info .one-product {
        grid-template-columns: 72px minmax(0, 1fr) auto 150px;
        padding: 12px 0;
    }
    #cartpopup .mini-cart-info .image {
        width: 72px;
        height: 72px;
    }
    #cartpopup .mini-cart-info .name {
        font-size: 16px;
    }
    #cartpopup .mini-cart-info .total-sum {
        font-size: 24px;
    }
    #cartpopup .cart-summary {
        padding-top: 14px;
    }
    #cartpopup .cart-summary__total b {
        font-size: 26px;
    }
    #cartpopup .btn2-container {
        padding: 14px 0 22px;
    }
    #cartpopup .cartpopup-btn--primary,
    #cartpopup .cartpopup-btn--secondary {
        min-height: 50px;
        font-size: 16px;
    }
    #cartpopup .cartpopup-upsell {
        padding-bottom: 20px;
    }
    #cartpopup .cartpopup-section {
        padding-top: 14px;
    }
    #cartpopup .cartpopup-card__image {
        height: 64px;
    }
}

/* ============================================================
   Мобильная версия
   ============================================================ */
@media (max-width: 767.98px) {
    #cartpopup {
        max-width: calc(100% - 24px);
        margin: 8px 0;
    }
    #cartpopup.well {
        padding: 20px 16px 0;
        border-radius: 0 0 16px 16px;
    }
    #cartpopup h4 {
        font-size: 18px;
    }
    #cartpopup .modal-close {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
    }

    #cartpopup .mini-cart-info .one-product {
        grid-template-columns: 64px minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        column-gap: 12px;
        row-gap: 8px;
        padding: 12px 0;
    }
    #cartpopup .mini-cart-info .image {
        width: 64px;
        height: 64px;
        grid-row: span 2;
        align-self: start;
    }
    #cartpopup .mini-cart-info .name {
        grid-column: 2 / span 2;
        grid-row: 1;
        font-size: 14px;
    }
    #cartpopup .mini-cart-info .total {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
    }
    #cartpopup .mini-cart-info .total .frame-change-count {
        margin: 0;
    }
    #cartpopup .mini-cart-info .total-sum {
        grid-column: 3;
        grid-row: 2;
        align-self: center;
        font-size: 18px;
    }
    #cartpopup .mini-cart-info .remove {
        grid-column: 1 / span 3;
        grid-row: 3;
        justify-self: end;
    }
    #cartpopup .cart-summary {
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
        padding-top: 14px;
    }
    #cartpopup .cart-summary__total b {
        font-size: 24px;
    }

    #cartpopup .btn2-container {
        flex-direction: column-reverse;
        padding: 14px 0 20px;
    }
    #cartpopup .cartpopup-btn--primary,
    #cartpopup .cartpopup-btn--secondary {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    #cartpopup .cartpopup-upsell {
        margin: 0 -16px;
        padding: 2px 16px 20px;
    }
    #cartpopup .cartpopup-section {
        padding-top: 16px;
    }
    /* Стрелки — на уровне фото, чтобы не перекрывать название и цену */
    #cartpopup .cartpopup-carousel .swiper-btn-prev,
    #cartpopup .cartpopup-carousel .swiper-btn-next {
        top: 34px;
    }
    #cartpopup .cartpopup-carousel .swiper-btn-prev {
        left: 0;
    }
    #cartpopup .cartpopup-carousel .swiper-btn-next {
        right: 0;
    }

    #cartpopup.cart-is-empty {
        width: auto;
    }
}
