/* 1. Страница списка (person_list.html) */

/* Заголовок страницы */
.page-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}
.page-header h1 {
    font-size: 2.8rem;
}
.page-header p {
    font-size: 1.2rem;
    color: var(--subtle-text-color);
    max-width: 700px;
}

/* Сетка персоналий */
.persons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

/* Карточка персоналии */
.person-card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.person-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md-hover);
    border-color: var(--accent-color);
}

.person-image {
    height: 300px;
    background-color: var(--bg-color);
}
.person-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}
.person-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: var(--border-color);
}

.person-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.person-name {
    font-family: var(--header-font);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}
.person-years {
    font-size: 0.95rem;
    color: var(--subtle-text-color);
    margin-bottom: 8px;
}
.person-occupation {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 15px;
}
.person-bio {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 15px;
}
.person-resources-count {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    margin-top: auto;
    text-transform: uppercase;
}

/* Результаты поиска */
.search-results-info {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}
.search-results-info p {
    margin: 0;
    color: var(--subtle-text-color);
}
.search-results-info .results-count {
    margin-top: 5px;
    font-weight: 500;
    color: var(--text-color);
}

/* 2. Страница детализации (person_detail.html) */

/* Хлебные крошки */
.breadcrumb {
    margin-bottom: 40px;
    font-size: 0.9rem;
    color: var(--subtle-text-color);
}
.breadcrumb a {
    color: var(--subtle-text-color);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--accent-color);
}
.breadcrumb span {
    margin: 0 8px;
}

/* Основная сетка страницы */
.person-detail-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 60px;
    align-items: flex-start;
}

/* Левая колонка (сайдбар) */
.person-sidebar {
    position: sticky;
    top: 120px;
}
.person-detail-image {
    margin-bottom: 30px;
}
.person-detail-image .author-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.person-meta {
    text-align: left;
}
.person-detail-name {
    font-family: var(--header-font);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 10px;
}
.person-detail-years {
    font-size: 1.1rem;
    color: var(--subtle-text-color);
    margin-bottom: 15px;
}
.person-detail-occupation {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 25px;
}
.person-detail-place {
    font-size: 1rem;
    margin-bottom: 25px;
}
.person-detail-place strong {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}
.person-detail-place span {
    color: var(--subtle-text-color);
}

.person-stats {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.person-stats .stat-item {
    text-align: left; /* Переопределяем text-align: center из .about-stats-section */
}
.person-stats .stat-number {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-color);
}
.person-stats .stat-label {
    font-size: 1rem;
    color: var(--subtle-text-color);
}


/* Правая колонка (контент) */
.person-content > div {
    margin-bottom: 60px;
}
.person-content h2 {
    font-family: var(--header-font);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* Биография (включая стили для CKEditor) */
.biography-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    text-align: justify;
}

/* Общие стили для контента из CKEditor */
.biography-text, .post-article, .blog-post-content {
    /* Заголовки */
    h1, h2, h3, h4, h5, h6 {
        font-family: var(--header-font);
        font-weight: 600;
        color: var(--text-color);
        margin: 2em 0 1em 0;
        line-height: 1.3;
    }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.7rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.3rem; }
    /* Параграфы */
    p { margin-bottom: 1.5em; }
    /* Списки */
    ul, ol { margin: 1.5em 0; padding-left: 2em; }
    li { margin-bottom: 0.8em; }
    /* Цитаты */
    blockquote {
        background: var(--bg-color);
        border-left: 4px solid var(--accent-color);
        padding: 20px 25px;
        margin: 2em 0;
        border-radius: var(--border-radius-sm);
        font-style: italic;
        color: var(--subtle-text-color);
    }
    /* Изображения */
    img {
        width: 100%;
        height: auto;
        border-radius: var(--border-radius-sm);
        margin: 2em 0;
    }
    .image-style-align-left { float: left; margin: 0 2em 1em 0; max-width: 50%; }
    .image-style-align-right { float: right; margin: 0 0 1em 2em; max-width: 50%; }
    .image-style-align-center { display: block; margin: 2em auto; text-align: center; }
    &::after { content: ""; display: table; clear: both; } /* Очистка float */
}


