/*
 * /public/assets/css/product-card.css
 * NIKKI_PRODUCT_CARD_SHARED_V1
 *
 * Composant produit commun :
 * - résultats de recherche
 * - découverte
 * - accueil à terme
 */

.nikki-product-card {
    overflow: hidden;
    min-width: 0;
    height: 100%;
    border: 1px solid rgba(6, 11, 45, 0.075);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 7px 22px rgba(6, 11, 45, 0.042);
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.nikki-product-card:hover {
    transform: translateY(-2px);
    border-color: rgba(6, 11, 45, 0.14);
    box-shadow: 0 14px 34px rgba(6, 11, 45, 0.078);
}

.nikki-product-card:focus-within {
    border-color: rgba(6, 11, 45, 0.22);
    box-shadow:
        0 0 0 3px rgba(6, 11, 45, 0.08),
        0 14px 34px rgba(6, 11, 45, 0.078);
}


/* ============================================================
   MÉDIA
   ============================================================ */

.nikki-product-card-media {
    position: relative;
    isolation: isolate;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f1ede7;
    outline: none;
}

.nikki-product-card-image-placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #eee9e1;
    color: #c8bbad;
    opacity: 1;
    visibility: visible;
    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}

.nikki-product-card-image-placeholder::after {
    position: absolute;
    inset: 0;
    content: '';
    transform: translateX(-100%);
    background: linear-gradient(
        100deg,
        transparent 20%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 80%
    );
    animation: nikki-product-card-image-shimmer 1.35s ease-in-out infinite;
}

.nikki-product-card-image-error-icon {
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    opacity: 0;
    transition: opacity 160ms ease;
}

.nikki-product-card-media [data-product-card-image] {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition:
        opacity 180ms ease,
        transform 700ms ease-out;
    will-change: transform;
}

.nikki-product-card-media.is-image-loaded [data-product-card-image] {
    opacity: 1;
}

.nikki-product-card-media.is-image-loaded
.nikki-product-card-image-placeholder {
    opacity: 0;
    visibility: hidden;
}

.nikki-product-card-media.is-image-error
.nikki-product-card-image-placeholder::after {
    display: none;
}

.nikki-product-card-media.is-image-error
.nikki-product-card-image-error-icon {
    opacity: 1;
}

.nikki-product-card-media > .nikki-product-card-unavailable {
    z-index: 2;
}

@keyframes nikki-product-card-image-shimmer {
    100% {
        transform: translateX(100%);
    }
}


/* ============================================================
   CORPS
   ============================================================ */

.nikki-product-card-body {
    box-sizing: border-box;
    display: grid;
    min-height: 106px;
    padding: 10px 12px 11px;
    grid-template-rows: minmax(38px, auto) 32px;
    row-gap: 5px;
    align-content: space-between;
    background: #ffffff;
}

.nikki-product-card-title-row {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 2px;
}

.nikki-product-card-title {
    display: -webkit-box;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    color: #171a2f;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}


/* ============================================================
   FAVORIS
   ============================================================ */

.nikki-product-card-favorite {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    width: 32px;
    height: 32px;
    margin-top: -4px;
    margin-right: -7px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    -webkit-tap-highlight-color: transparent;
    transition:
        color 70ms ease-out,
        transform 120ms ease-out;
}

.nikki-product-card-favorite > svg {
    position: relative;
    z-index: 1;
}

.nikki-product-card-favorite::before {
    position: absolute;
    z-index: 0;
    inset: 2px;
    border-radius: inherit;
    background: rgba(226, 85, 98, 0.24);
    content: '';
    opacity: 0;
    pointer-events: none;
    transform: scale(0.72);
}

.nikki-product-card-favorite.is-feedback::before {
    animation:
        nikki-product-card-favorite-feedback
        340ms
        cubic-bezier(.22, 1, .36, 1)
        both;
}

.nikki-product-card-favorite:active {
    transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
    .nikki-product-card-favorite:hover {
        transform: scale(1.05);
        background: #f9e8eb;
        color: #c83d53 !important;
    }
}

@keyframes nikki-product-card-favorite-feedback {
    0% {
        opacity: 0.52;
        transform: scale(0.72);
    }

    46% {
        opacity: 0.2;
        transform: scale(0.98);
    }

    100% {
        opacity: 0;
        transform: scale(1.12);
    }
}


/* ============================================================
   BAS DE CARD
   ============================================================ */

.nikki-product-card-bottom {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.nikki-product-card-shipping {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
}

.nikki-product-card-price {
    flex: 0 0 auto;
    text-align: right;
}

.nikki-product-card-price-normal {
    display: block;
    color: #171a2f;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.025em;
}

.nikki-product-card-sale-price-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    white-space: nowrap;
}

.nikki-product-card-sale-price-stack .nikki-product-sale-price {
    font-size: 16px;
}


/* ============================================================
   RESPONSIVE
   Même densité que les cards résultats
   ============================================================ */

@media (min-width: 1180px) {
    .nikki-product-card-body {
        min-height: 103px;
        padding: 9px 11px 10px;
        grid-template-rows: 38px 31px;
        row-gap: 4px;
    }

    .nikki-product-card-title {
        font-size: 13.5px;
    }
}

@media (min-width: 1480px) {
    .nikki-product-card-title {
        font-size: 13px;
    }
}

@media (max-width: 639px) {
    .nikki-product-card {
        border-radius: 15px;
        box-shadow: 0 5px 16px rgba(6, 11, 45, 0.04);
    }

    .nikki-product-card-body {
        min-height: 110px;
        padding: 10px 10px 12px;
        grid-template-rows: minmax(40px, auto) 32px;
    }

    .nikki-product-card-title {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nikki-product-card,
    .nikki-product-card-favorite,
    .nikki-product-card-image-placeholder,
    .nikki-product-card-media [data-product-card-image] {
        transition: none !important;
    }

    .nikki-product-card-image-placeholder::after {
        animation: none !important;
    }

    .nikki-product-card:hover,
    .nikki-product-card-favorite:hover {
        transform: none;
    }
}
