/* Popular Products Slider (Slider-Catalog) */

.popular-products-section {
    position: relative;
    width: 100%;
    height: 842px;
    background: #FFFFFF; /* фон для блока "Популярные товары" делаем белым */
    overflow: hidden;
}

.popular-products-section__wrapper {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 50px auto 0;
    height: 100%;
}

.popular-products-section__header {
    position: absolute;
    top: 32px;
    left: 180px;
    width: calc(100% - 360px);
    padding-right: 22px;
    z-index: 5;
}

.popular-products-section__header-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 40px;
}

.popular-products-section__title {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: #0C181A;
    margin: 0;
}

/* Фильтр по размерам (пилюли) */
.popular-products-section__width-filters {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-width: 0;
}

.popular-products-section__width-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 11px;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-width: 0;
}

.popular-products-section__width-pills::-webkit-scrollbar {
    display: none;
}

.popular-products-section__width-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 22px;
    border: 1px solid #E0E0E0;
    background: transparent;
    font-family: Montserrat, Arial, sans-serif;
    font-size: 11px;
    font-style: normal;
    font-weight: 500;
    line-height: 112%;
    text-transform: uppercase;
    color: var(--Garda_Black-Color, #0C181A);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.popular-products-section__width-pill:hover {
    background: var(--Garda-Green_Primary, #57A7B3);
    color: #FFFFFF;
    border-color: var(--Garda-Green_Primary, #57A7B3);
}

.popular-products-section__width-pill--active {
    background: var(--Garda-Green_Primary, #57A7B3);
    color: #FFFFFF;
    border-color: var(--Garda-Green_Primary, #57A7B3);
}

.popular-products-section__width-pill--active:hover {
    background: var(--Garda-Green_Primary, #57A7B3);
    border-color: var(--Garda-Green_Primary, #57A7B3);
}

.popular-products-section__filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.popular-products-section__filter {
    border: 1px solid #0C181A;
    border-radius: 22px;
    padding: 9px 20px 8px;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    background: transparent;
    color: #0C181A;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popular-products-section__filter--active {
    background: #57A7B3;
    color: #FFFFFF;
    border-color: #57A7B3;
}

.popular-products-section__arrows {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.popular-products-section__arrow {
    width: 44px; /* 40px * 1.1 = 44px */
    height: 44px; /* 40px * 1.1 = 44px */
    border: 0.5px solid #0C181A;
    border-radius: 60px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.popular-products-section__arrow:hover {
    background: rgba(12, 24, 26, 0.05);
}

.popular-products-section__arrow--prev svg {
    transform: rotate(180deg);
}

.popular-products-section__slider {
    position: absolute;
    top: 110px;
    left: 0;
    width: 100%;
    height: 607px;
    overflow: hidden;
}

.popular-products-section__slider-container {
    position: absolute;
    top: 26px;
    left: 172px;
    right: 0;
    width: calc(100% - 172px);
    display: flex;
    gap: 10px;
    padding-right: 60px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.popular-products-section__slider-container::-webkit-scrollbar {
    display: none;
}

.popular-products-card {
    width: 368px;
    height: 560px;
    background: #FFFFFF;
    padding: 8px;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
}

.popular-products-card__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.popular-products-card__image {
    width: 100%;
    height: 396px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.popular-products-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-products-card__label {
    position: absolute;
    top: 24px;
    left: 24px;
    padding: 5px 12px;
    border-radius: 22px;
    background: #FFFFFF;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    color: #0C181A;
}

.popular-products-card__label--sale {
    display: inline-flex;
    padding: 5px 10px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 22px;
    background: #FFF;
    color: var(--Garda_Black-Color, #0C181A);
    font-family: Montserrat, Arial, sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    line-height: 112%;
}

.popular-products-card__label--popular {
    background: #FF9800;
    color: #FFFFFF;
    font-weight: 600;
    text-transform: uppercase;
}

.popular-products-card__favorite {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #EEEEEE;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.popular-products-card__favorite img {
    width: 24px;
    height: 24px;
}

.popular-products-card__content {
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.popular-products-card__title {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
    color: #0C181A;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popular-products-card__colors,
.product-card__colors {
    display: flex;
    gap: 5px;
    align-items: center;
}

.popular-products-card__color,
.product-card__color {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: transparent;
    overflow: visible;
    display: inline-flex;
    position: relative;
    z-index: 0;
}

/* Подложка с лёгким осветлением сверху вниз (не уменьшая картинку) */
.popular-products-card__color::before,
.product-card__color::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 13px; /* 7px (плашка) + 6px (подложка) */
    /*
      Подложка: базовый цвет = ровно как "обводка" (#F5F5F5),
      сверху лёгкое осветление через прозрачный градиент (без затемнения по краям).
    */
    background: #F5F5F5;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: -1;
    pointer-events: none;
}

/* Картинка цвета (из SDK/кэша): скругление + подложка */
.popular-products-card__color img,
.product-card__color img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 7px;
    background: transparent;
    display: block;
}

.popular-products-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.popular-products-card__prices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.popular-products-card__price-current {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #0C181A;
}

.popular-products-card__price-old {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 15px;
    font-weight: 300;
    color: #0C181A;
    text-decoration: line-through;
}

.popular-products-card__cart {
    width: 64px;
    height: 36px;
    border-radius: 30px;
    border: none;
    background: #0C181A;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.popular-products-card__cart-icon {
    width: 26px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popular-products-card__cart-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.popular-products-section__line {
    position: absolute;
    left: 180px;
    top: 742px;
    width: calc(100% - 360px);
    height: 1px;
    background: #DEDEDE;
}

.popular-products-section__button {
    display: none; /* Скрыта по умолчанию, показывается только на мобилке */
}

.popular-products-section__line-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 112px;
    height: 2px;
    background: #0C181A;
    display: block;
    z-index: 1;
}

@media screen and (max-width: 1600px) {
    .popular-products-section__header {
        left: clamp(20px, 8%, 180px);
        width: calc(100% - clamp(20px, 8%, 180px) * 2);
    }

    .popular-products-section__slider-container {
        left: clamp(20px, 8%, 180px);
        width: calc(100% - clamp(20px, 8%, 180px));
    }

    .popular-products-section__line {
        left: clamp(20px, 8%, 180px);
        width: calc(100% - clamp(20px, 8%, 180px) * 2);
    }
}

@media screen and (max-width: 1199px) {
    .popular-products-section {
        height: 900px;
        padding-bottom: 60px;
    }
    
    .popular-products-section__wrapper {
        margin-top: 10px;
    }

    .popular-products-section__header-top {
        grid-template-columns: 1fr auto;
        gap: 20px;
        align-items: center;
    }
    
    .popular-products-section__title {
        width: 164px;
        flex-shrink: 0;
        color: var(--Garda_Black-Color, #0C181A);
        font-family: 'Montserrat', Arial, sans-serif;
        font-size: 24px;
        font-style: normal;
        font-weight: 600;
        line-height: 1.2;
    }

    .popular-products-section__width-filters {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }
    
    .popular-products-section__arrows {
        grid-column: 2;
        grid-row: 1;
    }
    
    .popular-products-section__arrow {
        display: flex;
        width: 35.2px; /* 32px * 1.1 = 35.2px */
        height: 35.2px; /* 32px * 1.1 = 35.2px */
        padding: 10.56px; /* 9.6px * 1.1 = 10.56px */
        justify-content: center;
        align-items: center;
        border-radius: 48px;
        border: 0.4px solid var(--Garda_Black-Color, #0C181A);
    }

    .popular-products-section__width-pills {
        gap: 8px;
    }

    .popular-products-section__width-pill {
        padding: 8px 14px;
        font-size: 12px;
    }

    .popular-products-section__slider {
        position: relative;
        top: 200px;
        height: auto;
        padding-bottom: 100px;
        margin-left: 10px;
    }

    .popular-products-section__slider-container {
        position: relative;
        top: 0;
        left: 0;
        padding: 0 20px;
    }

    .popular-products-section__line {
        top: auto;
        bottom: 20px;
    }
}

/* Mobile (640px и меньше) */
@media screen and (max-width: 639px) {
    .popular-products-section {
        height: 660px;
        padding: 40px 0 60px;
    }
    
    .popular-products-section__wrapper {
        height: auto;
        text-align: center; /* Для выравнивания кнопки по центру */
    }
    
    .popular-products-section__header {
        position: static;
        width: 100%;
        padding: 0 20px;
        margin-bottom: 24px;
        text-align: left;
    }

    .popular-products-section__header-top {
        grid-template-columns: 1fr auto;
        gap: 20px;
        align-items: center;
    }
    
    .popular-products-section__title {
        width: 164px;
        flex-shrink: 0;
        color: var(--Garda_Black-Color, #0C181A);
        font-family: 'Montserrat', Arial, sans-serif;
        font-size: 24px;
        font-style: normal;
        font-weight: 600;
        line-height: 1.2;
        text-align: left;
    }
    
    .popular-products-section__width-filters {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }
    
    .popular-products-section__arrows {
        grid-column: 2;
        grid-row: 1;
    }

    .popular-products-section__width-pills {
        gap: 6px;
    }

    .popular-products-section__width-pill {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .popular-products-section__arrows {
        justify-content: flex-start;
    }
    
    .popular-products-section__arrow {
        display: flex;
        width: 35.2px; /* 32px * 1.1 = 35.2px */
        height: 35.2px; /* 32px * 1.1 = 35.2px */
        padding: 10.56px; /* 9.6px * 1.1 = 10.56px */
        justify-content: center;
        align-items: center;
        border-radius: 48px;
        border: 0.4px solid var(--Garda_Black-Color, #0C181A);
    }
    
    .popular-products-section__slider {
        position: static;
        width: 100%;
        height: auto;
        padding-bottom: 0;
        margin-left: 10px;
    }
    
    .popular-products-section__slider-container {
        position: static;
        width: 100%;
        padding: 0 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .popular-products-section__slider-container::-webkit-scrollbar {
        display: none;
    }
    
    .popular-products-card {
        width: 280px;
        min-width: 280px;
        height: auto;
        scroll-snap-align: start;
        padding: 0;
        background: var(--Garda-Bg-Grey, #FAFAFA);
    }
    
    .popular-products-card__image {
        height: 280px;
        border-radius: 0;
    }
    
    .popular-products-card__label {
        top: 12px;
        left: 12px;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        line-height: 1.2;
    }
    
    .popular-products-card__label--sale {
        display: inline-flex;
        padding: 5px 10px;
        justify-content: center;
        align-items: center;
        gap: 10px;
        border-radius: 22px;
        background: #FFF;
        color: var(--Garda_Black-Color, #0C181A);
        font-family: Montserrat, Arial, sans-serif;
        font-size: 12px;
        font-style: normal;
        font-weight: 500;
        line-height: 112%;
    }
    
    .popular-products-card__label--popular {
        background: #FF9800;
        color: #FFFFFF;
        border: none;
    }
    
    /* Скрываем стандартный белый бейдж на мобильной версии, если есть цветной */
    .popular-products-card__label:not(.popular-products-card__label--sale):not(.popular-products-card__label--popular) {
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .popular-products-card__favorite {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        background: rgba(255, 255, 255, 0.9);
    }
    
    .popular-products-card__favorite img {
        width: 20px;
        height: 20px;
    }
    
    .popular-products-card__content {
        padding: 16px 12px;
        gap: 12px;
    }
    
    .popular-products-card__title {
        font-size: 13px;
        font-weight: 500;
        line-height: 1.3;
        -webkit-line-clamp: 3;
        text-align: left;
    }
    
    .popular-products-card__colors {
        display: none; /* Скрываем цвета на мобильной версии */
    }
    
    .popular-products-card__footer {
        margin-top: 4px;
    }
    
    .popular-products-card__price-current {
        font-size: 18px;
        font-weight: 600;
    }
    
    .popular-products-card__price-old {
        font-size: 14px;
        font-weight: 400;
        opacity: 0.6;
    }
    
    .popular-products-card__cart {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: #0C181A;
        flex-shrink: 0;
    }
    
    .popular-products-card__cart-icon {
        width: 20px;
        height: 20px;
    }
    
    .popular-products-section__line {
        position: static;
        width: 100%;
        margin: 32px 20px 0;
        position: relative;
    }
    
    .popular-products-section__line-slider {
        width: 112px;
        height: 2px;
        display: block;
    }
    
    .popular-products-section__button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px 20px;
        border-radius: 8px;
        border: 1px solid #0C181A;
        background: #FFFFFF;
        font-family: 'Montserrat', Arial, sans-serif;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.12;
        text-transform: uppercase;
        color: #0C181A;
        text-decoration: none;
        white-space: nowrap;
        margin: 24px auto 0;
        transition: background 0.2s ease, color 0.2s ease;
    }
    
    .popular-products-section__button:hover {
        background: #0C181A;
        color: #FFFFFF;
    }
}

/* Small Mobile (480px и меньше) */
@media screen and (max-width: 479px) {
    .popular-products-section {
        height: 660px;
        padding: 32px 0 48px;
    }
    
    .popular-products-section__header {
        padding: 0 16px;
        margin-bottom: 20px;
        gap: 16px;
        text-align: left;
    }
    
    .popular-products-section__header-top {
        grid-template-columns: 1fr auto;
        gap: 20px;
        align-items: center;
    }
    
    .popular-products-section__title {
        width: 164px;
        flex-shrink: 0;
        color: var(--Garda_Black-Color, #0C181A);
        font-family: 'Montserrat', Arial, sans-serif;
        font-size: 23px;
        font-style: normal;
        font-weight: 600;
        line-height: 100%;
        text-align: left;
    }
    
    .popular-products-section__width-filters {
        grid-column: 1 / -1;
    }
    
    .popular-products-section__arrows {
        grid-column: 2;
        grid-row: 1;
    }
    
    .popular-products-section__width-pill {
        padding: 6px 10px;
        font-size: 10px;
    }

    .popular-products-section__filter {
        padding: 6px 12px;
        font-size: 9px;
    }
    
    .popular-products-section__arrow {
        display: flex;
        width: 35.2px; /* 32px * 1.1 = 35.2px */
        height: 35.2px; /* 32px * 1.1 = 35.2px */
        padding: 10.56px; /* 9.6px * 1.1 = 10.56px */
        justify-content: center;
        align-items: center;
        border-radius: 48px;
        border: 0.4px solid var(--Garda_Black-Color, #0C181A);
    }
    
    .popular-products-section__slider-container {
        padding: 0 16px;
    }
    
    .popular-products-card {
        width: 240px;
        min-width: 240px;
        padding: 0;
        background: var(--Garda-Bg-Grey, #FAFAFA);
    }
    
    .popular-products-card__image {
        height: 240px;
    }
    
    .popular-products-card__label {
        top: 10px;
        left: 10px;
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .popular-products-card__favorite {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .popular-products-card__favorite img {
        width: 18px;
        height: 18px;
    }
    
    .popular-products-card__content {
        padding: 12px 10px;
        gap: 10px;
    }
    
    .popular-products-card__title {
        font-size: 12px;
        -webkit-line-clamp: 3;
        text-align: left;
    }
    
    .popular-products-card__price-current {
        font-size: 16px;
    }
    
    .popular-products-card__price-old {
        font-size: 13px;
    }
    
    .popular-products-card__cart {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: #0C181A;
    }
    
    .popular-products-card__cart-icon {
        width: 18px;
        height: 18px;
    }
    
    .popular-products-card__label--sale {
        display: inline-flex;
        padding: 5px 10px;
        justify-content: center;
        align-items: center;
        gap: 10px;
        border-radius: 22px;
        background: #FFF;
        color: var(--Garda_Black-Color, #0C181A);
        font-family: Montserrat, Arial, sans-serif;
        font-size: 12px;
        font-style: normal;
        font-weight: 500;
        line-height: 112%;
    }
    
    .popular-products-card__label--popular {
        background: #FF9800;
        color: #FFFFFF;
        border: none;
    }
    
    .popular-products-section__line {
        margin: 24px 16px 0;
        position: relative;
    }
    
    .popular-products-section__line-slider {
        width: 112px;
        height: 2px;
        display: block;
    }
    
    .popular-products-section__button {
        padding: 8px 16px;
        font-size: 10px;
        margin: 20px auto 0;
    }
}
