/* Base: mobile first (very narrow) */
/* ==========================================================
   MINI-CART OFFCANVAS
   All selectors are scoped to #cartOffcanvas so these styles
   do not affect the separate mobile-menu offcanvas.
   ========================================================== */


/* ---------- OFFCANVAS WIDTH / HEIGHT ---------- */

#cartOffcanvas {
    font-size: 15px;
    line-height: 1.5;

    --bg-yellow: hsl(50, 100%, 97%);

    /*
     * Height is locked by JS when the offcanvas opens.
     * 100vh is only the fallback before JS sets --ns-cart-height.
     */
    height: var(--ns-cart-height, 100vh);
    max-height: var(--ns-cart-height, 100vh);

    top: 0;
    bottom: auto;
    margin: 0;

    display: flex;
    flex-direction: column;

    background-color: #fff;

    overflow-x: hidden;
    max-width: 100%;
}


/* ---------- OFFCANVAS BODY ---------- */

#cartOffcanvas #cartOffcanvasBody {
    padding: 0;

    flex: 1 1 auto;
    min-height: 0;

    overflow: hidden;
    overflow-x: hidden;

    display: flex;
    flex-direction: column;

    background-color: #fff;
    max-width: 100%;
}


/* ---------- MAIN CART CONTENT ---------- */

#cartOffcanvas #cartOffcanvasContent {
    flex: 1 1 auto;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow-x: hidden;

    background-color: #fff;
    max-width: 100%;
}


/* ---------- SCROLLABLE PRODUCT AREA ---------- */

#cartOffcanvas .ns-mini-cart-products {
    flex: 1 1 auto;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;
    scrollbar-width: thin;

    max-width: 100%;
}


/* ---------- SCROLL INDICATOR ---------- */

#cartOffcanvas .ns-mini-cart-products.has-scroll-bottom::after {
    content: "";

    position: sticky;
    display: block;

    left: 50%;
    bottom: 8px;

    width: 15px;
    height: 15px;

    border-right: 3px solid rgba(0, 0, 0, 0.45);
    border-bottom: 3px solid rgba(0, 0, 0, 0.45);

    margin-top: -20px;
    margin-bottom: 8px;

    pointer-events: none;
    z-index: 2;

    animation: miniCartChevronBounce 1.6s ease-in-out infinite;
}

@keyframes miniCartChevronBounce {
    0%,
    100% {
        transform: translateX(-50%) translateY(0) rotate(45deg);
    }

    50% {
        transform: translateX(-50%) translateY(4px) rotate(45deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    #cartOffcanvas .ns-mini-cart-products.has-scroll-bottom::after {
        animation: none;
        transform: translateX(-50%) rotate(45deg);
    }
}


/* ---------- PRODUCT ROWS ---------- */

#cartOffcanvas .ns-mini-cart-row {
    padding: 0.5rem 0;
}

#cartOffcanvas .ns-mini-cart-name {
    font-size: 1.1rem;
    margin-top: -6px;
}

#cartOffcanvas .ns-mini-cart-line-total {
    font-size: 0.95rem;
    color: #13a1f4;
}

#cartOffcanvas .ns-mini-cart-muted-note {
    font-size: 0.8rem;
    margin-left: 0.25rem;
    color: #13a1f4;
}


/* ---------- PRODUCT IMAGE ---------- */

#cartOffcanvas .ns-mini-cart-image {
    border-radius: 0.25rem;
}


/* ---------- PRODUCT INFO FOOTER ---------- */

#cartOffcanvas .ns-mini-cart-row-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 0.75rem;
    margin-top: 0.5rem;

    min-width: 0;
}


/* ---------- DELETE LINK ---------- */

#cartOffcanvas .ns-mini-cart-delete-btn {
    flex: 1 1 auto;
    min-width: 0;

    color: #6c757d !important;
    opacity: 1;

    transition: color 0.15s ease;
}

#cartOffcanvas .ns-mini-cart-delete-btn:hover,
#cartOffcanvas .ns-mini-cart-delete-btn:focus {
    color: #495057 !important;
}


/* ---------- QUANTITY CONTROL ---------- */

#cartOffcanvas .ns-mini-cart-qty-control {
    display: inline-flex;
    align-items: center;

    gap: 6px;

    flex: 0 0 auto;
    min-width: 0;

    height: 32px;
}


/* Minus / plus buttons */
#cartOffcanvas .ns-mini-cart-qty-btn {
    position: relative;

    flex: 0 0 32px;

    width: 32px;
    height: 32px;

    min-width: 32px;
    min-height: 32px;

    display: block;

    padding: 0;
    margin: 0;

    border: 0;
    border-radius: 50%;

    background: #d9dee3;
    color: transparent;

    font-size: 0;
    line-height: 0;

    cursor: pointer;

    -webkit-user-select: none;
    user-select: none;

    touch-action: manipulation;

    -webkit-appearance: none;
    appearance: none;

    overflow: hidden;

    transition:
        background-color 0.15s ease,
        transform 0.05s ease;
}


/* Horizontal stroke shared by both + and - */
#cartOffcanvas .ns-mini-cart-qty-btn::before {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 10px;
    height: 1.5px;

    border-radius: 2px;

    background: #495057;

    transform: translate(-50%, -50%);

    pointer-events: none;
}


/* Vertical stroke only for + */
#cartOffcanvas .ns-mini-cart-qty-plus::after {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 1.5px;
    height: 10px;

    border-radius: 2px;

    background: #495057;

    transform: translate(-50%, -50%);

    pointer-events: none;
}


