/**
 * Страница «Избранное»: плитка компактных карточек, список с подробностями
 * на больших экранах и строки на маленьких.
 */

.gk-fav {
    --fav-line: #d7e0dc;
    --fav-line-soft: #c8e2ea;
    --fav-deep: #023849;
    --fav-link: #0e4f5f;
    --fav-bg: #e9f4f7;
    --fav-muted: #5f7570;
    display: block;
    color: #0b2d38;
}

.gk-fav [hidden] {
    display: none !important;
}

/* Страница лежит внутри .gk-v4-page-content--plain, и общий стиль текстовых
   ссылок добавлял всем ссылкам box-shadow-линию 2px. Здесь он не нужен:
   у ссылок страницы свои подчёркивания. */
.gk-fav a,
.gk-fav a:hover,
.gk-fav a:focus-visible {
    box-shadow: none !important;
    background-image: none !important;
}

/* Шапка */
.gk-fav__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    margin: 0 0 16px;
}

.gk-fav__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    color: var(--fav-deep);
    font-size: clamp(22px, 2.6vw, 30px);
    line-height: 1.15;
}

.gk-fav__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--fav-bg);
    border: 1px solid var(--fav-line-soft);
    color: var(--fav-link);
    font-size: 12.5px;
    font-weight: 700;
}

.gk-fav__lead {
    margin: 0;
    max-width: 70ch;
    color: var(--fav-muted);
    font-size: 13.5px;
}

/* Сегменты «Плитка / Список» и сортировка — как кнопки на странице школ */
.gk-fav__seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--fav-line);
    border-radius: 12px;
    background: #eef4f7;
}

.gk-fav__seg-btn {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--fav-link);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.gk-fav__seg-btn:hover {
    background: rgba(255, 255, 255, .65);
}

.gk-fav__seg-btn.is-on {
    background: #ffffff;
    color: var(--fav-deep);
    box-shadow: 0 2px 8px -5px rgba(2, 56, 73, .5);
}

@media (min-width: 561px) {
    .gk-fav__toolbar .gk-fav__seg + .gk-fav__seg {
        margin-left: auto;
    }
}

/* «Очистить избранное» — в правом верхнем углу страницы */
.gk-fav__clear {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--fav-line);
    border-radius: 10px;
    background: #ffffff;
    color: var(--fav-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.gk-fav__clear:hover,
.gk-fav__clear:focus-visible {
    border-color: #9fc9d6;
    background: #ffecec;
    color: #a33a2a;
}

/* Кнопки в шапке страницы: подбор курса + очистка */
.gk-fav__head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.gk-fav__pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    background: #0e4f5f;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease;
}

.gk-fav__pick:hover,
.gk-fav__pick:focus-visible {
    background: #0b4351;
    color: #ffffff;
    text-decoration: none;
}

/* Перебиваем цвет ссылок текстовых страниц: текст кнопки должен быть белым */
.gk-fav .gk-fav__pick,
.gk-fav .gk-fav__pick:hover,
.gk-fav .gk-fav__pick:focus-visible {
    color: #ffffff;
}

/* Панель инструментов */
.gk-fav__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--fav-line);
    border-radius: 14px;
    background: #fafcfa;
}

.gk-fav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--fav-line-soft);
    border-radius: 10px;
    background: #ffffff;
    color: var(--fav-link);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.gk-fav__btn:hover,
.gk-fav__btn:focus-visible {
    border-color: #9fc9d6;
    background: var(--fav-bg);
    color: var(--fav-deep);
    text-decoration: none;
}

.gk-fav__btn--primary {
    border-color: #2fd06b;
    background: #2fd06b;
    color: #10351d;
}

.gk-fav__btn--primary:hover,
.gk-fav__btn--primary:focus-visible {
    border-color: #24b95e;
    background: #24b95e;
    color: #10351d;
}

.gk-fav__btn--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--fav-muted);
}

.gk-fav__status {
    margin: 0 0 14px;
    color: var(--fav-muted);
    font-size: 13px;
}

