/**
 * Стили для SEO-контента страниц услуг
 * Файл: css/service-page.css
 *
 * H1, секции, FAQ с аккордеоном, таблица цен, CTA
 */

/* ═══════════════════════════════════════════════════════
   GUTENBERG RESILIENCE
   Все блоки внутри .entry-content на страницах услуг
   должны выдерживать alignleft / alignright / aligncenter /
   alignwide / alignfull и любые другие классы,
   которые редактор добавляет автоматически.
   ═══════════════════════════════════════════════════════ */

/* ── Изображения: всегда вписываются в контейнер ────── */
.entry-content img {
    max-width: 100%;
    height: auto;
}

/* ── Gutenberg: выравнивание изображений ──────────────── */
.entry-content .alignleft {
    float: left;
    margin: 0 24px 16px 0;
    max-width: 50%;
}
.entry-content .alignright {
    float: right;
    margin: 0 0 16px 24px;
    max-width: 50%;
}
.entry-content .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    float: none;
    text-align: center;
}
/* Wide / Full — ограничиваем до контейнера на страницах услуг */
.page .entry-content .alignwide,
.page .entry-content .alignfull {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* ── Clearfix после float-элементов ─────────────────── */
.entry-content::after,
.service-with-doctor__content::after {
    content: "";
    display: table;
    clear: both;
}

/* ── Текстовое выравнивание из Gutenberg ────────────── */
.entry-content .has-text-align-left   { text-align: left; }
.entry-content .has-text-align-center { text-align: center; }
.entry-content .has-text-align-right  { text-align: right; }

/* ── Gutenberg Columns: защита от поломки ────────────── */
.entry-content .wp-block-columns {
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box;
}
.entry-content .wp-block-column {
    box-sizing: border-box;
    min-width: 0;       /* fix: flex items overflow */
    overflow-wrap: break-word;
    word-break: break-word;
}
/* Изображения внутри колонок не ломают flex */
.entry-content .wp-block-column img {
    max-width: 100%;
    height: auto;
}
/* Alignment inside columns: отключаем float, чтобы не ломать flex */
.entry-content .wp-block-column .alignleft,
.entry-content .wp-block-column .alignright {
    float: none;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

/* ── wp:image — figure c выравниванием ────────────────── */
.entry-content .wp-block-image {
    max-width: 100%;
    overflow: hidden;
}
.entry-content .wp-block-image.alignleft {
    float: left;
    margin: 0 24px 16px 0;
    max-width: 50%;
}
.entry-content .wp-block-image.alignright {
    float: right;
    margin: 0 0 16px 24px;
    max-width: 50%;
}
.entry-content .wp-block-image.aligncenter {
    float: none;
    margin-left: auto;
    margin-right: auto;
}
.entry-content .wp-block-image.aligncenter img {
    margin-left: auto;
    margin-right: auto;
}

/* ── wp:group с выравниванием ─────────────────────────── */
.entry-content .wp-block-group.alignwide,
.entry-content .wp-block-group.alignfull {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* ── Gutenberg spacing / gap ─────────────────────────── */
.entry-content .wp-block-columns.is-layout-flex {
    gap: 32px;
}
.entry-content .wp-block-columns:not(.is-not-stacked-on-mobile) {
    flex-wrap: wrap;
}

/* ── Gutenberg таблицы — всегда responsive ───────────── */
.entry-content .wp-block-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.entry-content .wp-block-table table {
    min-width: 100%;
}

/* ── Gutenberg списки — не ломаются float-ом ─────────── */
.entry-content .wp-block-list {
    overflow: hidden; /* clearfix для float-картинок рядом */
}

/* ═══ H1 ══════════════════════════════════════════════ */
.service-page__h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    line-height: 1.3;
    color: #1a1a2e;
    margin-bottom: 16px;
}

.service-page__intro {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #444;
    margin-bottom: 8px;
}

/* ═══ H2 секции ═══════════════════════════════════════ */
.service-page__h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.6rem);
    color: #1a1a2e;
    margin-top: 8px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e31f26;
    display: inline-block;
}