#cartOffcanvas .ns-mini-cart-qty-btn:hover,
#cartOffcanvas .ns-mini-cart-qty-btn:focus-visible {
    background: #c9cfd5;
    outline: none;
}

#cartOffcanvas .ns-mini-cart-qty-btn:active {
    transform: scale(0.96);
}


/* Quantity input */
#cartOffcanvas .ns-mini-cart-qty-input {
    flex: 0 0 52px;

    width: 52px;
    min-width: 52px;

    height: 32px;
    min-height: 32px;

    margin: 0;
    padding: 0 0.35rem;

    border: 1px solid #d6dce2;
    border-radius: 16px !important;

    background: #fff;
    color: #212529;

    /*
     * Explicit 16px avoids iPhone/WebKit zooming the page
     * when the quantity input receives focus.
     */
    font-size: 16px;
    font-weight: 400;
    line-height: normal;

    text-align: center;

    box-shadow: none;

    -moz-appearance: textfield;
    appearance: textfield;

    vertical-align: top;
}

#cartOffcanvas .ns-mini-cart-qty-input:focus {
    border-color: #adb5bd;

    outline: none;

    box-shadow: none;
}


/* Hide native number spinners so all browsers use our own +/- controls */
#cartOffcanvas .ns-mini-cart-qty-input::-webkit-outer-spin-button,
#cartOffcanvas .ns-mini-cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


/* ---------- OFFCANVAS HEADER ---------- */

#cartOffcanvas .offcanvas-header {
    border: none;

    flex: 0 0 auto;

    background-color: #fff;
}

#cartOffcanvas .offcanvas-header .offcanvas-title {
    flex: 1;

    font-size: 1.75rem;
    font-weight: 400;

    padding-top: 1rem;
    padding-bottom: 1rem;

    color: rgba(0, 0, 0, 0.5);
}

#cartOffcanvas .offcanvas-header .btn-close {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cline x1='7' y1='7' x2='17' y2='17' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='17' y1='7' x2='7' y2='17' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");

    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px 20px;

    align-self: center;
}


/* ---------- TOTALS BLOCK ---------- */

#cartOffcanvas .ns-mini-cart-totals {
    flex: 0 0 auto;

    padding-top: 0.8rem;
    margin-top: 0;

    font-size: 0.95rem;

    background-color: var(--bg-yellow);
}

#cartOffcanvas .ns-mini-cart-totals .tLabel {
    flex: 1;
}

#cartOffcanvas .ns-mini-cart-totals div:last-of-type {
    border-top:
        var(--bs-border-width)
        var(--bs-border-style)
        var(--bs-border-color)
        !important;

    font-size: 1.2rem;

    margin-top: 1rem;
    padding-top: 0.5rem;
}

#cartOffcanvas .ns-mini-cart-total-row {
    margin-bottom: 0.35rem;
}

#cartOffcanvas .ns-mini-cart-total-row--grand {
    margin-top: 0.25rem;
    font-size: 1rem;
}


/* ---------- ACTIONS (CHECKOUT + CONTINUE) ---------- */

#cartOffcanvas .ns-mini-cart-actions {
    flex: 0 0 auto;

    margin-top: 0;

    background-color: #fff;
}


/* ---------- CHECKOUT BUTTON ---------- */

#cartOffcanvas .ns-mini-cart-checkout-btn {
    width: 100%;

    padding: 0.6rem 0;

    background: #e9632a;
    border-color: #e9632a;

    color: #fff;

    font-size: 1rem;
    font-weight: 600;

    border-radius: 0;

    text-transform: uppercase;
}

#cartOffcanvas .ns-mini-cart-checkout-btn:hover,
#cartOffcanvas .ns-mini-cart-checkout-btn:focus {
    background: #d85720;
    border-color: #d85720;

    color: #fff;
}


/* ---------- CONTINUE SHOPPING ---------- */

#cartOffcanvas .ns-mini-cart-continue-link {
    font-size: 0.9rem;
    color: inherit;
}

#cartOffcanvas .ns-mini-cart-continue-link:hover {
    color: inherit;
    text-decoration: underline;
}


/* ---------- CART BADGE ---------- */

#cartOffcanvas .offcanvas-title .offcanvas-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    vertical-align: top;

    min-width: 24px;
    height: 24px;

    padding: 5px;

    border-radius: 999px;

    background-color: #e9632a;
    color: #fff;

    font-size: 16px;
    font-weight: 700;
    line-height: 1;

    text-align: center;

    font-variant-numeric: tabular-nums;
}


/* ---------- LOADER ---------- */

#cartOffcanvas .ns-mini-cart-loader {
    min-height: 250px;

    display: flex;
    align-items: center;
    justify-content: center;
}

#cartOffcanvas .ns-mini-cart-spinner {
    display: block;

    width: 48px;
    height: 48px;

    fill: hsl(17, 79%, 57%);
}


/* ---------- RESPONSIVE OFFCANVAS WIDTH ---------- */

/* ≥ 576px (Bootstrap sm) */
@media (min-width: 576px) {
    #cartOffcanvas {
        --bs-offcanvas-width: 80vw;
    }
}


/* ≥ 768px (Bootstrap md) */
@media (min-width: 768px) {
    #cartOffcanvas {
        --bs-offcanvas-width: 420px;
    }
}


/* ≥ 992px (Bootstrap lg) */
@media (min-width: 992px) {
    #cartOffcanvas {
        --bs-offcanvas-width: 480px;
    }
}


/* ≥ 1200px (Bootstrap xl) */
@media (min-width: 1200px) {
    #cartOffcanvas {
        --bs-offcanvas-width: 520px;
    }
}