/* Плитка компактных карточек */
.gk-fav__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.gk-fav-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--fav-line);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 34px -30px rgba(7, 30, 24, .55);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.gk-fav-card:hover {
    transform: translateY(-2px);
    border-color: #c4d0ca;
    box-shadow: 0 18px 34px -24px rgba(2, 56, 73, .45);
}

.gk-fav-card__media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #e9f4f7, #d7ecf2);
    color: var(--fav-link);
    font-size: 20px;
    font-weight: 800;
    overflow: hidden;
}

.gk-fav-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gk-fav-card__media-link {
    display: block;
    width: 100%;
    height: 100%;
}

.gk-fav-card__media-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gk-fav-card__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(14, 79, 95, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #26424a;
    line-height: 0;
    cursor: pointer;
}

.gk-fav-card__remove svg {
    display: block;
}

.gk-fav-card__remove:hover {
    background: #ffecec;
    border-color: rgba(192, 57, 43, .35);
    color: #c0392b;
}

.gk-fav-card__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px 14px;
    min-width: 0;
}

.gk-fav-card__platform {
    color: var(--fav-muted);
    font-size: 11.5px;
    font-weight: 600;
}

.gk-fav-card__title {
    margin: 0;
    color: var(--fav-deep);
    font-size: 14px;
    line-height: 1.3;
}

/* Перебиваем типографику текстовых страниц (h2 → 23–32px и отступ 44px) */
.gk-fav .gk-fav-card__title {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.gk-fav .gk-fav-card__title a:hover,
.gk-fav .gk-fav-card__title a:focus-visible {
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* Ссылки на инструменты подбора — в одну строку */
.gk-fav-card__links {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    min-width: 0;
    overflow: hidden;
}

.gk-fav-card__links a {
    flex: 0 1 auto;
    overflow: hidden;
    color: var(--fav-link);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-bottom: 1px dashed rgba(14, 79, 95, .4);
}

.gk-fav-card__links a:hover {
    color: var(--fav-deep);
    border-bottom-style: solid;
}

/* «Перейти к сравнению» и «Не более 4 курсов» — в одной строке */
.gk-fav-card__compare-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.gk-fav-card__compare-row .gk-fav-card__compare-link,
.gk-fav-card__compare-row .gk-fav-card__limit {
    margin: 0;
    flex: 0 0 auto;
}

.gk-fav-card__title a {
    color: inherit;
    text-decoration: none;
}

.gk-fav-card__title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gk-fav-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.gk-fav-card__meta span {
    padding: 2px 7px;
    border-radius: 6px;
    background: #f2f6f8;
    color: #26424a;
    font-size: 11px;
}

.gk-fav-card__prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 4px;
}

.gk-fav-card__price {
    color: var(--fav-deep);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.gk-fav-card__old {
    color: #8a9a95;
    font-size: 12.5px;
    text-decoration: line-through;
    white-space: nowrap;
}

.gk-fav-card__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.gk-fav-card__foot .gk-fav__btn {
    flex: 1 1 auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12.5px;
}

.gk-fav-card__foot .gk-fav__btn.is-on {
    border-color: var(--fav-line-soft);
    background: var(--fav-bg);
    color: var(--fav-deep);
}

.gk-fav-card__compare-link {
    display: inline-flex;
    align-items: center;
    color: var(--fav-link);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    border-bottom: 1px dashed rgba(14, 79, 95, .4);
    white-space: nowrap;
}

.gk-fav-card__compare-link:hover {
    color: var(--fav-deep);
    border-bottom-style: solid;
}

.gk-fav-card__limit {
    margin: 0;
    color: #a33a2a;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
}

/* Список + подробности (большие экраны) */
.gk-fav__split {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.gk-fav__list {
    max-height: 620px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--fav-line);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 34px -30px rgba(7, 30, 24, .55);
}

/* Пагинация плитки */
.gk-fav__pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 18px 0 0;
}

.gk-fav__pager-btn,
.gk-fav__pager-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--fav-line);
    border-radius: 10px;
    background: #ffffff;
    color: var(--fav-link);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.gk-fav__pager-btn:hover:not(:disabled),