/* ═══ Заметка ═════════════════════════════════════════ */
.service-page__note {
    background: #f0f6ff;
    border-left: 4px solid #2271b1;
    padding: 14px 18px;
    border-radius: 4px;
    margin: 16px 0;
    font-size: 0.95rem;
}

/* ═══ Таблица цен ═════════════════════════════════════ */
.service-page__price-table table {
    width: 100%;
    border-collapse: collapse;
}

.service-page__price-table th {
    background: #1a1a2e;
    color: #fff;
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
}

.service-page__price-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
}

.service-page__price-table tr:hover td {
    background: #f8f9fa;
}

.service-page__price-table td:last-child {
    font-weight: 600;
    color: #e31f26;
    white-space: nowrap;
    text-align: right;
    min-width: 120px;
}

/* ═══ FAQ секция ══════════════════════════════════════ */
.faq-item {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.faq-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.faq-item__question {
    margin: 0;
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    padding-right: 48px;
    transition: background 0.2s;
}

.faq-item__question:hover {
    background: #f0f0f0;
}

/* Стрелка-индикатор */
.faq-item__question::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    font-weight: 300;
    color: #e31f26;
    transition: transform 0.3s;
}

.faq-item.is-open .faq-item__question::after {
    content: '−';
}

.faq-item__answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s;
}

.faq-item.is-open .faq-item__answer {
    max-height: 600px;
    padding: 16px 20px 16px;
}

.faq-item__answer p {
    margin: 8px 0;
    line-height: 1.7;
    color: #555;
}

/* ═══ CTA кнопка ══════════════════════════════════════ */
.service-page__h2 + .wp-block-buttons .wp-block-button__link,
.open-appointment-modal .wp-block-button__link {
    background: #e31f26;
    border-radius: 8px;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
}

.open-appointment-modal .wp-block-button__link:hover {
    background: #c7191f;
    transform: translateY(-1px);
}

/* ═══ Разделители ═════════════════════════════════════ */
.entry-content .wp-block-separator.is-style-wide {
    border-color: #f0f0f0;
    margin: 32px 0;
}

/* ═══ Этапы (H3 внутри контента) ═════════════════════ */
.entry-content h3 {
    font-size: 1.15rem;
    color: #1a1a2e;
    margin-top: 24px;
    margin-bottom: 8px;
}

