:root {
    --doctors-purple-dark:  #5C075E;
    --doctors-purple-mid:   #8D2A8F;
    --doctors-purple-light: #8E468F;
    --doctors-bg:           rgba(252, 245, 252, 1);
    --doctors-white:        #fff;
}

.doctors {
    background: var(--doctors-bg);
    padding-top: 80px;
}

.doctor-card-section {
    padding-top: 80px;
    background: #FCF5FC; 
}

.doctors__title {
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 55px;
    line-height: 64px;
    letter-spacing: -0.01em;
    color: var(--doctors-purple-dark);
    margin: 0 0 40px 0;
}

.doctors__filters {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 35px;
}

.doctors__filter-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 35px;
}

.doctors__filter-label {
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 14px;
    line-height: 100%;
    color: var(--doctors-purple-light);
    margin: 0;
}

.doctors__filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.doctors__filter-track {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    flex: 1;
}

.doctors__clear-filters {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 14px;
    line-height: 100%;
    color: #5C075E;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.doctors__clear-filters:hover {
    color: var(--doctors-purple-dark);
}

.doctors__clear-filters-x {
    font-size: 22px;
}

.doctors__specialty-bar {
    display: flex;
    align-items: center;
    background: var(--doctors-white);
    border-radius: 16px;
    padding: 12px 16px;
    gap: 12px;
    overflow: hidden;
}

.doctors__filter-track--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 20px;
    flex: 1;
}

.doctors__filter-track--scroll::-webkit-scrollbar {
    display: none;
}

.doctors__filter-btn {
    flex-shrink: 0;
    background: var(--doctors-white);
    border: 1px solid var(--doctors-purple-mid);
    border-radius: 12px;
    padding: 16px 24px;
    font-family: Manrope, sans-serif;
    font-size: 16px;
    color: var(--doctors-purple-dark);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.doctors__filter-btn:hover {
    background: rgba(141, 42, 143, 0.06);
}

.doctors__filter-btn.active {
    background: var(--doctors-purple-mid);
    color: var(--doctors-white);
    border-color: var(--doctors-purple-mid);
}

.doctors__specialty-bar .doctors__filter-btn {
    padding: 12px 20px;
    font-size: 15px;
    border-radius: 10px;
}

.doctors__filter-arrow {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--doctors-purple-mid);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--doctors-white);
    font-size: 36px;
    line-height: 1;
    padding-bottom: 2px; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.doctors__filter-arrow:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(141, 42, 143, 0.3);
}

.doctors__filter-arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.doctors__filter-arrow:disabled:hover {
    transform: none;
    box-shadow: none;
}

.doctors__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.doctors__card-wrap.hidden {
    display: none;
}

.doctors__card {
    background: var(--doctors-white);
    border-radius: 20px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.doctors__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(141, 42, 143, 0.14);
}

.doctors__card-photo-wrap {
    margin: 20px 20px 0;          
    border-radius: 20px;
    overflow: hidden;
    background: var(--doctors-bg);
    aspect-ratio: 261 / 283;
    flex-shrink: 0;
}

.doctors__card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.doctors__card-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

.doctors__card-name {
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 28px;
    line-height: 36px;
    letter-spacing: -0.01em;
    color: var(--doctors-purple-dark);
    margin: 0 0 14px 0;
}

.doctors__card-specs {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;  /* ← добавить */
    gap: 6px;
    min-height: 62px;           /* ← добавить */
    margin-bottom: 20px;
}

.doctors__card-spec {
    display: inline-block;
    background: var(--doctors-bg);
    border-radius: 5px;
    padding: 5px 10px;
    font-family: Manrope, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 100%;
    color: var(--doctors-purple-dark);
}

.doctors__card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    margin-top: auto;
    padding-top: 8px;
}

.doctors__card-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doctors__card-meta-label {
    font-family: Manrope, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 100%;
    color: var(--doctors-purple-dark);
}

.doctors__card-meta-value {
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 14px;
    line-height: 100%;
    color: var(--doctors-purple-dark);
}

.doctors__card-branches-wrap {
    position: relative;
}

.doctors__card-branches-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 14px;
    line-height: 100%;
    color: var(--doctors-purple-dark);
    text-decoration: none;
    text-align: left;
}

