/* ============================================================
   POPULAR.CSS - БЛОК "ПОПУЛЯРНЫЕ ТОВАРЫ" НА ГЛАВНОЙ
   Сетка 4 в ряд + кнопка "Каталог товаров" снизу
   Стили симметричны блоку "Популярные услуги"
   ============================================================ */

.popular-products-section {
    padding: 20px 0 40px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    border-bottom: 1px solid #2a2a2a;
}

.popular-products-section .section-title {
    margin-bottom: 20px;
    text-align: center;
}

/* ============================================================
   ОБЁРТКА И СЕТКА
   ============================================================ */

.popular-products-wrapper {
    max-width: 1450px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.popular-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
}

/* ============================================================
   КАРТОЧКА ТОВАРА — КВАДРАТНАЯ
   ============================================================ */

.popular-product-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #2a2a2a;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #3a3a3a;
    aspect-ratio: 1 / 1;
    position: relative;
}

.popular-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.popular-product-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    overflow: hidden;
}

.popular-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s ease;
}

.popular-product-card:hover .popular-product-card__image img {
    transform: scale(1.05);
}

.popular-product-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    font-size: 56px;
}

/* ============================================================
   ОВЕРЛЕЙ СНИЗУ: НАЗВАНИЕ + ЦЕНА + "ПОДРОБНЕЕ"
   ============================================================ */

.popular-product-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 14px 16px 16px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.80) 40%,
        rgba(0, 0, 0, 0.40) 75%,
        rgba(0, 0, 0, 0) 100%
    );
    transition: background 0.3s ease;
}

.popular-product-card:hover .popular-product-card__overlay {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.98) 0%,
        rgba(0, 0, 0, 0.85) 40%,
        rgba(0, 0, 0, 0.45) 75%,
        rgba(0, 0, 0, 0) 100%
    );
}

.popular-product-card__title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
}

.popular-product-card__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.popular-product-card__price {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
    flex-shrink: 0;
}

.popular-product-card__more {
    display: inline-block;
    padding: 4px 14px;
    font-size: 11px;
    font-weight: 500;
    color: #8a8a8a;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.popular-product-card:hover .popular-product-card__more {
    color: #4a90d9;
    background: rgba(74, 144, 217, 0.15);
    border-color: rgba(74, 144, 217, 0.3);
    transform: translateY(-1px);
}

/* ============================================================
   КНОПКА "КАТАЛОГ ТОВАРОВ" — ПОСЛЕ КАРТОЧЕК, ПО ЦЕНТРУ
   ============================================================ */

.popular-products-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
    padding: 0 20px;
}

.popular-products-actions__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 40px;
    font-size: 15px;
    font-weight: 600;
    color: #f0f0f0;
    background: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.popular-products-actions__btn:hover {
    background: #4a4a4a;
    border-color: #5a5a5a;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

@media (max-width: 1400px) {
    .popular-products-wrapper {
        max-width: 1200px;
    }
}

@media (max-width: 1024px) {
    .popular-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .popular-product-card__title {
        font-size: 15px;
    }

    .popular-product-card__price {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .popular-products-section {
        padding: 30px 0;
    }

    .popular-products-wrapper {
        padding: 0 16px;
    }

    .popular-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .popular-product-card__title {
        font-size: 14px;
    }

    .popular-product-card__overlay {
        padding: 12px 14px 14px;
    }

    .popular-product-card__price {
        font-size: 12px;
    }

    .popular-product-card__more {
        font-size: 10px;
        padding: 3px 10px;
    }

    .popular-products-actions {
        margin-top: 20px;
    }

    .popular-products-actions__btn {
        padding: 12px 28px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .popular-products-section {
        padding: 20px 0;
    }

    .popular-products-wrapper {
        padding: 0 12px;
    }

    .popular-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .popular-product-card__title {
        font-size: 13px;
    }

    .popular-product-card__price {
        font-size: 11px;
    }

    .popular-product-card__more {
        font-size: 10px;
        padding: 3px 8px;
    }

    .popular-product-card__placeholder {
        font-size: 40px;
    }

    .popular-products-actions__btn {
        padding: 11px 22px;
        font-size: 13px;
        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 360px) {
    .popular-products-grid {
        grid-template-columns: 1fr;
    }
}