/* Связанные ресурсы */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.resource-card-small {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    transition: all 0.3s ease;
}
.resource-card-small:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}
.resource-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background-color: var(--bg-color);
}
.resource-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.resource-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--border-color);
}
.resource-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}
.resource-info p {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    margin: 0 0 8px 0;
    line-height: 1.5;
}
.resource-info .resource-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--subtle-text-color);
}

/* Связанные персоналии */
.related-persons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.related-person-card {
    text-decoration: none;
    text-align: center;
    transition: transform 0.2s ease;
}
.related-person-card:hover {
    transform: translateY(-3px);
}
.related-person-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.person-placeholder-small {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--border-color);
    margin: 0 auto 15px;
}
.related-person-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 3px;
}
.related-person-info span {
    font-size: 0.85rem;
    color: var(--subtle-text-color);
}

/* Навигация внизу страницы */
.person-navigation {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}
.person-navigation .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}


/* 3. Адаптивность */
@media (max-width: 992px) {
    .person-detail-grid {
        grid-template-columns: 1fr;
    }
    .person-sidebar {
        position: static;
        text-align: center;
    }
    .person-detail-image .author-image {
        max-width: 300px;
        margin: 0 auto 30px;
    }
    .person-stats .stat-item {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2.2rem;
    }
    .page-header p {
        font-size: 1.1rem;
    }
    .persons-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .person-detail-grid {
        gap: 40px;
    }
    .person-detail-name {
        font-size: 2rem;
    }
    .person-content h2 {
        font-size: 1.6rem;
    }
    .biography-text {
        font-size: 1rem;
    }
}

/* ==============================================
   СТИЛИ ДЛЯ СТРАНИЦЫ ПЕРСОНАЛИЙ
   ============================================== */

/* Верхняя секция с двумя колонками */
.top-section-grid {
    display: grid;
    grid-template-columns: 0.4fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
    align-items: start;
}

/* ==============================================
   ПЕРСОНАЛИЯ ДНЯ (ЛЕВАЯ КОЛОНКА)
   ============================================== */

.person-of-day-section {
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.person-of-day-section .section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    padding: 0px 40px 0;
    color: var(--text-color);
    display: flex;
    align-items:center;
    gap: 10px;
}

.person-of-day-section .section-title i {
    color: var(--primary-color);
}

.person-of-day-card {
    background: white;
    margin: 15px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.person-of-day-card:hover {
    transform: translateY(-3px);
}

.person-of-day-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.person-of-day-image {
    width: 100%;
    height: 280px;
    flex-shrink: 0;
    overflow: hidden;
}

.person-of-day-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.person-placeholder-large {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3.5rem;
}

.person-of-day-info {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.person-of-day-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-color);
    line-height: 1.2;
}

.person-of-day-years {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 8px;
}

.person-of-day-occupation {
    font-size: 1.05rem;
    color: var(--subtle-text-color);
    font-weight: 500;
    margin-bottom: 15px;
}

.person-of-day-bio {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 20px;
    flex: 1;
}

.person-of-day-resources {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

/* ==============================================
   ОБЪЕДИНЕНИЯ (ПРАВАЯ КОЛОНКА)
   ============================================== */

.featured-groups-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.featured-groups-section .section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 !important;
    color: var(--text-color);
    display: flex;
    align-items:center;
    gap: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title i {
    color: var(--primary-color);
}

.view-all-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.view-all-link:hover {
    color: var(--secondary-color);
}

.featured-groups-grid-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    flex: 1;
}

.featured-group-card-compact {
    display: block;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 140px;
}

