.courses__list {
    display: grid;
    grid-auto-flow: row dense;
    grid-template-columns: repeat(4, 1fr);
    /* Сетка из 4 колонок */
    gap: 1.5em 2em;
    list-style: none;
    margin: 0;
    margin-bottom: 50px;
}

/* Паттерн для общей сетки */
.courses__card:nth-child(9n + 1) {
    grid-column: span 1;
    /* маленькая */
}

.courses__card:nth-child(9n + 2) {
    grid-column: span 2;
    /* большая */
}

.courses__card:nth-child(9n + 3) {
    grid-column: span 1;
    /* маленькая */
}

.courses__card:nth-child(9n + 4) {
    grid-column: span 2;
    /* большая */
}

.courses__card:nth-child(9n + 5) {
    grid-column: span 1;
    /* маленькая */
}

.courses__card:nth-child(9n + 6) {
    grid-column: span 1;
    /* маленькая */
}

.courses__card:nth-child(9n + 7) {
    grid-column: span 1;
    /* маленькая */
}

.courses__card:nth-child(9n + 8) {
    grid-column: span 1;
    /* маленькая */
}

.courses__card:nth-child(9n + 9) {
    grid-column: span 2;
    /* большая */
}

/* Особый случай для ровно 4 элементов */
.courses__list:nth-child(4) {
    grid-template-columns: repeat(2, 1fr);
    /* Сетка из 2 колонок */
}

.courses__list:nth-child(4) .courses__card:nth-child(1) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(4) .courses__card:nth-child(2) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(4) .courses__card:nth-child(3) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(4) .courses__card:nth-child(4) {
    grid-column: span 2;
    /* большая */
}

/* Особый случай для ровно 5 элементов */
.courses__list:nth-child(5) {
    grid-template-columns: repeat(3, 1fr);
    /* Сетка из 3 колонок */
}

.courses__list:nth-child(5) .courses__card:nth-child(1) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(5) .courses__card:nth-child(2) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(5) .courses__card:nth-child(3) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(5) .courses__card:nth-child(4) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(5) .courses__card:nth-child(5) {
    grid-column: span 1;
    /* маленькая */
}

/* Особый случай для ровно 6 элементов */
.courses__list:nth-child(6) {
    grid-template-columns: repeat(3, 1fr);
    /* Сетка из 3 колонок */
}

.courses__list:nth-child(6) .courses__card:nth-child(1) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(6) .courses__card:nth-child(2) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(6) .courses__card:nth-child(3) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(6) .courses__card:nth-child(4) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(6) .courses__card:nth-child(5) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(6) .courses__card:nth-child(6) {
    grid-column: span 1;
    /* маленькая */
}

/* Особый случай для ровно 7 элементов */
.courses__list:nth-child(7) {
    grid-template-columns: repeat(4, 1fr);
    /* Сетка из 4 колонок */
}

.courses__list:nth-child(7) .courses__card:nth-child(1) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(7) .courses__card:nth-child(2) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(7) .courses__card:nth-child(3) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(7) .courses__card:nth-child(4) {
    grid-column: span 2;
    /* большая */
}

.courses__list:nth-child(7) .courses__card:nth-child(5) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(7) .courses__card:nth-child(6) {
    grid-column: span 1;
    /* маленькая */
}

.courses__list:nth-child(7) .courses__card:nth-child(7) {
    grid-column: span 2;
    /* большая */
}

.courses__card {
    height: 22.5em;
    position: relative;
}

.courses__link-disabled {
    height: 100%;
}

.courses__link:hover {
    color: #fff;
}


