/*---*\
    CAT Floating Compare Tray
\*---*/

.cat-compare-tray {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1200;
    width: min(100% - 32px, 360px);
    font-family: var(--font-body, inherit);
}

.cat-compare-tray[hidden] {
    display: none !important;
}

.cat-compare-tray__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 4px;
    background-color: var(--color-heading);
    color: var(--color-surface-white);
    font-family: var(--font-button, inherit);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.cat-compare-tray__toggle:hover,
.cat-compare-tray__toggle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.cat-compare-tray__toggle[hidden] {
    display: none !important;
}

.cat-compare-tray__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 999px;
    background-color: var(--color-primary);
    color: var(--color-heading);
    font-size: 13px;
}

/* Pulse the yellow count badge when a model is added to compare. */
.cat-compare-tray__count.is-pulse {
    animation: cat-compare-tray-count-pulse 0.7s ease-out 2;
}

@keyframes cat-compare-tray-count-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 70%, transparent);
    }

    55% {
        transform: scale(1.35);
        box-shadow: 0 0 0 10px color-mix(in srgb, var(--color-primary) 0%, transparent);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 0%, transparent);
    }
}

.cat-compare-tray__panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 10px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-surface-white);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.cat-compare-tray__panel[hidden] {
    display: none !important;
}

.cat-compare-tray__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cat-compare-tray__title {
    margin: 0;
    color: var(--color-heading);
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.cat-compare-tray__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: transparent;
    color: var(--color-heading);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.cat-compare-tray__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
}

.cat-compare-tray__item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-left: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
    padding-bottom: 12px;

    &:before {
        display: none;
    }
}

.cat-compare-tray__thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 40px;
    overflow: hidden;
    border-radius: 2px;
    background-color: var(--color-surface-gray);
}

.cat-compare-tray__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cat-compare-tray__item-title {
    flex: 1 1 auto;
    margin: 0;
    color: var(--color-heading);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.cat-compare-tray__item-remove {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-paragraph-body);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.cat-compare-tray__empty {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-compare-tray__empty[hidden] {
    display: none !important;
}

.cat-compare-tray__empty-text {
    margin: 0;
    color: var(--color-paragraph-body);
    font-size: 14px;
}

.cat-compare-tray__empty .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    text-align: center;
}

.cat-compare-tray__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cat-compare-tray__actions[hidden] {
    display: none !important;
}

.cat-compare-tray__actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    text-align: center;
}

.cat-compare-tray__actions .btn[aria-disabled="true"],
.cat-compare-tray__actions .btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.cat-compare-tray__actions .js-cat-compare-tray-add-more[hidden] {
    display: none !important;
}

.cat-compare-tray__toast {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    padding: 10px 12px;
    border-radius: 4px;
    background-color: var(--color-heading);
    color: var(--color-surface-white);
    font-size: 13px;
    line-height: 1.35;
}

.cat-compare-tray__toast[hidden] {
    display: none !important;
}

/* Feed / hero compare toggles */
.new-product-feed__compare,
.product-detail-hero__compare {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-heading);
    font-family: var(--font-button, inherit);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    text-align: left;
}

.new-product-feed__compare:hover .js-cat-compare-toggle-label,
.product-detail-hero__compare:hover .js-cat-compare-toggle-label {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

.new-product-feed__compare:focus-visible,
.product-detail-hero__compare:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

.new-product-feed__compare-box,
.product-detail-hero__compare-box {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-heading);
    border-radius: 2px;
    background-color: var(--color-surface-white);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.new-product-feed__compare.is-checked .new-product-feed__compare-box,
.product-detail-hero__compare.is-checked .product-detail-hero__compare-box {
    background-color: var(--color-primary);
    border-color: var(--color-heading);
}

.new-product-feed__compare.is-checked .new-product-feed__compare-box::after,
.product-detail-hero__compare.is-checked .product-detail-hero__compare-box::after {
    content: "";
    width: 5px;
    height: 10px;
    margin-top: -2px;
    border: solid var(--color-heading);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.new-product-feed__compare.is-compare-focus,
.product-detail-hero__compare.is-compare-focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

.product-detail-hero__compare {
    margin-top: 12px;
}


.link-bar .product-detail-hero__compare {
    margin-top: 0;
    margin-bottom: 0;
}

.link-bar .product-detail-hero__compare-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 12px;
}

.product-detail-hero__compare-item .fx-live-viewers {
    font-size: 18px;
    line-height: 1.25;
    color: var(--color-heading);
}