.wd-ajax-cart-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    direction: rtl;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease-in-out;
    margin-top: 8px;
}

.wd-ajax-cart-control .wd-ajax-btn {
    border: none;
    background-color: var(--e-global-color-primary);
    color: #ffffff;
    cursor: pointer;
    flex: 0 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    border-radius: 5px;
}

button.wd-ajax-btn.wd-ajax-add:hover {
    border: 1px solid var(--e-global-color-primary);
    color: var(--e-global-color-primary) !important;
    background: transparent;
}

.wd-ajax-cart-control .wd-ajax-add {
    flex: 1 1 auto;
    font-size: 15px;
    font-weight: 500;
}

.wd-ajax-cart-control .wd-ajax-qty {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    width: auto;
    display: block;
    background: var(--e-global-color-primary);
    color: #FFF;
    height: 40px;
    line-height: 40px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.wd-ajax-cart-control .wd-ajax-btn:hover {
    background: var(--e-global-color-423324e);
    color: #ffffff !important;
}

.wd-ajax-cart-control.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

button.wd-ajax-btn.wd-ajax-plus {
    border-radius: 5px 0 0 5px;
    font-weight: 700;
}

button.wd-ajax-btn.wd-ajax-minus {
    border-radius: 0 5px 5px 0;
    font-weight: 700;
}

button.wd-ajax-btn.wd-ajax-plus:hover,
button.wd-ajax-btn.wd-ajax-minus:hover {
    color: var(--e-global-color-primary) !important;
    border: 1px solid var(--e-global-color-primary);
}

.wd-btn-select-variation {
    display: inline-block;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    border: 1px solid var(--e-global-color-primary);
    direction: rtl;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    color: var(--e-global-color-423324e);
    text-align: center;
    line-height: 40px;
    margin-top: 8px;
    transition: all 0.2s ease-in-out;
}

.wd-btn-select-variation:hover {
    background: var(--e-global-color-423324e);
    color: #ffffff;
}

.wd-ajax-cart-control-variable {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.wd-ajax-cart-control-variable .wd-btn-select-variation {
    flex: 1 1 auto;
    border: none;
    margin-top: 0;
    height: 100%;
    font-size: 16px;
    font-weight: 700;
    line-height: 40px;
}

.wd-ajax-cart-control-variable .wd-btn-select-variation:hover {
    background: var(--e-global-color-423324e);
    color: #ffffff;
}

/* ========================================
   Cart Bounce Animation
   ======================================== */

@keyframes wdCartBounce {

    0%,
    100% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.2);
    }

    60% {
        transform: scale(1.1);
    }
}

.wd-cart-bounce {
    animation: wdCartBounce 0.5s ease-out;
}

/* ========================================
   Cart Popup Styles
   ======================================== */

.wd-cart-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.wd-cart-popup {
    background: #fff;
    border-radius: 16px;
    max-width: 60%;
    width: 60%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    direction: rtl;
    /* Ensure RTL for Hebrew content */
}

/* Close Button */
.wd-cart-popup-close {
    position: absolute;
    top: 15px;
    left: 15px;
    /* RTL position */
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.wd-cart-popup-close:hover {
    background: #e0e0e0;
    color: #000;
}

/* Header - Added Product */
.wd-cart-popup-header {
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 16px 16px 0 0;
}

.wd-cart-popup-added-product {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align right in RTL */
    gap: 15px;
}

.wd-cart-popup-product-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #eee;
}

.wd-cart-popup-product-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: right;
}

.wd-cart-popup-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #FF7843;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    margin-left: 5px;
}

.wd-cart-popup-header .wd-cart-popup-product-name {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    display: block;
}

.wd-cart-popup-success-text {
    font-size: 14px;
    color: #FF7843;
    font-weight: 600;
}

/* Recommendations Section */
.wd-cart-popup-recommendations {
    padding: 15px;
}

.wd-cart-popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin: 0 0 20px 0;
    text-align: center;
}

.wd-cart-popup-products {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

.wd-cart-popup-product {
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s;
    background: #fff;
}

.wd-cart-popup-product:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}


.wd-cart-popup-product-link {
    text-decoration: none;
    display: block;
}

/* Enforce strict box model */
.wd-cart-popup,
.wd-cart-popup * {
    box-sizing: border-box;
}

.wd-cart-popup-product-thumb {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Flexbox column layout for product card */
.wd-cart-popup-product {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    /* Force width containment */
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s;
    background: #fff;
    /* Ensure white background */
    border: 1px solid transparent;
    /* Placeholder for hover */
    overflow: hidden;
    /* CRITICAL: Prevent button sticking out */
}

/* Hover state - clean white with border/shadow, NO GRAY */
.wd-cart-popup-product:hover {
    background: #fff;
    border-color: #eee;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Gentle shadow */
    transform: translateY(-2px);
}

.wd-cart-popup-product .wd-cart-popup-product-name {
    display: block;
    font-size: 13px;
    color: #000;
    font-weight: 500;
    line-height: 1.4;
    height: 36px;
    overflow: hidden;
    margin-bottom: 8px;

    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wd-cart-popup-product-price {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--e-global-color-primary, #000);
    margin-bottom: 10px;
    margin-top: auto;
    /* Push to bottom of flex container */
}

.wd-cart-popup-add-btn {
    display: block;
    width: 100%;
    max-width: 100%;
    /* Ensure it fits container */
    padding: 10px 5px;
    /* Reduced side padding */
    background: var(--e-global-color-primary, #000);
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;

    /* Text truncation logic */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.wd-cart-popup-add-btn:hover {
    opacity: 0.9;
    transform: none;
    /* Removed scale to prevent overflow issues */
}

/* Added state (After successful add) */
.wd-cart-popup-add-btn.added {
    background: #FF7843 !important;
    color: transparent !important;
    /* Hide original text */
    position: relative;
    cursor: default;
    pointer-events: none;
    /* Disable click */
}

.wd-cart-popup-add-btn.added::after {
    content: 'אצלך בסל!';
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Hide default WooCommerce "View Cart" link in popup */
.wd-cart-popup-product a.added_to_cart {
    display: none !important;
}

/* Actions */
.wd-cart-popup-actions {
    display: flex;
    gap: 10px;
    padding: 15px 25px;
    border-top: 1px solid #eee;
}

.wd-cart-popup-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wd-cart-popup-btn-cart {
    background: var(--e-global-color-primary, #000);
    color: #fff !important;
}

.wd-cart-popup-btn-cart:hover {
    opacity: 0.9;
}

.wd-cart-popup-btn-continue {
    background: #f5f5f5;
    color: #000;
}

.wd-cart-popup-btn-continue:hover {
    background: #e8e8e8;
}

/* Loading State */
.wd-cart-popup-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 900px) {
    .wd-cart-popup {
        max-width: 90%;
        width: 90%;
    }

    .wd-cart-popup-products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .wd-cart-popup {
        max-width: 95%;
        width: 95%;
        max-height: 85vh;
    }

    .wd-cart-popup-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .wd-cart-popup-product {
        padding: 10px;
        /* Tighter padding on mobile */
    }

    .wd-cart-popup-product-thumb {
        height: 80px;
    }

    .wd-cart-popup-actions {
        flex-direction: column;
        padding: 15px;
        /* Adjust padding for mobile */
    }

    .wd-cart-popup-btn {
        width: 100%;
        margin-bottom: 5px;
    }
}