/* ==========================================================================
   popup-checkout (popup-checkout/template-2) — mini-cart drawer
   Warm organic-grocer cohort. Right-side slide-in drawer.
   Preserves legacy hooks (#cart-widget-side, .cart-widget-opened,
   .cart-widget-wrapper, .widget-scroll-content, .mini_cart_item,
   .remove_from_cart_button, .widget_mini_cart_total, .amount) that the
   shared cartWidget() jQuery plugin + global add-to-cart handler rely on.
   ========================================================================== */

/* ---------- Overlay ---------- */
.cart-widget-side {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--bs-body-color-rgb), 0.48);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cart-widget-side.cart-widget-opened {
    display: block;
    opacity: 1;
}

/* ---------- Drawer ---------- */
.cart-widget-wrapper {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 9999;
    top: 0;
    right: 0;
    height: 100%;
    width: min(380px, 100vw);
    background: var(--bs-body-bg);
    box-shadow: -10px 0 30px rgba(var(--bs-body-color-rgb), 0.14);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    transform: translate3d(100%, 0, 0);
    overflow: hidden;
    font-family: var(--bs-body-font-family, 'Poppins', system-ui, sans-serif);
    color: var(--bs-body-color, var(--bs-body-color));
}

.cart-widget-opened .cart-widget-wrapper {
    transform: none;
}

/* ---------- Header ---------- */
.popup-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bs-primary, var(--bs-link-color));
    color: var(--bs-body-bg);
    flex-shrink: 0;
}

.popup-cart-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.popup-cart-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.popup-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: var(--bs-secondary, var(--bs-border-accent));
    color: var(--bs-body-bg);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 50rem;
    letter-spacing: 0.02em;
}

.popup-cart-close-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-body-bg-rgb), 0.12);
    color: var(--bs-body-bg);
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
}

.popup-cart-close-btn:hover {
    background: rgba(var(--bs-body-bg-rgb), 0.22);
    color: var(--bs-body-bg);
    transform: rotate(90deg);
}

/* ---------- Body / Items ---------- */
.cart-widget-wrapper .widget_shopping_cart {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.cart-widget-wrapper .widget_shopping_cart_content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.cart-widget-wrapper .widget_shopping_cart_body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bs-body, var(--bs-body));
}

.widget_shopping_cart_body .widget-scroll-content {
    position: absolute;
    inset: 0;
    max-height: 100%;
    overscroll-behavior: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px;
}

/* Mini cart items */
.mini_cart_item {
    position: relative;
    display: flex;
    padding: 12px !important;
    margin-bottom: 10px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color, var(--bs-border-color));
    border-radius: 0.5rem;
    box-shadow: 0 2px 6px rgba(var(--bs-body-color-rgb), 0.04);
    transition: box-shadow 0.2s ease;
}

.mini_cart_item:hover {
    box-shadow: 0 4px 12px rgba(var(--bs-body-color-rgb), 0.08);
}

.mini_cart_item:last-child {
    margin-bottom: 0;
    border-bottom: 1px solid var(--bs-border-color, var(--bs-border-color)) !important;
}

.widget-scroll-content>.mini_cart_item:last-child {
    border-bottom: 1px solid var(--bs-border-color, var(--bs-border-color)) !important;
}

.mini_cart_item .remove_from_cart_button {
    position: absolute;
    top: 10px;
    right: 10px;
    inset-inline-end: 10px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bs-light-secondary, var(--bs-secondary-bg));
    color: var(--bs-danger, var(--bs-danger));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 16px;
    line-height: 1;
    font-weight: 700;
    text-decoration: none;
    z-index: 2;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mini_cart_item .remove_from_cart_button:hover {
    background: var(--bs-danger, var(--bs-danger));
    color: var(--bs-body-bg);
    box-shadow: 0 0 0 3px rgba(var(--bs-danger-rgb), 0.12);
}

.mini_cart_item>a {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex: 1 1 auto;
    padding-right: 22px;
}

.mini_cart_item img {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
    min-width: 64px;
    max-width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color, var(--bs-border-color));
    background: var(--bs-light-secondary, var(--bs-secondary-bg));
    margin: 0;
}

