/* =========================
   КНОПКА КАЛЬКУЛЯТОРА — ОБЩИЕ НАСТРОЙКИ
========================= */

.icc-widget,
.icc-widget * {
    box-sizing: border-box;
}

.icc-widget {
    position: relative;
    z-index: 1;
    transform: none !important;
    -webkit-transform: none !important;
}

/* =========================
   ОСНОВНАЯ КНОПКА POPUP
========================= */

.icc-widget .icc-btn-open,
button.icc-btn-open,
.icc-widget button.icc-btn-open {
    width: 100% !important;
    display: block !important;
    position: relative !important;
    overflow: hidden !important;

    background: #ffffff !important;
    border: 2px solid #e53935 !important;
    color: #000000 !important;

    font-family: 'Lato', sans-serif !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    letter-spacing: 0.8px !important;
    text-align: center !important;

    padding: 14px 18px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    opacity: 1 !important;

    box-shadow: 0 8px 22px rgba(229, 57, 53, 0.22) !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease !important;
    z-index: 1 !important;
}

/* Hover: фон остаётся белым, усиливается оранжевая рамка и тень */
.icc-widget .icc-btn-open:hover,
button.icc-btn-open:hover,
.icc-widget button.icc-btn-open:hover {
    background: #ffffff !important;
    border-color: #d32f2f !important;
    color: #000000 !important;
    box-shadow: 0 12px 30px rgba(229, 57, 53, 0.35) !important;
    transform: translateY(-1px) !important;
}

/* Active: возврат кнопки после нажатия */
.icc-widget .icc-btn-open:active,
button.icc-btn-open:active,
.icc-widget button.icc-btn-open:active {
    transform: translateY(0) !important;
    box-shadow: 0 8px 22px rgba(229, 57, 53, 0.22) !important;
}

/* =========================
   БЛИК ТОЛЬКО ПО БОРДЕРУ
========================= */

.icc-widget .icc-btn-open::before,
button.icc-btn-open::before,
.icc-widget button.icc-btn-open::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 8px;
    padding: 2px;
    pointer-events: none;
    z-index: 1;

    background: linear-gradient(
        90deg,
        #e53935 0%,
        #e53935 25%,
        #ffffff 50%,
        #e53935 75%,
        #e53935 100%
    );
    background-size: 220% 100%;
    animation: iccBorderShine 2.2s linear infinite;

    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Текст всегда поверх border-блика */
.icc-widget .icc-btn-open .icc-btn-txt,
button.icc-btn-open .icc-btn-txt,
.icc-widget button.icc-btn-open .icc-btn-txt {
    position: relative;
    z-index: 2;
    color: #000000 !important;
}

/* Disabled: оставляем такой же внешний вид */
.icc-widget .icc-btn-open:disabled,
button.icc-btn-open:disabled,
.icc-widget button.icc-btn-open:disabled {
    opacity: 1 !important;
    cursor: pointer !important;
    background: #ffffff !important;
    border: 2px solid #e53935 !important;
    color: #000000 !important;
}

/* Анимация блика по рамке */
@keyframes iccBorderShine {
    0% {
        background-position: 220% 0;
    }
    100% {
        background-position: -220% 0;
    }
}

/* Кадры анимации блика */
@keyframes iccShine {
    0% {
        left: -140%;
    }
    100% {
        left: 140%;
    }
}

/* =========================
   МОДАЛЬНОЕ ОКНО — ПОДЛОЖКА И ОБЩЕЕ ПОЗИЦИОНИРОВАНИЕ
========================= */

/* Полноэкранная затемнённая подложка модального окна */
.icc-modal {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;

    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;

    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;

    padding: 24px !important;
    margin: 0 !important;

    display: none;
    align-items: center;
    justify-content: center;

    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;

    background: rgba(0,0,0,0.62) !important;

    z-index: 9999999 !important;

    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    will-change: opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Когда модалка открыта инлайновым display:block — включаем flex */
.icc-modal[style*="display:block"],
.icc-modal[style*="display: block"] {
    display: flex !important;
}

/* Внутренний контейнер модалки:
   - белый фон
   - скругление
   - тень
   - анимация появления */
.icc-modal-content {
    background: #fff;
    max-width: 900px;
    width: 100%;
    margin: auto !important;
    border-radius: 10px;
    padding: 25px;
    position: relative !important;
    z-index: 9999999 !important;
    animation: iccFadeIn 0.3s ease;
    box-sizing: border-box;

    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;

    box-shadow: 0 18px 60px rgba(0,0,0,0.28);
}

/* Анимация появления модального окна */
@keyframes iccFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Кнопка закрытия модалки */
.icc-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    z-index: 5;
}

/* =========================
   СЕТКА МОДАЛКИ
========================= */

/* Две колонки: левая часть и правая часть */
.icc-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    align-items: start;
}

/* Адаптация на мобильных:
   - уменьшаем padding
   - делаем одну колонку */
