/* Оптимизация карточек каталога для мобильных устройств */
@media (max-width: 768px) {
    /* Применяем шрифт Onest */
    .t-store__card,
    .t-store__card * {
        font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    }

    /* Минимальные отступы контейнера */
    .t-store__grid-cont.t-container {
        padding-left: 3px !important;
        padding-right: 3px !important;
        padding-bottom: 10px !important;
    }

    /* Выравнивание блока фильтров и поиска */
    .t-store__filter {
        padding: 0 3px !important;
        margin-bottom: 0 !important;
    }

    .t-store__filter__controls-wrapper {
        margin: 0 !important;
        padding: 10px 0 !important;
        margin-bottom: 0 !important;
    }

    /* Минимальные отступы между карточками */
    .t-store__card {
        padding: 3px !important;
        margin-bottom: 6px !important;
    }

    /* Внутренние отступы карточки */
    .t-store__card__wrap_all {
        border-radius: 10px !important;
    }

    .t-store__card__wrap_txt-and-btns {
        padding: 8px !important;
        padding-bottom: 8px !important;
        height: auto !important;
    }

    /* Минимизируем отступ заголовка от картинки */
    .t-store__card__textwrapper {
        height: auto !important;
        margin-top: 2px !important;
        margin-bottom: 6px !important;
        padding-top: 0 !important;
    }

    .store__card__wrap_txt-and-opts {
        padding-top: 0 !important;
        margin-top: 0 !important;
        padding-bottom: 5px !important;
    }

    /* Размер заголовка и цен */
    .t-store__card__title {
        font-size: 16px !important;
        line-height: 1.2 !important;
        margin-bottom: 0 !important;
        margin-top: 5px !important;
    }

    /* Выравнивание цен в линию */
    .t-store__card__price-wrapper {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin-bottom: 6px !important;
    }

    .t-store__card__price,
    .t-store__card__price_old {
        display: flex !important;
        align-items: baseline !important;
    }

    .t-store__card__price {
        font-size: 16px !important;
    }

    .t-store__card__price_old {
        font-size: 13px !important;
        opacity: 0.6;
    }

    /* Скидка */
    .dbm-wrapper-discount {
        font-size: 10px !important;
        padding: 4px 6px !important;
        align-self: center !important;
        --bdmMarginLeftDiscount: 10px !important;
        margin-left: 5px !important;
    }

    /* Dropdown с вариантами */
    .t-store__card__prod-controls-wrapper {
        margin-bottom: 0px !important;
    }

    /* Контейнер для кнопок */
    .t-store__card__btns-wrapper {
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        margin: 0 !important;
        margin-top: 0px !important;
        padding: 0 !important;
        transition: all 0.3s ease;
        flex-wrap: nowrap !important;
    }

    /* Счетчик количества - скрыт по умолчанию с анимацией */
    .t-store__prod__quantity {
        display: none !important;
        flex: 1;
        min-width: 0;
        height: 44px !important;
        background: #f5f5f5;
        border-radius: 10px;
        opacity: 0;
        transform: translateX(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    /* Показываем счетчик при активации с анимацией */
    .t-store__card__btns-wrapper.quantity-active .t-store__prod__quantity {
        display: flex !important;
        opacity: 1;
        transform: translateX(0);
    }

    /* Кнопка В КОРЗИНУ */
    .t-store__card__btn {
        height: 44px !important;
        padding: 0 20px !important;
        font-size: 13px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100%;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }

    /* При активации счетчика трансформируем кнопку */
    .t-store__card__btns-wrapper.quantity-active .t-store__card__btn {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Скрываем текст, показываем иконку */
    .t-store__card__btns-wrapper.quantity-active .t-store__card__btn .t-store__card__btn-text {
        display: none !important;
    }

    .t-store__card__btn .cart-icon {
        display: none;
        width: 20px;
        height: 20px;
        fill: currentColor;
    }

    .t-store__card__btns-wrapper.quantity-active .t-store__card__btn .cart-icon {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .t-store__card__btns-wrapper.quantity-active .t-store__card__btn .cart-icon svg {
        width: 20px;
        height: 20px;
    }

    /* Стили для элементов счетчика */
    .t-store__prod__quantity-input {
        font-size: 15px !important;
        font-weight: 500 !important;
        background: transparent !important;
    }

    .t-store__prod__quantity__minus-wrapper,
    .t-store__prod__quantity__plus-wrapper {
        width: 44px !important;
        cursor: pointer;
    }

    .t-store__prod__quantity__minus,
    .t-store__prod__quantity__plus {
        font-size: 18px !important;
    }
}

/* Скрываем артикул на всех устройствах */
.t-store__card__sku {
    display: none !important;
}

/* Скрываем пустую старую цену на всех устройствах */
.t-store__card__price_old.hidden-empty-price {
    display: none !important;
}

/* Оптимизация для десктопа */
@media (min-width: 769px) {

    /* Отступ снизу для блока с текстом и кнопками */
    .t-store__valign-buttons.js-store-grid-cont .t-item .t-store__card__wrap_all .t-store__card__wrap_txt-and-btns {
        margin-bottom: 20px !important;
    }

    .t-store__card__wrap_txt-and-btns {
        padding-bottom: 8px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .store__card__wrap_txt-and-opts {
        padding-bottom: 5px !important;
        flex-grow: 1 !important;
    }

    /* Dropdown с вариантами */
    .t-store__card__prod-controls-wrapper {
        margin-bottom: 0px !important;
    }

    /* Фиксируем минимальную высоту для предотвращения скачка */
    .t-store__card__btns-wrapper {
        min-height: 40px;
    }

    /* Контейнер для кнопок */
    .t-store__card__btns-wrapper {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin-top: 0px !important;
        transition: all 0.3s ease;
    }

    /* Счетчик количества - скрыт по умолчанию с анимацией */
    .t-store__prod__quantity {
        display: none !important;
        flex: 1;
        opacity: 0;
        transform: translateX(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    /* Показываем счетчик при активации с анимацией */
    .t-store__card__btns-wrapper.quantity-active .t-store__prod__quantity {
        display: flex !important;
        opacity: 1;
        transform: translateX(0);
    }

    /* Кнопка В КОРЗИНУ - растянута на всю ширину */
    .t-store__card__btn {
        transition: all 0.3s ease;
        width: 100% !important;
        flex-shrink: 0;
    }

    /* При активации счетчика трансформируем кнопку - соотношение 50/50 */
    .t-store__card__btns-wrapper.quantity-active .t-store__card__btn {
        width: calc(50% - 4px) !important;
        min-width: auto !important;
        flex: 1;
    }

    /* Иконка корзины скрыта по умолчанию */
    .t-store__card__btn .cart-icon {
        display: none;
    }
}
