/* ==========================================================================
   CART (shared by every page - rendered by cart.js)
   Load after styles.css and responsive-style.css.
   ========================================================================== */

:root {
    --rbs-ink: #111111;
    --rbs-muted: #6b6b6b;
    --rbs-line: #e7e7e7;
    --rbs-soft: #f6f6f4;
    --rbs-orange: #FB8B08;
    --rbs-yellow: #FFCD1D;
    --rbs-mint: #C7E4CC;
    --rbs-gradient: linear-gradient(270deg, #C7E4CC 14.58%, #FFCD1D 54.69%, #FB8B08 100%);
}

html.cart-lock,
html.cart-lock body {
    overflow: hidden;
}

/* Drawer: full height panel instead of the old drop-down */
.cart-sidebar {
    width: 410px;
    right: -440px;
    height: 100% !important;
    padding: 0 !important;
    border-radius: 24px 0 0 24px !important;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transition: right .45s cubic-bezier(.22, 1, .36, 1);
}

.cart-sidebar.cart-open {
    right: 0;
}

.cart-close {
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--rbs-soft);
    font-size: 1.6rem !important;
    line-height: 1;
    z-index: 2;
    transition: background .2s, transform .2s;
}

.cart-close:hover {
    background: #ececec;
    transform: rotate(90deg);
}

.cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, .35);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s;
    z-index: 9999;
}

.cart-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.cart-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.cart-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 26px 76px 18px 28px;
    border-bottom: 1px solid var(--rbs-line);
}

.cart-head h4 {
    margin: 0;
    font-size: 1.5rem;
}

.cart-count-pill {
    font-size: .8rem;
    padding: 4px 10px;
    border-radius: 99px;
    background: var(--rbs-ink);
    color: #fff;
    white-space: nowrap;
}

.cart-perk {
    margin: 16px 28px 4px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(199, 228, 204, .55), rgba(255, 205, 29, .25));
    font-size: .9rem;
}

.cart-perk i {
    margin-right: 6px;
}

.cart-lines {
    flex: 1;
    overflow-y: auto;
    padding: 8px 28px;
}

.cart-line {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rbs-line);
    animation: cartLineIn .35s ease both;
    transition: opacity .25s, transform .25s;
}

.cart-line.leaving {
    opacity: 0;
    transform: translateX(40px);
}

@keyframes cartLineIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.cart-line-img {
    flex: 0 0 76px;
    height: 76px;
    border-radius: 14px;
    background: var(--rbs-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.cart-line-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-line-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.cart-line-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.cart-line-top h6 {
    margin: 0 0 2px;
    font-size: 1rem;
}

.cart-line-top small {
    color: var(--rbs-muted);
}

.cart-line-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-icon-btn {
    border: 0;
    background: none;
    color: var(--rbs-muted);
    padding: 2px 6px;
    height: fit-content;
    border-radius: 8px;
    transition: color .2s, background .2s;
}

.cart-icon-btn:hover {
    color: #c0392b;
    background: #fbeaea;
}

.cart-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--rbs-line);
    border-radius: 99px;
    overflow: hidden;
    background: #fff;
}

.cart-stepper button {
    border: 0;
    background: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rbs-ink);
    transition: background .2s;
}

.cart-stepper button:hover:not(:disabled) {
    background: var(--rbs-soft);
}

.cart-stepper button:disabled {
    opacity: .3;
}

.cart-stepper span {
    min-width: 26px;
    text-align: center;
    font-weight: 600;
}

.cart-foot {
    padding: 20px 28px 26px;
    border-top: 1px solid var(--rbs-line);
    background: #fff;
    border-radius: 0 0 0 24px;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--rbs-muted);
}

.cart-save {
    color: #1e8e3e;
}

.cart-free {
    font-weight: 700;
    color: #1e8e3e;
    letter-spacing: 1px;
}

.cart-total {
    color: var(--rbs-ink);
    font-size: 1.3rem;
    font-weight: 700;
    padding-top: 12px;
    margin: 12px 0 18px;
    border-top: 1px dashed var(--rbs-line);
}

