/*
 * Breiten-Fix für SGCW EM 2021 und 2022.
 * Bewusst defensiv formuliert, damit er auch bei leicht abweichenden
 * Klassennamen der beiden Plugin-Versionen greift.
 */

.sgcw21,
.sgcw22,
.sgcw-em-2021,
.sgcw-em-2022,
[data-sgcw-year="2021"],
[data-sgcw-year="2022"] {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
}

.sgcw21 *,
.sgcw22 *,
.sgcw-em-2021 *,
.sgcw-em-2022 *,
[data-sgcw-year="2021"] *,
[data-sgcw-year="2022"] * {
    box-sizing: border-box;
    min-width: 0;
}

/* Registerkarten und Bedienfelder dürfen den Inhaltsbereich nie verbreitern. */
.sgcw21__tabs,
.sgcw22__tabs,
.sgcw21__tab-panel,
.sgcw22__tab-panel,
.sgcw21__panel,
.sgcw22__panel,
.sgcw21__section,
.sgcw22__section,
.sgcw21__content,
.sgcw22__content,
.sgcw21__rankings,
.sgcw22__rankings,
.sgcw21__clubs,
.sgcw22__clubs,
.sgcw21__nations,
.sgcw22__nations,
.sgcw-em-2021 [role="tabpanel"],
.sgcw-em-2022 [role="tabpanel"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.sgcw21__tabs,
.sgcw22__tabs,
.sgcw-em-2021 [role="tablist"],
.sgcw-em-2022 [role="tablist"] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sgcw21__tabs > *,
.sgcw22__tabs > *,
.sgcw-em-2021 [role="tablist"] > *,
.sgcw-em-2022 [role="tablist"] > * {
    max-width: 100%;
}

/* Club- und Nationenkarten passen sich automatisch an die vorhandene Breite an. */
.sgcw21__club-grid,
.sgcw22__club-grid,
.sgcw21__nation-grid,
.sgcw22__nation-grid,
.sgcw21__ranking-grid,
.sgcw22__ranking-grid,
.sgcw21__stats-grid,
.sgcw22__stats-grid,
.sgcw21__cards,
.sgcw22__cards,
.sgcw-em-2021 .club-grid,
.sgcw-em-2022 .club-grid,
.sgcw-em-2021 .nation-grid,
.sgcw-em-2022 .nation-grid,
.sgcw-em-2021 .ranking-grid,
.sgcw-em-2022 .ranking-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 14px;
}

.sgcw21__club-grid > *,
.sgcw22__club-grid > *,
.sgcw21__nation-grid > *,
.sgcw22__nation-grid > *,
.sgcw21__ranking-grid > *,
.sgcw22__ranking-grid > *,
.sgcw-em-2021 .club-grid > *,
.sgcw-em-2022 .club-grid > *,
.sgcw-em-2021 .nation-grid > *,
.sgcw-em-2022 .nation-grid > * {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Tabellen bleiben innerhalb der Seite und sind bei vielen Spalten scrollbar. */
.sgcw-layoutfix-scroll,
.sgcw21__table-wrap,
.sgcw22__table-wrap,
.sgcw21__ranking-wrap,
.sgcw22__ranking-wrap,
.sgcw21__clubs-table,
.sgcw22__clubs-table,
.sgcw21__nations-table,
.sgcw22__nations-table,
.sgcw-em-2021 .table-wrap,
.sgcw-em-2022 .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

.sgcw-layoutfix-scroll > table,
.sgcw21 table,
.sgcw22 table,
.sgcw-em-2021 table,
.sgcw-em-2022 table,
[data-sgcw-year="2021"] table,
[data-sgcw-year="2022"] table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse;
}

.sgcw-layoutfix-scroll > table {
    min-width: 620px;
}

.sgcw21 th,
.sgcw22 th,
.sgcw21 td,
.sgcw22 td,
.sgcw-em-2021 th,
.sgcw-em-2022 th,
.sgcw-em-2021 td,
.sgcw-em-2022 td {
    max-width: 360px;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

@media (max-width: 760px) {
    .sgcw21,
    .sgcw22,
    .sgcw-em-2021,
    .sgcw-em-2022,
    [data-sgcw-year="2021"],
    [data-sgcw-year="2022"] {
        overflow: visible;
    }

    .sgcw21__club-grid,
    .sgcw22__club-grid,
    .sgcw21__nation-grid,
    .sgcw22__nation-grid,
    .sgcw21__ranking-grid,
    .sgcw22__ranking-grid,
    .sgcw21__stats-grid,
    .sgcw22__stats-grid,
    .sgcw-em-2021 .club-grid,
    .sgcw-em-2022 .club-grid,
    .sgcw-em-2021 .nation-grid,
    .sgcw-em-2022 .nation-grid,
    .sgcw-em-2021 .ranking-grid,
    .sgcw-em-2022 .ranking-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .sgcw-layoutfix-scroll {
        margin-inline: 0;
        border-radius: 10px;
    }

    .sgcw-layoutfix-scroll > table {
        min-width: 560px;
    }
}