.gk-fav__pager-num:hover {
    border-color: #9fc9d6;
    background: var(--fav-bg);
    color: var(--fav-deep);
}

.gk-fav__pager-num.is-on {
    border-color: var(--fav-link);
    background: var(--fav-link);
    color: #ffffff;
}

.gk-fav__pager-btn:disabled {
    opacity: .45;
    cursor: default;
}

/* «Посмотреть ещё» на телефоне */
.gk-fav__more-wrap {
    display: flex;
    justify-content: center;
    margin: 14px 0 0;
}

.gk-fav-list-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--fav-line);
    background: transparent;
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    cursor: pointer;
}

.gk-fav-list-item:last-child {
    border-bottom: 0;
}

.gk-fav-list-item:hover {
    background: #fafcfa;
}

.gk-fav-list-item.is-on {
    background: var(--fav-bg);
}

.gk-fav-list-item__thumb {
    display: grid;
    place-items: center;
    width: 52px;
    height: 40px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(135deg, #e9f4f7, #d7ecf2);
    color: var(--fav-link);
    font-size: 12px;
    font-weight: 800;
}

.gk-fav-list-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gk-fav-list-item__name {
    min-width: 0;
    color: var(--fav-deep);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}

.gk-fav-list-item__price {
    color: var(--fav-deep);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

/* Большой блок выбранного курса — по мотивам .gk-v4-single-hero */
.gk-fav-hero {
    position: relative;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
        "media content"
        "media price"
        "media actions";
    gap: 12px 20px;
    align-items: start;
    padding: 18px;
    border: 1px solid var(--fav-line);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 14px 34px -30px rgba(7, 30, 24, .55);
}

.gk-fav-hero > .gk-fav-card__remove {
    top: 12px;
    right: 12px;
}

.gk-fav-hero__media {
    grid-area: media;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid var(--fav-line-soft);
    border-radius: 14px;
    background: linear-gradient(135deg, #e9f4f7, #d7ecf2);
    color: var(--fav-link);
    font-size: 22px;
    font-weight: 800;
}

.gk-fav-hero__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gk-fav-hero__media-link {
    display: block;
    width: 100%;
    height: 100%;
}

.gk-fav-hero__content {
    grid-area: content;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gk-fav-hero__platform {
    color: var(--fav-muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.gk-fav-hero__title {
    margin: 0 0 6px;
    color: var(--fav-deep);
    font-size: 22px;
    line-height: 1.22;
}

/* Перебиваем типографику текстовых страниц: там у h2 margin-top 44px */
.gk-fav .gk-fav-hero__title {
    margin: 0 0 6px;
}

.gk-fav-hero__title a {
    color: inherit;
    text-decoration: none;
}

.gk-fav-hero__title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.gk-fav-hero__summary {
    margin: 0 0 10px;
    color: var(--fav-muted);
    font-size: 13.5px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

/* Краткое описание — только на больших экранах: на телефоне блок компактнее */
@media (max-width: 700px) {
    .gk-fav-hero__summary {
        display: none;
    }
}

.gk-fav-hero__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.gk-fav-hero__facts span {
    padding: 3px 9px;
    border-radius: 7px;
    background: #f2f6f8;
    color: #26424a;
    font-size: 11.5px;
}

.gk-fav-hero__price {
    grid-area: price;
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0;
    color: var(--fav-deep);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}

.gk-fav-hero__price s {
    color: #8a9a95;
    font-size: 14px;
    font-weight: 500;
}

.gk-fav-hero__actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gk-fav-detail__empty {
    margin: 0;
    padding: 18px;
    color: var(--fav-muted);
    font-size: 13.5px;
}

/* На телефоне: картинка слева, название занимает всю правую часть,
   цена — под картинкой, затем кнопки */
@media (max-width: 700px) {
    .gk-fav-hero {
        grid-template-columns: 120px minmax(0, 1fr);
        grid-template-areas:
            "media content"
            "price price"
            "actions actions";
        gap: 10px 14px;
        padding: 16px;
    }

    .gk-fav-hero > .gk-fav-card__remove {
        top: 10px;
        right: 10px;
    }

    .gk-fav-hero__media {
        width: 100%;
        margin: 0;
        font-size: 16px;
    }

    .gk-fav-hero__title {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .gk-fav-hero__summary {
        font-size: 12.5px;
        margin-bottom: 8px;
    }

    .gk-fav-hero__facts {
        margin-bottom: 0;
    }

    .gk-fav-hero__price {
        font-size: 20px;
        margin-top: 4px;
    }

    .gk-fav-hero__price s {
        font-size: 12px;
    }
}

/* Строки (маленькие экраны) */
.gk-fav__rows {
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--fav-line);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 34px -30px rgba(7, 30, 24, .55);
}

.gk-fav-row {
    position: relative;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas:
        "thumb main"
        "thumb price"
        "actions actions";
    gap: 4px 12px;
    align-items: start;
    padding: 12px 36px 12px 14px;
    border-bottom: 1px solid var(--fav-line);
}

.gk-fav-row__thumb {
    grid-area: thumb;
    align-self: start;
    margin-top: 2px;
}

.gk-fav-row__main {
    grid-area: main;
    min-width: 0;
}

.gk-fav-row__price {
    grid-area: price;
    color: var(--fav-deep);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

.gk-fav-row__remove {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(14, 79, 95, .16);
    border-radius: 7px;
    background: #ffffff;
    color: #26424a;
    line-height: 0;
    cursor: pointer;
}

.gk-fav-row__remove:hover {
    border-color: rgba(192, 57, 43, .35);
    background: #ffecec;
    color: #c0392b;
}

.gk-fav-row:last-child {
    border-bottom: 0;
}

.gk-fav-row__thumb {
    display: grid;
    place-items: center;
    width: 56px;
    height: 44px;
    overflow: hidden;
    border-radius: 10px;
    background: linear-gradient(135deg, #e9f4f7, #d7ecf2);
    color: var(--fav-link);
    font-size: 13px;
    font-weight: 800;
}

.gk-fav-row__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gk-fav-row__title {
    color: var(--fav-deep);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
}

.gk-fav-row__title:hover {
    text-decoration: underline;
}

.gk-fav-row__actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    margin-top: 2px;
}

.gk-fav-row__actions .gk-fav-card__compare-row {
    margin-top: 0;
    gap: 8px;
}

.gk-fav-row__actions .gk-fav-card__compare-link,
.gk-fav-row__actions .gk-fav-card__limit {
    font-size: 11.5px;
}

.gk-fav-row__actions .gk-fav__btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

/* Пустое состояние */
.gk-fav__empty {
    padding: 46px 24px;
    border: 1px dashed var(--fav-line);
    border-radius: 20px;
    background: #ffffff;
    text-align: center;
}

.gk-fav__empty-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border: 1px solid var(--fav-line-soft);
    border-radius: 18px;
    background: var(--fav-bg);
    color: #c0392b;
    font-size: 26px;
    line-height: 1;
}

.gk-fav__empty h2 {
    margin: 0 0 6px;
    color: var(--fav-deep);
    font-size: 19px;
}

.gk-fav__empty p {
    margin: 0 auto 18px;
    max-width: 46ch;
    color: var(--fav-muted);
    font-size: 13.5px;
}

.gk-fav__empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Переключение видов */
.gk-fav.is-list .gk-fav__grid {
    display: none;
}

.gk-fav.is-list .gk-fav__split {
    display: grid;
}

@media (max-width: 1000px) {
    .gk-fav__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gk-fav.is-list .gk-fav__split {
        display: none;
    }

    .gk-fav.is-list .gk-fav__rows {
        display: flex;
    }
}

@media (max-width: 560px) {
    .gk-fav__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .gk-fav__toolbar {
        gap: 8px;
    }

    .gk-fav__seg {
        width: 100%;
    }

    .gk-fav__seg-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 1 1 auto;
        padding: 0 10px;
    }

    .gk-fav__clear {
        width: 100%;
        justify-content: center;
    }

    .gk-fav__head-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .gk-fav__pick {
        width: 100%;
    }
}
