/* Cart Login Popup Styles */
.clp-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 23, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.clp-popup-content {
    background: linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
    border-radius: 24px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.clp-popup-header {
    padding: 28px 32px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.clp-popup-header h3 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.clp-close-popup {
    background: rgba(17, 24, 39, 0.08);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #111827;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.25s ease, background 0.25s ease;
}

.clp-close-popup:hover {
    transform: scale(1.05);
    background: rgba(17, 24, 39, 0.14);
}

.clp-popup-body {
    padding: 24px 32px 0;
}

.clp-popup-body p {
    margin: 0 0 24px;
    font-size: 16px;
    line-height: 1.7;
    color: #475569;
}

.clp-cart-preview-container {
    margin-bottom: 24px;
}

.clp-cart-preview {
    border-radius: 20px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.clp-cart-preview .nl-woosb-mini-child {
    display: none !important;
}


.clp-cart-preview .cart-item-link {
    display: inline-block !important;
    position: static !important;
}

.clp-cart-preview .remove_from_cart_button,
.clp-cart-preview .clp-remove-item {
    left: 0 !important;
    right: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    color: #9ca3af !important;
    font-size: 20px !important;
    line-height: 1 !important;
    border-radius: 0 !important;
}

.clp-cart-preview .clp-remove-item:hover,
.clp-cart-preview .remove_from_cart_button:hover {
    background: transparent !important;
    border: none !important;
    color: #6b7280 !important;
    transform: none !important;
}


.clp-cart-preview .woocommerce-mini-cart-item {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 12px !important;
}

.clp-cart-preview .woocommerce-mini-cart-item.nl-woosb-mini-child {
    display: none !important;
}

.clp-cart-preview .woocommerce-mini-cart-item.nl-woosb-mini-child[style*="display: list-item"] {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    min-height: 100px !important;
    padding: 8px 0 !important;
}


.clp-cart-preview .nl-woosb-mini-child .cart-item-image {
    flex: 0 0 75px !important;
    width: 75px !important;
    height: 75px !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    border-radius: 8px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.clp-cart-preview .nl-woosb-mini-child .cart-item-image img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
}

.clp-cart-preview .nl-woosb-mini-child .cart-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    text-align: center !important;
}



.clp-cart-preview .cart-item-image {
    flex: 0 0 95px !important;
    max-width: 95px !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    border-radius: 8px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.clp-cart-preview .cart-item-image img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
}

.clp-cart-preview .cart-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.clp-cart-preview .nl-woosb-toggle-holder {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    order: 1 !important;
    margin-top: 12px !important;
    min-height: 40px !important;
    align-items: center !important;
}

.clp-cart-preview .nl-woosb-toggle-icon {
    margin: 0 auto !important;
    white-space: normal !important;
    text-align: center !important;
    max-width: 100% !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    cursor: pointer !important;
}

.clp-cart-preview h4 {
    margin: 0 0 18px;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.clp-cart-items {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
}

.clp-cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    position: relative;
}

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

.clp-remove-item {
    position: absolute;
    top: 8px;
    right: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.clp-remove-item:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.1);
}

.clp-remove-item:active {
    transform: scale(0.95);
}

.clp-item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    overflow: hidden;
    background: #f1f5f9;
}

.clp-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.clp-item-details {
    flex: 1;
    min-width: 0;
}

.clp-item-details h5 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
}

.clp-item-quantity {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.clp-bundle-details {
    margin-top: 12px;
    padding-left: 76px;
    display: grid;
    gap: 12px;
}

.clp-bundle-child-item {
    border-bottom: none;
    padding: 0;
    margin: 0;
    background: transparent;
}

.clp-bundle-option {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.08);
    margin-top: 12px;
}

.clp-bundle-option span {
    font-size: 13px;
    color: #111827;
    font-weight: 700;
}

.clp-bundle-option p {
    margin: 0;
    font-size: 13px;
    color: #475569;
}

.clp-cart-total {
    text-align: right;
    padding-top: 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.clp-cart-total strong {
    font-size: 18px;
    color: #111827;
}

.clp-popup-footer {
    padding: 24px 32px 32px;
    display: flex;
    gap: 14px;
    justify-content: flex-end;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.92);
}

.clp-popup-footer .button {
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.24s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
}

