/* Блок «Действующие акции» — слайдер (block-top-gifts).
   Перенесено из инлайнового <style> шаблона widgets/block_top_gifts.blade.php. */
.gifts-block {
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.gifts-slider-wrapper {
    position: relative;
    padding: 20px 0;
    margin: 0 -20px; /* Компенсируем padding контейнера */
}

.gifts-swiper {
    padding: 20px 20px 30px;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    position: relative;
    z-index: 2;
    width: 100%;
}

/* Скрытие скроллбара в WebKit */
.gifts-swiper::-webkit-scrollbar {
    display: none;
}

.swiper-wrapper {
    align-items: stretch;
    box-sizing: border-box;
    position: relative;
    display: flex;
    width: max-content; /* Важно для автоматической ширины */
}

.swiper-slide {
    height: auto;
    box-sizing: border-box;
    flex-shrink: 0;
}

.gift-card {
    width: 262px;
    height: 361px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    background: white;
    display: flex;
    flex-direction: column;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.gift-image {
    width: 100%;
    height: 361px;
    position: relative;
    overflow: hidden;
}

.gift-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gift-image a:hover img {
    transform: scale(1.05);
}

.gift-content-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    padding: 40px 20px 20px;
    color: white;
    text-align: center;
}

.gift-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    word-break: break-word;
    overflow-wrap: break-word;
}

.gift-title a {
    color: white;
    text-decoration: none;
    display: block;
}

.gift-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    text-align: center;
    background: white;
    flex-grow: 1;
}

.gift-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 15px;
    flex: 1;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.gift-button {
    display: inline-block;
    background: #FF7F00;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.gift-button:hover {
    background: #1BA3D5;
    color: white;
    text-decoration: none;
}

/* Частичный показ следующего слайда */
.gifts-swiper .swiper-slide {
    width: 262px !important;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    transform: translate3d(0,0,0);
    -webkit-transform: translate3d(0,0,0);
}

.gifts-swiper .swiper-slide-active {
    opacity: 1;
}

.gifts-swiper .swiper-slide-next {
    opacity: 0.9;
}

/* Адаптивность */
@media (max-width: 768px) {
    .gifts-slider-wrapper {
        margin: 0 -15px;
    }

    .gifts-swiper {
        padding: 15px 15px 25px;
    }

    .gift-card {
        width: 240px;
        height: 330px;
    }

    .gifts-swiper .swiper-slide {
        width: 240px !important;
    }

    .gift-image {
        height: 330px;
    }

    .gift-content-overlay {
        padding: 25px 15px 15px;
    }

    .gift-content {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .gifts-slider-wrapper {
        margin: 0 -10px;
    }

    .gifts-swiper {
        padding: 10px 10px 20px;
    }

    .gift-card {
        width: 220px;
        height: 300px;
    }

    .gifts-swiper .swiper-slide {
        width: 220px !important;
    }

    .gift-image {
        height: 300px;
    }

    .gift-title {
        font-size: 15px;
    }

    .gift-description {
        font-size: 12px;
    }
}

/* Исправления для мобильных устройств */
@media (hover: none) and (pointer: coarse) {
    .gift-image a:hover img {
        transform: none;
    }

    .gifts-swiper {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* Исправление для Samsung Internet Browser */
@media (-webkit-touch-callout: none) {
    .gifts-swiper {
        -webkit-overflow-scrolling: auto !important;
    }

    .gift-card {
        -webkit-transform: none;
        transform: none;
    }
}

/* Гарантия, что слайды не будут сжиматься */
.swiper-slide {
    flex-shrink: 0 !important;
}

/* Стили для контента внутри gift-description */
.gift-description p {
    margin: 0;
    padding: 0;
}

.gift-description br {
    display: none;
}

/* Для случая с no_image.png - создаем темный фон для текста */
.gift-image:not(:has(img[src*="/uploads/gifts/"])) .gift-content-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 100%);
}
