/* ================================
   Cart Drawer
================================ */

#cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}


#cart-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* ================================
   Drawer
================================ */

.cart-drawer {
    position: fixed;
    top: 0;
    bottom: 0;

    width: min(430px, 100%);
    max-width: 100%;

    background: var(--body-bg-color, #fff);

    z-index: 9999;

    display: flex;
    flex-direction: column;

    box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);

    transition: transform 0.35s ease;

    color: var(--text-color, #222);
}


/*
    RTL
    السلة من اليمين
*/
.cart-drawer[dir="rtl"] {
    right: 0;
    left: auto;

    transform: translateX(100%);
}


/*
    LTR
    السلة من الشمال
*/
.cart-drawer[dir="ltr"] {
    left: 0;
    right: auto;

    transform: translateX(-100%);
}


/* Open */

.cart-drawer.active {
    transform: translateX(0);
}


/* ================================
   Header
================================ */

.cart-drawer-header {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 82px;

    padding: 20px 60px;

    border-bottom: 1px solid
        var(--border-color, #eee);
}


.cart-drawer-title {
    text-align: center;
}


.cart-drawer-title h2 {
    margin: 0;

    font-size: 20px;
    font-weight: 700;
}


.cart-drawer-title span {
    display: block;

    width: 45px;
    height: 4px;

    margin: 8px auto 0;

    border-radius: 999px;

    background: var(
        --primary-color,
        #000
    );
}


.cart-drawer-close {
    position: absolute;

    top: 50%;

    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    background: transparent;

    color: inherit;

    cursor: pointer;

    transform: translateY(-50%);
}


.cart-drawer[dir="rtl"] .cart-drawer-close {
    right: 15px;
}


.cart-drawer[dir="ltr"] .cart-drawer-close {
    left: 15px;
}


.cart-drawer-close:hover {
    color: var(
        --primary-color,
        #000
    );
}


/* ================================
   Body
================================ */

.cart-drawer-body {
    position: relative;

    flex: 1;

    overflow-y: auto;

    padding: 20px;
}


.cart-drawer-items {
    display: flex;
    flex-direction: column;

    gap: 14px;
}


/* ================================
   Product
================================ */

.cart-drawer-item {
    position: relative;

    display: flex;

    gap: 14px;

    padding: 12px;

    border: 1px solid
        var(--border-color, #eee);

    border-radius: 12px;

    background: var(
        --body-bg-color,
        #fff
    );

    transition:
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}


.cart-drawer-item:hover {
    box-shadow:
        0 5px 20px
        rgba(0, 0, 0, 0.07);
}


/* RTL */

.cart-drawer[dir="rtl"]
.cart-drawer-item {
    direction: rtl;
}


/* LTR */

.cart-drawer[dir="ltr"]
.cart-drawer-item {
    direction: ltr;
}


/* ================================
   Product Image
================================ */

.cart-drawer-product-image {
    width: 82px;
    height: 82px;

    flex: 0 0 82px;

    overflow: hidden;

    border-radius: 9px;

    background: #f5f5f5;
}


.cart-drawer-product-image img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


/* ================================
   Product Content
================================ */

.cart-drawer-product-content {
    flex: 1;

    min-width: 0;

    display: flex;
    flex-direction: column;
}


.cart-drawer-product-top {
    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 8px;
}


.cart-drawer-product-name {
    margin: 0;

    font-size: 14px;
    line-height: 1.5;

    font-weight: 600;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    overflow: hidden;
}


.cart-drawer-remove {
    flex: 0 0 auto;

    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;

    background: transparent;

    color: #999;

    cursor: pointer;
}


.cart-drawer-remove:hover {
    color: #dc3545;
}


/* ================================
   Price
================================ */

.cart-drawer-product-price {
    margin-top: 5px;

    font-size: 14px;

    font-weight: 700;

    color: var(
        --primary-color,
        #000
    );
}


/* ================================
   Bottom
================================ */

.cart-drawer-product-bottom {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-top: auto;
    padding-top: 10px;
}


/* ================================
   Quantity
================================ */

.cart-drawer-quantity {
    display: flex;

    align-items: center;

    height: 34px;

    overflow: hidden;

    border: 1px solid
        var(--border-color, #ddd);

    border-radius: 8px;
}


.cart-drawer-quantity button {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;

    background: transparent;

    color: inherit;

    cursor: pointer;
}


.cart-drawer-quantity button:hover {
    background: rgba(0, 0, 0, 0.05);
}


.cart-drawer-quantity button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


.cart-drawer-quantity span {
    min-width: 35px;

    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 8px;

    border-left: 1px solid
        var(--border-color, #ddd);

    border-right: 1px solid
        var(--border-color, #ddd);

    font-size: 13px;

    font-weight: 600;
}


/* ================================
   Footer
================================ */

.cart-drawer-footer {
    padding: 20px;

    border-top: 1px solid
        var(--border-color, #eee);

    background: var(
        --body-bg-color,
        #fff
    );
}


/* ================================
   Totals
================================ */

.cart-drawer-subtotal,
.cart-drawer-total {
    display: flex;

    align-items: center;

    justify-content: space-between;
}


.cart-drawer-subtotal {
    margin-bottom: 10px;

    font-size: 14px;

    color: #777;
}


.cart-drawer-total {
    margin-bottom: 20px;

    font-size: 18px;

    font-weight: 700;
}


.cart-drawer-total strong {
    color: var(
        --primary-color,
        #000
    );
}


/* ================================
   Coupon
================================ */

.cart-drawer-coupon {
    margin-bottom: 18px;
}


.cart-drawer-coupon label {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;

    font-weight: 600;
}


.cart-coupon-form {
    display: flex;

    gap: 8px;
}


.cart-coupon-form input {
    min-width: 0;
    flex: 1;

    height: 42px;

    padding: 0 12px;

    border: 1px solid
        var(--border-color, #ddd);

    border-radius: 7px;

    background: transparent;

    color: inherit;

    outline: none;
}


.cart-coupon-form input:focus {
    border-color: var(
        --primary-color,
        #000
    );
}


.cart-coupon-form button {
    height: 42px;

    padding: 0 18px;

    border: 0;

    border-radius: 7px;

    background: var(
        --primary-color,
        #000
    );

    color: #fff;

    cursor: pointer;
}


.cart-coupon-form button:disabled {
    opacity: 0.6;
    cursor: wait;
}


.cart-coupon-message {
    margin-top: 7px;

    font-size: 12px;
}


/* ================================
   Actions
================================ */

.cart-drawer-actions {
    display: flex;

    gap: 10px;
}


.cart-drawer-actions a {
    flex: 1;

    min-height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 15px;

    border-radius: 8px;

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;
}


.cart-drawer-view-cart {
    background: #f2f2f2;

    color: #222;
}


.cart-drawer-checkout {
    background: var(
        --primary-color,
        #000
    );

    color: #fff;
}


/* ================================
   Empty
================================ */

.cart-drawer-empty {
    min-height: 350px;

    display: none;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;
}


.cart-drawer-empty.show {
    display: flex;
}


.cart-drawer-empty i {
    margin-bottom: 15px;

    font-size: 55px;

    opacity: 0.25;
}


.cart-drawer-empty h3 {
    margin: 0 0 20px;

    font-size: 18px;
}


.cart-drawer-shopping {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 42px;

    padding: 0 20px;

    border-radius: 7px;

    background: var(
        --primary-color,
        #000
    );

    color: #fff;

    text-decoration: none;
}


/* ================================
   Loading
================================ */

.cart-drawer-loading {
    position: absolute;

    inset: 0;

    z-index: 10;

    display: none;

    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,0.7);
}


.cart-drawer-loading.active {
    display: flex;
}


.cart-loader {
    width: 32px;
    height: 32px;

    border: 3px solid #ddd;

    border-top-color: var(
        --primary-color,
        #000
    );

    border-radius: 50%;

    animation:
        cart-loader-spin
        0.7s linear infinite;
}


@keyframes cart-loader-spin {

    to {
        transform: rotate(360deg);
    }

}


/* ================================
   Item Updating
================================ */

.cart-drawer-item.is-updating {
    pointer-events: none;

    opacity: 0.5;
}


/* ================================
   Mobile
================================ */

@media (max-width: 575px) {

    .cart-drawer {
        width: 100%;
    }

    .cart-drawer-body {
        padding: 15px;
    }

    .cart-drawer-footer {
        padding: 15px;
    }

    .cart-drawer-product-image {
        width: 72px;
        height: 72px;

        flex-basis: 72px;
    }

}