/* ─── Кнопка «Сравнить» на карточке в листинге каталога ─── */
.compare-btn {
    background: #fff;
    border: 1px solid #d4d8dc;
    color: #888;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    /* Ховер — только смена цвета/обводки, без transform. Из-за scale
       button начинал тонко прыгать при пере-наведении (race с tooltip).
       Цвет меняем без `transition: all` — точечный transition. */
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.compare-btn svg { width: 16px; height: 16px; }
.compare-btn:hover { color: #21bea6; border-color: #21bea6; }
.compare-btn.is-in-compare {
    background: #21bea6;
    border-color: #21bea6;
    color: #fff;
}

/* В листинге товаров: кнопка в правом нижнем углу карточки.
   Прицепляем к .shoplistitem (это и есть видимая рамка карточки;
   .item — внешний контейнер с position:relative, к нему привязывать
   нельзя — кнопка вылезает за визуальную рамку). */
.shoplistitem { position: relative; }
.compare-btn--card {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 4;
}

/* ─── Кнопка «Сравнить» на странице товара (рядом с «В корзину») ─── */
.compare-btn--detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    height: 36px;
    padding: 0 14px;
    border-radius: 4px;
    font-size: 13px;
    margin-left: 10px;
    vertical-align: middle;
    background: #fff;
    border: 1px solid #d4d8dc;
    color: #444;
}
.compare-btn--detail svg { width: 16px; height: 16px; }
.compare-btn--detail::after { content: 'Сравнить'; }
.compare-btn--detail.is-in-compare { background: #21bea6; border-color: #21bea6; color: #fff; }
.compare-btn--detail.is-in-compare::after { content: '✓ В сравнении'; }

/* ─── Плавающая кнопка «Перейти в сравнение» (правый верх) ─── */
.compare-fab {
    position: fixed;
    top: 90px;
    right: 18px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #21bea6, #1aa893);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(33,190,166,.4), 0 2px 5px rgba(0,0,0,.12);
    z-index: 9998;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.compare-fab.is-visible {
    display: inline-flex;
    /* Покачивание с 6-сек циклом, чуть смещено от Климатика */
    animation: compare-wiggle 5.5s ease-in-out infinite;
}
.compare-fab:hover {
    transform: scale(1.08) rotate(-2deg);
    box-shadow:
        0 0 0 3px #ff9000,
        0 4px 14px rgba(255,144,0,.45);
    animation-play-state: paused;
}
/* SVG-«столбики» внутри иконки чуть растут по очереди — намёк на сравнение */
.compare-fab svg { display: block; transition: transform .15s ease; }
.compare-fab:hover svg { transform: scale(1.1); }

.compare-fab__count {
    position: absolute;
    top: -4px; right: -4px;
    background: #ff9000;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
/* Класс ставится JS-кодом из compare.js на 600мс после изменения счётчика */
.compare-fab.just-changed         { animation: compare-pop .55s ease-out; }
.compare-fab.just-changed .compare-fab__count { transform: scale(1.4); }

/* ─── Анимации ─── */
@keyframes compare-wiggle {
    0%, 88%, 100% { transform: translateY(0)   rotate(0); }
    91%           { transform: translateY(-4px) rotate(-6deg); }
    94%           { transform: translateY(0)   rotate(4deg); }
    97%           { transform: translateY(-2px) rotate(-2deg); }
}
@keyframes compare-pop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.25); }
    70%  { transform: scale(.92); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .compare-fab { top: auto; bottom: 220px; right: 14px; width: 46px; height: 46px; }
}

/* ─── Тост ─── */
.compare-toast {
    position: fixed;
    left: 50%;
    top: 30px;
    transform: translate(-50%, -120%);
    background: #2a4d6e;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    z-index: 10001;
    opacity: 0;
    transition: opacity .2s ease, transform .25s ease;
    pointer-events: none;
}
.compare-toast.is-shown {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ─── Страница сравнения ─── */
.cmp-page { padding: 14px 0 40px; }

/* Ограничение `.component { max-width: 980px }` из crutch.css снято
   через `:has(.cmp-page)` (см. crutch.css). Здесь — только базовое
   растяжение обёртки и таблицы по ширине родителя (= ширина .container,
   как у header'а и крошек). */
body.shop-compare .cmp-page,
body.shop-compare .cmp-table-wrap { width: 100%; }
body.shop-compare .cmp-table { width: 100% !important; }
.cmp-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.cmp-head h1 { margin: 0; color: #2a4d6e; }
.cmp-toggle { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.cmp-toggle label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 6px 12px; border-radius: 16px; background: #f0f2f5; }
.cmp-toggle input { margin: 0; }
.cmp-toggle input:checked + label,
.cmp-toggle label.is-active { background: #2a4d6e; color: #fff; }
.cmp-clear {
    background: #fff; border: 1px solid #e8a3a3; color: #c33;
    border-radius: 4px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.cmp-clear:hover { background: #fce8e8; }

.cmp-empty { background: #fff; border: 1px solid #ececec; border-radius: 8px;
             padding: 60px 30px; text-align: center; color: #888; }
.cmp-empty a { color: #21bea6; font-weight: 600; }

.cmp-table-wrap { overflow-x: auto; border-radius: 8px; background: #fff; border: 1px solid #ececec; }
.cmp-table { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; }
.cmp-table th, .cmp-table td { padding: 10px 12px; border-bottom: 1px solid #ececec; text-align: left; vertical-align: top; font-size: 13px; word-break: break-word; }
.cmp-table th { background: #fafbfc; color: #555; font-weight: 600; font-size: 12px; }
.cmp-table th.cmp-label-col,
.cmp-table td.cmp-label-col {
    position: sticky; left: 0;
    background: #fafbfc;
    z-index: 2;
    border-right: 1px solid #ececec;
    width: 170px;
    color: #666;
}
.cmp-table tr.cmp-row-same { opacity: .35; }

/* Шапка с миниатюрами. Колонки растягиваются на доступную ширину
   за счёт `table-layout: fixed` + `width:100%` на таблице. */
.cmp-card { display: block; text-align: center; padding: 8px 6px; position: relative; }
.cmp-card__remove { position: absolute; top: 4px; right: 4px; background: #fff; border: 1px solid #d4d8dc;
                    color: #888; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; }
.cmp-card__remove:hover { background: #fce8e8; border-color: #e8a3a3; color: #c33; }
.cmp-card__img { width: 110px; height: 110px; object-fit: contain; background: #f6f7f9; border-radius: 4px; margin: 0 auto 8px; display: block; }
.cmp-card__title { font-weight: 600; color: #2a4d6e; text-decoration: none; font-size: 13px; line-height: 1.3; display: block; }
.cmp-card__title:hover { text-decoration: underline; }
.cmp-card__brand { color: #888; font-size: 11px; margin-top: 2px; }
.cmp-card__price { color: #21bea6; font-weight: 700; font-size: 14px; margin-top: 6px; }
