/**
 * Lafinda Product Card Design System
 * Unified presentation for grids, carousels, and list views.
 */

:root {
    --lp-orange: var(--primary-color, #FE6A07);
    --lp-orange-dark: var(--primary-dark, #d45906);
    --lp-navy: #0b1b3c;
    --lp-navy-muted: #4a5568;
    --lp-surface: #ffffff;
    --lp-media-bg: #f3f5f8;
    --lp-border: rgba(11, 27, 60, 0.08);
    --lp-shadow: 0 2px 8px rgba(11, 27, 60, 0.06);
    --lp-shadow-hover: 0 12px 28px rgba(11, 27, 60, 0.12);
    --lp-radius: 14px;
    --lp-media-ratio: 1 / 1;
    --lp-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base card ── */
.lp-card,
.product-card,
.product-card-mobile,
.vendor-shop-grid-card,
.wishlist-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    box-shadow: var(--lp-shadow);
    overflow: hidden;
    height: 100%;
    transition: transform var(--lp-transition), box-shadow var(--lp-transition), border-color var(--lp-transition);
}

.lp-card:hover,
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--lp-shadow-hover);
    border-color: rgba(254, 106, 7, 0.25);
}

.lp-card:active,
.product-card-mobile:active {
    transform: scale(0.985);
}

/* Out of stock */
.lp-card--out-of-stock .lp-card__media-stage,
.lp-card--out-of-stock .lp-card__image {
    opacity: 0.55;
    filter: grayscale(0.35);
}

.lp-card__oos-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    color: var(--lp-navy);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    z-index: 3;
    pointer-events: none;
}

/* ── Media area ── */
.lp-card__media {
    position: relative;
    flex-shrink: 0;
}

.lp-card__media-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.lp-card__media-stage {
    position: relative;
    aspect-ratio: var(--lp-media-ratio, 1 / 1);
    background: #f8fafc;
    overflow: hidden;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-card__image,
.product-card img.card-img-top,
.product-card-mobile-image,
.vendor-shop-grid-card__media img,
.wishlist-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 6px;
    transition: transform var(--lp-transition);
    background: #f8fafc;
    display: block;
}

.lp-card:hover .lp-card__image,
.product-card:hover img.card-img-top {
    transform: scale(1.03);
}

.lp-card__placeholder,
.vendor-shop-grid-card__placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b8c4;
    font-size: 2.5rem;
    background: var(--lp-media-bg);
}

/* ── Badges ── */
.lp-card__badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    z-index: 4;
    pointer-events: none;
}

.lp-badge,
.product-card-mobile-badge,
.vendor-shop-grid-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.lp-badge--sale,
.lp-badge--discount {
    background: var(--lp-orange);
    color: #fff;
}

.lp-badge--deal {
    background: #e74c3c;
    color: #fff;
}

.lp-badge--new {
    background: var(--lp-navy);
    color: #fff;
}

.lp-badge--sponsored {
    background: #ffc107;
    color: #1a1a1a;
}

.lp-badge--featured {
    background: #6f42c1;
    color: #fff;
}

.lp-badge--popular {
    background: #198754;
    color: #fff;
}

.lp-badge--limited {
    background: #dc3545;
    color: #fff;
}

.lp-badge--campaign {
    background: var(--lp-orange);
    color: #fff;
}

.lp-badge--blackfriday {
    background: #111;
    color: #fff;
}

/* ── Wishlist & quick actions ── */
.lp-card__actions-float {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}

.lp-card__wishlist,
.product-card-mobile-wishlist,
.wishlist-card__remove {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.96);
    color: #dc3545;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(11, 27, 60, 0.15);
    text-decoration: none;
    transition: transform var(--lp-transition), background var(--lp-transition), color var(--lp-transition);
}

.lp-card__wishlist:hover,
.product-card-mobile-wishlist:hover {
    background: #fff;
    color: #c82333;
    transform: scale(1.06);
}

.lp-card__wishlist.active,
.product-card-mobile-wishlist.active,
.wishlist-card__remove {
    background: #dc3545;
    color: #fff;
}

.product-card-mobile-cart,
.lp-card__cart {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--lp-orange);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(254, 106, 7, 0.35);
    text-decoration: none;
    transition: transform var(--lp-transition), background var(--lp-transition);
}

