/* Стили Тильды для информационных блоков */
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;500;600;700&display=swap');

.r { padding: 45px 0; background: transparent; }
.t-container { max-width: 1200px; margin: 0 auto; padding: 0 15px; box-sizing: border-box; }
.t-align_center { text-align: center; }
.t-col { display: inline-block; vertical-align: top; width: 100%; box-sizing: border-box; }
.t-row { display: flex; flex-wrap: wrap; margin: 0 -15px; }
.t-col_6 { width: 50%; padding: 0 15px; }
.t-col_10 { width: 83.33%; margin: 0 auto; }
.t-col_12 { width: 100%; }
.t-title_lg { font-size: 52px; font-weight: bold; }

/* ИЗМЕНЕНИЕ: Уменьшен шрифт текста в инфо-блоках (не в табах!) */
.t-text_md { font-size: 16px; line-height: 1.8; font-weight: 300; }
.t817 { font-family: 'Lora', serif; }

.t817__wrapper { list-style: none; padding: 0; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 1160px; }
.t817__tab { border: 1px solid #d9d1c5; border-bottom: none; border-radius: 5px 5px 0 0; }
/* ИЗМЕНЕНИЕ: Убран transition и возвращен исходный размер шрифта */
.t817__tab-name { 
    background: #f9f7f4; 
    border: none; padding: 10px 15px; cursor: pointer; 
    font-size: 14px; 
    font-family: 'Lora', serif; color: #8a8175;
}
.t817__tab:not(.t817__tab_active) .t817__tab-name:hover { background: #fff; }
.t817__tab_active .t817__tab-name { background: #fff; position: relative; top: 1px; font-weight: 600; color: #3d352d; }
.t817__content-row { border-top: 1px solid #d9d1c5; }
.t817__content { display: none; padding: 20px; border: 1px solid #d9d1c5; border-top: none; background: #fff; }
.t817__content_active { display: block; }
.t817__title { margin-bottom: 15px; font-weight: 600; font-size: 24px; }
/* ИЗМЕНЕНИЕ: Выравнивание по ширине и уменьшение шрифта для текста ВНУТРИ табов */
.t817__content .t-text_md {
    text-align: justify;
    font-size: 16px;
}
.t817__wrapper_mobile, .t817__mobile-nav-wrapper { display: none; }

:root {
    --brand: #6d5f51; --page-bg: #fdfaf2; --text-main: #3d352d;
    --text-light: #8a8175; --border-color: #d9d1c5; --sidebar-bg: #f9f7f4;
}
body { 
    font-family: 'Lora', serif; background: var(--page-bg); margin: 0; padding: 20px; color: var(--text-main);
}
hr.divider { width: 85%; margin: 40px auto; border: 0; border-top: 1px solid var(--border-color); }

.header-tabs { display: flex; justify-content: center; margin-bottom: 20px; gap: 10px; max-width: 1200px; margin: 0 auto 20px; }
.header-tab a { 
    display: flex; align-items: center; justify-content: center;
    padding: 15px; text-align: center; text-decoration: none; font-weight: bold; border-radius: 8px; 
    gap: 10px;
}
.header-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.header-tab.red .header-icon {
    fill: rgb(255, 215, 0);
}
.header-tab.red a { background-color: rgb(205, 0, 0); color: white; }
.header-tab.yellow a { background-color: rgb(255, 215, 0); color: #3d352d; }
.header-tab.active a { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.header-tab.inactive { 
    opacity: 0.6; 
}

.mobile-only { display: none; }

.tabs { display: flex; justify-content: center; margin-bottom: -1px; gap: 4px; position: relative; z-index: 1; }
.tab { 
    padding: 12px 22px; font-size: 1.05rem; font-weight: 600;
    border: 1px solid var(--border-color); border-bottom: none;
    border-radius: 8px 8px 0 0; background-color: var(--sidebar-bg);
    color: var(--text-light); cursor: pointer; position: relative; bottom: -1px;
}
.tab.active {
    background-color: #fff; color: var(--text-main); border-bottom-color: #fff;
}
.search-container { 
    display: none; justify-content: center; align-items: center; margin: 0 auto 20px; gap: 15px; flex-wrap: wrap; 
    width: 85%; background: #fff; padding: 20px;
    border: 1px solid var(--border-color); border-radius: 8px; border-top-left-radius: 0;
}
.search-container.active { display: flex; }
#form-surname.active, #form-birthplace.active, #form-service_place.active, #form-coincidence.active { display: flex; }
.search-box { position: relative; width: 300px; }
input, select, button { 
    font-family: 'Lora', serif;
}
.search-box input, select { 
    border: 1px solid var(--border-color); background: #fff;
    border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.search-box input { width: 100%; padding: 12px 40px 12px 16px; font-size: 1rem; height: 48px; box-sizing: border-box; }
.search-box input:focus { outline: none; border-color: var(--brand); }
.search-box .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 18px; color: #aaa; }
#form-service_place .search-box .icon { display: none; }
#form-service_place .search-box input { padding-right: 16px; }

select { height: 48px; padding: 10px; font-size: 1rem; }
button { 
    height: 48px; padding: 10px 20px; border-radius: 10px; 
    font-weight: 600; cursor: pointer;
    background: var(--brand); color: white; border: none;
}
button:hover:not(:disabled) { background: #8a7a6a; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button[id^="stop-"] { background: #c0392b; }
button[id^="stop-"]:hover:not(:disabled) { background: #e74c3c; }
.reset-button { background: #e9ecef; color: var(--text-main); border: 1px solid var(--border-color); }
.reset-button:hover { background: #d8dde1; }

#spinner { display: none; text-align: center; margin: 15px 0; }
#spinner svg { width: 40px; }
#progress-container { width: 80%; margin: 10px auto; height: 10px; background: #eee; border-radius: 5px; display: none; }
#progress-bar { height: 100%; width: 0; background: var(--brand); border-radius: 5px; transition: width 0.6s ease; }
#counter { text-align: center; margin: 10px 0; font-size: 18px; display: none; }

#charts { display: grid; gap: 20px; width: 85%; margin: 20px auto; }
#charts.pamyat-charts { grid-template-columns: repeat(3, 1fr); }
#charts.gwar-charts { grid-template-columns: repeat(2, 1fr); }
#charts.single-column { grid-template-columns: 1fr; }
.chart-box { 
    background: #fff; border-radius: 14px; box-shadow: 0 4px 15px rgba(0,0,0,.06); 
    padding: 20px; text-align: center; min-width: 0; border: 1px solid var(--border-color);
}
.chart-box h2 { font-size: 16px; margin-bottom: 8px; font-weight: 600; }
.chart-canvas-wrapper { position: relative; height: 400px; }
#results-table_wrapper { width: 85%; margin: 40px auto; }
#results-table { width: 100% !important; }
#results-table th, #coincidence-results-table th { background-color: var(--brand); color: white; font-weight: 600; }
#results-table tbody tr:nth-child(even), #coincidence-results-table tbody tr:nth-child(even) { background-color: var(--sidebar-bg); }

.chart-skeleton { 
    padding: 10px 10px 10px 0;
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-around;
}
.skeleton-bar { 
    height: 25px;
    background-color: #e9ecef; 
    border-radius: 4px;
    margin-left: 20px;
}

.chart-box canvas { display: none; }
.chart-box.has-data .chart-skeleton { display: none; }
.chart-box.has-data canvas { display: block; }

.dataTables_wrapper .top-controls,
.dataTables_wrapper .bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    flex-wrap: wrap;
    gap: 15px;
}
.dataTables_filter input {
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    padding: 8px 12px;
    font-size: 0.9rem;
}
.dataTables_filter input:focus {
    outline: none;
    border-color: var(--brand);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-family: 'Lora', serif;
    border: 1px solid var(--border-color) !important;
    background: #fff !important;
    color: var(--text-main) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    margin: 0 4px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.credits {
    width: 85%;
    margin: 20px auto;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-light);
}
.credits a {
    color: var(--text-main);
    text-decoration: none;
}
.credits a:hover {
    text-decoration: underline;
}

#form-coincidence {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

#form-coincidence .search-box, 
#form-coincidence select {
    width: 100%;
}

#coincidence-results-container {
    width: 85%;
    margin: 20px auto;
}

#coincidence-results-table_wrapper {
    margin-top: 20px;
}

.main-results-title, #results-table_wrapper, .main-divider {
    display: block;
}

.person-list div {
    margin-bottom: 8px;
}
.person-list ul {
    margin: 4px 0 0 0;
    padding-left: 20px;
}

@media (max-width: 768px) {
    body { 
        padding: 10px;
        padding-top: 70px;
    }
    
    .t-title_lg, .t-title_lg div { font-size: 26px !important; }
    
    .t-text_md { font-size: 16px; }
    .t-col_6 { width: 100%; padding: 0; }
    
    .header-tabs { 
        flex-direction: row;
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--page-bg);
        padding: 10px;
        margin: -70px -10px 20px -10px;
        width: calc(100% + 20px);
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .header-tab.inactive { 
        opacity: 0.6; 
    }
    .header-tab a { padding: 10px; font-size: 12px; }
    .desktop-only { display: none; }
    .mobile-only { display: inline; }
    
    .tabs .tab {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .search-container { flex-direction: column; align-items: stretch; width: 95%; }
    .search-box, .search-container select, .search-container button { width: 100%; }
    #charts, #results-table_wrapper, hr.divider { width: 95%; }
    #charts.pamyat-charts, #charts.gwar-charts, #charts.single-column { grid-template-columns: 1fr; }
    #results-table_wrapper { overflow-x: auto; }
    
    .credits {
        width: 95%;
    }

    .t817__wrapper { display: none; }
    .t817__mobile-nav-wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 5px;
    }
    .t817__nav-arrow {
        background: var(--sidebar-bg);
        border: 1px solid var(--border-color);
        border-radius: 5px;
        padding: 8px;
        cursor: pointer;
        line-height: 1;
        font-size: 18px;
        color: var(--text-main);
    }
    .t817__nav-arrow:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }
    .t817__mobile-nav-wrapper .t817__wrapper {
        display: block;
        flex-grow: 1;
        overflow: hidden;
    }
    .t817__mobile-nav-wrapper .t817__tab {
        display: none;
        text-align: center;
    }
    .t817__mobile-nav-wrapper .t817__tab_active {
        display: block;
    }
    .t817__mobile-nav-wrapper .t817__tab-name {
        width: 100%;
    }
    
    #coincidence-results-container {
        width: 95%;
    }
}
