/*
  edukursy — сравнение курсов: кнопка «Сравнить», плавающая панель, страница /compare/.
  Если на сайте уже подключён полный style.css из основного пакета — этот файл НЕ нужен.
  Подключайте compare.css, только если у сайта свой CSS.
  Нужны CSS-переменные ниже (если на сайте свои — замените значения), а также
  классы .btn, .btn--primary, .btn--outline, .btn--block, .visually-hidden — они есть в style.css.
*/
:root {
  --c-text: #1a1d23;
  --c-muted: #5b6270;
  --c-bg-light: #f4f6f9;
  --c-border: #dde1e8;
  --c-primary: #1f5eff;
  --c-primary-dark: #1546c4;
  --c-accent: #0f9d6b;
  --header-h: 64px;
  --gutter: 16px;
}

/* ============================================================
   СРАВНЕНИЕ КУРСОВ /compare/
   ============================================================ */

.cmp-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 20px;
}
.cmp-add__label {
  font-weight: 600;
}
.cmp-add__select {
  flex: 1 1 260px;
  max-width: 420px;
}
.cmp-add .btn--outline {
  padding: 10px 18px;
}
.cmp-add__diff {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  cursor: pointer;
}
.cmp-add__diff input {
  width: 18px;
  height: 18px;
  accent-color: var(--c-primary);
}

/* ===== Итоги ===== */
.cmp-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.cmp-pick {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--c-border);
  border-radius: 16px;
  background: #fff;
}
.cmp-pick__tag {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: #e2f5ec;
  color: #1f8a5b;
  font-size: 14px;
  font-weight: 700;
}
.cmp-pick__name {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 800;
}
.cmp-pick__school {
  font-size: 14px;
  color: var(--c-muted);
}
.cmp-pick__text {
  margin: 10px 0 18px;
  color: var(--c-muted);
}
.cmp-pick .btn {
  margin-top: auto;
  padding: 12px 18px;
}

/* ===== Таблица ===== */
.cmp-legend {
  margin: -12px 0 20px;
  font-size: 14px;
  color: var(--c-muted);
}
.cmp-scroll {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: 16px;
  background: #fff;
}
.cmp-scroll:focus-visible {
  outline: 3px solid var(--c-primary);
}
.cmp-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
}
.cmp-table th,
.cmp-table td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-border);
}
.cmp-table tbody th[scope="row"],
.cmp-table tfoot th,
.cmp-corner {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 220px;
  min-width: 160px;
  background: #fff;
  color: var(--c-muted);
  font-weight: 500;
  box-shadow: 1px 0 0 var(--c-border);
}
.cmp-corner {
  z-index: 3;
  vertical-align: bottom;
  font-size: 14px;
}
.cmp-col {
  min-width: 220px;
  font-weight: 400;
}
.cmp-table td + td,
.cmp-table th + td,
.cmp-col + .cmp-col {
  border-left: 1px solid var(--c-border);
}

.cmp-head {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmp-head__remove {
  position: absolute;
  top: -6px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #8a909b;
  font-size: 22px;
  text-decoration: none;
}
.cmp-head__remove:hover {
  background: var(--c-bg-light);
  color: var(--c-text);
}
.cmp-head__school {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-right: 28px;
  font-size: 14px;
  color: var(--c-muted);
  text-decoration: none;
}
.cmp-head__school img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}
.cmp-head__rating::before {
  content: "★ ";
  color: #f5a524;
}
.cmp-head__name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--c-text);
  text-decoration: none;
}
.cmp-head__name:hover {
  color: var(--c-primary);
}
.cmp-head__price {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 800;
}
.cmp-head__price s,
.cmp-table s {
  font-size: 14px;
  font-weight: 400;
  color: #9aa1ad;
}
.cmp-head .btn {
  padding: 11px 16px;
}