.doctors__branches-popup {
    position: absolute;
    top: -4px;           
    left: 0;
    background: var(--doctors-white);
    border: 1px solid var(--doctors-purple-light);
    border-radius: 15px;
    box-shadow: -1px 1px 4px rgba(0, 0, 0, 0.16);
    padding: 12px 16px;
    min-width: 125px;
    width: max-content;
    max-width: 220px;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.doctors__branches-popup.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.doctors__branches-popup-item {
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 14px;
    line-height: 24px;
    color: var(--doctors-purple-dark);
    margin: 0;
}

.doctors__card-btn {
    display: block;
    width: 100%;
    background: linear-gradient(180deg, #8D2A8F 0%, #8D388F 100%);
    border-radius: 12px;
    padding: 16px 20px;
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 16px;
    line-height: 100%;
    color: var(--doctors-white);
    text-align: center;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    margin-top: 20px;
}

.doctors__card-btn:hover {
    background: linear-gradient(180deg, #C05FC2 0%, #8D2A8F 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(141, 42, 143, 0.3);
}

@media (max-width: 1400px) {
    .doctors__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .doctors { padding-top: 30px !important; }

    .doctors__title {
        font-size: 34px;
        line-height: 46px;
        margin-bottom: 25px;
    }

    .doctors__filters {
        gap: 15px;
        margin-bottom: 40px;
    }

    .doctors__filter-group {
        gap: 15px;
        margin-bottom: 0;
    }

    .doctors__filter-label {
        font-size: 12px;
        line-height: 16px;
    }

    .doctors__filter-track {
        gap: 20px;
    }

    .doctors__filter-btn {
        padding: 10px 20px;
        font-size: 12px;
        line-height: 16px;
        border-radius: 8px;
    }

    .doctors__specialty-bar {
        padding: 20px;
        gap: 15px;
        border-radius: 15px;
    }

    .doctors__specialty-bar .doctors__filter-btn {
        padding: 10px 20px;
        font-size: 12px;
        line-height: 16px;
        border-radius: 8px;
    }

    .doctors__filter-arrow {
        width: 40px;
        height: 40px;
    }

    .doctors__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .doctors__card {
        border-radius: 15px;
    }

    .doctors__card-photo-wrap {
        margin: 15px 15px 0;
        border-radius: 15px;
    }

    .doctors__card-body {
        padding: 15px;
    }

    .doctors__card-name {
        font-size: 18px;
        line-height: 25px;
        letter-spacing: -0.01em;
        margin-bottom: 10px;
    }

    .doctors__card-specs {
        min-height: auto;
        margin-bottom: 15px;
    }

    .doctors__card-spec {
        font-size: 12px;
        padding: 4px 8px;
        border-radius: 4px;
    }

    .doctors__card-meta-label,
    .doctors__card-meta-value {
        font-size: 12px;
    }

    .doctors__card-btn {
        font-size: 12px;
        padding: 10px 16px;
        border-radius: 8px;
        margin-top: 15px;
    }

    .doctors__filters {
        display: flex;
        flex-direction: column;
        position: relative;
        padding-bottom: 30px;
        margin-bottom: 40px;
    }

    .doctors__clear-filters {
        font-size: 12px;
        position: absolute;
        bottom: 0;
        left: 0;
    }
}

@media (max-width: 768px) {
    .doctors__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Dropdown фильтры (мобилка) */
.doctors__filter-dropdown {
    display: none;
}

.doctors__filter-select {
    width: 100%;
    padding: 10px 16px;
    background: #FEFAFF;
    border: 1px solid #C05FC2;
    border-radius: 8px;
    font-family: Manrope, sans-serif;
    font-weight: 500;
    font-size: 12px;
    line-height: 16px;
    color: #B171B2;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='7' height='4' viewBox='0 0 7 4' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L3.5 3L6 1' stroke='%23B171B2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.doctors__mobile-clear {
    display: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 12px;
    line-height: 16px;
    color: #5C075E;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.doctors__mobile-clear-x {
    font-size: 16px;
    color: #8D2A8F;
}

@media (max-width: 576px) {
    .doctors { padding-top: 50px; }

    .doctors__title {
        font-size: 24px;
        line-height: 27px;
        margin-bottom: 20px;
    }

    /* Скрыть desktop фильтры, показать dropdown */
    .doctors__filters {
        display: none;
    }

    .doctors__filter-dropdown {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 25px;
    }

    .doctors__mobile-clear {
        display: flex;
    }

    .doctors__grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Карточка мобилка */
    .doctors__card {
        display: flex;
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        border-radius: 15px;
        position: relative;
    }

    .doctors__card-link {
        border-radius: 15px;
    }

    .doctors__card-photo-wrap {
        margin: 0;
        width: 69px;
        height: 67px;
        aspect-ratio: auto;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .doctors__card-body {
        padding: 0;
        gap: 25px;
    }

    .doctors__card-name {
        font-size: 18px;
        line-height: 25px;
        letter-spacing: -0.01em;
        margin: -77px 0 0 84px;
        min-height: 67px;
        display: flex;
        align-items: center;
    }

    .doctors__card-specs {
        min-height: auto;
        margin-bottom: 0;
        gap: 4px;
    }

    .doctors__card-spec {
        font-size: 12px;
        padding: 4px 8px;
    }

    .doctors__card-meta {
        gap: 10px;
    }

    .doctors__card-meta-label,
    .doctors__card-meta-value {
        font-size: 12px;
    }

    .doctors__card-btn {
        font-size: 12px;
        padding: 10px 16px;
        border-radius: 8px;
        margin-top: 10px;
    }
}

.doctors__card {
    position: relative; 
}

.doctors__card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 20px;
}

.doctors__card-branches-wrap {
    position: relative;
    z-index: 3;
}

.doctors__card-btn {
    position: relative;
    z-index: 2;
}