.product-card {
    position: relative;
    overflow: visible;
    transition: transform 0.2s ease;
    animation: product-card-fade-in 0.4s ease both;
}

.product-card:hover,
.product-card:focus-within {
    z-index: 80;
    transform: translateY(-4px) scale(1.03);
}

.product-card-best {
    outline: 2px solid rgba(16, 185, 129, 0.45);
    outline-offset: 0;
}

.product-card-worst {
    outline: 2px solid rgba(220, 38, 38, 0.35);
    outline-offset: 0;
}

@keyframes product-card-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#product-grid.product-list-grid > .product-card:nth-child(1) { animation-delay: 0ms; }
#product-grid.product-list-grid > .product-card:nth-child(2) { animation-delay: 30ms; }
#product-grid.product-list-grid > .product-card:nth-child(3) { animation-delay: 60ms; }
#product-grid.product-list-grid > .product-card:nth-child(4) { animation-delay: 90ms; }
#product-grid.product-list-grid > .product-card:nth-child(5) { animation-delay: 120ms; }
#product-grid.product-list-grid > .product-card:nth-child(6) { animation-delay: 150ms; }
#product-grid.product-list-grid > .product-card:nth-child(7) { animation-delay: 180ms; }
#product-grid.product-list-grid > .product-card:nth-child(8) { animation-delay: 210ms; }
#product-grid.product-list-grid > .product-card:nth-child(9) { animation-delay: 240ms; }
#product-grid.product-list-grid > .product-card:nth-child(10) { animation-delay: 270ms; }

@media (prefers-reduced-motion: reduce) {
    .product-card {
        animation: none;
        transition: none;
    }

    .product-card:hover,
    .product-card:focus-within {
        transform: none;
    }
}

.product-media-shell {
    position: relative;
    min-height: 136px;
    background-color: #F7F7F7;
    /* Some engines fail to clip a mix-blend-mode child to the parent's
       rounded corners via overflow:hidden alone. The mask forces the
       browser onto the masking compositing path instead, so it actually
       respects whatever border-radius is set below at every breakpoint. */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.product-media-shell img {
    mix-blend-mode: multiply;
}

.product-source-image-frame {
    border-radius: 1.5rem;
    clip-path: inset(0 round 1.5rem);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.product-media-shell::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    transition: opacity 0.2s ease, backdrop-filter 0.2s ease, -webkit-backdrop-filter 0.2s ease;
    pointer-events: none;
}

.product-card-coupon-inline-badge {
    z-index: 20;
    align-items: center;
    gap: 4px;
    border: 1px solid #BBF7D0;
    border-radius: 9999px;
    background: #DCFCE7;
    padding: 2px 6px 2px 4px;
    color: #15803D;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    text-transform: none;
}

.product-card-coupon-inline-badge svg {
    color: #16A34A;
    fill: #16A34A;
    stroke: #FFFFFF;
    stroke-width: 1.8;
}

.product-card-coupon-inline-label {
    display: inline-block;
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card-coupon-inline-tooltip {
    z-index: 70;
}

.product-detail-coupon-alert {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    border: 1px solid #BBF7D0;
    border-radius: 16px;
    background: #DCFCE7;
    padding: 0;
    color: #15803D;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.product-detail-coupon-alert:hover {
    border-color: #86EFAC;
    background: #BBF7D0;
}

.product-detail-coupon-alert:active {
    transform: translateY(1px);
}

.product-detail-coupon-alert-content {
    display: inline-flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
}

.product-detail-coupon-copy-action {
    display: inline-flex;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #BBF7D0;
    padding: 0 14px;
}

.product-detail-coupon-alert:hover .product-detail-coupon-copy-action {
    border-left-color: #86EFAC;
}

.product-detail-coupon-alert svg {
    color: #16A34A;
    fill: #16A34A;
    stroke: #FFFFFF;
    stroke-width: 1.8;
}

.product-detail-coupon-alert .product-detail-coupon-copy-icon {
    color: #15803D;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.product-media-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: max-content;
    max-width: calc(100% - 24px);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-50% - 4px));
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.product-sort-tab {
    position: relative;
    z-index: 1;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

#product-sort-tabs {
    position: relative;
}

.product-sort-thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    z-index: 0;
    width: 0;
    border-radius: 9999px;
    background: #F1F5F9;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
    .card:hover .product-media-actions,
    .card:focus-within .product-media-actions {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, -50%);
    }

    .card:hover .product-media-shell::after,
    .card:focus-within .product-media-shell::after {
        opacity: 1;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
}

