/* =========================================================
   Попап карточки врача (AJAX + Fancybox)
   Разметка: /ajax/doctor.php
   ========================================================= */

/* --- Контейнер Fancybox: попап прижат к правому краю --- */
/* Убираем внутренний скролл слайда (второй скролл) и центрирование,
   слайд занимает ровно высоту окна, контент прижат вправо, без переполнения. */
.doctor-popup-fancybox-wrap .fancybox-slide {
    padding: 0;
    margin: 0;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.doctor-popup-fancybox-wrap .fancybox-slide::before {
    display: none;
}

/* Пока открыт попап врача — прячем полосу прокрутки страницы,
   чтобы попап был прижат вплотную к правому краю окна и не было скролла страницы. */
html.doctor-popup-html-lock,
html.doctor-popup-html-lock body {
    overflow: hidden !important;
}

html.doctor-popup-html-lock {
    scrollbar-width: none;
    /* Fancybox компенсирует ширину скроллбара паддингом на body — убираем её */
}

html.doctor-popup-html-lock body {
    padding-right: 0 !important;
}

html.doctor-popup-html-lock::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.doctor-popup-fancybox-wrap .fancybox-content.doctor-popup-fancybox {
    width: 100vw;
    max-width: 1509px;
    height: 100vh;
    max-height: 100vh;
    padding: 0;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    background: #fff;

    border-radius: 24px 0 0 24px;
}

/* Кнопка закрытия поверх контента */
.doctor-popup-fancybox-wrap .fancybox-button {
    background: rgba(255, 255, 255, .9);
    color: #1c1f24;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

.doctor-popup-fancybox-wrap .fancybox-close-small {
    top: 16px;
    right: 20px;
}

/* --- Корневой grid попапа --- */
.doctor-popup {
    display: grid;
    grid-template-columns: 472px 1fr;
    font-family: "Golos", "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1c1f24;
    height: 100vh;
    max-height: 100vh;
}

.doctor-popup__error {
    padding: 40px;
    font-size: 18px;
    text-align: center;
    font-family: "Golos", sans-serif;
}

/* =========================================================
   Левая колонка (aside)
   ========================================================= */
.doctor-popup__aside {
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;


    border-right: 1px solid #E6E8EC;
}

.doctor-popup__photo {
    position: relative;
    width: 100%;
    max-height: 384px;
    max-width: 384px;
    border-radius: 20px;
    overflow: hidden;
    background: #e7eaef;
    margin-bottom: 20px;
    aspect-ratio: 3 / 4;
}

.doctor-popup__img {
    max-width: 384px;
    max-height: 384px;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.doctor-popup__badge {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #F5F6FB;
    border-radius: 8px;

    font-weight: 500;
    font-size: 13px;
    line-height: 20px;
    vertical-align: middle;
    color: #111827;
}

.doctor-popup__name {
    font-weight: 500;
    font-size: 24px;
    line-height: 32px;
    color: #000000;
    margin-bottom: 12px;
    padding: 0 20px;
}

.doctor-popup__spec {
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: #5A616C;
    padding: 0 20px;
}

.doctor-popup__actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 36px;
}

.doctor-popup__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 100px;
    font-weight: 500;
    font-size: 18px;
    line-height: 24px;
    letter-spacing: 0%;

    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
    box-sizing: border-box;
}

.doctor-popup__btn:focus {
    outline: none;
}

.doctor-popup__btn--primary {
    background: #B90640;
    color: #fff;
    border: 1px solid #B90640;
}

.doctor-popup__btn--primary:hover {
    background: #83162b;
    border-color: #83162b;
    color: #fff;
}

.doctor-popup__btn--ghost {
    background: #F0F2F5;
    color: #111827;
    border: 1px solid #F0F2F5;
}

.doctor-popup__btn--ghost path {
    transition: 0.3s;
}

.doctor-popup__btn--ghost:hover {
    background: #E5E8ED;
    color: #111827;
}

.doctor-popup__btn--ghost:hover path {
    stroke: #5A616C;
}

.doctor-popup__btn--ghost svg {
    flex: 0 0 auto;
}

/* =========================================================
   Правая колонка (content)
   ========================================================= */
.doctor-popup__content {
    padding: 48px 84px 48px 40px;
    overflow-y: auto;
    height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
}


.doctor-popup__content::-webkit-scrollbar {
    width: 8px;
}

.doctor-popup__content::-webkit-scrollbar-thumb {
    background: #d7dbe1;
    border-radius: 8px;
}

.doctor-popup__section {
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.doctor-popup__section:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.doctor-popup__title {

    font-weight: 500;
    font-size: 32px;
    line-height: 40px;
    letter-spacing: 0%;
    vertical-align: middle;


    margin-bottom: 24px;
}

.doctor-popup__text {
    font-weight: 500;
    font-size: 18px;
    line-height: 28px;
    letter-spacing: 0%;
    vertical-align: middle;
    color: #5A616C;
}

.doctor-popup__text p {
    margin: 0 0 12px;
}

.doctor-popup__text p:last-child {
    margin-bottom: 0;
}

/* --- Теги услуг --- */
.doctor-popup__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.doctor-popup__tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #F0F2F5;
    color: #111827;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}

.doctor-popup__tag:hover {
    background: #9c1c34;
    color: #fff;
}

/* --- Сетка опыта/образования --- */
.doctor-popup__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.doctor-popup__grid--experience {
    grid-template-columns: repeat(4, 1fr);
}

.doctor-popup__grid--education {
    grid-template-columns: repeat(3, 1fr);
}

/* Режим слайдера: включается через JS (класс is-slider),
   когда элементов больше, чем помещается по ширине. */
.doctor-popup__grid.is-slider {
    display: flex;
    grid-template-columns: none;
    gap: unset;
}

.doctor-popup__grid.is-slider::-webkit-scrollbar {
    height: 6px;
}

.doctor-popup__grid.is-slider::-webkit-scrollbar-thumb {
    background: #d7dbe1;
    border-radius: 8px;
}



div.doctor-popup__item {
    display: flex;
    flex-direction: column;
    gap: 6px;

}

.doctor-popup__year {
    align-self: flex-start;
    padding: 8px 16px;
    background: #F0F2F5;
    border-radius: 8px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;

    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0%;

}

.doctor-popup__item-place {
    font-weight: 500;
    font-size: 18px;
    line-height: 24px;
    color: #111827;

}

.doctor-popup__item-desc {
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: #5A616C;
}

/* --- Сертификаты --- */
.doctor-popup__certs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.doctor-popup__certs-head .doctor-popup__title {
    margin: 0;
}

.doctor-popup__certs-nav {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.doctor-popup__certs-nav:has(.doctor-popup__cert-prev[disabled]):has(.doctor-popup__cert-next[disabled]) {
    display: none;
}

.doctor-popup__cert-prev,
.doctor-popup__cert-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d7dbe1;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
    padding: 0;
}

.doctor-popup__cert-prev:hover,
.doctor-popup__cert-next:hover {
    background: #f0f2f5;
    border-color: #c3c9d1;
}

.doctor-popup__cert-prev:disabled,
.doctor-popup__cert-next:disabled {
    opacity: .4;
    cursor: default;
}

.doctor-popup__certs {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.doctor-popup__certs::-webkit-scrollbar {
    height: 6px;
}

.doctor-popup__certs::-webkit-scrollbar-thumb {
    background: #d7dbe1;
    border-radius: 8px;
}

.doctor-popup__cert {
    flex: 0 0 auto;
    height: 212px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f2f5;
    display: block;
    border: 1px solid #edeff2;
    transition: transform .2s ease, box-shadow .2s ease;
}

.doctor-popup__cert:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}

.doctor-popup__cert img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================================================
   Адаптив
   ========================================================= */
@media (max-width: 860px) {
    .doctor-popup-fancybox-wrap .fancybox-content.doctor-popup-fancybox {
        overflow: auto;
        border-radius: unset;
    }

    .doctor-popup__certs-head {
        margin-bottom: 16px;
    }

    div.doctor-popup__item {
        gap: 0;
    }

    .doctor-popup__title {
        font-weight: 500;
        font-size: 24px;
        line-height: 32px;
        margin-bottom: 16px;
    }

    .doctor-popup__section {
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    .doctor-popup__tag {
        font-weight: 500;
        font-size: 14px;
        line-height: 20px;
    }

    .doctor-popup__text {
        font-weight: 500;
        font-size: 16px;
        line-height: 28px;
        letter-spacing: 0%;
    }

    .doctor-popup__year {
        font-weight: 500;
        font-size: 14px;
        line-height: 20px;
        margin-bottom: 12px;
    }

    .doctor-popup__item-place {
        font-weight: 500;
        font-size: 18px;
        line-height: 24px;
        margin-bottom: 6px;
    }

    .doctor-popup__item-desc {
        font-weight: 500;
        font-size: 16px;
        line-height: 24px;
    }

    .doctor-popup__certs-nav {
        display: none;
    }

    .doctor-popup__grid {
        flex-direction: column;
    }

    .doctor-popup {
        grid-template-columns: 1fr;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        display: block;
    }

    .doctor-popup__aside {
        height: auto;
        max-height: none;
        overflow: visible;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
        padding: 20px;
    }

    .doctor-popup__photo {
        width: 120px;
        flex: 0 0 120px;
        margin-bottom: 0;
        aspect-ratio: 3 / 4;
        max-height: 310px;
    }

    .doctor-popup__img {
        max-height: 310px;
    }

    .doctor-popup__name {
        font-weight: 500;
        font-size: 20px;
        line-height: 24px;
        margin-top: 16px;
    }

    .doctor-popup__spec {
        font-weight: 500;
        font-size: 16px;
        line-height: 24px;
        margin-top: 12px;
    }

    .doctor-popup__name,
    .doctor-popup__spec {
        width: calc(100% - 136px);
        margin-bottom: 0;
    }

    .doctor-popup__spec {
        margin-bottom: 0;
    }

    .doctor-popup__actions {
        margin-top: 24px;
        flex-direction: row;
    }

    .doctor-popup__content {
        height: auto;
        max-height: none;
        overflow: visible;
        padding: 20px;
    }

    .doctor-popup__grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 520px) {
    .doctor-popup__aside {
        flex-direction: column;
        align-items: flex-start;
    }

    .doctor-popup__photo {
        width: 100%;
        flex: none;
    }

    .doctor-popup__name,
    .doctor-popup__spec {
        width: 100%;
    }

    .doctor-popup__actions {
        flex-direction: column;
    }
}