/* ============================================================
   Charsutra — Side cart drawer
   ------------------------------------------------------------
   Open / minimized state lives on <body>:
       body.cs-cart-open   drawer visible
       body.cs-cart-min    collapsed to the corner pill
   State is kept off the drawer itself because the markup is
   replaced wholesale by mini_cart_html after every AJAX update.
   ============================================================ */

:root {
    --csc-navy: #0F1E33;
    --csc-gold: #A9825A;
    --csc-terracotta: #B5523B;
    --csc-line: #ECE8E1;
    --csc-ink: #16233A;
    --csc-muted: #6B7688;
    --csc-width: 408px;
}

.cs-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 1060;
    visibility: hidden;
    pointer-events: none;
}

body.cs-cart-open .cs-cart-drawer {
    visibility: visible;
    pointer-events: auto;
}

/* Minimized: the drawer must not block the page, only the pill is live */
body.cs-cart-min .cs-cart-drawer {
    pointer-events: none;
}

/* --- Backdrop --- */
.cs-cart-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 18, 32, .5);
    opacity: 0;
    transition: opacity .32s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

body.cs-cart-open .cs-cart-backdrop {
    opacity: 1;
}

body.cs-cart-min .cs-cart-backdrop {
    opacity: 0;
    pointer-events: none;
}

/* --- Panel --- */
.cs-cart-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--csc-width);
    max-width: 94vw;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    box-shadow: -14px 0 44px rgba(15, 30, 51, .2);
    transform: translateX(100%);
    transition: transform .38s cubic-bezier(.22, .68, .28, 1);
}

body.cs-cart-open .cs-cart-panel {
    transform: translateX(0);
}

body.cs-cart-min .cs-cart-panel {
    transform: translateX(100%);
}

/* --- Head --- */
.cs-cart-head {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--csc-line);
}

.cs-cart-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--csc-navy);
}

.cs-cart-sub {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--csc-gold);
}

.cs-cart-headbtns {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cs-cart-iconbtn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--csc-line);
    border-radius: 10px;
    background-color: #fff;
    color: var(--csc-navy);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.cs-cart-iconbtn:hover {
    background-color: var(--csc-navy);
    border-color: var(--csc-navy);
    color: #fff;
}

.cs-cart-iconbtn--close:hover {
    background-color: var(--csc-terracotta);
    border-color: var(--csc-terracotta);
}

/* Minimize glyph drawn in CSS so it can't depend on an icon font */
.cs-cart-minicon {
    display: block;
    width: 13px;
    height: 2px;
    border-radius: 2px;
    background-color: currentColor;
}

/* --- Items --- */
.cs-cart-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* stops the scroll from chaining to the page behind the drawer */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.cs-cart-list {
    list-style: none;
    margin: 0;
    padding: 6px 20px;
}

.cs-cart-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #F4F1EC;
    animation: cs-cart-itemin .32s ease both;
}

.cs-cart-item:last-child { border-bottom: none; }

@keyframes cs-cart-itemin {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cs-cart-item.is-removing {
    opacity: .4;
    transform: translateX(10px);
    transition: opacity .25s ease, transform .25s ease;
}

.cs-cart-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 78px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #F5F3EF;
}

.cs-cart-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-cart-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-cart-name {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--csc-ink);
    text-decoration: none;
    /* Product names here run long ("Bath & Body Works Sweetest Song Fine
       Fragrance Mist | 8 fl oz (236 mL) floral and fruity body spray").
       Two lines keeps every row the same height. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-right: 26px;
}

.cs-cart-name:hover { color: var(--csc-gold); }

.cs-cart-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cs-cart-meta span {
    padding: 2px 8px;
    border-radius: 5px;
    background-color: #F4F1EC;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--csc-muted);
}

.cs-cart-meta--gift {
    background-color: rgba(169, 130, 90, .14) !important;
    color: var(--csc-gold) !important;
}

.cs-cart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
}

/* --- Quantity stepper --- */
.cs-cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--csc-line);
    border-radius: 999px;
    overflow: hidden;
}

.cs-cart-qtybtn {
    width: 28px;
    height: 28px;
    border: none;
    background-color: #fff;
    color: var(--csc-navy);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transition: background-color .18s ease, color .18s ease;
}

.cs-cart-qtybtn:hover:not(:disabled) {
    background-color: var(--csc-navy);
    color: #fff;
}

.cs-cart-qtybtn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.cs-cart-qtynum {
    min-width: 30px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--csc-ink);
    font-variant-numeric: tabular-nums;
}

.cs-cart-qtystatic {
    font-size: 12px;
    font-weight: 600;
    color: var(--csc-muted);
}