.featured-group-card-compact:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.featured-group-image-compact {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.featured-group-image-compact img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.featured-group-card-compact:hover .featured-group-image-compact img {
    transform: scale(1.05);
}

.group-placeholder-compact {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.featured-group-overlay-compact {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    padding: 25px 15px 12px;
    color: white;
}

.featured-group-title-compact {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.featured-group-members-compact {
    font-size: 0.8rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ==============================================
   ЗАГОЛОВОК СЕКЦИИ ПЕРСОНАЛИЙ
   ============================================== */

.persons-section-header {
    margin-bottom: 40px;
    text-align: center;
}

.persons-section-header .section-title {
    font-size: 1.8rem;
    justify-content: center;
    margin-bottom: 10px;
}

.section-description {
    font-size: 1rem;
    color: var(--subtle-text-color);
    margin: 0;
    font-style: italic;
}

/* ==============================================
   СЕТКА ПЕРСОНАЛИЙ
   ============================================== */

.persons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.person-card {
    display: block;
    text-decoration: none;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    height: 500px;
}

.person-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.person-image {
    width: 100%;
    height: 350px;
    overflow: hidden;
}

.person-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.person-card:hover .person-image img {
    transform: scale(1.05);
}

.person-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.person-info {
    padding: 20px;
}

.person-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.3;
}

.person-years {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 6px;
}

.person-occupation {
    font-size: 0.95rem;
    color: var(--subtle-text-color);
    font-weight: 500;
    margin-bottom: 12px;
}

.person-bio {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
    margin-bottom: 15px;
}

.person-resources-count {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* ==============================================
   АДАПТИВНОСТЬ
   ============================================== */

@media (max-width: 768px) {
    .top-section-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-bottom: 40px;
    }
    
    .person-of-day-image {
        height: 220px;
    }
    
    .person-of-day-info {
        padding: 20px;
    }
    
    .person-of-day-name {
        font-size: 1.3rem;
    }
    
    .featured-groups-grid-compact {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .featured-group-card-compact {
        height: 120px;
    }
    
    .persons-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 480px) {
    .top-section-grid {
        gap: 25px;
    }
    
    .person-of-day-section .section-title {
        font-size: 1.2rem;
        padding: 15px 15px 0;
    }
    
    .person-of-day-card {
        margin: 10px;
    }
    
    .person-of-day-image {
        height: 180px;
    }
    
    .person-of-day-info {
        padding: 18px;
    }
    
    .person-of-day-name {
        font-size: 1.2rem;
    }
    
    .featured-groups-grid-compact {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .featured-group-card-compact {
        height: 100px;
    }
    
    .featured-group-overlay-compact {
        padding: 20px 12px 10px;
    }
    
    .featured-group-title-compact {
        font-size: 0.85rem;
    }
    
    .persons-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .person-info {
        padding: 15px;
    }
}

/* ==============================================
   СТИЛИ ДЛЯ СТРАНИЦЫ СПИСКА ОБЪЕДИНЕНИЙ
   ============================================== */

/* Сетка объединений */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.group-card {
    display: block;
    text-decoration: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 280px;
    position: relative;
    background: #f8f9fa;
}

.group-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.group-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.group-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.group-card:hover .group-image {
    transform: scale(1.08);
}

.group-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3.5rem;
}

.group-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    padding: 40px 25px 25px;
    color: white;
    transition: all 0.3s ease;
}

.group-card:hover .group-overlay {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
}

.group-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.group-members-count {
    font-size: 1rem;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.group-members-count i {
    font-size: 0.9rem;
}

/* ==============================================
   СТИЛИ ДЛЯ ДЕТАЛЬНОЙ СТРАНИЦЫ ОБЪЕДИНЕНИЯ
   ============================================== */

.group-detail-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 60px;
    margin-top: 40px;
}

/* Левая колонка - изображение и основная информация */
.group-sidebar {
    position: sticky;
    top: 30px;
    height: fit-content;
}

.group-detail-image {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;
}

.group-detail-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.group-detail-image:hover img {
    transform: scale(1.02);
}

.group-meta {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.group-detail-name {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-color);
    line-height: 1.2;
    font-family: var(--header-font);
}

.group-stats {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    color: var(--text-color);
    padding: 12px 0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item i {
    color: var(--primary-color);
    width: 24px;
    font-size: 1.2rem;
}

/* Правая колонка - описание и участники */
.group-content {
    max-width: none;
}

.group-description {
    margin-bottom: 60px;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.group-description h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: var(--text-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-description h2::before {
    content: '';
    width: 4px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 2px;
}

.description-text {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-color);
}

/* Участники группы */
.group-members {
    margin-bottom: 60px;
}

.group-members h2 {
    font-size: 2rem;
    margin-bottom: 35px;
    color: var(--text-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-members h2::before {
    content: '';
    width: 4px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 2px;
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.member-card {
    display: block;
    text-decoration: none;
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.member-card:hover::before {
    transform: scaleX(1);
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.member-image {
    width: 90px;
    height: 90px;
    border-radius: 20%;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.member-card:hover .member-image {
    transform: scale(1.05);
}

.member-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.member-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.member-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.3;
}

.member-role {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 6px;
}

.member-occupation {
    font-size: 0.95rem;
    color: var(--subtle-text-color);
    margin: 0;
    line-height: 1.4;
}

/* Связанные ресурсы */
.group-resources h2 {
    font-size: 2rem;
    margin-bottom: 35px;
    color: var(--text-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-resources h2::before {
    content: '';
    width: 4px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 2px;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.resource-card-small {
    display: block;
    text-decoration: none;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.resource-card-small:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.resource-preview {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f8f9fa;
}

.resource-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.resource-card-small:hover .resource-preview img {
    transform: scale(1.05);
}

.resource-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.resource-info {
    padding: 20px;
}

.resource-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.3;
}

.resource-info p {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    line-height: 1.5;
    margin-bottom: 10px;
}

.resource-type {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==============================================
   АДАПТИВНОСТЬ
   ============================================== */

@media (max-width: 1024px) {
    .group-detail-grid {
        grid-template-columns: 350px 1fr;
        gap: 40px;
    }
    
    .group-detail-name {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .groups-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }
    
    .group-card {
        height: 240px;
    }
    
    .group-title {
        font-size: 1.3rem;
    }
    
    .group-detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .group-sidebar {
        position: static;
    }
    
    .group-meta {
        padding: 25px;
    }
    
    .group-detail-name {
        font-size: 1.8rem;
    }
    
    .group-description {
        padding: 30px;
    }
    
    .members-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 25px;
    }
    
    .member-card {
        padding: 20px;
    }
    
    .member-image {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .groups-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .group-card {
        height: 200px;
    }
    
    .group-overlay {
        padding: 25px 20px 20px;
    }
    
    .group-title {
        font-size: 1.2rem;
    }
    
    .group-members-count {
        font-size: 0.9rem;
    }
    
    .group-meta {
        padding: 20px;
    }
    
    .group-detail-name {
        font-size: 1.5rem;
    }
    
    .group-description {
        padding: 25px;
    }
    
    .group-description h2,
    .group-members h2,
    .group-resources h2 {
        font-size: 1.6rem;
    }
    
    .members-grid {
        grid-template-columns: 1fr;
    }
    
    .member-card {
        padding: 18px;
    }
    
    .member-image {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }
    
    .member-name {
        font-size: 1.1rem;
    }
    
    .member-role {
        font-size: 0.9rem;
    }
    
    .member-occupation {
        font-size: 0.85rem;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .resource-info {
        padding: 15px;
    }
    
    .resource-info h4 {
        font-size: 1rem;
    }
    
    .resource-info p {
        font-size: 0.85rem;
    }
    
    .stat-item {
        font-size: 1rem;
        padding: 10px 0;
    }
    
    .description-text {
        font-size: 1rem;
    }
}

.biography-toggle {
   background: none;
   border: none;
   cursor: pointer;
   font-size: 1.5rem;
   padding: 0;
   display: flex;
   align-items: center;
   gap: 0.5rem;
   width: 100%;
   text-align: left;
 }

 .biography-toggle i {
   transition: transform 0.3s ease;
   margin-bottom: 10px;
 }

 .biography-toggle.collapsed i {
   transform: rotate(-90deg);
   margin-bottom: 10px;
 }

 .biography-content {
   max-height: 0;
   overflow: hidden;
   transition: max-height 0.3s ease-out;
 }

 .biography-content.show {
   max-height: 2000px;
   /* Достаточно большое значение для любого контента */
   transition: max-height 0.5s ease-in;
 }

 .biography-preview {
   color: #6c757d;
   font-style: italic;
   margin-top: 0.5rem;
 }

 /* Стили для секции рекомендуемых персоналий */
.featured-persons-section {
  margin-bottom: 50px;
}

.featured-persons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

.featured-person-card {
  background: var(--card-bg-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.featured-person-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.featured-person-header {
  padding: 20px 25px 0;
}

.featured-person-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.featured-person-content {
  display: flex;
  padding: 20px 25px 25px;
  gap: 20px;
}

.featured-person-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.featured-person-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-placeholder-featured {
  width: 100%;
  height: 100%;
  background: var(--subtle-bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subtle-text-color);
  font-size: 2.5rem;
}

.featured-person-info {
  flex: 1;
  min-width: 0;
}

.featured-person-name {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--primary-color);
}

.featured-person-years {
  font-size: 0.95rem;
  color: var(--subtle-text-color);
  margin-bottom: 6px;
}

.featured-person-occupation {
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: 500;
  margin-bottom: 10px;
}

.featured-person-bio {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-color);
  margin-bottom: 10px;
}

.birthday-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff6b6b, #ffa500);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Адаптивность */
@media (max-width: 768px) {
  .featured-persons-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .featured-person-content {
    flex-direction: column;
    text-align: center;
  }
  
  .featured-person-image {
    width: 100px;
    height: 100px;
    margin: 0 auto;
  }
}

/* ==============================================
   СТИЛИ ДЛЯ AFFINITY GROUPS
   ============================================== */

.affinity-section-header {
  text-align: center;
  margin-bottom: 40px;
  margin-top: 60px;
}

.affinity-section-header .section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-color);
}

.affinity-section-header .section-description {
  font-size: 1rem;
  color: var(--subtle-text-color);
  margin: 0;
  font-style: italic;
}

/* Сетка affinity групп */
.affinity-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

/* Карточка affinity группы */
.affinity-group-card {
  background: var(--card-bg-color);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.affinity-group-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-5px);
}

/* Заголовок affinity группы */
.affinity-group-header {
  padding: 25px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  position: relative;
}

.affinity-group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.affinity-group-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  line-height: 1.3;
  color:#212529;
}

.affinity-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  padding: 8px;
  backdrop-filter: blur(10px);
  color:#212529;
}

.affinity-group-description {
  font-size: 0.95rem;
  margin: 10px 0 0 0;
  opacity: 0.95;
  line-height: 1.5;
  color:#212529;
}

/* Кнопка "Показать все персоналии" */
.btn-show-all-persons {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color:#212529;
  border: none;
  padding: 18px 40px;
  border-radius: 50px;
  font-size: 1.4rem;
  font-weight: 600;
  font-family: var(--main-font);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.btn-show-all-persons:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-show-all-persons:active {
  transform: translateY(-1px);
}

.all-persons-count {
  font-size: 0.9rem;
  opacity: 0.9;
  font-family: var(--main-font);
}

/* Модальное окно affinity */
.affinity-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
  align-items: center;
  justify-content: center;
}

.affinity-modal-title {
    color:#212529;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.affinity-modal-content {
  position: relative;
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  width: 90%;
  max-width: 1200px;
  max-height: 85vh;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
  animation: slideDown 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.affinity-modal-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 25px 30px;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.affinity-modal-header h3 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color:#212529;
}

.affinity-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.affinity-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.affinity-modal-body {
  padding: 40px;
  overflow-y: auto;
  flex: 1;
  background-color: #f8f9fa;
}

/* Scrollbar для модального окна */
.affinity-modal-body::-webkit-scrollbar {
  width: 10px;
}

.affinity-modal-body::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 10px;
}

.affinity-modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.affinity-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

.affinity-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 40px;
  color: var(--primary-color);
  font-size: 1.1rem;
  font-weight: 600;
}

.affinity-loading i {
  font-size: 1.5rem;
}

.affinity-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 60px 40px;
  color: #dc3545;
  text-align: center;
}

.affinity-error i {
  font-size: 3rem;
  opacity: 0.5;
}

.affinity-error p {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #212529;
}

/* Expanded content styles (в модальном окне) */
.affinity-content-expanded {
  padding: 0;
}

.affinity-expanded-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #dee2e6;
}

.affinity-expanded-header h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 10px;
}

.affinity-description {
  font-size: 1rem;
  line-height: 1.6;
  color: #6c757d;
  margin-bottom: 15px;
}

.affinity-stats {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  color: var(--primary-color);
  font-weight: 600;
}

.affinity-stats i {
  margin-right: 5px;
}

/* Компактная сетка персоналий */
.persons-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

/* Компактная карточка персоналии */
.person-card-compact {
  display: block;
  text-decoration: none;
  background: #ffffff;
  border: 2px solid #dee2e6;
  border-radius: var(--border-radius-md);
  padding: 15px;
  transition: all 0.3s ease;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.person-card-compact:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-3px);
}

.person-image-compact {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 15px;
  border: 3px solid #dee2e6;
  transition: border-color 0.3s ease;
}

.person-card-compact:hover .person-image-compact {
  border-color: var(--primary-color);
}

.person-image-compact img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.person-placeholder-compact {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
}

.person-info-compact {
  text-align: center;
}

.person-name-compact {
  font-size: 1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 5px;
  line-height: 1.3;
}

.person-years-compact {
  font-size: 0.85rem;
  color: var(--primary-color);
  font-weight: 500;
  margin-bottom: 4px;
}

.person-occupation-compact {
  font-size: 0.85rem;
  color: #6c757d;
  margin: 0;
  line-height: 1.4;
}

/* ==============================================
   АДАПТИВНОСТЬ ДЛЯ AFFINITY GROUPS
   ============================================== */

@media (max-width: 768px) {
  .affinity-groups-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .affinity-group-header {
    padding: 20px;
  }

  .affinity-group-name {
    font-size: 1.2rem;
  }

  .affinity-count-badge {
    min-width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }

  .btn-show-all-persons {
    padding: 15px 30px;
    font-size: 1rem;
  }

  .affinity-modal-content {
    width: 95%;
    margin: 2% auto;
    max-height: 90vh;
  }

  .affinity-modal-header {
    padding: 20px;
  }

  .affinity-modal-header h3 {
    font-size: 1.5rem;
  }

  .affinity-modal-body {
    padding: 25px;
  }

  .affinity-expanded-header h3 {
    font-size: 1.4rem;
  }

  .persons-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .person-image-compact {
    width: 70px;
    height: 70px;
  }

  .person-name-compact {
    font-size: 0.95rem;
  }

  .person-years-compact,
  .person-occupation-compact {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .affinity-section-header .section-title {
    font-size: 1.6rem;
    flex-direction: column;
    gap: 8px;
  }

  .affinity-group-header {
    padding: 18px;
  }

  .affinity-group-name {
    font-size: 1.1rem;
  }

  .btn-show-all-persons {
    padding: 12px 25px;
    font-size: 0.95rem;
  }

  .affinity-modal-content {
    width: 98%;
    margin: 1% auto;
    max-height: 95vh;
  }

  .affinity-modal-header {
    padding: 15px;
  }

  .affinity-modal-header h3 {
    font-size: 1.3rem;
  }

  .affinity-modal-close {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }

  .affinity-modal-body {
    padding: 20px;
  }

  .persons-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .person-card-compact {
    padding: 12px;
  }

  .person-image-compact {
    width: 60px;
    height: 60px;
  }
}
