/* Premium Related Products and Customers Also Liked Sections
   Redesigned for better visual appeal and user experience */

/* Common styles for both sections */
.related-products {
    margin-top: 60px;
    position: relative;
    padding: 40px 0;
    background: linear-gradient(to bottom, var(--product-light) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.related-products::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23f97316' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.5;
    z-index: 0;
}

/* Section headers */
.related-products h2 {
    font-size: 2rem;
    color: var(--product-dark);
    margin-bottom: 15px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.related-products h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--product-primary), transparent);
    margin: 15px auto 0;
    border-radius: 2px;
}

.section-intro {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 40px;
    color: var(--product-text-light);
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* Customers Also Liked section */
.customers-also-liked {
    margin-top: 60px;
    position: relative;
    z-index: 1;
}

.customers-also-liked h3 {
    font-size: 1.8rem;
    color: var(--product-dark);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.customers-also-liked h3::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, var(--product-secondary), transparent);
    margin: 12px auto 0;
    border-radius: 2px;
}

/* Product grid with improved layout */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
    position: relative;
    z-index: 2;
}

/* Enhanced product cards */
.product-card {
    background: var(--product-white);
    border-radius: var(--product-card-radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: translateY(0);
    max-width: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.1);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--product-primary), var(--product-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover::before {
    opacity: 1;
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    /* Đảm bảo tỷ lệ 1:1 (hình vuông) */
    overflow: hidden;
    border-radius: var(--product-card-radius) var(--product-card-radius) 0 0;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    background-color: #ffffff;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--product-primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(249, 115, 22, 0.2);
}

.product-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    background-color: #ffffff;
}

.product-category {
    color: var(--product-text-light);
    font-size: 0.85rem;
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.product-category i {
    color: var(--product-primary);
    font-size: 0.9rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--product-dark);
    margin-bottom: 10px;
    line-height: 1.4;
    transition: var(--product-transition);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 3.08rem;
    min-height: 3.08rem;
    max-height: 3.08rem;
    word-break: break-word;
    hyphens: auto;
    text-align: left;
}

.product-card:hover .product-title {
    color: var(--product-primary);
}

.product-stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 8px;
}

.product-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-width: 0;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #FFB800;
    font-size: 0.9rem;
}

.product-rating span {
    color: var(--product-text);
    font-weight: 600;
    margin-left: 5px;
}

.related-product-sold,
.also-liked-product-views {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(249, 115, 22, 0.1);
    padding: 5px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--product-primary);
    font-weight: 600;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

.related-product-sold span,
.also-liked-product-views span {
    text-overflow: ellipsis;
    overflow: hidden;
    display: inline-block;
}

.related-product-sold i,
.also-liked-product-views i {
    font-size: 0.85rem;
    flex-shrink: 0;
    min-width: 12px;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--product-primary);
    margin-bottom: 15px;
}

.product-action {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.product-details,
.also-liked-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background-color: var(--product-primary);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    gap: 8px;
    width: 100%;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-details:hover,
.also-liked-details:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(249, 115, 22, 0.3);
    background-color: #ff6a00;
}

.product-details i,
.also-liked-details i {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-left: 2px;
}

.product-details:hover i,
.also-liked-details:hover i {
    transform: translateX(5px);
}

/* Differentiate "Customers Also Liked" section */
.also-liked-card {
    border: 1px solid rgba(0, 88, 221, 0.1);
}

.also-liked-card::before {
    background: linear-gradient(to right, var(--product-secondary), var(--product-primary));
}

.also-liked-card .product-badge {
    background: var(--product-secondary);
    box-shadow: 0 3px 10px rgba(0, 88, 221, 0.2);
}

.also-liked-card .product-category i {
    color: var(--product-secondary);
}

.also-liked-card .product-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--product-dark);
    margin-bottom: 10px;
    line-height: 1.4;
    transition: var(--product-transition);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 3.08rem;
    min-height: 3.08rem;
    max-height: 3.08rem;
    word-break: break-word;
    hyphens: auto;
    text-align: left;
}

.also-liked-card:hover .product-title {
    color: var(--product-secondary);
}

.also-liked-product-views {
    background-color: rgba(0, 88, 221, 0.1);
    color: var(--product-secondary);
}

@media (max-width: 576px) {
    .also-liked-product-views {
        background-color: rgba(0, 88, 221, 0.08);
        color: var(--product-secondary);
    }
}

.also-liked-card .product-price {
    color: var(--product-secondary);
}

.also-liked-details {
    background-color: var(--product-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.also-liked-details:hover {
    box-shadow: 0 5px 15px rgba(0, 88, 221, 0.3);
    background-color: #0046b8;
}

/* Animation for cards */
.product-card.fade-in {
    animation: fadeInUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive styles */
@media (max-width: 992px) {
    .related-products {
        padding: 30px 0;
    }

    .related-products h2 {
        font-size: 1.8rem;
    }

    .customers-also-liked h3 {
        font-size: 1.6rem;
    }

    .product-grid {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .related-products {
        margin-top: 40px;
        padding: 25px 0;
    }

    .related-products h2 {
        font-size: 1.6rem;
    }

    .customers-also-liked {
        margin-top: 40px;
    }

    .customers-also-liked h3 {
        font-size: 1.4rem;
    }

    .section-intro {
        font-size: 0.95rem;
        margin-bottom: 30px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-image {
        aspect-ratio: 1/1;
        /* Giữ tỷ lệ hình vuông */
    }

    .product-content {
        padding: 12px;
    }

    .product-title,
    .also-liked-card .product-title {
        font-size: 1rem;
        height: 2.8rem;
        min-height: 2.8rem;
        max-height: 2.8rem;
        margin-bottom: 8px;
    }

    .product-price {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .product-details,
    .also-liked-details {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .related-product-sold,
    .also-liked-product-views {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .product-rating {
        font-size: 0.8rem;
    }

    .product-rating span {
        margin-left: 3px;
    }
}

@media (max-width: 576px) {
    .related-products {
        margin-top: 30px;
        padding: 20px 0;
    }

    .related-products h2 {
        font-size: 1.4rem;
    }

    .customers-also-liked h3 {
        font-size: 1.3rem;
    }

    .section-intro {
        font-size: 0.9rem;
        margin-bottom: 25px;
    }

    .product-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .product-image {
        aspect-ratio: 1/1;
        /* Giữ tỷ lệ hình vuông */
    }

    .product-title,
    .also-liked-card .product-title {
        font-size: 0.95rem;
        height: 2.66rem;
        min-height: 2.66rem;
        max-height: 2.66rem;
    }

    .product-stats-container {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 5px;
        flex-wrap: nowrap;
    }

    .product-stats {
        display: flex;
        justify-content: flex-start;
        width: auto;
        flex-shrink: 0;
    }

    .related-product-sold,
    .also-liked-product-views {
        margin-top: 0;
        padding: 3px 6px;
        font-size: 0.7rem;
        flex-grow: 0;
        flex-shrink: 1;
        justify-content: center;
        max-width: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-rating {
        flex-grow: 0;
        flex-shrink: 0;
        justify-content: flex-start;
        max-width: none;
        font-size: 0.75rem;
    }

    .product-rating span {
        font-size: 0.7rem;
    }

    .product-rating i {
        font-size: 0.7rem;
        margin-right: 1px;
    }

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