.cs-cart-linetotal {
    font-size: 14px;
    font-weight: 700;
    color: var(--csc-navy);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cs-cart-remove {
    position: absolute;
    top: 12px;
    right: 0;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 7px;
    background-color: transparent;
    color: #B9BFC9;
    font-size: 12px;
    transition: background-color .18s ease, color .18s ease;
}

.cs-cart-remove:hover {
    background-color: rgba(181, 82, 59, .1);
    color: var(--csc-terracotta);
}

/* --- Empty state --- */
.cs-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 54px 30px;
}

.cs-cart-emptyicon {
    width: 66px;
    height: 66px;
    margin-bottom: 16px;
    border-radius: 50%;
    background-color: #F5F3EF;
    color: var(--csc-gold);
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cs-cart-empty strong {
    font-size: 16px;
    color: var(--csc-navy);
}

.cs-cart-empty p {
    margin: 6px 0 20px;
    font-size: 13px;
    color: var(--csc-muted);
}

/* --- Footer --- */
.cs-cart-foot {
    flex: 0 0 auto;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--csc-line);
    background-color: #FCFBF9;
}

.cs-cart-totals {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.cs-cart-totals span {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--csc-muted);
}

.cs-cart-totals strong {
    font-size: 20px;
    font-weight: 800;
    color: var(--csc-navy);
    font-variant-numeric: tabular-nums;
}

.cs-cart-note {
    margin: 5px 0 14px;
    font-size: 11.5px;
    color: var(--csc-muted);
}

.cs-cart-actions {
    display: flex;
    gap: 10px;
}

.cs-cart-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 14px;
    border: none;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .3px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease, transform .12s ease;
}

.cs-cart-btn--primary {
    background-color: var(--csc-navy);
    color: #fff;
}

.cs-cart-btn--primary:hover {
    background-color: var(--csc-gold);
    color: var(--csc-navy);
}

.cs-cart-btn--ghost {
    background-color: #fff;
    border: 1.5px solid var(--csc-line);
    color: var(--csc-navy);
}

.cs-cart-btn--ghost:hover {
    border-color: var(--csc-navy);
    background-color: #F5F3EF;
}

.cs-cart-btn:active { transform: scale(.98); }

/* --- Busy overlay while an AJAX update is in flight --- */
.cs-cart-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, .6);
    z-index: 5;
}

.cs-cart-panel.is-busy .cs-cart-loader { display: flex; }

.cs-cart-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(15, 30, 51, .15);
    border-top-color: var(--csc-navy);
    border-radius: 50%;
    animation: cs-cart-spin .7s linear infinite;
}

@keyframes cs-cart-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Minimized pill
   ============================================================ */
.cs-cart-pill {
    position: absolute;
    right: 22px;
    bottom: 22px;
    display: none;
    align-items: center;
    gap: 11px;
    height: 52px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background-color: var(--csc-navy);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 30, 51, .3);
    pointer-events: auto;
    animation: cs-cart-pillin .3s ease both;
}

body.cs-cart-min .cs-cart-pill {
    display: inline-flex;
}

@keyframes cs-cart-pillin {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cs-cart-pill:hover {
    background-color: var(--csc-gold);
    color: var(--csc-navy);
}

.cs-cart-pilltext b {
    margin-left: 6px;
    font-weight: 800;
}

.cs-cart-pill > i:last-child {
    font-size: 11px;
    opacity: .8;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 575.98px) {
    :root { --csc-width: 100%; }

    .cs-cart-panel { max-width: 100vw; }

    .cs-cart-head { padding: 16px 16px 13px; }
    .cs-cart-title { font-size: 17px; }
    .cs-cart-list { padding: 4px 16px; }

    .cs-cart-thumb {
        width: 56px;
        height: 68px;
    }

    .cs-cart-name { font-size: 13px; }

    .cs-cart-foot {
        padding: 14px 16px 16px;
        /* clear of the fixed mobile bottom nav */
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .cs-cart-btn {
        height: 44px;
        font-size: 12.5px;
    }

    .cs-cart-totals strong { font-size: 18px; }

    /* Sit above the mobile bottom nav */
    .cs-cart-pill {
        right: 14px;
        bottom: 76px;
        height: 48px;
        padding: 0 16px;
        font-size: 12.5px;
    }
}

/* The mobile bottom nav is z-index 999; the drawer must clear it */
@media (max-width: 767.98px) {
    .cs-cart-drawer { z-index: 1060; }
}

/* ============================================================
   Accessibility
   ============================================================ */
.cs-cart-panel a:focus-visible,
.cs-cart-panel button:focus-visible,
.cs-cart-pill:focus-visible {
    outline: 2px solid var(--csc-gold);
    outline-offset: 2px;
    border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .cs-cart-panel,
    .cs-cart-backdrop,
    .cs-cart-btn {
        transition: none;
    }

    .cs-cart-item,
    .cs-cart-pill {
        animation: none;
    }

    .cs-cart-spinner { animation-duration: 1.4s; }
}