.courses__img {
    border-radius: 1em;
    display: block;
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.courses__card.marker {
    position: relative;
}

.courses__card.marker::after {
    content: '';
    position: absolute;

    width: 6em;
    height: 6em;

    top: 1em;
    right: 1em;

    background: url('/blocks/courses_cards/img/marker.png') no-repeat;
    background-size: 100% 100%;
}

.courses__text {
    -webkit-backdrop-filter: blur(12.5px);
    backdrop-filter: blur(12.5px);
    background: linear-gradient(0deg, #0003, #0003), #f4f4f44d;
    border-radius: 0 0 1em 1em;
    bottom: 0;
    left: 0;
    padding: 1em 1.25em;
    position: absolute;
    width: 100%;
    color: #fff;

    transition: all .3s ease-in;
}

.courses__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.courses__title,
.courses__category {
    margin: 0;
    font-size: 1.125em;
    font-weight: 600;
    line-height: 133%;
}


.courses__footer {
    height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(10px);
    transition: height .3s cubic-bezier(0.83, 0, 0.55, 0.95), transform 0.1s ease-in-out, opacity .2s ease-in-out;
    will-change: height, transform, opacity;
}

.courses__card:hover .courses__footer {
    height: 3em;
    opacity: 1;
    transform: translateY(0);

    display: flex;
    align-items: end;
}

.courses__card:hover .courses__text {
    -webkit-backdrop-filter: blur(20.5px);
    backdrop-filter: blur(20.5px);
}

/* Course block */

.course-title {
    color: #00ac86;
    margin: 0;
    margin-bottom: 0.5em;
    padding: 1em;
    background-color: #3c3c3c;
    border-radius: 0.5em;
    font-size: 1.8em;
}

.course-block-first {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    grid-template-rows: 2.3fr 1fr;
    gap: 1em;
    width: 100%;
    height: 100%;
    margin-bottom: 1em;
}


.course-block-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1em;
}

.course-description {
    grid-row: span 2 / span 2;
    grid-column-start: 2;
    grid-row-start: 1;

    font-size: 1.2em;
    padding: 1em;
    background-color: #3c3c3c;
    border-radius: 1em;
    color: white;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.target-audience {
    grid-column-start: 1;
    grid-row-start: 2;

    font-size: 1em;
    padding: 1em 2em;
    color: white;
    background-color: #3c3c3c;
    border-radius: 1em;

    display: flex;
    align-items: center;
}


.target-audience ul {
    list-style: none;
    margin: 0;

    display: flex;
    flex-wrap: wrap;
}

.target-audience ul li {
    padding-right: .5em;
    font-size: 1.1em;
}

.target-audience ul li+li::before {
    content: "|";
    color: #00AC86;
    float: left;
    padding-right: .5rem;
}

.course-block-title {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 1em;
}

.course-block-title h4 {
    margin: 0;
    color: white;
}

.course-persantage {
    margin-top: 1em;
}

.course-persantage span {
    color: #00ac86;
    font-weight: 700;
}

.course-persantage p {
    margin: 0;
}

.course-block-second {
    background-color: #3c3c3c;
    padding: 2em 1.5em;
    border-radius: 1em;
    margin-bottom: 1em;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.course-small-element {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    align-items: center;
}

.course-element-desc h4,
.course-element-desc p {
    margin: 0;
}

.course-element-desc h4 {
    color: white;
}

.course-element-desc p {
    color: #00ac86;
}

.course-block-third {
    color: white;

    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1em;
}

.block-third-wrapper {
    display: flex;
    justify-content: space-between;
    background-color: #3c3c3c;
    padding: 2em;
    border-radius: 1em;
}

.block-third-wrapper ul strong {
    color: #00ac86;
    font-weight: 700;
}

.block-third-cta {
    border: 1px solid #05ac86;
    border-radius: 1em;
    display: flex;
    flex-direction: column;
    gap: 1em;
    justify-content: center;
    padding: 2em;
    align-items: center;
}

.block-third-cta h5 {
    text-align: center;
}


.block-third-cta .m__btn {
    width: fit-content;
}

.block-third-cta .btn__main {
    background-color: #00ac86;
    color: white;
}

.block-third-cta .btn__main:hover {
    background-color: #029D7A;
}

.block-third-cta .btn__main span::after {
    filter: invert(80%) sepia(100%) saturate(1%) hue-rotate(67deg) brightness(109%) contrast(101%)
}

#page-blocks-courses_cards-view div.secondary-navigation {
    display: none;
}

.courses__cards {
    gap: 1rem;
}

/* Popup */

/* Стиль для скрытого состояния попапа */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-end;
    /* Попап будет появляться снизу */
    z-index: 1000;
}

/* Плавная анимация для появления попапа */
.popup-window {
    background: #3c3c3c;
    padding: 2rem;
    margin: 0 1rem;
    max-width: 1400px;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    /* Начальная позиция снизу */
    opacity: 0;
    /* Начальная прозрачность */
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    /* Плавный переход */
}

/* Стиль при отображении попапа */
.popup-overlay.show .popup-window {
    transform: translateY(0);
    /* Позиция по умолчанию (по центру) */
    opacity: 1;
    /* Полная видимость */
}

/* Закрытие попапа */
.popup-close {
    position: absolute;
    top: 10px;
    right: 20px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #fff;
}

.popup-close:hover {
    color: #00ac86;
}


.form__wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    align-items: end;
}

.form__wrapper form {
    display: flex;
    flex-direction: column;
}

.form__wrapper img {
    max-width: 100%;
    object-fit: contain;
}

.form__wrapper h2 {
    text-align: center;
    margin-bottom: 1rem;
}

.input__wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.input__wrapper input {
    width: 100%;
}

.input__wrapper.checkboxes {
    grid-column: 1 / 3;
}

.input__wrapper .checkboxes__content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.checkboxes__item {
    display: flex;
    align-items: start;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checkboxes__item input[type="radio"] {
    max-width: 1rem;
    margin-top: 0.25rem;
}

.checkboxes__item label {
    margin: 0;
}

.input__wrapper:last-of-type {
    grid-column: 1 / 3;
}

.input__wrapper:last-of-type textarea {
    width: 100%;
}

#group-fields {
    width: 100%;
}

.form__cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 1rem;
}

.parent_category {
    font-weight: 700;
    border-bottom: 1px solid #00ac86;
}

#courses__list.loading {
    opacity: 0.5;
    pointer-events: none;
}

#courses-active-filters {
    gap: 10px;
}

.courses-separator {
    border: 1px solid #ddd;
    width: 100%;
    margin: 1.5rem 0;
}

.course-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}

.course-status-badge.completed {
    background-color: #00ac86;
    color: white;
}

.course-status-badge.in-progress {
    background-color: #9b9b9b;
    color: #ffffff;
}

.courses__link {
    position: relative;
    display: block;
    height: 100%;
}