.cmp-group__head th {
  padding-top: 22px;
  background: var(--c-bg-light);
  color: var(--c-text);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cmp-group__head th[scope="rowgroup"] {
  position: sticky;
  left: 0;
}
.cmp-sub {
  font-size: 13px;
  color: var(--c-muted);
}
.cmp-yes {
  color: var(--c-accent);
  font-weight: 800;
}
.cmp-no {
  color: #b9bfca;
}
.cmp-star::before {
  content: "★ ";
  color: #f5a524;
}
.cmp-table td.is-best {
  background: #f0faf5;
}
.cmp-best {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 6px;
  background: #e2f5ec;
  color: #1f8a5b;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 1px;
}
.cmp-legend .cmp-best {
  margin-left: 0;
}
.cmp-table tfoot th,
.cmp-table tfoot td {
  border-bottom: 0;
  vertical-align: middle;
}
.cmp-table tfoot .btn {
  padding: 12px 16px;
}
.cmp-more {
  display: block;
  margin-top: 8px;
  text-align: center;
  font-size: 14px;
}

/* ===== Липкая панель на мобильном ===== */
.cmp-sticky {
  display: none;
}
@media (max-width: 767.98px) {
  .cmp-sticky {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    position: sticky;
    bottom: 0;
    z-index: 90;
    padding: 8px var(--gutter);
    background: #fff;
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
  }
  .cmp-sticky__item {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .cmp-sticky__name {
    font-size: 12px;
    color: var(--c-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cmp-sticky__price {
    font-size: 15px;
    font-weight: 800;
  }
  .cmp-sticky .btn {
    margin-top: 4px;
    padding: 8px 6px;
    font-size: 14px;
  }
  .cmp-add__diff {
    margin-left: 0;
  }
  .cmp-table tbody th[scope="row"],
  .cmp-table tfoot th,
  .cmp-corner {
    width: 130px;
    min-width: 130px;
    font-size: 14px;
  }
}


/* ============================================================
   КНОПКА «СРАВНИТЬ» + ПАНЕЛЬ СРАВНЕНИЯ (compare.js)
   ============================================================ */

/* ----- Кнопка: общее ----- */
.cmp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.cmp-btn svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cmp-btn__on,
.cmp-btn .cmp-btn__icon-on {
  display: none;
}
.cmp-btn[aria-pressed="true"] .cmp-btn__on,
.cmp-btn[aria-pressed="true"] .cmp-btn__icon-on {
  display: inline;
}
.cmp-btn[aria-pressed="true"] .cmp-btn__off,
.cmp-btn[aria-pressed="true"] .cmp-btn__icon-off {
  display: none;
}
.cmp-btn:focus-visible {
  outline: 3px solid rgba(31, 94, 255, 0.35);
  outline-offset: 2px;
}

/* ----- Вариант 1: на карточке каталога (поверх обложки) ----- */
.catalog-card {
  position: relative;
}
.cmp-btn--card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--c-text);
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(20, 23, 28, 0.14);
  backdrop-filter: blur(4px);
}
.cmp-btn--card:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.cmp-btn--card[aria-pressed="true"] {
  border-color: var(--c-primary);
  background: var(--c-primary);
  color: #fff;
}
.cmp-btn--card[aria-pressed="true"]:hover {
  background: var(--c-primary-dark);
  color: #fff;
}
@media (hover: hover) and (min-width: 768px) {
  .cmp-btn--card[aria-pressed="false"] .cmp-btn__off {
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.2s;
  }
  .cmp-btn--card[aria-pressed="false"] {
    gap: 0;
    padding: 0 9px;
  }
  .catalog-card:hover .cmp-btn--card[aria-pressed="false"],
  .cmp-btn--card[aria-pressed="false"]:focus-visible {
    gap: 6px;
    padding: 0 12px;
  }
  .catalog-card:hover .cmp-btn--card[aria-pressed="false"] .cmp-btn__off,
  .cmp-btn--card[aria-pressed="false"]:focus-visible .cmp-btn__off {
    max-width: 120px;
  }
}
.catalog-card:has(.cmp-btn--card[aria-pressed="true"]) {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 1px var(--c-primary);
}

/* ----- Вариант 2: в карточке цены (на всю ширину) ----- */
.cmp-btn--block {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px dashed #b9c3d6;
  border-radius: 10px;
  background: #fff;
  color: var(--c-text);
  font-size: 15px;
}
.cmp-btn--block:hover {
  border-style: solid;
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.cmp-btn--block[aria-pressed="true"] {
  border: 1px solid #b8ccff;
  background: #eef3ff;
  color: var(--c-primary-dark);
}
.price-box .cmp-btn--block {
  margin-top: 10px;
}

/* Ссылка «Перейти к сравнению (N)» */
.cmp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-primary);
}
.cmp-link[hidden] {
  display: none;
}
.cmp-link span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-primary);
  color: #fff;
  font-size: 12px;
}
.price-box .cmp-link {
  display: flex;
  justify-content: center;
}
.price-box .cmp-link[hidden] {
  display: none;
}

