/**
 * IJW Pack Up — drawer styling.
 * Colours come from CSS variables set inline (see Frontend::inline_css()).
 */

.ijw-pu {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

.ijw-pu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.ijw-pu.is-open .ijw-pu__backdrop {
    opacity: 1;
}

.ijw-pu__panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    background: #fff;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.22);
    padding: 0 20px 16px;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ijw-pu.is-open .ijw-pu__panel {
    transform: translateY(0);
}

.ijw-pu__grip {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: #d9d9d9;
    margin: 10px auto 6px;
}

/* Header ------------------------------------------------------------- */

.ijw-pu__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0 14px;
    border-bottom: 1px solid #eee;
}

.ijw-pu__tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ijw-pu-accent, #d6006e);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    flex: 0 0 auto;
}

.ijw-pu__added {
    font-size: 19px;
    font-weight: 700;
    color: #111;
    flex: 1 1 auto;
}

.ijw-pu__close {
    flex: 0 0 auto;
    position: relative;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f1f1;
    color: #333;
    font-size: 0; /* hide the × glyph; the cross is drawn below */
    cursor: pointer;
    transition: background 0.15s ease;
}

/* Font-independent cross — always dead-centre */
.ijw-pu__close::before,
.ijw-pu__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.ijw-pu__close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.ijw-pu__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.ijw-pu__close:hover {
    background: #e5e5e5;
}

/* Intro -------------------------------------------------------------- */

.ijw-pu__intro {
    padding: 18px 0 6px;
}

.ijw-pu__title {
    margin: 0 0 6px;
    font-size: 30px;
    line-height: 1.12;
    font-weight: 800;
    color: #111;
}

.ijw-pu__sub {
    margin: 0;
    font-size: 16px;
    color: #777;
}

/* Offer banner ------------------------------------------------------- */

.ijw-pu__offer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 4px;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--ijw-pu-badge-bg, #fce4ef);
    color: var(--ijw-pu-badge-tx, #d6006e);
    font-size: 17px;
    font-weight: 600;
}

.ijw-pu__tag {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    background: currentColor;
    -webkit-mask: no-repeat center / contain;
    mask: no-repeat center / contain;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E");
}

/* Cards -------------------------------------------------------------- */

.ijw-pu__body {
    position: relative;
    padding: 16px 0 4px;
}

.ijw-pu-cards {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox — arrows replace the scrollbar */
}

.ijw-pu-cards::-webkit-scrollbar {
    display: none; /* WebKit */
}

/* Slider arrows */
.ijw-pu__nav {
    position: absolute;
    top: calc(50% - 8px);
    transform: translateY(-50%);
    z-index: 3;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #222;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    opacity: 1;
    transition: opacity 0.15s ease;
}

.ijw-pu__nav--prev {
    left: -4px;
}

.ijw-pu__nav--next {
    right: -4px;
}

