/*
 * ProsperXLabs Smart Upsell — v2.0.0
 * Mobile-first. Matches prosperxlabs.com theme tokens.
 */

/* ── Section ──────────────────────────────────────────────────────────────── */
.pxl-upsell {
    margin: 36px 0 0;
    padding: 24px;
    background: linear-gradient(135deg, #faf7ff 0%, #f2ecff 100%);
    border: 1.5px solid var(--border, #e8dff5);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(67,45,118,.08);
    position: relative;
    overflow: hidden;
    animation: pxlIn .38s cubic-bezier(.22,1,.36,1) both;
}
.pxl-upsell::before {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(143,103,255,.14), transparent 68%);
    pointer-events: none;
}
.pxl-upsell--checkout {
    margin: 0 0 20px;
}
@keyframes pxlIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.pxl-upsell__hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.pxl-upsell__eyebrow {
    font-size: .64rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 900;
    color: var(--purple, #432D76);
    margin-bottom: 4px;
}
.pxl-upsell__title {
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: -.03em;
    color: var(--text, #120d20);
    margin: 0 0 4px;
}
.pxl-upsell__sub {
    font-size: .78rem;
    color: var(--muted, #7d7592);
    margin: 0;
}
.pxl-upsell__close {
    background: rgba(255,255,255,.7);
    border: 1px solid var(--border, #e8dff5);
    border-radius: 50%;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    cursor: pointer;
    color: var(--muted, #7d7592);
    font-size: .78rem;
    flex-shrink: 0;
    transition: all .18s;
    backdrop-filter: blur(4px);
}
.pxl-upsell__close:hover {
    background: #fff0f0;
    border-color: #e05252;
    color: #e05252;
    transform: rotate(90deg);
}

/* ── Grid — MOBILE-FIRST horizontal scroll ────────────────────────────────── */
.pxl-upsell__grid {
    display: flex;
    gap: 12px;
    /* Mobile: horizontal scroll row */
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px; /* room for scrollbar on some browsers */
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.pxl-upsell__grid::-webkit-scrollbar { display: none; }

/* Each card — fixed width on mobile so they scroll nicely */
.pxl-card {
    flex: 0 0 160px;   /* mobile card width */
    scroll-snap-align: start;
    background: #fff;
    border: 1.5px solid var(--border, #e8dff5);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(67,45,118,.07);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    animation: pxlCardIn .35s ease both;
    animation-delay: var(--delay, 0ms);
}
.pxl-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 36px rgba(67,45,118,.14);
    border-color: #c8b8e8;
}
@keyframes pxlCardIn {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* Dismiss X */
.pxl-card__x {
    position: absolute;
    top: 7px; right: 7px;
    width: 22px; height: 22px;
    background: rgba(255,255,255,.85);
    border: 1px solid var(--border, #e8dff5);
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .58rem;
    cursor: pointer;
    color: var(--muted, #7d7592);
    z-index: 2;
    opacity: 0;
    transition: opacity .15s, background .15s;
    backdrop-filter: blur(4px);
}
.pxl-card:hover .pxl-card__x { opacity: 1; }
.pxl-card__x:hover { background: #fff0f0; border-color: #e05252; color: #e05252; }

/* Image */
.pxl-card__img {
    display: grid;
    place-items: center;
    height: 120px;
    padding: 12px;
    background: #faf7ff;
    text-decoration: none;
    overflow: hidden;
}
.pxl-card__img img {
    max-height: 90px;
    max-width: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
    transition: transform .26s ease;
    display: block;
    width: auto;
    height: auto;
}
.pxl-card:hover .pxl-card__img img {
    transform: scale(1.06) translateY(-2px);
}

/* Body */
.pxl-card__body {
    padding: 10px 12px 4px;
    flex: 1;
}
.pxl-card__cat {
    font-size: .56rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 900;
    color: var(--purple, #432D76);
    margin-bottom: 3px;
}
.pxl-card__name {
    font-size: .82rem;
    font-weight: 900;
    line-height: 1.2;
    margin: 0 0 6px;
    color: var(--text, #120d20);
}
.pxl-card__name a { text-decoration: none; color: inherit; }
.pxl-card__name a:hover { color: var(--purple, #432D76); }
.pxl-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 6px;
}
.pxl-card__badges span {
    font-size: .54rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 999px;
    background: #f5f0ff;
    border: 1px solid var(--border, #e8dff5);
    color: var(--purple, #432D76);
    white-space: nowrap;
}

/* Footer */
.pxl-card__foot {
    padding: 8px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border, #e8dff5);
}
.pxl-card__price {
    font-size: 1rem;
    font-weight: 900;
    color: var(--purple, #432D76);
    line-height: 1;
}
.pxl-card__price .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* ── Add Button ──────────────────────────────────────────────────────────── */
.pxl-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 9px 10px;
    background: var(--purple, #432D76);
    color: #fff !important;
    border: 1.5px solid var(--purple, #432D76);
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .03em;
    cursor: pointer;
    transition: all .2s ease;
    text-align: center;
    line-height: 1;
}
.pxl-add-btn:hover {
    background: #fff;
    color: var(--purple, #432D76) !important;
    box-shadow: 0 8px 20px rgba(67,45,118,.18);
}
.pxl-add-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}
.pxl-add-btn.is-added {
    background: #1fa350;
    border-color: #1fa350;
}
.pxl-add-btn.is-added:hover {
    background: #fff;
    color: #1fa350 !important;
    border-color: #1fa350;
}

/* ── Desktop: switch back to grid ─────────────────────────────────────────── */
@media (min-width: 641px) {
    .pxl-upsell__grid {
        display: grid;
        overflow-x: visible;
        scroll-snap-type: none;
        padding-bottom: 0;
    }
    /* 2-col checkout, 4-col cart, collapse for count */
    .pxl-upsell--checkout .pxl-upsell__grid { grid-template-columns: repeat(3, 1fr); }
    .pxl-upsell__grid--1 { grid-template-columns: 1fr; }
    .pxl-upsell__grid--2 { grid-template-columns: repeat(2, 1fr); }
    .pxl-upsell__grid--3 { grid-template-columns: repeat(3, 1fr); }
    .pxl-upsell__grid--4 { grid-template-columns: repeat(4, 1fr); }

    .pxl-card {
        flex: none;      /* let grid control sizing */
        width: auto;
    }
    .pxl-card__img { height: 130px; }
}

@media (min-width: 641px) and (max-width: 900px) {
    /* Tablet: max 2 per row */
    .pxl-upsell__grid--3,
    .pxl-upsell__grid--4 { grid-template-columns: repeat(2, 1fr); }
    .pxl-upsell--checkout .pxl-upsell__grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.pxl-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #fff;
    border: 1.5px solid var(--border, #e8dff5);
    border-radius: 14px;
    padding: 13px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 16px 48px rgba(67,45,118,.2);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: all .3s cubic-bezier(.22,1,.36,1);
    max-width: min(360px, calc(100vw - 32px));
    width: max-content;
}
.pxl-toast.is-on {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.pxl-toast__icon {
    width: 32px; height: 32px;
    background: #f0fff4;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .9rem;
    flex-shrink: 0;
    border: 1px solid #c3f0cb;
}
.pxl-toast__msg {
    font-size: .86rem;
    font-weight: 800;
    color: var(--text, #120d20);
    line-height: 1.3;
}

/* ── Animations ───────────────────────────────────────────────────────────── */
.pxl-upsell.is-closing {
    animation: pxlOut .28s ease forwards;
}
.pxl-card.is-removing {
    animation: pxlCardOut .22s ease forwards;
}
@keyframes pxlOut {
    to { opacity: 0; transform: translateY(-10px); }
}
@keyframes pxlCardOut {
    to { opacity: 0; transform: scale(.9); }
}