.product-card-mobile-cart:hover,
.lp-card__cart:hover {
    background: var(--lp-orange-dark);
    color: #fff;
}

.product-card-mobile-cart:active,
.lp-card__wishlist:active {
    transform: scale(0.92);
}

/* Legacy top-position overrides → bottom-right stack */
.product-card-mobile .product-card-mobile-wishlist,
.product-card-mobile .product-card-mobile-cart {
    position: static;
    box-shadow: 0 2px 8px rgba(11, 27, 60, 0.15);
}

.product-card-mobile .lp-card__actions-float {
    position: absolute;
    top: auto;
    right: 8px;
    bottom: 8px;
    left: auto;
}

.product-card-mobile .product-card-mobile-badge,
.product-card-mobile .lp-badge {
    position: static;
}

.product-card-mobile:has(.lp-card__actions-float) .lp-card__badges {
    max-width: calc(100% - 48px);
}

/* ── Body / typography ── */
.lp-card__body,
.product-card-body,
.product-card-mobile-body,
.vendor-shop-grid-card__body,
.wishlist-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
    flex: 1;
    min-width: 0;
}

.lp-card__title,
.product-title,
.product-card-mobile-title,
.vendor-shop-grid-card__title,
.wishlist-card__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--lp-navy);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

.lp-card__title a,
.product-title a,
.product-card-mobile-title a,
.vendor-shop-grid-card__title,
.wishlist-card__title a {
    color: inherit;
    text-decoration: none;
}

.lp-card__title a:hover,
.product-title a:hover {
    color: var(--lp-orange);
}

.lp-card__rating,
.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--lp-navy-muted);
    line-height: 1.2;
}

.lp-card__rating-stars {
    color: #f59e0b;
    letter-spacing: -0.5px;
}

.lp-card__rating-value {
    font-weight: 600;
    color: var(--lp-navy);
}

.lp-card__price-row,
.product-price,
.product-card-mobile-price,
.vendor-shop-grid-card__price-row,
.wishlist-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 6px;
    margin-top: auto;
    padding-top: 2px;
}

.lp-card__price-current,
.product-price > span:first-child,
.product-card-mobile-price > span:first-child,
.vendor-shop-grid-card__price,
.wishlist-card__price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--lp-orange);
    line-height: 1.2;
}

.lp-card__price-old,
.product-price-old,
.product-card-mobile-old-price,
.vendor-shop-grid-card__price-old,
.wishlist-card__price-old {
    font-size: 0.75rem;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 500;
}

.lp-card__discount-inline {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
}

.lp-card__vendor {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lp-card__vendor a {
    color: inherit;
    text-decoration: none;
}

.lp-card__vendor a:hover {
    color: var(--lp-orange);
}

.lp-card__footer-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 4px;
}

.lp-card__footer-actions .btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
}

/* ── Grid variant (list/category/search/PDP) ── */
.category-landing__product-grid .lp-card--grid,
.category-landing__product-grid .product-card,
.category-landing .product-grid .lp-card--grid,
.category-landing .product-grid .product-card {
    width: 100%;
}

.lp-card--grid.product-card {
    overflow: hidden;
}

.lp-card--grid .lp-card__media-stage {
    aspect-ratio: var(--lp-media-ratio);
}

.lp-card--grid .product-card-body {
    padding: 12px 14px 14px;
}

@media (min-width: 768px) {
    .lp-card--grid .lp-card__title,
    .lp-card--grid .product-title {
        font-size: 0.95rem;
    }

    .lp-card--grid .lp-card__price-current,
    .lp-card--grid .product-price > span:first-child {
        font-size: 1.125rem;
    }
}

/* ── Carousel variant (home feed) ── */
.lp-card--carousel.product-card-mobile {
    min-width: 152px;
    width: 152px;
    max-width: 152px;
    min-height: auto;
    flex-shrink: 0;
    box-shadow: var(--lp-shadow);
}

.lp-card--carousel .lp-card__media-stage {
    aspect-ratio: var(--lp-media-ratio);
}

.lp-card--carousel .product-card-mobile-body,
.lp-card--carousel .lp-card__body {
    padding: 8px 10px 10px;
    min-height: auto;
}

.lp-card--carousel .product-card-mobile-title,
.lp-card--carousel .lp-card__title {
    font-size: 0.78rem;
    min-height: 2.2em;
    -webkit-line-clamp: 2;
}

