/**
 * RAD Tech Week side cart changes (see includes/xoo-wsc-rtw.php)
 */

/*
 * Upsell block layout
 * Every layout rule is !important and starts with .xoo-wsc-container, so theme, page builder
 * and other plugin CSS can't stack the cards or squeeze the block. Colours and sizes follow below.
 */

/* The cart item row wraps, so the block gets its own full-width line under the course */
.xoo-wsc-container .xoo-wsc-product.xoo-wsc-has-rtw {
    flex-wrap: wrap !important;
}

.xoo-wsc-container .xoo-wsc-product.xoo-wsc-has-rtw > .xoo-wsc-sum-col {
    flex: 1 1 0% !important; /* keeps image and details on one line now that the row can wrap */
    min-width: 0 !important;
}

.xoo-wsc-container .xoo-wsc-product > .xoo-wsc-rtw {
    display: block !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 12px 0 4px !important;
    float: none !important;
    clear: both !important;
}

/* Without assets/js/xoo-wsc-rtw.js the Upgrade buttons can't work, so the block stays hidden */
html:not(.xoo-wsc-rtw-js) .xoo-wsc-container .xoo-wsc-rtw {
    display: none !important;
}

/* Two equal columns at every screen width (no mobile breakpoint), one column when only Unlimited is offered */
.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-cards {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-cards.xoo-wsc-rtw-cards-one {
    grid-template-columns: minmax(0, 1fr) !important;
}

/* Equal height cards: content on top, Upgrade button at the bottom */
.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-card {
    display: flex !important;
    flex-direction: column !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    float: none !important;
    grid-column: auto !important;
    grid-row: auto !important;
}

.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-card-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 12px !important; /* space above the Upgrade button */
}

.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-card-body > * {
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Tags wrap inside the card on narrow screens instead of widening it */
.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-tags {
    display: flex !important;
    flex-wrap: wrap !important;
}

.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-tag {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

/* Sale price and crossed-out regular price share a line, and wrap when the card is narrow */
.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-price {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
}

/* Upsell block look */
.xoo-wsc-rtw-card {
    padding: 12px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    color: #000;
    text-align: left;
}

.xoo-wsc-rtw-card-body {
    gap: 6px;
}

.xoo-wsc-rtw-tags {
    gap: 4px;
}

.xoo-wsc-rtw-tag {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.xoo-wsc-rtw-tag-sale {
    color: #B4232A;
    background-color: #FDECEC;
}

.xoo-wsc-rtw-tag-popular {
    color: #fff;
    background-color: #000;
}

.xoo-wsc-rtw-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.xoo-wsc-rtw-price {
    gap: 2px 6px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.xoo-wsc-rtw-price del {
    display: inline;
    opacity: 1;
    color: #757575;
    font-size: 13px;
    font-weight: 400;
}

.xoo-wsc-body .xoo-wsc-rtw span.amount {
    font-size: inherit;
    color: inherit;
}

.xoo-wsc-rtw-saving {
    color: #B4232A;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

/* Upgrade buttons: full card width, pinned to the bottom of the card so both line up */
.xoo-wsc-container .xoo-wsc-rtw .xoo-wsc-rtw-btn {
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 44px !important;
    margin: auto 0 0 !important;
    float: none !important;
}

/* Upgrade buttons: outlined, so Checkout stays the only solid black button */
.xoo-wsc-rtw .xoo-wsc-rtw-btn {
    padding: 0 12px;
    background-color: #fff;
    color: #000;
    border: 1px solid #000;
    border-radius: 12px;
    box-shadow: none;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
}

.xoo-wsc-rtw .xoo-wsc-rtw-btn:hover,
.xoo-wsc-rtw .xoo-wsc-rtw-btn:focus {
    background-color: #f2f2f2;
    color: #000;
}

.xoo-wsc-rtw .xoo-wsc-rtw-btn:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.xoo-wsc-rtw .xoo-wsc-rtw-btn:disabled {
    background-color: #fff;
    opacity: 0.5;
    cursor: default;
}

.xoo-wsc-rtw .xoo-wsc-rtw-btn.xoo-wsc-rtw-loading {
    opacity: 1;
}

.xoo-wsc-rtw-spinner {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: xoo-wsc-rtw-spin 0.7s linear infinite;
}

@keyframes xoo-wsc-rtw-spin {
    to {
        transform: rotate(360deg);
    }
}

.xoo-wsc-rtw-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Collapsible promo code (templates/global/coupon-form.php) */
.xoo-wsc-rtw-promo-toggle,
.xoo-wsc-rtw-promo-toggle:hover,
.xoo-wsc-rtw-promo-toggle:focus {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 8px 0;
    background: none !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    cursor: pointer;
}

/* Without the script the form stays open and the toggle is not needed */
html:not(.xoo-wsc-rtw-js) .xoo-wsc-rtw-promo-toggle {
    display: none;
}

.xoo-wsc-rtw-promo-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.xoo-wsc-rtw-chevron {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin: -3px 2px 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s;
}

.xoo-wsc-rtw-promo-toggle[aria-expanded="true"] .xoo-wsc-rtw-chevron {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.xoo-wsc-rtw-promo-panel[hidden] {
    display: none !important;
}
