/* Превью матча: личные встречи, последние игры, лидеры, дисквалификации.
   Подключается из views/tournament/match/_preview.php (отдельно от main.min.css). */

.h2h-preview-stack {
    box-sizing: border-box;
}
/* Одинаковый отступ между всеми секциями в стеке (split → лидеры = лидеры → дисквалификации и т.д.) */
.h2h-preview-stack > .h2h-preview-section + .h2h-preview-section {
    margin-top: 22px;
}

/* Панели в split — без глобального margin-bottom у .uiblock-white (иначе снизу +15–22px и зазор до «Лучшие игроки» кажется вдвое больше, чем до «Дисквалификации») */
.h2h-preview-stack .h2h-preview-section--split .uiblock-white.h2h-meetings-last-panel {
    margin-bottom: 0 !important;
}
/* Оболочка заголовок + панель: светлая — один визуальный блок; тёмная — прозрачная, заголовок над карточкой (не внутри) */
.h2h-preview-panel-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
}
.h2h-preview-section--split .h2h-meetings-equal-col > .h2h-preview-panel-shell {
    flex: 1 1 auto;
}
.h2h-section-title-wrap {
    text-align: left;
    flex-shrink: 0;
}
html:not([data-theme="dark"]) .h2h-preview-panel-shell {
    border: 1px solid #e8ebe9;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}
html:not([data-theme="dark"]) .h2h-preview-panel-shell > .h2h-section-title-wrap {
    margin: 0;
    padding: 10px 14px 8px;
}
html:not([data-theme="dark"]) .h2h-preview-panel-shell > .uiblock-white.h2h-meetings-last-panel {
    flex: 1 1 auto;
    min-height: 0;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .h2h-preview-panel-shell {
    background: transparent;
    border: none;
    box-shadow: none;
}
html[data-theme="dark"] .h2h-preview-panel-shell > .h2h-section-title-wrap {
    margin: 0 0 10px;
    padding: 0 2px;
}
.h2h-meetings-last-table tbody td .black-head {
    display: inline;
    margin: 0;
    padding: 0;
    background: transparent;
    font-size: inherit;
    text-transform: none;
    font-weight: bold;
}
.h2h-meetings-last-table tbody td a.h2h-last-meetings-score,
.h2h-meetings-last-table tbody td a.h2h-last-meetings-score:visited {
    color: rgb(0, 114, 188);
    border-bottom: 1px dotted rgb(0, 114, 188);
    text-decoration: none;
    padding: 1px 0;
    cursor: pointer;
}
.h2h-meetings-last-table tbody td a.h2h-last-meetings-score:hover {
    border-bottom-color: transparent;
    text-decoration: none;
}
.h2h-last-meetings-score {
    font-weight: bold;
}
.h2h-meetings-last-empty {
    border-top: 1px solid #e8ebe9;
    padding: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
}
.h2h-meetings-last-empty p {
    padding: 16px 12px 20px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}
.h2h-meetings-equal-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}
.h2h-preview-section--split .h2h-meetings-equal-col {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
}
.h2h-preview-section--split .h2h-meetings-equal-col:last-child {
    margin-bottom: 0;
}
@media (min-width: 768px) {
    .h2h-preview-section--split .h2h-meetings-equal-row {
        flex-wrap: nowrap;
    }
    .h2h-preview-section--split .h2h-meetings-equal-col {
        margin-bottom: 0;
    }
    .h2h-preview-section--split .h2h-meetings-equal-row > .h2h-col-stat {
        flex: 0 0 30%;
        width: 30%;
        max-width: 30%;
        padding-right: 6px;
        box-sizing: border-box;
    }
    .h2h-preview-section--split .h2h-meetings-equal-row > .h2h-col-last {
        flex: 0 0 70%;
        width: 70%;
        max-width: 70%;
        min-width: 0;
        padding-left: 6px;
        box-sizing: border-box;
    }
}

/* Split: фиксированная «витрина» списка последних матчей (N строк + скролл) — обе темы; отличие макета только у лидеров / pie */
.h2h-preview-section--split {
    --h2h-last-meetings-visible-rows: 8;
    --h2h-last-meetings-row-height: 3.5rem;
}

.h2h-preview-section--split .h2h-meetings-equal-row .h2h-meetings-last-panel {
    min-height: 0;
    justify-content: center;
}

.h2h-preview-section--split .h2h-meetings-equal-row > .h2h-col-last .h2h-meetings-last-panel {
    flex: 0 0 auto;
    justify-content: flex-start;
}

.h2h-preview-section--split .h2h-meetings-equal-row .h2h-meetings-last-panel .table-responsive {
    flex: 0 0 auto;
    width: 100%;
}

.h2h-preview-section--split .h2h-meetings-equal-row > .h2h-col-last .h2h-meetings-last-panel > .table-responsive {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    height: calc(var(--h2h-last-meetings-visible-rows) * var(--h2h-last-meetings-row-height));
    min-height: calc(var(--h2h-last-meetings-visible-rows) * var(--h2h-last-meetings-row-height));
    max-height: calc(var(--h2h-last-meetings-visible-rows) * var(--h2h-last-meetings-row-height));
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.h2h-preview-section--split .h2h-meetings-equal-row > .h2h-col-last .h2h-meetings-last-panel > .table-responsive .h2h-meetings-last-table {
    width: 100%;
}

.h2h-preview-section--split .h2h-meetings-equal-row .h2h-meetings-last-empty {
    flex: 0 0 auto;
    width: 100%;
}

.h2h-preview-section--split .h2h-meetings-equal-row .h2h-meetings-last-empty p {
    padding-top: 12px;
    padding-bottom: 12px;
}

.h2h-meetings-last-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    margin: 0;
    border: 1px solid #e8ebe9;
    border-radius: 4px;
}
.h2h-meetings-last-panel .table-responsive {
    flex: 1 1 auto;
}
.h2h-meetings-last-table {
    margin-bottom: 0;
}

.h2h-team-leaders-wrap {
    margin-top: 0;
    padding: 0;
}
.h2h-team-leaders-wrap .uiblock-white,
.h2h-disqual-wrap .uiblock-white {
    margin-bottom: 0;
}
.h2h-team-leaders-table {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}
/* Светлая тема: «Лучшие игроки» — обычная таблица */
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .h2h-team-leaders-table {
    display: table;
    width: 100%;
}
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .h2h-team-leaders-table tbody {
    display: table-row-group;
}
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .h2h-team-leaders-table tbody tr {
    display: table-row;
    margin-bottom: 0;
    padding: 0;
    border-radius: 0;
    background: none;
    border: none;
    box-shadow: none;
}
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .h2h-team-leaders-table tbody tr:hover {
    filter: none;
}
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .h2h-team-leaders-table tbody td {
    display: table-cell;
    flex: none;
    width: auto;
    vertical-align: middle;
    padding: 8px;
    box-sizing: border-box;
}
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .h2h-team-leaders-table tbody td.h2h-team-leaders-center {
    flex: unset;
    min-width: 0;
    max-width: none;
}
html:not([data-theme="dark"]) .h2h-team-leaders-wrap .table-responsive {
    padding: 0;
}
html:not([data-theme="dark"]) .h2h-team-leaders-footnote {
    margin: 8px 0 0;
    padding: 0 12px 10px;
    text-align: center;
}

.h2h-team-leaders-center {
    white-space: normal;
}
.h2h-team-leaders-side {
    min-width: 0;
}

/* Тёмная тема: строки лидеров — овальные «капсулы» (flex вместо table-row) */
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table {
    display: block;
    width: 100%;
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table tbody {
    display: block;
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table tbody tr {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    padding: 0;
    border-radius: 9999px;
    background: linear-gradient(145deg, #eef2f7 0%, #dce6f0 45%, #cfd9e6 100%);
    border: 1px solid rgba(99, 118, 141, 0.22);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.07);
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table tbody tr:last-child {
    margin-bottom: 0;
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table tbody td {
    display: block;
    flex: 1 1 34%;
    width: auto !important;
    vertical-align: middle;
    padding: 10px 14px;
    border: none !important;
    background: transparent !important;
    box-sizing: border-box;
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table.table-hover > tbody > tr:hover > td {
    background-color: transparent !important;
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table tbody tr:hover {
    filter: brightness(1.04);
}
html[data-theme="dark"] .h2h-team-leaders-wrap .h2h-team-leaders-table tbody td.h2h-team-leaders-center {
    flex: 0 1 30%;
    min-width: 0;
    max-width: none;
}
html[data-theme="dark"] .h2h-team-leaders-wrap .table-responsive {
    padding: 6px 10px 2px;
}
html[data-theme="dark"] .h2h-team-leaders-footnote {
    margin: 10px 12px 0;
    padding: 0 12px 10px;
    text-align: center;
}
.h2h-stat-table-cell {
    vertical-align: middle;
    padding: 12px 10px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.h2h-preview-section--split .h2h-col-stat .h2h-stat-table-cell {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}
.h2h-disqual-wrap {
    margin-top: 0;
    padding: 0;
}
.h2h-disqual-table {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}
.h2h-disqual-cell {
    vertical-align: top;
    padding: 12px 14px !important;
    width: 50%;
    border-color: #eef1f0;
}
/* Светлая тема: диаграмма и легенда в ряд */
html:not([data-theme="dark"]) .h2h-pie-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 18px 24px;
    padding: 2px 0 4px;
}
html:not([data-theme="dark"]) .h2h-col-stat .h2h-pie-legend {
    min-width: 160px;
    flex: 1 1 auto;
    width: auto;
    max-width: min(100%, 280px);
}
html:not([data-theme="dark"]) .h2h-pie-legend {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
    max-width: 100%;
}
html:not([data-theme="dark"]) .h2h-pie-legend-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #2c2c2c;
}
html:not([data-theme="dark"]) .h2h-pie-legend-item:last-child {
    margin-bottom: 0;
}
html:not([data-theme="dark"]) .h2h-pie-legend-item::before {
    content: '';
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Тёмная тема: диаграмма по центру, легенда под ней */
html[data-theme="dark"] .h2h-pie-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 2px 0 4px;
}
html[data-theme="dark"] .h2h-col-stat .h2h-pie-legend {
    min-width: 0;
    flex: 0 1 auto;
    width: 100%;
    max-width: 100%;
}
html[data-theme="dark"] .h2h-pie-legend {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
    max-width: 100%;
}
html[data-theme="dark"] .h2h-pie-legend-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #2c2c2c;
}
html[data-theme="dark"] .h2h-pie-legend-item:last-child {
    margin-bottom: 0;
}
html[data-theme="dark"] .h2h-pie-legend-item::before {
    content: '';
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.h2h-pie-chart {
    width: 168px;
    height: 168px;
    flex-shrink: 0;
    line-height: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}
.h2h-pie-svg {
    display: block;
    width: 168px;
    height: 168px;
    vertical-align: top;
}
.h2h-pie-legend--a::before {
    background: #28ba28;
}
.h2h-pie-legend--d::before {
    background: #9aa7ab;
}
.h2h-pie-legend--b::before {
    background: #e74c3c;
}
.h2h-pie-legend-text {
    word-wrap: break-word;
}
@media (max-width: 480px) {
    .h2h-pie-chart {
        width: 140px;
        height: 140px;
    }
    .h2h-pie-svg {
        width: 140px;
        height: 140px;
    }
}
.h2h-meetings-calendar-wrap .table {
    margin-bottom: 0;
}

/* Тёмная тема: внешний «короб» превью матча — прозрачный (файл подключается после dark-theme, перебивает .uiblock-white / .uiblock-inner.white) */
html[data-theme="dark"] .match-preview-page > .uiblock-white {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
    overflow: visible;
}

html[data-theme="dark"] .match-preview-page > .uiblock-white > .uiblock-inner.white {
    background: transparent !important;
    background-color: transparent !important;
}

/* «Лучшие игроки»: общая панель .uiblock-white без градиента — только капсулы-строки (перебивает .h2h-preview-stack .h2h-meetings-last-panel) */
html[data-theme="dark"] .match-preview-page .h2h-team-leaders-wrap .uiblock-white.h2h-meetings-last-panel,
html[data-theme="dark"] .h2h-preview-stack .h2h-team-leaders-wrap .uiblock-white.h2h-meetings-last-panel {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
}

/* Обезличенное голосование конкурса прогнозистов. */
.prediction-voting-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.prediction-voting-panel {
    padding: 14px !important;
}
.prediction-voting-summary {
    margin-bottom: 8px;
}
.prediction-voting-bar {
    display: flex;
    width: 100%;
    height: 18px;
    overflow: hidden;
    background: #e5e9e7;
    border-radius: 9px;
}
.prediction-voting-segment {
    display: block;
    min-width: 2px;
    height: 100%;
}
.prediction-voting--home.prediction-voting-segment,
.prediction-voting--home::before {
    background: #28ba28;
}
.prediction-voting--draw.prediction-voting-segment,
.prediction-voting--draw::before {
    background: #9aa7ab;
}
.prediction-voting--away.prediction-voting-segment,
.prediction-voting--away::before {
    background: #e74c3c;
}
.prediction-voting-legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.prediction-voting-legend-item {
    position: relative;
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
}
.prediction-voting-legend-item::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.prediction-voting-legend-item .text-muted {
    grid-column: 2 / 4;
}
.prediction-voting-legend-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prediction-voting-popular {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e8ebe9;
}
.prediction-voting-score-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.prediction-voting-score {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 10px;
    background: #f2f5f3;
    border-radius: 4px;
}
html[data-theme="dark"] .prediction-voting-bar {
    background: #30383a;
}
html[data-theme="dark"] .prediction-voting-popular {
    border-top-color: rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .prediction-voting-score {
    background: rgba(255, 255, 255, 0.08);
}
@media (max-width: 640px) {
    .prediction-voting-legend {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .prediction-voting-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}
