/* mod_repo_popular */

.mod-repo-popular {
    font-family: 'Roboto Condensed', sans-serif;
    margin: 10px 0;
}

.mod-repo-popular__table {
    width: 100%;
    border-collapse: collapse;
    background: #fafafa;
}

.mod-repo-popular__table thead th {
    background-color: #007bff;
    color: #fff;
    text-align: left;
    padding: 8px 10px;
    font-weight: 700;
    font-size: 0.95em;
}

.mod-repo-popular__table thead th.rp-uniq,
.mod-repo-popular__table thead th.rp-views,
.mod-repo-popular__table thead th.rp-rank {
    text-align: center;
    white-space: nowrap;
}

.mod-repo-popular__table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e2e2;
    vertical-align: top;
}

.mod-repo-popular__table tr.rp-item:hover {
    background: #f0f6ff;
}

.mod-repo-popular .rp-rank {
    text-align: center;
    width: 36px;
    color: #888;
    font-weight: 700;
}

.mod-repo-popular .rp-title a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 700;
}

.mod-repo-popular .rp-title a:hover {
    color: #2c3e50;
    text-decoration: underline;
}

.mod-repo-popular .rp-uniq,
.mod-repo-popular .rp-views {
    text-align: center;
    white-space: nowrap;
    width: 70px;
}

.mod-repo-popular__table td.rp-views {
    color: #777;
}

/* Кнопка раскрытия стран */
.mod-repo-popular .rp-toggle {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    font-size: 0.78em;
    line-height: 1.6;
    color: #fff;
    background: #28a745;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    vertical-align: middle;
}

.mod-repo-popular .rp-toggle:hover {
    background: #2ebd4f;
}

.mod-repo-popular .rp-toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
}

.mod-repo-popular .rp-toggle[aria-expanded="true"] .rp-toggle-icon {
    transform: rotate(180deg);
}

/* Блок стран — частина тієї ж картки, що й стаття (без окремого фону) */
.mod-repo-popular .rp-countries-row td {
    background: none;
    border-bottom: 1px solid #e2e2e2;   /* нижня межа картки — під країнами */
    padding-top: 0;                      /* прилягає до статті зверху */
}

/* коли за статтею йдуть країни — прибираємо межу між ними (одна картка) */
.mod-repo-popular .rp-item.has-countries td {
    border-bottom: none;
}

/* підсвічування ховером усієї картки (стаття + країни) */
.mod-repo-popular .rp-item.has-countries:hover,
.mod-repo-popular .rp-item.has-countries:hover + .rp-countries-row td {
    background: #f0f6ff;
}

.mod-repo-popular .rp-countries-switch {
    margin-bottom: 8px;
}

.mod-repo-popular .rp-cs-btn {
    padding: 2px 12px;
    font-size: 0.82em;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    cursor: pointer;
}

.mod-repo-popular .rp-cs-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.mod-repo-popular .rp-cs-btn:last-child {
    border-radius: 0 3px 3px 0;
    border-left: none;
}

.mod-repo-popular .rp-cs-btn.is-active {
    background: #007bff;
    color: #fff;
}

.mod-repo-popular .rp-countries-list {
    list-style: none;
    margin: 0;
    padding-left: 2.5em;      /* відступ зліва ~4 символи */
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 0.82em;
    color: #6c757d;
}

.mod-repo-popular .rp-country {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    font-size: 1em;
}

.mod-repo-popular .rp-country.is-ua {
    background: none;
    border: none;
}

.mod-repo-popular .rp-country-name {
    font-weight: 400;
    color: #6c757d;
}

.mod-repo-popular .rp-country-uniq {
    color: #6c757d;
    font-weight: 600;
}

.mod-repo-popular .rp-country-views {
    color: #adb5bd;
    font-size: 0.95em;
}

/* Скрытие Украины в режиме "без України" */
.mod-repo-popular .rp-countries.mode-noua .rp-country.is-ua {
    display: none;
}

.mod-repo-popular__empty,
.mod-repo-popular-empty,
.mod-repo-popular-error {
    padding: 10px;
    font-family: 'Roboto Condensed', sans-serif;
}

/* === Панель переключателей === */
.mod-repo-popular .rp-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    margin-bottom: 12px;
}

.mod-repo-popular .rp-ctl-label {
    font-weight: 700;
    color: #555;
    margin-right: 6px;
    font-size: 0.9em;
}

.mod-repo-popular .rp-period,
.mod-repo-popular .rp-scope {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.mod-repo-popular .rp-period-btn,
.mod-repo-popular .rp-scope-btn {
    padding: 3px 10px;
    font-size: 0.85em;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Roboto Condensed', sans-serif;
}

.mod-repo-popular .rp-period-btn:hover,
.mod-repo-popular .rp-scope-btn:hover {
    background: #eaf3ff;
}

.mod-repo-popular .rp-period-btn.is-active,
.mod-repo-popular .rp-scope-btn.is-active {
    background: #007bff;
    color: #fff;
}

/* Индикатор загрузки */
/* Обгортка таблиці — база для накладки завантаження */
.mod-repo-popular .rp-table-wrap {
    position: relative;
}

/* Індикатор завантаження — накладка, НЕ займає місце в потоці
   (таблиця не «стрибає» при появі/зникненні) */
.mod-repo-popular .rp-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    background: rgba(255, 255, 255, 0.6);
    z-index: 5;
    pointer-events: none;
}