.clp-login-btn {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.clp-login-btn:hover {
    background: #eef2ff;
}

.clp-signup-btn {
    background: #1d4ed8;
    color: #ffffff;
    border: 1px solid transparent;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.16);
}

.clp-signup-btn:hover {
    background: #2563eb;
}

.clp-popup-footer .button.primary {
    background: #1d4ed8;
    color: #fff;
}

.clp-popup-footer .button.primary:hover {
    background: #2563eb;
}

/* Login/Register Page Cart Display */
.clp-login-cart,
.clp-woo-login-cart,
.clp-woo-register-cart {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    padding: 24px;
    margin: 22px 0;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.clp-login-cart h3,
.clp-woo-login-cart h4,
.clp-woo-register-cart h4 {
    margin: 0 0 16px;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 2px solid #1d4ed8;
    padding-bottom: 10px;
}

.clp-cart-preview-compact {
    text-align: left;
}

.clp-cart-preview-compact p {
    margin: 0 0 10px;
    font-size: 14px;
    color: #475569;
}

.clp-cart-preview-compact strong {
    font-size: 16px;
    color: #1d4ed8;
}

/* Responsive */
@media (max-width: 768px) {
    .clp-popup-content {
        max-height: 90vh;
    }

    .clp-popup-header,
    .clp-popup-body,
    .clp-popup-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .clp-popup-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .clp-popup-footer .button {
        width: 100%;
    }

    .clp-cart-item {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }

    .clp-item-image {
        margin-right: 0;
        margin-bottom: 12px;
        width: 100%;
        height: 120px;
    }
}

/* RTL Support */
.rtl .clp-popup-header,
.rtl .clp-popup-body,
.rtl .clp-popup-footer {
    direction: rtl;
}

.rtl .clp-cart-item {
    direction: rtl;
}

.rtl .clp-item-image {
    margin-right: 0;
    margin-left: 15px;
}

/* Cart Confirmation Notification */
.clp-cart-confirmation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 23, 0.8);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.clp-cart-confirmation-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.clp-confirmation-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.3);
}

.clp-cart-confirmation-content h4 {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.clp-cart-confirmation-content p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #475569;
}

/* Custom CSS from settings */
<?php echo get_option('clp_custom_css', ''); ?>

/* Prevent unwanted product modals on login/register pages */
.woocommerce-product-modal,
.product-modal,
.quick-view-modal,
.wc-quick-view,
.wd-quick-view,
.product-list-modal,
.product-list-window,
[class*="product-modal"],
[id*="product-modal"],
[id*="quick-view"] {
    display: none !important;
}

/* Hide modal backdrops */
.modal-backdrop,
.woocommerce-modal-backdrop,
.quickview-backdrop {
    display: none !important;
}

/* Ensure body scroll works on login pages */
body.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}

/* Force pending-cart remove button on the LEFT side (theme-safe override). */
.clp-woo-login-cart .clp-cart-preview .clp-remove-item,
.clp-woo-register-cart .clp-cart-preview .clp-remove-item,
.clp-login-cart .clp-cart-preview .clp-remove-item,
.clp-woo-login-cart .clp-cart-preview .remove_from_cart_button,
.clp-woo-register-cart .clp-cart-preview .remove_from_cart_button,
.clp-login-cart .clp-cart-preview .remove_from_cart_button {
    position: absolute !important;
    left: 8px !important;
    right: auto !important;
    inset-inline-start: 8px !important;
    inset-inline-end: auto !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Hard override: pending cart item remove icon must stay on far-left. */
.clp-cart-preview .clp-cart-item {
    position: relative !important;
    padding-left: 26px !important;
}

.clp-cart-preview .clp-cart-item .clp-remove-item,
.clp-cart-preview .clp-cart-item .remove_from_cart_button {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
    inset: 8px auto auto 8px !important;
    inset-inline-start: 8px !important;
    inset-inline-end: auto !important;
    float: none !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 3 !important;
}

/* RTL fix: place remove icon on visual LEFT side. */
html[dir="rtl"] .clp-cart-preview .clp-cart-item .clp-remove-item,
html[dir="rtl"] .clp-cart-preview .clp-cart-item .remove_from_cart_button,
.rtl .clp-cart-preview .clp-cart-item .clp-remove-item,
.rtl .clp-cart-preview .clp-cart-item .remove_from_cart_button {
    left: auto !important;
    right: auto !important;
    inset-inline-start: auto !important;
    inset-inline-end: 8px !important;
}