/* ----- Вариант 3: в шапке курса, рядом с фактами ----- */
.cmp-btn--inline {
  margin-top: 16px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--c-primary);
  border-radius: 10px;
  background: #fff;
  color: var(--c-primary);
  font-size: 15px;
}
.cmp-btn--inline:hover {
  background: #eef3ff;
}
.cmp-btn--inline[aria-pressed="true"] {
  background: var(--c-primary);
  color: #fff;
}

/* ----- Вариант 4: иконка в липкой мобильной панели ----- */
.cmp-btn--icon {
  flex: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  color: var(--c-text);
}
.cmp-btn--icon svg {
  width: 20px;
  height: 20px;
}
.cmp-btn--icon[aria-pressed="true"] {
  border-color: var(--c-primary);
  background: #eef3ff;
  color: var(--c-primary);
}
.sticky-cta__actions {
  display: flex;
  gap: 8px;
}

/* ----- Счётчик в меню «Сравнения» ----- */
.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 2px;
}
.nav-count[hidden] {
  display: none;
}

/* ----- Плавающая панель сравнения ----- */
.cmp-tray {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 120;
  width: min(1080px, calc(100% - 24px));
  transform: translateX(-50%);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(20, 23, 28, 0.18);
  animation: cmp-in 0.2s ease-out;
}
.cmp-tray[hidden] {
  display: none;
}
@keyframes cmp-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.cmp-tray__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 12px 12px 16px;
}
.cmp-tray__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--c-text);
  text-align: left;
  cursor: default;
}
.cmp-tray__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eef3ff;
  color: var(--c-primary);
}
.cmp-tray svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cmp-tray__title {
  display: flex;
  flex-direction: column;
  font-weight: 800;
  line-height: 1.2;
}
.cmp-tray__count {
  font-size: 13px;
  font-weight: 400;
  color: var(--c-muted);
}
.cmp-tray__chevron {
  display: none;
}
.cmp-tray__rail {
  position: relative;
  min-width: 0;
}
.cmp-tray__list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.cmp-tray__list::-webkit-scrollbar {
  display: none;
}
.cmp-tray__list > li {
  flex: 0 0 200px;
  scroll-snap-align: start;
}
.cmp-tray__nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 50%;
  background: #fff;
  color: var(--c-text);
  box-shadow: 0 2px 8px rgba(20, 23, 28, 0.15);
  transform: translateY(-50%);
  cursor: pointer;
}
.cmp-tray__nav:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.cmp-tray__nav--prev {
  left: -10px;
}
.cmp-tray__nav--next {
  right: -10px;
}
.cmp-tray.can-left .cmp-tray__nav--prev,
.cmp-tray.can-right .cmp-tray__nav--next {
  display: grid;
}
.cmp-tray.can-left .cmp-tray__list {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40px);
  mask-image: linear-gradient(90deg, transparent 0, #000 40px);
}
.cmp-tray.can-right .cmp-tray__list {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.cmp-tray.can-left.can-right .cmp-tray__list {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 40px, #000 calc(100% - 40px), transparent);
}
.cmp-tray__chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 48px;
  padding: 0 6px 0 12px;
  border-radius: 10px;
  background: var(--c-bg-light);
}
.cmp-tray__chip--empty {
  justify-content: center;
  padding: 0;
  border: 1px dashed var(--c-border);
  background: none;
  color: #9aa1ad;
  font-size: 13px;
}
.cmp-tray__chip-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}
.cmp-tray__chip-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cmp-tray__chip-school {
  overflow: hidden;
  font-size: 12px;
  color: var(--c-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cmp-tray__remove {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--c-muted);
  cursor: pointer;
}
.cmp-tray__remove:hover {
  background: #fff;
  color: #c23d58;
}
.cmp-tray__remove svg {
  width: 16px;
  height: 16px;
}
.cmp-tray__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cmp-tray__clear {
  padding: 8px 4px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--c-muted);
  text-decoration: underline;
  cursor: pointer;
}
.cmp-tray__clear:hover {
  color: var(--c-text);
}
.cmp-tray__go {
  min-height: 46px;
  padding: 0 20px;
  white-space: nowrap;
}
.cmp-tray__go--disabled {
  background: #e7eaf0;
  color: #8a919e;
  font-weight: 600;
  cursor: default;
}
body.has-cmp-tray {
  padding-bottom: 100px;
}

