/**
 * Product page extras (delivery lines, trust badges, sticky add to cart) and the side cart.
 * Colours follow the brand colour; corners match the checkout setting when it is on the page.
 *
 * @package Medora
 */

:root {
    --rcx-accent: var(--color-primary, #0ea5b7);
    --rcx-accent-soft: color-mix(in srgb, var(--rcx-accent) 9%, #fff);
    --rcx-button: var(--color-secondary, #f18e29);
    --rcx-line: #e5e9f0;
    --rcx-text: #0f172a;
    --rcx-muted: #64748b;
    --rcx-radius: 12px;
}

/* ==========================================================================
   Product page: delivery / free shipping lines
   ========================================================================== */
.rc-pdp-lines {
    display: grid;
    gap: 8px;
    margin: 14px 0 18px;
    padding: 0;
    list-style: none;
}

.rc-pdp-lines li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.rc-pdp-lines svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    fill: var(--rcx-accent);
}

.rc-pdp-lines li.is-free {
    color: #15803d;
}

.rc-pdp-lines li.is-free svg {
    fill: #16a34a;
}

/* ==========================================================================
   Product page: trust badges under the button
   ========================================================================== */
.rc-pdp-trust {
    display: grid;
    grid-template-columns: repeat(var(--rcx-cols, 3), minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 6px;
    padding: 0;
    list-style: none;
}

.rc-pdp-trust-1 { --rcx-cols: 1; }
.rc-pdp-trust-2 { --rcx-cols: 2; }
.rc-pdp-trust-3 { --rcx-cols: 3; }
.rc-pdp-trust-4 { --rcx-cols: 4; }

.rc-pdp-trust li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 12px 8px;
    border: 1px solid var(--rcx-line);
    border-radius: var(--rcx-radius);
    background: #fff;
    text-align: center;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.4;
    color: #334155;
}

.rc-pdp-trust svg {
    width: 24px;
    height: 24px;
    fill: var(--rcx-accent);
}

@media (max-width: 600px) {
    .rc-pdp-trust-4 { --rcx-cols: 2; }
}

/* The add to cart form flashes when the sticky bar asks the customer to pick an option first */
form.cart.rc-attention {
    animation: rcx-attention 1.6s ease;
    border-radius: var(--rcx-radius);
}

@keyframes rcx-attention {
    0%, 100% { box-shadow: 0 0 0 0 transparent; }
    20%, 60% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--rcx-accent) 35%, transparent); }
}

/* ==========================================================================
   Sticky add to cart bar
   ========================================================================== */
.rc-sticky-atc {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 990;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--rcx-line);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(110%);
    transition: transform 0.25s ease;
}

.rc-sticky-atc[hidden] {
    display: none;
}

.rc-sticky-atc.is-visible {
    transform: translateY(0);
}

.rc-sticky-atc__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.rc-sticky-atc__img {
    flex: 0 0 44px;
    width: 44px !important;
    height: 44px !important;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--rcx-line);
    background: #fff;
}

.rc-sticky-atc__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rc-sticky-atc__name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 700;
    color: var(--rcx-text);
}

.rc-sticky-atc__price {
    font-size: 14px;
    font-weight: 800;
    color: var(--rcx-text);
}

.rc-sticky-atc__price del {
    font-size: 12px;
    font-weight: 500;
    color: var(--rcx-muted);
}

.rc-sticky-atc__price .rc-saving-break,
.rc-sticky-atc__price .rc-saving,
.rc-sticky-atc__price [class*="saving"] {
    display: none !important;
}

.rc-sticky-atc__btn {
    flex: 0 0 auto;
    height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: var(--rcx-button);
    color: #fff;
    font-size: 14.5px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

/* Phones only, unless the desktop option is on */
@media (min-width: 992px) {
    .rc-sticky-atc:not(.rc-sticky-desktop) {
        display: none !important;
    }
}

/* Room so the bar does not cover the end of the page */
body.rc-sticky-atc-on {
    padding-bottom: 76px;
}

@media (min-width: 992px) {
    body.rc-sticky-atc-on:not(:has(.rc-sticky-desktop)) {
        padding-bottom: 0;
    }
}

/* ==========================================================================
   Side cart
   ========================================================================== */
html.rc-side-cart-open {
    overflow: hidden;
}

.rc-side-cart {
    position: fixed;
    inset: 0;
    z-index: 100000;
    visibility: hidden;
    pointer-events: none;
}

.rc-side-cart.is-open {
    visibility: visible;
    pointer-events: auto;
}

.rc-side-cart__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.rc-side-cart.is-open .rc-side-cart__overlay {
    opacity: 1;
}

/* RTL: the panel slides in from the left edge (the end side of the page). */
.rc-side-cart__panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: min(420px, 92vw);
    background: #f5f7fa;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
    transform: translateX(-102%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.rc-side-cart.is-open .rc-side-cart__panel {
    transform: translateX(0);
}

.rc-side-cart__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    background: #fff;
    border-bottom: 1px solid var(--rcx-line);
}

.rc-side-cart__head strong {
    font-size: 17px;
    font-weight: 800;
    color: var(--rcx-text);
}

.rc-side-cart__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--rcx-text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.rc-side-cart__close:hover {
    background: #e2e8f0;
}

.rc-side-cart__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 18px;
    overflow-y: auto;
}

