/* Общие стили */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Герой-секция — только главная; внутренние страницы используют ssr-common.css */
.home-page .hero-section,
.front-page .hero-section {
    text-align: center;
    padding: 36px 20px;
    background: linear-gradient(135deg, #2a9d8f 0%, #264653 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 40px;
}

.home-page .hero-section h1,
.front-page .hero-section h1 {
    font-size: 2.5em;
    margin: 0;
}

/* Legacy fallback when body class is absent */
.hero-section {
    text-align: center;
    padding: 36px 20px;
    color: white;
    border-radius: 10px;
    margin-bottom: 40px;
}

.hero-section h1 {
    font-size: 2.5em;
    margin: 0;
}

/* Breadcrumbs — slightly larger for readability site-wide */
.breadcrumbs .breadcrumb-list,
.breadcrumbs .breadcrumb-item,
.breadcrumb-list {
    font-size: 0.9375rem;
}

@media (min-width: 768px) {
    .breadcrumbs .breadcrumb-list,
    .breadcrumbs .breadcrumb-item,
    .breadcrumb-list {
        font-size: 1rem;
    }
}

/* Основной контент */
.main-content {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.main-content:has(.post-dates-bar) {
    padding-top: 16px;
}

/* Блоки контента */
.content-block {
    margin-bottom: 40px;
}

.content-block h2 {
    font-size: 1.8em;
    color: #2a9d8f;
    margin-bottom: 20px;
}

.text-block {
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Карточки */
.card-slider {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 20px 0;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    cursor: grab; /* Курсор для перетаскивания */
}

.card-slider:active {
    cursor: grabbing; /* Курсор при активном перетаскивании */
}

.card-item {
    flex: 0 0 300px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    scroll-snap-align: start;
    position: relative;
}

.card-item:hover {
    border-color: #2a9d8f;
    transform: scale(1.05) rotateX(5deg) rotateY(5deg);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    z-index: 1;
}

/* Стрелки */
.slider-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.slider-arrow {
    cursor: pointer;
    font-size: 24px;
    padding: 5px 10px;
    background: #1f7a6d; /* Темнее, чем #2a9d8f */
    color: white;
    border-radius: 50%;
    transition: background 0.3s;
}

.slider-arrow:hover {
    background: #165952; /* Ещё темнее при наведении */
}

/* Бегунок (scrollbar) */
.card-slider::-webkit-scrollbar {
    height: 8px; /* Высота бегунка */
}

.card-slider::-webkit-scrollbar-track {
    background: #f1f1f1; /* Фон бегунка */
    border-radius: 4px;
}

.card-slider::-webkit-scrollbar-thumb {
    background: #2a9d8f; /* Цвет ползунка */
    border-radius: 4px;
}

.card-slider::-webkit-scrollbar-thumb:hover {
    background: #1f7a6d; /* Темнее при наведении */
}

.card-slider {
    -ms-overflow-style: auto; /* Показываем бегунок в IE/Edge */
    scrollbar-width: thin; /* Тонкий бегунок в Firefox */
    scrollbar-color: #2a9d8f #f1f1f1; /* Цвет ползунка и фона в Firefox */
}

/* Аккордеон */
.phd-topics-section .phd-topics-content ul {
    margin: 0.75rem 0 1rem 1.25rem;
    padding: 0;
}

.phd-topics-section .phd-topics-content li {
    margin-bottom: 0.35rem;
}

.phd-topics-section .phd-topics-content a {
    text-decoration: underline;
}

.accordion {
    margin-bottom: 10px;
}

.accordion-header {
    background: white;
    padding: 15px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s, color 0.3s;
}

.accordion-header:hover {
    border-color: #2a9d8f;
    color: #2a9d8f;
}

.accordion-header.active {
    border-color: #2a9d8f;
    color: #2a9d8f;
}

.accordion-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #264653;
    transition: transform 0.3s ease;
}

.accordion-header.active .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 15px;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Кнопка */
.cta-section {
    text-align: center;
    margin-top: 40px;
}

.button {
    display: inline-block;
    padding: 15px 30px;
    background: #2a9d8f;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.button:hover {
    background: #264653;
}

/* Список шагов */
.application-steps {
    margin: 20px 0;
    padding-left: 40px;
}

.application-steps li {
    margin-bottom: 15px;
}

/* Карта */
.map-container {
    position: relative;
    padding-bottom: 56.25%; /* Соотношение 16:9 */
    height: 0;
    overflow: hidden;
}

.map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/*
 * AOS fade-up: only hide content after AOS successfully boots (html.aos-enabled).
 * Live aos.js/css under assets/vendor/aos have 404'd before — without this gate,
 * institute singles stay at opacity:0 forever ("empty blocks").
 */
html:not(.aos-enabled) [data-aos] {
    opacity: 1 !important;
    transform: none !important;
}

html.aos-enabled [data-aos="fade-up"] {
    opacity: 0;
    transform: translateY(20px);
    transition-property: opacity, transform;
    transition-duration: 0.8s;
    transition-timing-function: ease-out;
}

html.aos-enabled [data-aos="fade-up"].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* СТИЛИ ДЛЯ ПОИСКА */
.search-box:not(.header-search-corner .search-box) {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.search-box--compact:not(.header-search-corner .search-box--compact) {
    max-width: 200px;
}

.search-box__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.search-box input:focus {
    outline: none;
    border-color: #2a9d8f;
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

.search-box__icon {
    position: absolute;
    right: 16px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 18px;
    pointer-events: none;
}

.search-box--focused .search-box__icon {
    color: #2a9d8f;
}

/* Listing archives — search pinned to viewport top-right */
body.category .header-search-corner,
body.tag .header-search-corner,
body.search .header-search-corner,
body.category .header-search-corner.is-header-search-mounted,
body.tag .header-search-corner.is-header-search-mounted,
body.search .header-search-corner.is-header-search-mounted {
    position: fixed !important;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + 0px);
    right: 12px;
    left: auto !important;
    transform: none;
    z-index: 1010;
    min-width: 40px;
    min-height: 36px;
    margin: 0 !important;
    width: 210px !important;
    max-width: none !important;
}

/* Open positions archive — masthead search (overrides body.category fixed) */
body.open-phd-positions-archive .header-search-corner,
body.open-phd-positions-archive .header-search-corner.is-header-search-mounted,
body.category.open-phd-positions-archive .header-search-corner,
body.category.open-phd-positions-archive .header-search-corner.is-header-search-mounted {
    position: absolute !important;
    top: 0 !important;
    right: 12px !important;
    left: auto !important;
    transform: none !important;
    z-index: 1010 !important;
    min-width: 40px;
    min-height: 36px;
    margin: 0 !important;
    width: 210px !important;
    max-width: none !important;
}

/* Internal content pages — search in masthead (scrolls with page) */
body.single-post .header-search-corner,
body.single .header-search-corner,
.sch-seo-page .header-search-corner,
.tax-hub-page .header-search-corner,
.aff-hub .header-search-corner,
.aff-country .header-search-corner,
.aff-city .header-search-corner,
body.single-post .header-search-corner.is-header-search-mounted,
body.single .header-search-corner.is-header-search-mounted,
.sch-seo-page .header-search-corner.is-header-search-mounted,
.tax-hub-page .header-search-corner.is-header-search-mounted {
    position: absolute !important;
    top: 0 !important;
    right: 12px !important;
    left: auto !important;
    transform: none !important;
    z-index: 1010 !important;
    min-width: 40px;
    min-height: 36px;
    margin: 0 !important;
    width: 210px !important;
    max-width: none !important;
}

.header-search-corner .search-box,
.header-search-corner .search-box--compact {
    margin: 0 !important;
    max-width: none !important;
    width: 210px;
}

/* СТИЛИ ДЛЯ ПОСТОВ */
.post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.post-item {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e0e0e0;
}

.post-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.post-item__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2a9d8f;
    line-height: 1.4;
}

.post-item__excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
}

.post-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.post-item__meta-item {
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #555;
}

.post-item__link {
    display: inline-block;
    background: #2a9d8f;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.post-item__link:hover {
    background: #264653;
}

/* СТИЛИ ДЛЯ ФИЛЬТРОВ */
.filter-form {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 32px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .hero-section h1 { font-size: 2em; }
    .content-block h2 { font-size: 1.5em; }
    .card-item { flex: 0 0 250px; } /* Уменьшаем карточки на мобильных */
    
    /* Адаптивность поиска */
    .search-box:not(.header-search-corner .search-box) {
        max-width: 100%;
    }
    
    .search-box--compact:not(.header-search-corner .search-box--compact) {
        max-width: 150px;
    }
    
    .header-search-corner,
    .header-search-corner.is-header-search-mounted {
        top: calc(var(--wp-admin--admin-bar--height, 0px) + 0px) !important;
        right: 10px !important;
        left: auto !important;
        transform: none !important;
    }
    
    .search-box input {
        padding: 10px 44px 10px 14px;
        font-size: 14px;
    }
    
    /* Адаптивность постов */
    .post-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .post-item {
        padding: 20px;
    }
    
    .post-item__title {
        font-size: 1.125rem;
    }
    
    .post-item__meta {
        gap: 6px;
    }
    
    .post-item__meta-item {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
    
    /* Адаптивность фильтров */
    .filter-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .hero-section h1 { font-size: 1.75em; }
    .content-block h2 { font-size: 1.25em; }
    
    /* Мобильные устройства */
    .search-box input {
        padding: 8px 12px 8px 32px;
        font-size: 13px;
    }
    
    .post-item {
        padding: 16px;
    }
    
    .post-item__title {
        font-size: 1rem;
    }
    
    .filter-form {
        padding: 16px;
    }
}

/* ============================================
   SUMMARY SECTION STYLES
   ============================================ */
.summary-section {
    /* Используем те же стили, что и content-block-modern */
    margin-bottom: 2rem;
}

.summary-content-modern {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


/* Таблица с информацией */
.summary-info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    border: 1px solid #dee2e6;
}

.summary-table-cell {
    padding: 1rem;
    border: 1px solid #dee2e6;
    vertical-align: middle;
    text-align: left;
}

.summary-info-table--compact .summary-table-cell {
    padding: 0.58rem 0.82rem;
    line-height: 1.28;
    font-size: 0.92rem;
}

/* Overview style closer to Open Positions panel (borderless rows + hover animation) */
.summary-info-table--compact {
    border: none;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin: 0.6rem 0 0.2rem;
}

.summary-info-table--compact .summary-table-cell {
    border: none;
    background: #fff;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.summary-info-table--compact tr .summary-table-cell:first-child {
    width: 36%;
    font-weight: 600;
    color: #475569;
    border-left: 3px solid transparent;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.summary-info-table--compact tr .summary-table-cell:last-child {
    color: #0f172a;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.summary-info-table--compact tr:hover .summary-table-cell,
.summary-info-table--compact tr:focus-within .summary-table-cell {
    background: #f8fafc;
}

.summary-info-table--compact tr:hover .summary-table-cell:first-child,
.summary-info-table--compact tr:focus-within .summary-table-cell:first-child {
    border-left-color: #0d9488;
}

/* Official institute social profiles — compact button row (no embeds/widgets) */
.institute-social-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.institute-social-links li {
    margin: 0;
    flex: 0 0 auto;
}

.institute-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.22rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.institute-social-link:hover,
.institute-social-link:focus {
    background: #ecfdf5;
    border-color: #0d9488;
    color: #0f766e;
    text-decoration: none;
}

@media (max-width: 480px) {
    .institute-social-links {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

.open-vacancy-details {
    margin-top: 4px;
}

.summary-label {
    font-weight: 600;
    color: #2a9d8f;
    font-size: 0.95rem;
    margin-right: 0.5rem;
}

.summary-value {
    color: #333;
    font-size: 1rem;
    line-height: 1.6;
}

.summary-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2a9d8f;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.summary-link:hover {
    color: #264653;
    text-decoration: underline;
}

.summary-link svg {
    transition: transform 0.3s ease;
}

.summary-link:hover svg {
    transform: translateX(2px);
}

/* Якоря-ссылки в таблице */
.summary-anchor-link {
    color: #1a4a4a;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.summary-anchor-link:hover {
    color: #2a9d8f;
    text-decoration: underline;
}

/* Apply Now Button - используем стили как в конце страницы */
.summary-cta-modern {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
    padding-top: 0;
    border-top: none;
    width: 100%;
}

.summary-cta-modern .cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.7rem 1.4rem;
    background: linear-gradient(135deg, #2a9d8f 0%, #264653 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.77rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(42, 157, 143, 0.3);
    visibility: visible;
    opacity: 1;
}

.summary-cta-modern .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(42, 157, 143, 0.4);
    background: linear-gradient(135deg, #264653 0%, #2a9d8f 100%);
    color: white;
}

.summary-cta-modern .cta-button svg {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.summary-cta-modern .cta-button:hover svg {
    transform: translateX(4px);
}


/* ============================================
   RESPONSIVE STYLES FOR SUMMARY & FLOATING BUTTON
   ============================================ */
@media (max-width: 768px) {
    .summary-info-table {
        font-size: 0.9rem;
    }
    
    .summary-table-cell {
        padding: 0.75rem;
    }
    
    .summary-anchor-link {
        font-size: 0.85rem;
    }
    
    .summary-cta-modern .cta-button {
        display: inline-flex !important;
        padding: 0.7rem 1rem;
        font-size: 0.8rem;
        width: 100%;
        justify-content: center;
        min-height: 42px;
        border-radius: 10px;
    }
    
    .summary-cta-modern .cta-button svg {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .summary-table-cell {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .summary-info-table--compact .summary-table-cell {
        padding: 0.48rem 0.66rem;
        font-size: 0.85rem;
        line-height: 1.24;
    }

    .summary-info-table--compact tr .summary-table-cell:first-child {
        width: 42%;
    }
    
    .summary-anchor-link {
        font-size: 0.8rem;
    }
    
    .summary-cta-modern .cta-button {
        display: inline-flex !important;
        padding: 0.68rem 0.9rem;
        font-size: 0.78rem;
        min-height: 40px;
        width: 100%;
        justify-content: center;
    }
    
    .summary-cta-modern .cta-button svg {
        width: 11px;
        height: 11px;
    }
}