.mini_cart_item .cart-info {
    flex: 1 1 auto;
    padding-right: 0;
    min-width: 0;
}

.mini_cart_item .cart-info .fs-3,
.mini_cart_item .cart-info span:first-child {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    color: var(--bs-body-color, var(--bs-body-color));
    line-height: 1.35;
    margin-bottom: 4px;
}

.mini_cart_item .cart-info .quantity {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 6px;
    font-size: 0.8rem;
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    font-weight: 500;
}

.cart-widget-side .amount {
    color: var(--bs-primary, var(--bs-link-color));
    font-weight: 700;
}

.mini_cart_item .cart-info .quantity .amount {
    font-size: 0.92rem;
    color: var(--bs-primary, var(--bs-link-color));
    font-weight: 700;
    margin-left: 4px;
}

/* ---------- Empty state ---------- */
.popup-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    padding: 40px 24px;
    text-align: center;
    background: var(--bs-body, var(--bs-body));
}

.popup-cart-empty-illus {
    width: 120px;
    height: 120px;
    margin-bottom: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-light-secondary, var(--bs-secondary-bg));
    color: var(--bs-primary, var(--bs-link-color));
}

.popup-cart-empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bs-body-color, var(--bs-body-color));
    margin: 0 0 4px;
}

.popup-cart-empty-sub {
    font-size: 0.88rem;
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    margin: 0 0 18px;
}

.popup-cart-empty-btn {
    display: inline-flex;
    align-items: center;
    padding: 11px 22px;
    background: var(--bs-primary, var(--bs-link-color));
    color: var(--bs-body-bg);
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background 0.2s ease, transform 0.15s ease;
}

.popup-cart-empty-btn:hover {
    background: #245a32;
    color: var(--bs-body-bg);
    transform: translateY(-1px);
}

/* ---------- Footer ---------- */
.cart-widget-side .shopping-cart-widget-footer {
    flex: 0 0 auto;
    padding-bottom: 16px;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color, var(--bs-border-color));
}

.cart-widget-side .shopping-cart-widget-footer>* {
    padding-inline: 18px;
}

.widget_mini_cart_total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-block: 14px 10px;
    font-size: 1rem;
    border-top: 0 !important;
}

.popup-cart-subtotal-label {
    font-weight: 600;
    color: var(--bs-body-color, var(--bs-body-color));
    font-size: 0.92rem;
}

.popup-cart-subtotal-amount {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    color: var(--bs-secondary, var(--bs-border-accent)) !important;
    letter-spacing: -0.01em;
}

.popup-cart-note {
    font-size: 0.76rem;
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    margin: 0 0 12px;
    line-height: 1.4;
}

.widget-mini-cart_buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.widget-mini-cart_buttons .btn-cart {
    padding: 11px 18px;
    min-height: 44px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--bs-body-bg);
    color: var(--bs-primary, var(--bs-link-color));
    border: 1px solid var(--bs-primary, var(--bs-link-color));
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 0;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.widget-mini-cart_buttons .btn-cart:hover {
    background: var(--bs-light-secondary, var(--bs-secondary-bg));
    color: var(--bs-primary, var(--bs-link-color));
}

.widget-mini-cart_buttons .btn-checkout {
    padding: 12px 20px;
    min-height: 48px;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--bs-body-bg);
    background: var(--bs-secondary, var(--bs-border-accent));
    border: 0;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 0;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(var(--bs-secondary-rgb), 0.28);
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.widget-mini-cart_buttons .btn-checkout:hover {
    background: #e85d29;
    color: var(--bs-body-bg);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(var(--bs-secondary-rgb), 0.34);
}

/* ---------- Responsive ---------- */
@media (max-width: 575.98px) {
    .cart-widget-wrapper {
        width: 100vw;
    }

    .popup-cart-header {
        padding: 14px 16px;
    }

    .widget_shopping_cart_body .widget-scroll-content {
        padding: 10px 12px;
    }

    .cart-widget-side .shopping-cart-widget-footer>* {
        padding-inline: 14px;
    }
}


/* Promo strike-through on cart line (rendered when session line carries original_price > price) */
.cart-Price-amount-old {
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    font-size: 0.8em;
    margin-left: 4px;
    text-decoration: line-through;
    font-weight: 400;
}