.cart-cta {
    border-radius: 99px;
    padding: 14px 22px;
    font-weight: 600;
    letter-spacing: .5px;
    position: relative;
    overflow: hidden;
}

.cart-cta::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
    transform: skewX(-20deg);
    transition: left .6s;
    pointer-events: none;
}

.cart-cta:hover::after {
    left: 120%;
}

.cart-assure {
    margin: 12px 0 0;
    text-align: center;
    font-size: .82rem;
    color: var(--rbs-muted);
}

.cart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 36px;
}

.cart-empty-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--rbs-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    margin-bottom: 20px;
    box-shadow: 0 18px 40px rgba(251, 139, 8, .25);
}

.cart-empty p {
    color: var(--rbs-muted);
    margin-bottom: 24px;
}

/* Badge on the cart icon */
#cart-toggle.has-badge,
[data-cart-open].has-badge {
    position: relative;
    display: inline-flex;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -9px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 99px;
    background: var(--rbs-orange);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    transform: scale(0);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
    pointer-events: none;
}

.cart-badge.show {
    transform: scale(1);
}

.cart-badge.show.bump {
    animation: badgeBump .5s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes badgeBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.6); }
    100% { transform: scale(1); }
}

/* Toasts */
.rbs-toasts {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.rbs-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    border-radius: 16px;
    background: var(--rbs-ink);
    color: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
    opacity: 0;
    transform: translateY(20px) scale(.96);
    transition: opacity .3s, transform .35s cubic-bezier(.22, 1, .36, 1);
    pointer-events: auto;
}

.rbs-toast.show {
    opacity: 1;
    transform: none;
}

.rbs-toast > i {
    font-size: 1.2rem;
    color: var(--rbs-yellow);
}

.rbs-toast.success > i {
    color: var(--rbs-mint);
}

.rbs-toast button {
    border: 0;
    border-radius: 99px;
    padding: 6px 14px;
    background: #fff;
    color: var(--rbs-ink);
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
}

/* Checkout confirmation */
.rbs-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(17, 17, 17, .45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .3s;
}

.rbs-modal.show {
    opacity: 1;
}

.rbs-modal-card {
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #fff;
    border-radius: 28px;
    padding: 36px 32px 26px;
    text-align: center;
    transform: translateY(30px) scale(.95);
    transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}

.rbs-modal.show .rbs-modal-card {
    transform: none;
}

.rbs-modal-check {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--rbs-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    animation: popIn .6s .15s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.rbs-modal-sub {
    color: var(--rbs-muted);
}

.rbs-modal-order {
    text-align: left;
    background: var(--rbs-soft);
    border-radius: 18px;
    padding: 18px;
    margin: 20px 0;
}

.rbs-modal-meta,
.rbs-modal-order li,
.rbs-modal-total {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.rbs-modal-meta {
    margin-bottom: 6px;
    color: var(--rbs-muted);
}

.rbs-modal-meta strong {
    color: var(--rbs-ink);
}

.rbs-modal-order ul {
    list-style: none;
    padding: 12px 0;
    margin: 10px 0;
    border-top: 1px dashed #d8d8d8;
    border-bottom: 1px dashed #d8d8d8;
}

.rbs-modal-order li {
    margin: 4px 0;
}

.rbs-modal-total {
    font-size: 1.1rem;
}

.rbs-modal-note {
    margin: 12px 0 0;
    font-size: .8rem;
    color: var(--rbs-muted);
}

.rbs-confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10003;
}

/* Phones: drawer never wider than the screen */
@media screen and (max-width: 767.98px) {
    .cart-sidebar {
        width: 92vw;
        right: -100vw;
    }

    .cart-head,
    .cart-foot {
        padding-left: 20px;
        padding-right: 20px;
    }

    .cart-head {
        padding-right: 72px;
    }

    .cart-lines {
        padding: 8px 20px;
    }

    .cart-perk {
        margin-left: 20px;
        margin-right: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-sidebar,
    .cart-line,
    .rbs-toast,
    .rbs-modal-card,
    .cart-badge {
        transition: none;
        animation: none;
    }
}