.rc-side-cart__body .rc-free-shipping {
    margin: 0;
    border-radius: var(--rcx-radius);
}

.rc-side-cart__body .widget_shopping_cart_content,
.rc-side-cart__body > .woocommerce-mini-cart,
.rc-side-cart__body > p {
    margin: 0;
}

/* Items */
.rc-side-cart .woocommerce-mini-cart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rc-side-cart .woocommerce-mini-cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 4px 12px;
    align-items: center;
    margin: 0;
    padding: 12px 12px 12px 40px;
    background: #fff;
    border: 1px solid var(--rcx-line);
    border-radius: var(--rcx-radius);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.5;
}

.rc-side-cart .woocommerce-mini-cart-item > a:not(.remove) {
    display: contents;
    color: var(--rcx-text);
}

.rc-side-cart .woocommerce-mini-cart-item img {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 60px !important;
    height: 60px !important;
    margin: 0 !important;
    float: none !important;
    object-fit: contain;
    border: 1px solid var(--rcx-line);
    border-radius: 8px;
    background: #fff;
}

.rc-side-cart .woocommerce-mini-cart-item .quantity {
    grid-column: 2;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--rcx-muted);
}

.rc-side-cart .woocommerce-mini-cart-item .quantity .amount {
    color: var(--rcx-text);
    font-weight: 800;
}

.rc-side-cart .woocommerce-mini-cart-item .variation {
    grid-column: 2;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--rcx-muted);
}

.rc-side-cart .woocommerce-mini-cart-item .variation dt,
.rc-side-cart .woocommerce-mini-cart-item .variation dd,
.rc-side-cart .woocommerce-mini-cart-item .variation p {
    display: inline;
    margin: 0;
}

.rc-side-cart .woocommerce-mini-cart-item a.remove {
    position: absolute;
    top: 10px;
    left: 10px;
    display: grid !important;
    place-items: center;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    font-size: 17px !important;
    line-height: 1 !important;
    text-decoration: none;
}

.rc-side-cart .woocommerce-mini-cart-item a.remove:hover {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

/* Total + buttons */
.rc-side-cart .woocommerce-mini-cart__total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--rcx-line);
    border-radius: var(--rcx-radius);
    font-size: 15px;
    color: var(--rcx-text);
}

.rc-side-cart .woocommerce-mini-cart__total strong {
    font-weight: 700;
    color: var(--rcx-muted);
}

.rc-side-cart .woocommerce-mini-cart__total .amount {
    font-size: 19px;
    font-weight: 800;
    color: var(--rcx-accent);
}

.rc-side-cart .woocommerce-mini-cart__buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
}

.rc-side-cart .woocommerce-mini-cart__buttons .button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 48px;
    margin: 0 !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    border: 1px solid var(--rcx-line) !important;
    background: #fff !important;
    color: var(--rcx-text) !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    text-align: center;
}

.rc-side-cart .woocommerce-mini-cart__buttons .button.checkout {
    border-color: var(--rcx-button) !important;
    background: var(--rcx-button) !important;
    color: #fff !important;
}

.rc-side-cart .woocommerce-mini-cart__empty-message {
    margin: 30px 0 0;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--rcx-muted);
}

.rc-side-cart .rc-co-trust {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
    text-align: center;
    font-size: 12px;
    color: var(--rcx-muted);
}

.rc-side-cart .rc-co-trust li {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.rc-side-cart .rc-co-trust svg {
    width: 13px;
    height: 13px;
    fill: #16a34a;
}

/* Loading while WooCommerce updates the cart */
.rc-side-cart .blockUI.blockOverlay {
    border-radius: var(--rcx-radius);
}

/* Quick add from product cards: the side cart opens, so WooCommerce's extra "View cart" link is not needed. */
.product-card-actions a.added_to_cart,
.product-card .added_to_cart.wc-forward {
    display: none !important;
}

.product-card-actions .add-to-cart-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}