.lp-card--carousel .product-card-mobile-price,
.lp-card--carousel .lp-card__price-current {
    font-size: 0.88rem;
}

.lp-card--carousel .product-card-mobile-old-price,
.lp-card--carousel .lp-card__price-old {
    font-size: 0.75rem;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .lp-card--carousel.product-card-mobile {
        min-width: 168px;
        width: 168px;
        max-width: 168px;
    }
}

/* Desktop home feed - compact for good consistency */
@media (min-width: 992px) {
    .lp-card--carousel.product-card-mobile {
        flex: 0 0 calc((100% - 4 * 14px) / 5);
        min-width: 0;
        width: auto;
        max-width: none;
    }

    .lp-card--carousel .product-card-mobile-title,
    .lp-card--carousel .lp-card__title {
        font-size: 0.82rem;
        min-height: 2em;
    }

    .lp-card--carousel .product-card-mobile-price,
    .lp-card--carousel .lp-card__price-current {
        font-size: 0.92rem;
    }

    .lp-card--carousel .product-card-mobile-body,
    .lp-card--carousel .lp-card__body {
        padding: 8px 10px 10px;
    }

    .lp-card--carousel .lp-card__media-stage {
        aspect-ratio: 1 / 1;
    }
}

@media (min-width: 1200px) {
    .lp-card--carousel.product-card-mobile {
        flex: 0 0 calc((100% - 5 * 14px) / 6);
    }
}

/* ── Vendor shop (uses same tokens) ── */
.vendor-shop-grid-card {
    border-radius: var(--lp-radius);
}

.vendor-shop-grid-card__media {
    display: block;
    position: relative;
    text-decoration: none;
    aspect-ratio: auto;
}

.vendor-shop-grid-card__media .lp-card__media-stage {
    aspect-ratio: var(--lp-media-ratio);
}

.vendor-shop-grid-card__placeholder {
    font-size: 2rem;
}

/* ── Wishlist variant ── */
.wishlist-card__image-wrap {
    position: relative;
}

.wishlist-card__media {
    display: block;
}

.wishlist-card__media .lp-card__media-stage {
    aspect-ratio: 1 / 1;
}

.wishlist-card__remove {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 5;
}

.wishlist-card__cart {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 5;
}

/* ── Skeleton ── */
.lp-card--skeleton {
    pointer-events: none;
}

.lp-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: lp-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.lp-skeleton--media {
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 0;
    background: linear-gradient(90deg, #f8fafc 25%, #e2e8f0 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: lp-shimmer 1.5s ease-in-out infinite;
}

.lp-skeleton--title {
    height: 13px;
    width: 88%;
    margin-bottom: 6px;
}

.lp-skeleton--rating {
    height: 10px;
    width: 50%;
    margin-bottom: 8px;
}

.lp-skeleton--price {
    height: 15px;
    width: 65%;
}

@keyframes lp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.home-feed-skeleton-card {
    min-width: 152px;
    width: 152px;
    flex-shrink: 0;
    border-radius: var(--lp-radius);
    overflow: hidden;
    border: 1px solid var(--lp-border);
    background: var(--lp-surface);
}

/* ── Sponsored / featured card tint ── */
.lp-card--sponsored {
    border-color: rgba(255, 193, 7, 0.35);
}

/* Override legacy fixed-height / contain rules from style.css & shop-mobile.css */
.product-card img,
.product-card img.card-img-top,
.product-card-mobile-image {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
}

.product-card-mobile {
    overflow: hidden;
    box-shadow: var(--lp-shadow) !important;
    border: 1px solid var(--lp-border) !important;
    border-radius: var(--lp-radius) !important;
    min-height: auto !important;
}

.product-card-mobile .lp-card__media-stage {
    width: 100%;
}

.product-card {
    overflow: hidden;
    border-radius: var(--lp-radius) !important;
    border: 1px solid var(--lp-border) !important;
    box-shadow: var(--lp-shadow) !important;
}

.product-card:hover {
    transform: translateY(-4px);
}

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

.lp-card__price-row--deal .lp-card__price-current {
    color: #ff6b6b;
}

.lp-card__price-row--blackfriday .lp-card__price-current {
    color: #ff0000;
}