.product-media-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    height: 36px;
    padding: 0 18px;
    border: 1px solid #C1C1C1;
    border-radius: 9999px;
    background: #FFFFFF;
    color: #0F172A;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 10px 24px -16px rgba(15, 23, 42, 0.28);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.product-media-action svg {
    flex-shrink: 0;
}

.product-media-action:hover {
    background: #2563EB;
    border-color: #2563EB;
    color: #FFFFFF;
    box-shadow: 0 8px 18px -6px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}

.product-media-action:active {
    background: #1D4ED8;
    border-color: #1D4ED8;
    box-shadow: 0 3px 8px -4px rgba(29, 78, 216, 0.5);
    transform: translateY(0);
}

.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    padding: 24px;
}

.page-loading-card {
    width: 100%;
    max-width: 28rem;
    text-align: center;
}

.page-loading-spinner {
    width: 64px;
    height: 64px;
    border: 8px solid #D1D5DB;
    border-top-color: #2563EB;
    border-radius: 9999px;
    animation: product-card-spin 1s linear infinite;
    margin: 64px auto;
}

@keyframes product-card-spin {
    to {
        transform: rotate(360deg);
    }
}

.product-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8rem;
    max-height: 2.8rem;
    font-size: 0.875rem;
    line-height: 1.4rem;
}

.product-card-title-wrap {
    position: relative;
    z-index: 30;
}

.product-card-title-tooltip {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 70;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 0.75rem;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    visibility: hidden;
}

.product-card-verified-badge {
    z-index: 45;
}

.product-card-verified-tooltip {
    z-index: 70;
}

.product-card-title-wrap:hover .product-card-title-tooltip,
.product-primary-link:focus-visible .product-card-title-tooltip {
    z-index: 90;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

@media (max-width: 1023px) {
    .product-card-layout {
        align-items: stretch !important;
        gap: 0 !important;
        padding: 0 !important;
    }

    .product-card .product-media-shell {
        align-self: stretch;
        overflow: hidden;
        border-radius: 1.5rem 0 0 1.5rem !important;
        clip-path: inset(0 round 1.5rem 0 0 1.5rem);
        padding: 0 !important;
    }

    .product-card .product-media-frame {
        position: absolute;
        inset: 0;
        min-height: 0;
    }

    .product-card .product-media-shell img {
        width: 100% !important;
        height: 100% !important;
    }

    .product-card-content {
        padding: 0.75rem !important;
    }
}

@media (min-width: 1024px) {
    .product-card .product-media-shell {
        clip-path: inset(0 round 1.5rem 1.5rem 0 0);
    }
}

@media (max-width: 639px) {
    .product-media-shell-mobile {
        min-height: 96px;
    }

    .product-card-title {
        min-height: auto;
        max-height: none;
        line-height: 1.45rem;
    }

    .product-card-title-tooltip {
        display: none;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .product-list-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .product-card > .flex {
        flex-direction: row !important;
    }

    .product-card .product-media-shell {
        width: 112px !important;
        min-height: 96px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        flex-shrink: 0 !important;
    }

    .product-card .product-media-shell > .flex {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .product-card-title {
        min-height: auto;
        max-height: none;
        line-height: 1.45rem;
    }

    .product-card-title-wrap {
        margin-top: 0 !important;
    }

    .product-card-title-tooltip {
        display: none;
    }
}
