/* ============================================================
   КАСТОМНЫЙ ПОПАП КОРЗИНЫ
   Полное переопределение стандартных стилей Bitrix
   ============================================================ */

/* --- Основной контейнер попапа --- */
.popup-window.popup-window-with-titlebar {
    border-radius: 40px 20px 40px 20px !important;
    padding: 0 !important;
    background: #ffffff !important;
    min-width: 420px !important;
    max-width: 520px !important;
    overflow: hidden !important;
    font-family: "Montserrat", sans-serif !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25) !important;
    border: none !important;
    animation: popupSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* --- Заголовок попапа --- */
.popup-window-titlebar {
    background: #212121 !important;
    padding: 20px 60px 20px 28px !important;
    border-bottom: none !important;
    min-height: auto !important;
    height: auto !important;
    line-height: normal !important;
    position: relative !important;
}

.popup-window-titlebar-text {
    color: #ffffff !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    font-family: "Montserrat", sans-serif !important;
    letter-spacing: 0.3px !important;
    line-height: normal !important;
    padding: 0 !important;
    white-space: normal !important;
}

/* ============================================================
   КНОПКА ЗАКРЫТИЯ (КРЕСТИК) - ГЛАВНОЕ ИСПРАВЛЕНИЕ
   ============================================================ */


/* ============================================================
   СОДЕРЖИМОЕ ПОПАПА
   ============================================================ */

.popup-window-content {
    padding: 32px 28px 20px !important;
    background: #ffffff !important;
    border-radius: 0 !important;
}

.popup-window-content > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
}

/* --- Иконка успеха --- */
.popup-window-content .success-icon {
    width: 64px !important;
    height: 64px !important;
    background: #27ae60 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin-bottom: 4px !important;
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.3) !important;
}

.popup-window-content .success-icon svg {
    width: 32px !important;
    height: 32px !important;
    fill: none !important;
    stroke: #ffffff !important;
    stroke-width: 3 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

/* --- Изображение товара в попапе --- */
.popup-window-content img {
    border-radius: 12px !important;
    border: 1px solid #e9ecef !important;
    padding: 8px !important;
    background: #f8f9fa !important;
    max-height: 140px !important;
    width: auto !important;
    object-fit: contain !important;
    max-width: 200px !important;
}

/* --- Название товара в попапе --- */
.popup-window-content p {
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #212121 !important;
    margin: 0 !important;
    font-family: "Montserrat", sans-serif !important;
    text-align: center !important;
    line-height: 1.4 !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
}

/* ============================================================
   КНОПКИ В ПОПАПЕ
   ============================================================ */

/* --- Контейнер кнопок --- */
.popup-window-buttons {
    padding: 16px 28px 24px !important;
    display: flex !important;
    gap: 12px !important;
    justify-content: center !important;
    background: #f8f9fa !important;
    border-top: 1px solid #e9ecef !important;
    flex-wrap: wrap !important;
    text-align: center !important;
}

/* --- Стили для всех кнопок в попапе --- */
.popup-window-buttons .btn {
    padding: 12px 32px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: 100px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-family: "Montserrat", sans-serif !important;
    min-width: 140px !important;
    text-align: center !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: auto !important;
    line-height: normal !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* --- Кнопка "Перейти в корзину" (основная) --- */
.popup-window-buttons .btn.btn-default.btn-buy {
    background: #ffb300 !important;
    color: #212121 !important;
    box-shadow: 0 4px 16px rgba(255, 179, 0, 0.3) !important;
    border: 1.5px solid #ffb300 !important;
    text-transform: none !important;
}

.popup-window-buttons .btn.btn-default.btn-buy:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(255, 179, 0, 0.4) !important;
    background: #ffc433 !important;
    border-color: #ffc433 !important;
}

.popup-window-buttons .btn.btn-default.btn-buy:active {
    transform: translateY(0px) !important;
    box-shadow: 0 2px 8px rgba(255, 179, 0, 0.3) !important;
    background: #e6a100 !important;
    border-color: #e6a100 !important;
}

/* --- Кнопка "Продолжить покупки" (вторичная) --- */
.popup-window-buttons .btn.btn-default.btn-close {
    background: transparent !important;
    color: #212121 !important;
    border: 1.5px solid #dee2e6 !important;
    text-transform: none !important;
}

.popup-window-buttons .btn.btn-default.btn-close:hover {
    background: #f1f3f5 !important;
    border-color: #ced4da !important;
    transform: translateY(-2px) !important;
}

.popup-window-buttons .btn.btn-default.btn-close:active {
    transform: translateY(0px) !important;
}

/* --- Скрываем стандартные кнопки Bitrix --- */
.popup-window-button,
.popup-window-button-accept,
.popup-window-button-create,
.popup-window-button-decline,
.popup-window-button-cancel,
.popup-window-button-blue,
.popup-window-button-link,
.popup-window-button-link-cancel {
    display: none !important;
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================================
   ОВЕРЛЕЙ
   ============================================================ */

.popup-window-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(6px) !important;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

@media (max-width: 576px) {
    .popup-window.popup-window-with-titlebar {
        min-width: 320px !important;
        max-width: 92% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        border-radius: 28px 16px 28px 16px !important;
    }

    .popup-window-titlebar {
        padding: 16px 50px 16px 20px !important;
    }

    .popup-window-titlebar-text {
        font-size: 16px !important;
    }

    /* Крестик на мобильных */
    .popup-window-close-icon.popup-window-titlebar-close-icon {
        width: 32px !important;
        height: 32px !important;
        right: 12px !important;
    }

    .popup-window-close-icon.popup-window-titlebar-close-icon::before,
    .popup-window-close-icon.popup-window-titlebar-close-icon::after {
        width: 14px !important;
        height: 2px !important;
    }

    .popup-window-content {
        padding: 24px 16px 16px !important;
    }

    .popup-window-content p {
        font-size: 14px !important;
    }

    .popup-window-content img {
        max-height: 100px !important;
        max-width: 150px !important;
    }

    .popup-window-content .success-icon {
        width: 52px !important;
        height: 52px !important;
    }

    .popup-window-content .success-icon svg {
        width: 26px !important;
        height: 26px !important;
    }

    .popup-window-buttons {
        padding: 12px 16px 20px !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .popup-window-buttons .btn {
        min-width: 100% !important;
        padding: 14px 20px !important;
        font-size: 14px !important;
        justify-content: center !important;
    }
}

@media (max-width: 400px) {
    .popup-window.popup-window-with-titlebar {
        min-width: 280px !important;
        max-width: 96% !important;
        border-radius: 20px 12px 20px 12px !important;
    }

    .popup-window-titlebar {
        padding: 14px 44px 14px 16px !important;
    }

    .popup-window-titlebar-text {
        font-size: 14px !important;
    }

    .popup-window-close-icon.popup-window-titlebar-close-icon {
        width: 28px !important;
        height: 28px !important;
        right: 10px !important;
    }

    .popup-window-close-icon.popup-window-titlebar-close-icon::before,
    .popup-window-close-icon.popup-window-titlebar-close-icon::after {
        width: 12px !important;
        height: 2px !important;
    }

    .popup-window-content {
        padding: 20px 12px 12px !important;
    }

    .popup-window-content p {
        font-size: 13px !important;
    }

    .popup-window-buttons .btn {
        font-size: 13px !important;
        padding: 12px 16px !important;
    }
}