.ijw-pu__nav:hover {
    color: var(--ijw-pu-accent, #d6006e);
}

/* Hidden unless the strip overflows; faded + non-interactive at the ends. */
.ijw-pu__nav {
    display: none;
}

.ijw-pu__body.has-overflow .ijw-pu__nav {
    display: flex;
}

.ijw-pu__body.has-overflow .ijw-pu__nav.is-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.ijw-pu-card {
    flex: 0 0 47%;
    max-width: 240px;
    min-width: 160px;
    scroll-snap-align: start;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.ijw-pu-card.has-coupon {
    border-color: var(--ijw-pu-accent, #d6006e);
    box-shadow: 0 0 0 1px var(--ijw-pu-accent, #d6006e) inset;
}

/* Out-of-stock card (only shown when "Hide out-of-stock items" is off) */
.ijw-pu-card--oos {
    opacity: 0.7;
}

.ijw-pu-card--oos .ijw-pu-card__media {
    filter: grayscale(0.7);
}

.ijw-pu-card__oos-flag {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    background: #555;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 20px;
}

.ijw-pu-card--oos .ijw-pu-card__add {
    background: #eee;
    border-color: #ddd;
    color: #999;
    cursor: not-allowed;
}

.ijw-pu-card--oos .ijw-pu-card__add:hover {
    background: #eee;
    color: #999;
}

/* Gamified coupon ribbon, sits above the image */
.ijw-pu-card__coupon {
    display: block;
    text-align: center;
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    background: linear-gradient(90deg, var(--ijw-pu-accent, #d6006e), color-mix(in srgb, var(--ijw-pu-accent, #d6006e) 60%, #ff8a00));
    box-shadow: 0 2px 6px color-mix(in srgb, var(--ijw-pu-accent, #d6006e) 35%, transparent);
}

.ijw-pu-card__media {
    position: relative;
    background: #fafafa;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ijw-pu-card__media img,
.ijw-pu-card__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ijw-pu-card__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--ijw-pu-accent, #d6006e);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 1;
}

.ijw-pu-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding-top: 10px;
}

.ijw-pu-card__title {
    font-size: 15px;
    line-height: 1.3;
    color: #222;
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    flex: 1 1 auto;
}

.ijw-pu-card__title:hover {
    text-decoration: underline;
}

.ijw-pu-card__price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.ijw-pu-card__was {
    color: #9a9a9a;
    text-decoration: line-through;
    font-size: 14px;
}

.ijw-pu-card__now {
    color: var(--ijw-pu-accent, #d6006e);
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
}

.ijw-pu-card__add {
    position: relative;
    width: 100%;
    border: 1.5px solid var(--ijw-pu-accent, #d6006e);
    background: #fff;
    color: var(--ijw-pu-accent, #d6006e);
    font-weight: 700;
    font-size: 15px;
    padding: 10px 8px;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

/* In-flight loader — the theme's chasing-ring spinner, in the button's own
   (accent) colour via currentColor so it reads on the white card button. */
.ijw-pu-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
}

.ijw-pu-spinner span {
    box-sizing: border-box;
    position: absolute;
    display: block;
    width: 16px;
    height: 16px;
    margin: 2px;
    border: 2px solid currentColor;
    border-color: currentColor transparent transparent transparent;
    border-radius: 50%;
    animation: ijw-pu-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.ijw-pu-spinner span:nth-child(1) { animation-delay: -0.45s; }
.ijw-pu-spinner span:nth-child(2) { animation-delay: -0.3s; }
.ijw-pu-spinner span:nth-child(3) { animation-delay: -0.15s; }

@keyframes ijw-pu-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ijw-pu-spinner span { animation-duration: 2.4s; }
}

.ijw-pu-card__add:hover {
    background: var(--ijw-pu-accent, #d6006e);
    color: #fff;
}

.ijw-pu-card.is-adding .ijw-pu-card__add {
    opacity: 0.6;
    pointer-events: none;
}

.ijw-pu-card.is-added .ijw-pu-card__add {
    background: var(--ijw-pu-accent, #d6006e);
    color: #fff;
    border-color: var(--ijw-pu-accent, #d6006e);
    cursor: default;
}

.ijw-pu-card.is-added .ijw-pu-card__add-label::before {
    content: "\2713\00a0";
}

.ijw-pu-card__reward {
    display: block;
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--ijw-pu-accent, #d6006e);
}

/* CTA + footer ------------------------------------------------------- */

.ijw-pu__foot {
    margin-top: 16px;
    display: flex;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 14px;
}

.ijw-pu__foot-link {
    flex: 1 1 0;
    text-align: center;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
}

.ijw-pu__foot-link:first-child {
    border-right: 1px solid #eee;
}

.ijw-pu__foot-link:hover {
    color: var(--ijw-pu-accent, #d6006e);
}

@media (min-width: 600px) {
    .ijw-pu-card {
        flex-basis: 31%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ijw-pu__panel,
    .ijw-pu__backdrop {
        transition: none;
    }
}

/* While the drawer is open, get the Tawk.to live-chat bubble out of the way.
   Tawk_API.hideWidget() handles this when the script is ready; this is the
   fallback for the window before it loads (and covers its various wrappers). */
body.ijw-pu-open #tawkchat-container,
body.ijw-pu-open .tawk-min-container,
body.ijw-pu-open iframe[title="chat widget"],
body.ijw-pu-open iframe[title="chat"] {
    display: none !important;
}

/* Cart / mini-cart price: struck baseline + discounted price on Pack Up lines */
.ijw-pu-cart-was {
    color: #9a9a9a;
    font-weight: 400;
    margin-right: 4px;
}

.ijw-pu-cart-now {
    text-decoration: none;
    font-weight: 700;
    color: var(--ijw-pu-accent, #d6006e);
}

/* Cart / mini-cart promo tag on Pack Up extras */
.ijw-pu-cart-tags {
    display: block;
    margin-top: 6px;
}

.ijw-pu-cart-badge {
    display: inline-block;
    background: var(--ijw-pu-badge-bg, #fce4ef);
    color: var(--ijw-pu-badge-tx, #d6006e);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 20px;
    line-height: 1.6;
}

.ijw-pu-cart-note {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #777;
    font-style: italic;
}
