/* ============================================
   Products Listing
   ============================================ */

/* الجريد ← 21px ← الترقيم ← 113px ← الفوتر */
.products-listing {
    padding-bottom: 113px;
}

.products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 20px;
    margin-bottom: 0;
}

.products-listing .pagination {
    margin-top: 21px;
}

/* ── Card ──
   Image + info share a 24px gap; the card's 32px gap sits only before the button. */
.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 32px 16px 24px;
    border: 1px solid var(--n200);
    border-radius: 16px;
    background: linear-gradient(360deg, #FFFFFF 37.28%, #F2F2F2 100%);
    box-sizing: border-box;
    transition: box-shadow .2s, transform .2s;
}

.product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.product-card__image {
    position: relative;
    display: block;
    aspect-ratio: 363 / 248;
    background: transparent;
    overflow: hidden;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* SALE! badge — absolute child of the card, 16px from its top/start edge */
.product-card__badge {
    position: absolute;
    top: 15px;               /* 16px from the card's outer edge (1px border) */
    inset-inline-start: 15px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    box-sizing: border-box;
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    color: var(--primary-700);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
}

.product-card__content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
}

.product-card__content form {
    margin-top: auto;
}

.product-card__info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-card__content h3 {
    font-size: 18px;
    font-weight: 400;
    line-height: 27px;
    color: var(--text-black);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 54px; /* keep 2-line slot so cards stay ≈508px tall */
}

.product-card__price {
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-card__currency {
    font-size: 20px;
    font-weight: 400;
    line-height: 30px;
    color: var(--text-black);
}

.product-card__now {
    font-size: 20px;
    font-weight: 600;
    line-height: 30px;
    color: var(--text-black);
}

.product-card__old {
    margin-inline-start: 5px;
    font-size: 16px;
    font-weight: 500;
    line-height: 30px;
    color: var(--n500);
    text-decoration: line-through;
}

.product-card__cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 10px 20px;
    border: 1px solid var(--primary-600);
    border-radius: 12px;
    background: var(--white);
    color: var(--primary-700);
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    box-sizing: border-box;
    transition: background-color .2s, color .2s;
}

.product-card__cart svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.product-card__cart:hover {
    background: var(--primary-50);
}

/* ── Compact variant (related products on product details, ≈292px wide) ── */
.product-card--compact {
    gap: 17.65px;
    padding: 23.5px 12px 17.6px;
    border-width: 0.75px;
    border-radius: 11.77px;
}

.product-card--compact .product-card__image {
    aspect-ratio: 266.75 / 182.56;
}

.product-card--compact .product-card__badge {
    top: 11px;
    inset-inline-start: 11px;
    height: 20.6px;
    padding: 0 8.8px;
    border-width: 0.75px;
    border-radius: 5.9px;
    font-size: 10.3px;
    line-height: 15px;
}

.product-card--compact .product-card__content {
    gap: 23.54px;
}

.product-card--compact .product-card__info {
    gap: 11.77px;
}

.product-card--compact .product-card__content h3 {
    font-size: 14px;
    line-height: 21px;
    -webkit-line-clamp: 3;
    min-height: 63px;
}

.product-card--compact .product-card__price {
    gap: 2.94px;
}

.product-card--compact .product-card__currency {
    font-size: 16px;
    line-height: 24px;
}

.product-card--compact .product-card__now {
    font-size: 16px;
    line-height: 24px;
}

.product-card--compact .product-card__old {
    margin-inline-start: 3.7px;
    font-size: 12px;
    line-height: 21px;
}

.product-card--compact .product-card__cart {
    height: 36px;
    padding: 7.35px 14.7px;
    gap: 5.9px;
    border-width: 0.75px;
    border-radius: 8.83px;
    font-size: 12px;
    line-height: 18px;
}

.product-card--compact .product-card__cart svg {
    width: 14.7px;
    height: 14.7px;
}

@media (max-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr !important;
    }

    .products-listing {
        padding-bottom: 64px;
    }
}

/* صورة بديلة لما المنتج مالوش صورة */
.product-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #F6FDF8 0%, var(--primary-50) 100%);
    border-radius: 12px;
}

.product-card__placeholder img {
    width: 56px;
    height: 56px;
    opacity: .5;
    object-fit: contain;
}

.product-card__title-link {
    color: inherit;
}

/* رسالة الإضافة للسلة */
.cart-flash {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    background: var(--primary-50);
    color: var(--text-black);
    font-size: 16px;
    line-height: 24px;
}

.cart-flash svg {
    flex-shrink: 0;
    color: var(--primary-700);
}

.cart-flash a {
    margin-inline-start: auto;
    color: var(--primary-700);
    font-weight: 500;
    text-decoration: underline;
}

.cart-flash--compact {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 21px;
}