.mod-repo-popular .rp-loading[hidden] {
    display: none;
}

.mod-repo-popular .rp-loading-text {
    color: #555;
    font-style: italic;
    font-size: 0.95em;
    background: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Сообщение в пустой таблице */
.mod-repo-popular .rp-msg {
    padding: 14px 10px;
    color: #777;
    text-align: center;
}

/* Пейджинг «показати ще» */
.mod-repo-popular .rp-hidden {
    display: none;
}

.mod-repo-popular .rp-more-wrap {
    text-align: center;
    margin-top: 10px;
}

.mod-repo-popular .rp-more-btn {
    padding: 6px 20px;
    font-size: 0.9em;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Roboto Condensed', sans-serif;
    transition: background 0.15s;
}

.mod-repo-popular .rp-more-btn:hover {
    background: #007bff;
    color: #fff;
}

/* Мета-строка под названием: автори · журнал, рік */
.mod-repo-popular .rp-meta {
    margin-top: 3px;
    font-size: 0.82em;
    line-height: 1.4;
    color: #6c757d;
}

/* «Наш» автор (ІРГ) — жирним, колір як інші надписи */
.mod-repo-popular .rp-meta .rp-author-iof {
    font-weight: 700;
    color: #555;
}

/* Рік — сірий бейджик на початку мета-рядка */
.mod-repo-popular .rp-meta .rp-year-badge {
    display: inline-block;
    padding: 1px 8px;
    margin-right: 2px;
    background: #e9ecef;
    color: #495057;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95em;
    line-height: 1.4;
    vertical-align: baseline;
}

/* ===== Діаграма: унікальні відвідувачі за роком видання ===== */
.mod-repo-popular .rp-chart-wrap {
    margin-top: 18px;
}

.mod-repo-popular .rp-chart-title {
    font-weight: 700;
    color: #555;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.mod-repo-popular .rp-chart-scroll {
    overflow-x: auto;      /* горизонтальний скрол, якщо років багато */
    padding-bottom: 4px;
}

.mod-repo-popular .rp-chart-svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.mod-repo-popular .rp-bar {
    fill: #007bff;
    transition: fill 0.15s;
}

.mod-repo-popular .rp-bar:hover {
    fill: #0056b3;
}

.mod-repo-popular .rp-bar-zero {
    stroke: #ced4da;
    stroke-width: 1;
}

.mod-repo-popular .rp-bar-val {
    fill: #333;
    font-size: 11px;
    font-weight: 700;
}

.mod-repo-popular .rp-bar-year {
    fill: #777;
    font-size: 11px;
}

/* ===== Таблиця країн (топ-10) з міні-стовпчиками ===== */
.mod-repo-popular .rp-countries-table-wrap {
    margin-top: 22px;
}

.mod-repo-popular .rp-ct-title {
    font-weight: 700;
    color: #555;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.mod-repo-popular .rp-ct {
    width: 100%;
    border-collapse: collapse;
}

.mod-repo-popular .rp-ct-row td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.mod-repo-popular .rp-ct-name {
    white-space: nowrap;
    color: #333;
    font-size: 0.9em;
    width: 1%;
}

.mod-repo-popular .rp-ct-val {
    text-align: right;
    font-weight: 700;
    color: #007bff;
    font-size: 0.9em;
    width: 1%;
    white-space: nowrap;
    padding-right: 14px;
}

.mod-repo-popular .rp-ct-bar {
    width: 60%;
}

.mod-repo-popular .rp-ct-bar-fill {
    display: block;
    height: 12px;
    background: #007bff;
    border-radius: 3px;
    min-width: 2px;
    transition: width 0.3s;
}

/* Україна виділяється трохи іншим відтінком */
.mod-repo-popular .rp-ct-row.is-ua .rp-ct-bar-fill {
    background: #0056b3;
}

/* Рядок «Інші» в таблиці країн */
.mod-repo-popular .rp-ct-row.is-others .rp-ct-name {
    font-style: italic;
    color: #888;
}
.mod-repo-popular .rp-ct-row.is-others .rp-ct-val {
    color: #888;
}
.mod-repo-popular .rp-ct-row.is-others .rp-ct-bar-fill {
    background: #adb5bd;
}

/* ===== Перемикач Таблиця / Карта + карта ===== */
.mod-repo-popular .rp-geo-block {
    margin-top: 22px;
}

.mod-repo-popular .rp-geo-switch {
    display: inline-flex;
    margin-bottom: 12px;
}

.mod-repo-popular .rp-geo-btn {
    padding: 3px 14px;
    font-size: 0.85em;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    cursor: pointer;
    font-family: 'Roboto Condensed', sans-serif;
}
.mod-repo-popular .rp-geo-btn:first-child {
    border-radius: 3px 0 0 3px;
}
.mod-repo-popular .rp-geo-btn:last-child {
    border-radius: 0 3px 3px 0;
    border-left: none;
}
.mod-repo-popular .rp-geo-btn.is-active {
    background: #007bff;
    color: #fff;
}

.mod-repo-popular .rp-map {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
}
/* Leaflet у деяких темах ховає тайли без явного z-index */
.mod-repo-popular .rp-map .leaflet-pane {
    z-index: 1;
}

/* Підпис поточного стану (період + охоплення) у заголовках блоків */
.mod-repo-popular .rp-state-label {
    font-weight: 400;
    color: #868e96;
    font-size: 0.92em;
}
