/*
 * Картка товару (Views/Shared/_ProductCard.cshtml), сітка карток і кнопка "в обране".
 * Плоскі селектори, без !important. Кольори — з поточної палітри сайту.
 */

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
    }
}

.product-card {
    container: product-card / inline-size;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 12px 12px 14px;
    border-radius: 22px;
    background: #181839;
    box-shadow: 0 0 1px #0c0727;
    font-family: Roboto, sans-serif;
    transition: background 0.15s ease;
}

.product-card:hover {
    background: #1f1f47;
}

.product-card__media {
    position: relative;
    aspect-ratio: 5 / 4;
    overflow: hidden;
    border-radius: 16px;
    background: #91a3b7;
}

.product-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.product-card:hover .product-card__media img {
    transform: scale(1.04);
}

.product-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #393f6f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.product-card__badge--new {
    background: #2e6f5e;
}

.product-card__badge--pending {
    background: #6f5a2e;
    letter-spacing: 0;
}

.product-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 0 4px;
}

.product-card__title {
    overflow: hidden;
    color: #fff;
    font-family: "Space Grotesk", Roboto, sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Посилання з назви накриває всю картку — клік будь-де веде на товар */
.product-card__title::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.product-card__title:hover,
.product-card:hover .product-card__title {
    color: #fff;
    text-decoration: underline;
}

.product-card__title:focus-visible {
    outline: none;
}

.product-card__title:focus-visible::after {
    outline: 2px solid #91a3b7;
    outline-offset: 2px;
    border-radius: 22px;
}

.product-card__seller {
    overflow: hidden;
    color: #9b9da0;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: auto;
    padding: 0 4px;
}

.product-card__price {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

/* "Дізнатись більше": лише коли картка достатньо широка для кнопки поруч із сердечком.
   Вужча картка (телефон) — ціна й сердечко в одному рядку, уся картка клікабельна. */
.product-card__more {
    display: none;
}

@container product-card (min-width: 195px) {
    .product-card__footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "price ."
            "more heart";
        align-items: center;
        row-gap: 8px;
    }

    .product-card__price {
        grid-area: price;
    }

    .product-card__more {
        position: relative;
        z-index: 1; /* над розтягнутим посиланням, щоб працював hover */
        display: block;
        grid-area: more;
        justify-self: start;
        padding: 8px 14px;
        border-radius: 8px;
        background: #393f6f;
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
        text-decoration: none;
        white-space: nowrap;
    }

    .product-card__more:hover {
        background: #4a5190;
        color: #fff;
    }

    .product-card__footer .wish-button {
        grid-area: heart;
    }
}

/* Кнопка "в обране" (Views/Shared/_WishButton.cshtml) */

.wish-button {
    position: relative;
    z-index: 1; /* над розтягнутим посиланням картки */
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: -4px; /* край іконки на тій самій відстані від краю картки, що й текст ліворуч */
    color: #91a3b7;
}

.wish-button:hover {
    color: #fff;
}

.heart-icon {
    width: 28px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
}

.wish-button--active .heart-icon {
    fill: currentColor;
}

@media (max-width: 400px) {
    .product-card {
        padding: 10px 10px 12px;
        border-radius: 18px;
    }

    .product-card__media {
        border-radius: 13px;
    }

    .product-card__title {
        font-size: 14px;
    }

    .product-card__price {
        font-size: 15px;
    }

    .product-card__badge {
        top: 6px;
        left: 6px;
        padding: 2px 6px;
        font-size: 10px;
    }
}