/* ═══ Адаптив ═════════════════════════════════════════ */
@media (max-width: 768px) {
    .service-page__price-table th,
    .service-page__price-table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .faq-item__question {
        padding: 14px 40px 14px 16px;
        font-size: 0.95rem;
    }

    .faq-item__answer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ═══════════════════════════════════════════════════════
   Карточка врача справа (sticky)
   ═══════════════════════════════════════════════════════ */
.doctor-card-sticky {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    position: sticky;
    top: 24px;
    overflow: hidden;
}

/* ── ПРИНУДИТЕЛЬНЫЙ СБРОС alignment/float внутри карточки ── */
/* Gutenberg может добавить alignleft/alignright к картинке —
   внутри sticky-карточки это ВСЕГДА сбрасывается */
/* Специфичность: html body ... для перебивания WP/Gutenberg */
html body .doctor-card-sticky .alignleft,
html body .doctor-card-sticky .alignright,
html body .doctor-card-sticky .aligncenter,
html body .doctor-card-sticky .wp-block-image.alignleft,
html body .doctor-card-sticky .wp-block-image.alignright,
html body .doctor-card-sticky .wp-block-image.aligncenter,
html body .doctor-card-sticky figure.alignleft,
html body .doctor-card-sticky figure.alignright,
html body .doctor-card-sticky figure.aligncenter,
html body .doctor-card-sticky .wp-block-image {
    float: none;
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 16px;
    max-width: 100%;
    text-align: center;
}

html body .doctor-card-sticky__photo {
    margin: 0 auto 16px;
    float: none;
}

html body .doctor-card-sticky__photo img,
html body .doctor-card-sticky .wp-block-image img,
html body .doctor-card-sticky figure img {
    width: 100%;
    max-width: 240px;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    margin: 0 auto;
    display: block;
    float: none;
}

html body .doctor-card-sticky__name {
    font-size: 1rem;
    color: #1a1a2e;
    margin: 0 0 4px;
    text-align: center;
    clear: both;
}

html body .doctor-card-sticky__role {
    color: #e31f26;
    margin: 0 0 16px;
    text-align: center;
    line-height: 1.4;
    clear: both;
}

.doctor-card-sticky .wp-block-button__link {
    background: #e31f26;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 12px 20px;
    width: 100%;
    transition: background 0.2s;
}

.doctor-card-sticky .wp-block-button__link:hover {
    background: #c7191f;
}

/* ═══ Двухколоночный layout: контент + врач ═══════════ */
/* Специфичность html body для перебивания WP стилей */
html body .service-with-doctor {
    display: flex;
    flex-wrap: nowrap;
    gap: 32px;
    align-items: flex-start;
}

html body .service-with-doctor__content {
    flex: 1 1 0%;
    min-width: 0;
    overflow-wrap: break-word;
}
.service-with-doctor__content img {
    max-width: 100%;
    height: auto;
}
/* Внутри контент-колонки: float разрешён, но ограничен */
.service-with-doctor__content .alignleft,
.service-with-doctor__content .wp-block-image.alignleft {
    float: left;
    margin: 0 20px 12px 0;
    max-width: 45%;
}
.service-with-doctor__content .alignright,
.service-with-doctor__content .wp-block-image.alignright {
    float: right;
    margin: 0 0 12px 20px;
    max-width: 45%;
}
.service-with-doctor__content::after {
    content: "";
    display: table;
    clear: both;
}

html body .service-with-doctor__sidebar {
    flex: 0 0 280px;
    max-width: 300px;
    min-width: 240px;
    width: 280px;
}
/* Sidebar: alignment ВСЕГДА сброшен */
html body .service-with-doctor__sidebar .alignleft,
html body .service-with-doctor__sidebar .alignright,
html body .service-with-doctor__sidebar .aligncenter,
html body .service-with-doctor__sidebar .wp-block-image.alignleft,
html body .service-with-doctor__sidebar .wp-block-image.alignright {
    float: none;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}
.service-with-doctor__sidebar img {
    max-width: 100%;
    height: auto;
}

/* Мобильная: колонки в одну */
@media (max-width: 768px) {
    html body .service-with-doctor {
        flex-direction: column;
        flex-wrap: wrap;
    }

    html body .service-with-doctor__sidebar {
        flex: none;
        max-width: 100%;
        width: 100%;
        min-width: 0;
        order: -1;
    }

    .service-with-doctor__content {
        width: 100%;
    }

    .service-with-doctor__content .alignleft,
    .service-with-doctor__content .alignright,
    .service-with-doctor__content .wp-block-image.alignleft,
    .service-with-doctor__content .wp-block-image.alignright {
        float: none;
        max-width: 100%;
        margin: 0 0 12px;
    }

    .doctor-card-sticky {
        position: static;
        display: flex;
        align-items: center;
        gap: 16px;
        text-align: left;
        padding: 16px;
    }

    html body .doctor-card-sticky .alignleft,
    html body .doctor-card-sticky .alignright,
    html body .doctor-card-sticky .wp-block-image.alignleft,
    html body .doctor-card-sticky .wp-block-image.alignright,
    html body .doctor-card-sticky .wp-block-image {
        margin-bottom: 0;
    }

    html body .doctor-card-sticky__photo {
        margin: 0;
        flex: 0 0 80px;
    }

    .doctor-card-sticky__photo img,
    .doctor-card-sticky .wp-block-image img,
    .doctor-card-sticky figure img {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        max-width: none;
    }

    .doctor-card-sticky__name,
    .doctor-card-sticky__role {
        text-align: left;
    }

    html body .doctor-card-sticky__role {
        margin-bottom: 8px;
    }
}

/* ═══════════════════════════════════════════════════════
   Gutenberg Details Block (раскрывающийся список)
   wp-block-details — <details>/<summary>
   ═══════════════════════════════════════════════════════ */
.entry-content .wp-block-details {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-top: var(--gap-paragraph, 16px);
    margin-bottom: 0;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.entry-content .wp-block-details:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Несколько details подряд — одинаковый gap */
.entry-content .wp-block-details + .wp-block-details {
    margin-top: 12px;
}

.entry-content .wp-block-details summary {
    padding: 16px 48px 16px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    transition: background 0.2s;
    list-style: none;
    margin: 0;
}

.entry-content .wp-block-details summary::-webkit-details-marker {
    display: none;
}

.entry-content .wp-block-details summary::marker {
    display: none;
    content: '';
}

/* Стрелка-индикатор */
.entry-content .wp-block-details summary::after {
    content: '▼';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #e31f26;
    transition: transform 0.3s;
}

.entry-content .wp-block-details[open] summary::after {
    transform: translateY(-50%) rotate(180deg);
}

.entry-content .wp-block-details summary:hover {
    background: #f0f0f0;
}

/* Контент внутри details */
.entry-content .wp-block-details > *:not(summary) {
    padding: 16px 20px 16px;
    margin: 0;
}

.entry-content .wp-block-details > p {
    padding: 16px 20px 16px;
    margin: 0;
    line-height: 1.7;
    color: #555;
}

/* Вложенные элементы внутри details — нормализуем отступы */
.entry-content .wp-block-details ul,
.entry-content .wp-block-details ol {
    padding-left: 20px;
    margin: 8px 0 0;
}

.entry-content .wp-block-details li {
    margin-top: 4px;
    line-height: 1.6;
}

/* Заголовки внутри details — меньший margin */
.entry-content .wp-block-details h2,
.entry-content .wp-block-details h3,
.entry-content .wp-block-details h4 {
    margin-top: 12px;
    margin-bottom: 8px;
}

/* Первый элемент после summary — без лишнего gap */
.entry-content .wp-block-details summary + * {
    margin-top: 0;
}

@media (max-width: 768px) {
    .entry-content .wp-block-details summary {
        padding: 14px 40px 14px 16px;
        font-size: 0.95rem;
    }

    .entry-content .wp-block-details > *:not(summary) {
        padding: 14px 16px 14px;
    }
}

/* ═══════════════════════════════════════════════════════
   Фикс: единообразные отступы перед заголовками
   Работает для h2/h3/h4 и внутри вложенных блоков
   ═══════════════════════════════════════════════════════ */

/* Заголовки внутри колонок и групп тоже получают отступ */
body.page #primary .entry-content .wp-block-column > h2,
body.page #primary .entry-content .wp-block-column > h3,
body.page #primary .entry-content .wp-block-column > h4,
body.page #primary .entry-content .wp-block-column > .wp-block-heading,
body.page #primary .entry-content .wp-block-group > h2,
body.page #primary .entry-content .wp-block-group > h3,
body.page #primary .entry-content .wp-block-group > h4,
body.page #primary .entry-content .wp-block-group > .wp-block-heading {
    margin-top: var(--gap-before-heading, 48px);
}

/* Первый дочерний элемент — без верхнего отступа */
body.page #primary .entry-content .wp-block-column > *:first-child,
body.page #primary .entry-content .wp-block-group > *:first-child {
    margin-top: 0;
}
