/* Intelligo Favorites — B2B wishlist UI */

/* Keep Magento wishlist social links hidden (PDP uses SKU-row link instead) */
.product-social-links {
    display: none !important;
}

/*
 * Autolock parks .modal-inner-wrap at translateY(-200%) until ._show.
 * AjaxSuite success popups were opening the overlay without a visible dialog.
 * Force Favorites / AjaxSuite / confirm dialogs to actually appear and dismiss.
 */
body .modal-popup.popup-ajaxsuite._show,
body .modal-popup.confirm._show {
    visibility: visible !important;
    opacity: 1 !important;
}

body .modal-popup.popup-ajaxsuite._show .modal-inner-wrap,
body .modal-popup.confirm._show .modal-inner-wrap {
    transform: translateY(0) !important;
    pointer-events: auto;
}

body._has-modal .modals-overlay {
    pointer-events: auto;
    cursor: pointer;
}

/* Listing heart toggle only */
.product-item-info {
    position: relative;
}

.product-item-info .intelligo-favorites-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #d0dcdc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #1a1a1a;
}

body.favorites-enabled .product-item-info .intelligo-favorites-toggle {
    display: inline-flex;
}

.product-item-info .intelligo-favorites-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.product-item-info .intelligo-favorites-toggle__icon {
    display: block;
    width: 20px;
    height: 20px;
    background: center / contain no-repeat
        url("../images/wishlist-heart.svg");
}

.product-item-info .intelligo-favorites-toggle:hover,
.product-item-info .intelligo-favorites-toggle:focus {
    border-color: #009688;
}

/* PDP: SKU + Favorites on one row */
.intelligo-sku-favorites-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
}

.intelligo-sku-favorites-row .product.attribute.sku,
.intelligo-sku-favorites-row .sku {
    display: inline-block;
    vertical-align: middle;
    margin: 0;
}

.intelligo-sku-favorites-row .product.attribute.sku > *,
.intelligo-sku-favorites-row .sku > * {
    margin-bottom: 0;
}

.intelligo-favorites-pdp--sku {
    display: none;
    align-items: center;
    margin: 0;
}

body.favorites-enabled .intelligo-favorites-pdp--sku {
    display: inline-flex;
}

.intelligo-favorites-pdp--sku .intelligo-favorites-toggle--sku-text {
    display: inline-flex;
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 6px;
    align-items: center;
    /* Match SKU size + carousel-price__label color */
    color: rgba(26, 26, 26, 0.55);
    font-family: open-sans, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
    text-decoration: none;
}

.intelligo-favorites-pdp--sku .intelligo-favorites-toggle__icon {
    display: block;
    width: 14px;
    height: 14px;
    opacity: 0.7;
    background: center / contain no-repeat
        url("../images/wishlist-heart.svg");
}

.intelligo-favorites-pdp--sku .intelligo-favorites-toggle__label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    font-size: 16px;
    line-height: 1.5;
    color: rgba(26, 26, 26, 0.55);
}

.intelligo-favorites-pdp--sku .intelligo-favorites-toggle--sku-text:hover,
.intelligo-favorites-pdp--sku .intelligo-favorites-toggle--sku-text:focus {
    border: 0;
    color: rgba(26, 26, 26, 0.8);
}

.intelligo-favorites-pdp--sku .intelligo-favorites-toggle--sku-text:hover .intelligo-favorites-toggle__label,
.intelligo-favorites-pdp--sku .intelligo-favorites-toggle--sku-text:focus .intelligo-favorites-toggle__label {
    color: rgba(26, 26, 26, 0.8);
    text-decoration: underline;
}

/* Account + homepage sections */
.intelligo-favorites {
    margin: 24px 0 32px;
}

.intelligo-favorites__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.intelligo-favorites__title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.3;
    color: #1a1a1a;
}

.intelligo-favorites__all {
    white-space: nowrap;
    text-decoration: underline;
    color: #00665c;
}

.intelligo-favorites__empty {
    margin: 0;
}

.intelligo-favorites__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.intelligo-favorites__grid > .product-item {
    width: auto;
    margin: 0;
}

/* Full Favorites page (/wishlist/) */
.intelligo-favorites--wishlist {
    margin: 0 0 32px;
}

.intelligo-favorites--wishlist .intelligo-favorites__grid {
    margin-top: 8px;
}

.intelligo-carousel-cards .product-item-sku {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.4;
    color: rgba(26, 26, 26, 0.55);
}

.intelligo-favorites-card__remove {
    display: inline-flex;
    align-self: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: rgba(26, 26, 26, 0.55);
    text-decoration: underline;
    cursor: pointer;
}

.intelligo-favorites-card__remove:hover,
.intelligo-favorites-card__remove:focus {
    color: #1a1a1a;
    text-decoration: underline;
}

.wishlist-index-index .form-wishlist-items {
    margin: 0;
}

.wishlist-index-index .form-wishlist-items .actions-toolbar {
    display: none;
}

.intelligo-favorites--homepage {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 24px 16px 8px;
}

@media (max-width: 767px) {
    .intelligo-favorites__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .intelligo-favorites__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .intelligo-sku-favorites-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