@media (max-width: 768px) {
    .icc-modal {
        padding: 12px !important;
        align-items: flex-start;
    }

    .icc-modal-content {
        margin: 0 auto !important;
        padding: 18px;
        max-width: 100%;
        border-radius: 12px;
    }

    .icc-modal-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   ЛЕВАЯ ЧАСТЬ ПОПАПА
========================= */

/* Контейнер левой колонки */
.icc-m-left {
    min-width: 0;
}

/* Изображение товара */
.icc-m-left img,
.icc-js-img {
    width: 100%;
    max-width: 260px;
    height: auto;
    border-radius: 6px;
    margin-bottom: 10px;
    display: block;
}

/* Заголовок товара */
.icc-js-title {
    font-size: 18px;
    margin-bottom: 5px;
}

/* Строка вариаций/параметров */
.icc-js-vars {
    font-size: 14px;
    color: #777;
    margin-bottom: 10px;
}

/* =========================
   БЛОК КОЛИЧЕСТВА
========================= */

/* Контейнер минус / количество / плюс */
.icc-qty {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    align-items: center;
}

/* Кнопки + и - */
.icc-qty button {
    width: 35px;
    height: 35px;
    border: none;
    background: #eee;
    cursor: pointer;
    font-size: 18px;
    border-radius: 4px;
}

/* Поле количества:
   - центрируем число
   - отключаем системный вид number-поля */
.icc-qty input {
    width: 50px;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Убираем стрелки number input в Chrome/Safari */
.icc-qty input::-webkit-outer-spin-button,
.icc-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Отступы строки цены */
.icc-price-row {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* =========================
   КАРТОЧКИ ИТОГОВ
========================= */

/* Сетка карточек:
   - общая стоимость
   - аванс
   - платёж */
.icc-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

/* Базовая карточка */
.icc-card {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

/* Подпись в карточке */
.icc-card span {
    display: block;
    font-size: 12px;
    color: #777;
    margin-bottom: 4px;
}

/* Значение в карточке */
.icc-card strong {
    font-size: 16px;
}

/* Выделенная карточка платежа */
.icc-card.highlight {
    background: #ffebee;
}

/* =========================
   ПРАВАЯ ЧАСТЬ — СРОКИ
========================= */

/* Контейнер сроков */
.icc-terms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding-top: 16px;
}

/* Отдельная кнопка срока */
.icc-t-item {
    position: relative;
    min-width: 46px;
    height: 40px;
    padding: 8px 12px;
    background: #eee;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Цифра срока */
.icc-t-label {
    display: block;
    line-height: 1;
}

/* Бейдж 0% над сроком */
.icc-t-badge {
    position: absolute;
    top: -10px;
    right: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 20px;
    padding: 0 6px;
    background: #fff;
    border: 1px solid #e53935;
    border-radius: 999px;
    color: #e53935;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    z-index: 2;
}

/* Активный срок */
.icc-t-item.active {
    background: #e53935;
    color: #fff;
}

/* Бейдж внутри активного срока */
.icc-t-item.active .icc-t-badge {
    background: #fff;
    color: #e53935;
    border-color: #e53935;
}

/* =========================
   БОЛЬШОЙ ПЛАТЁЖ
========================= */

/* Крупное число ежемесячного платежа */
.icc-big-mon {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* Подсказка под платежом */
.icc-info {
    margin-bottom: 14px;
    color: #777;
    font-size: 13px;
}

/* =========================
   ФОРМА В ПОПАПЕ
========================= */

/* Подписи в форме */
.icc-form label {
    display: block;
    margin-bottom: 10px;
}

/* Поля формы */
.icc-form input {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

/* Кнопка отправки формы */
.icc-send {
    width: 100%;
    padding: 12px;
    border: none;
    background: #e53935;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
}

/* =========================
   AJAX-СООБЩЕНИЕ
========================= */

/* Сообщение об успешной отправке / результате */
.icc-ajax-message {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 6px;
}

/* =========================
   SAFARI / WOODMART / GALLERY FIXES
========================= */

/* Снижаем конфликты по z-index с галереей товара */
.single-product .woocommerce-product-gallery,
.single-product .woocommerce-product-gallery__wrapper,
.single-product .woocommerce-product-gallery__image,
.single-product .product-image-summary,
.single-product .wd-product-images,
.single-product .wd-images,
.single-product .wd-carousel-container,
.single-product .flickity-enabled,
.single-product .flickity-viewport,
.single-product .photoswipe-images,
.single-product .wd-gallery-images,
.single-product .wd-gallery-thumb,
.single-product .product-images-inner,
.single-product .woocommerce-product-gallery ol.flex-control-nav,
.single-product .woocommerce-product-gallery .flex-viewport {
    z-index: 1 !important;
}

/* Запрет скролла страницы при открытой модалке */
body.icc-modal-open,
html.icc-modal-open {
    overflow: hidden !important;
}

/* Дополнительная защита от перекрытия галереей */
body.icc-modal-open .woocommerce-product-gallery,
body.icc-modal-open .woocommerce-product-gallery__wrapper,
body.icc-modal-open .wd-product-images,
body.icc-modal-open .wd-images,
body.icc-modal-open .product-image-summary {
    z-index: 1 !important;
}