/* Product comparison plugin. Colours come from the active theme's tokens. */
.cmp-card-toggle, .cmp-product-toggle, .cmp-bar, .cmp-page {
    --cmp-primary: var(--color-theme-primary, var(--theme-primary, #4f46e5));
    --cmp-on-primary: var(--color-theme-on-primary, var(--theme-on-primary, #fff));
    --cmp-text: var(--color-theme-text, var(--theme-text, #18181b));
    --cmp-muted: var(--color-theme-muted, var(--theme-text-muted, #71717a));
    --cmp-border: var(--color-theme-border, var(--theme-border, #e4e4e7));
    --cmp-surface: var(--color-theme-surface, var(--theme-surface, #fff));
    --cmp-title-font: var(--font-title, inherit);
}

/* Button on product cards (top right of the image). */
.cmp-card-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #18181b; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); cursor: pointer; transition: background-color .15s, color .15s, transform .15s; }
.cmp-card-toggle:hover { transform: scale(1.06); }
.cmp-card-toggle svg { width: 1.125rem; height: 1.125rem; }
.cmp-card-toggle.is-active { background: var(--cmp-primary); color: var(--cmp-on-primary); }
.cmp-card-toggle:focus-visible, .cmp-product-toggle:focus-visible { outline: 2px solid var(--cmp-primary); outline-offset: 2px; }

/* Button on the product page. */
.cmp-product-toggle { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1rem; padding: .5rem 0; border: 0; background: none; color: var(--cmp-text); font: inherit; font-weight: 600; cursor: pointer; }
.cmp-product-toggle svg { width: 1.25rem; height: 1.25rem; }
.cmp-product-toggle:hover, .cmp-product-toggle.is-active { color: var(--cmp-primary); }

/* Floating bar. */
.cmp-bar { position: fixed; z-index: 60; left: 50%; bottom: 1rem; width: min(56rem, calc(100% - 2rem)); transform: translateX(-50%); color: var(--cmp-text); }
.cmp-bar[hidden] { display: none; }
.cmp-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; border: 1px solid var(--cmp-border); border-radius: 1rem; background: var(--cmp-surface); padding: .75rem 1rem; box-shadow: 0 20px 40px rgba(0, 0, 0, .18); }
.cmp-bar-items { display: flex; flex: 1; gap: .5rem; min-width: 0; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.cmp-bar-item { position: relative; flex: none; }
.cmp-bar-item img { display: block; width: 3rem; height: 3rem; border-radius: .5rem; object-fit: cover; border: 1px solid var(--cmp-border); }
.cmp-bar-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cmp-bar-remove { position: absolute; top: -.375rem; right: -.375rem; width: 1.25rem; height: 1.25rem; border: 0; border-radius: 999px; background: #18181b; color: #fff; font-size: .875rem; line-height: 1; cursor: pointer; }
.cmp-bar-message { flex-basis: 100%; order: 3; margin: 0; font-size: .8125rem; color: #b91c1c; }
.cmp-bar-message:empty { display: none; }
.cmp-bar-actions { display: flex; align-items: center; gap: 1rem; }
body.has-compare-bar { padding-bottom: 6rem; }

/* Shared controls. */
.cmp-button { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; border: 0; border-radius: .625rem; background: var(--cmp-primary); padding: .625rem 1.125rem; color: var(--cmp-on-primary); font: inherit; font-size: .875rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.cmp-button.is-disabled { opacity: .55; }
.cmp-small { padding: .4rem .75rem; font-size: .8125rem; }
.cmp-link { border: 0; background: none; padding: 0; color: var(--cmp-primary); font: inherit; font-size: .875rem; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.cmp-muted { margin: 0; color: var(--cmp-muted); font-size: .875rem; }
.cmp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Comparison page. */
.cmp-page { max-width: 80rem; margin: 0 auto; padding: 3rem 1rem; color: var(--cmp-text); }
.cmp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.cmp-heading { margin: 0; font-family: var(--cmp-title-font); font-size: 2rem; font-weight: 600; color: var(--cmp-text); }
.cmp-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.cmp-check { display: inline-flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 600; cursor: pointer; }
.cmp-check input { width: 1rem; height: 1rem; accent-color: var(--cmp-primary); }
.cmp-empty { display: grid; justify-items: center; gap: 1rem; border: 1px dashed var(--cmp-border); border-radius: 1rem; padding: 3rem 1rem; text-align: center; }
.cmp-scroll { overflow-x: auto; border: 1px solid var(--cmp-border); border-radius: 1rem; background: var(--cmp-surface); }
.cmp-scroll:focus-visible { outline: 2px solid var(--cmp-primary); }
.cmp-table { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.cmp-table th, .cmp-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--cmp-border); text-align: left; vertical-align: top; }
.cmp-table thead th { vertical-align: bottom; }
.cmp-table tbody tr:last-child th, .cmp-table tbody tr:last-child td { border-bottom: 0; }
.cmp-table td { width: 14rem; min-width: 11rem; max-width: 16rem; }
.cmp-table tr.is-different td { background: color-mix(in srgb, var(--cmp-primary) 6%, transparent); }
.cmp-sticky { position: sticky; left: 0; z-index: 1; width: 9rem; min-width: 7.5rem; background: var(--cmp-surface); font-weight: 600; color: var(--cmp-muted); box-shadow: 1px 0 0 var(--cmp-border); }
.cmp-product { position: relative; display: grid; gap: .5rem; justify-items: start; }
.cmp-product img { display: block; width: 100%; max-width: 11rem; aspect-ratio: 1; border-radius: .75rem; object-fit: cover; background: #f4f4f5; }
.cmp-name { color: var(--cmp-text); font-weight: 600; text-decoration: none; line-height: 1.35; }
.cmp-name:hover { color: var(--cmp-primary); }
.cmp-price { font-family: var(--cmp-title-font); font-size: 1.125rem; font-weight: 700; color: var(--cmp-text); }
.cmp-remove { position: absolute; top: .25rem; right: .25rem; z-index: 1; width: 1.75rem; height: 1.75rem; border: 0; border-radius: 999px; background: rgba(24, 24, 27, .85); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