@media (max-width: 1023.98px) {
  .cmp-tray {
    bottom: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .cmp-tray--raised {
    bottom: 66px;
    border-radius: 16px 16px 0 0;
  }
  .cmp-tray__inner {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }
  .cmp-tray__head {
    cursor: pointer;
  }
  .cmp-tray__chevron {
    display: block;
    color: var(--c-muted);
    transition: transform 0.2s;
  }
  .cmp-tray.is-collapsed .cmp-tray__chevron {
    transform: rotate(180deg);
  }
  .cmp-tray__rail {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .cmp-tray__list > li {
    flex-basis: 70%;
    max-width: 240px;
  }
  .cmp-tray__nav {
    display: none !important;
  }
  .cmp-tray.is-collapsed .cmp-tray__rail {
    display: none;
  }
  .cmp-tray__actions {
    grid-column: 2;
    grid-row: 1;
  }
  .cmp-tray__clear {
    display: none;
  }
  .cmp-tray__go {
    min-height: 42px;
    padding: 0 14px;
    font-size: 15px;
  }
  body.has-cmp-tray {
    padding-bottom: 130px;
  }
}
@media (max-width: 1023.98px) {
  .cmp-tray__chip--empty {
    display: none;
  }
}
.cmp-tray__chip--empty {
  flex-basis: 140px !important;
}

/* ----- Тост ----- */
.cmp-toast {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h) + 12px);
  z-index: 130;
  max-width: calc(100% - 24px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--c-text);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(20, 23, 28, 0.25);
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.cmp-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.cmp-toast a {
  margin-left: 6px;
  color: #9db9ff;
  font-weight: 700;
}

/* ----- Страница сравнения: навигация по широкой таблице (любое число курсов) ----- */
.cmp-table-wrap {
  position: relative;
}
.cmp-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: -8px 0 12px;
}
.cmp-nav[hidden] {
  display: none;
}
.cmp-nav__pos {
  margin-right: 4px;
  font-size: 14px;
  color: var(--c-muted);
}
.cmp-nav__btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  color: var(--c-text);
  cursor: pointer;
}
.cmp-nav__btn:hover:not(:disabled) {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.cmp-nav__btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.cmp-nav__btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cmp-scroll {
  scroll-snap-type: x proximity;
  scroll-padding-left: 220px;
}
.cmp-table {
  width: max-content;
  min-width: 100%;
}
.cmp-col {
  width: 240px;
  min-width: 240px;
  max-width: 280px;
  scroll-snap-align: start;
}
@media (max-width: 767.98px) {
  .cmp-scroll {
    scroll-padding-left: 130px;
  }
  .cmp-col {
    width: 200px;
    min-width: 200px;
  }
  .cmp-sticky {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  .cmp-sticky__item {
    flex: 0 0 calc((100% - 12px) / 3);
    scroll-snap-align: start;
  }
}


/* ----- Пустое состояние /compare/ ----- */
.cmp-empty {
  max-width: 560px;
  padding: 40px 24px;
  border: 1px dashed var(--c-border);
  border-radius: 16px;
  text-align: center;
  margin: 0 auto;
}
.cmp-empty p {
  margin: 12px 0 20px;
  color: var(--c-muted);
}
.cmp-empty .btn {
  padding: 12px 22px;
}
