/*
 * Hobbyliga Leipzig – Responsive-Korrektur v3
 * Ersetzt die bisherigen responsive-overrides.css.
 * Wichtig: Tabellen werden NICHT abgeschnitten, sondern innerhalb ihres
 * eigenen Bereichs horizontal scrollbar gehalten.
 */

/* Grundlayout: keine globale horizontale Abschneidung verwenden. */
html,
body {
    width: 100%;
    max-width: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
#wrapper,
#main,
#main > .inner {
    max-width: 100%;
}

img,
video {
    max-width: 100%;
    height: auto;
}

/* iFrames passen sich dem verfügbaren Platz an.
   Der Inhalt eines iFrames wird zusätzlich in seiner eigenen HTML-Datei
   über die untenstehenden Tabellenregeln angepasst. */
iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 0;
}

/* Tabellencontainer: nur der Tabellenbereich darf horizontal scrollen. */
.table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0 0 2em 0;
}

/* Tabellen behalten ihre natürliche Spaltenbreite. Sie werden ausdrücklich
   NICHT auf display:block gesetzt und NICHT auf die Viewportbreite gequetscht. */
.table-scroll table {
    display: table !important;
    width: max-content !important;
    min-width: 100%;
    max-width: none !important;
    margin: 0;
    table-layout: auto;
}

.table-scroll th,
.table-scroll td {
    white-space: nowrap;
}

/* Die Tabellenübersicht hat acht Spalten; auf Mobilgeräten darf sie breiter
   als der Bildschirm sein, damit alle Werte per Wischbewegung erreichbar sind. */
.table-scroll--standings table {
    min-width: 700px;
}

/* Spieltagslisten enthalten Mannschaften, Datum, Ergebnis und Satzergebnisse. */
.table-scroll--matchdays table {
    min-width: 900px;
}

@media screen and (max-width: 736px) {
    #main > .inner {
        padding-left: 1em;
        padding-right: 1em;
    }

    #header img {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }

    iframe {
        width: 100% !important;
        max-width: 100% !important;
    }

    .table-scroll--standings table {
        min-width: 700px;
    }

    .table-scroll--matchdays table {
        min-width: 900px;
    }

    #main p,
    #main li,
    #main a {
        overflow-wrap: anywhere;
    }
}

@media screen and (max-width: 480px) {
    #main > .inner {
        padding-left: 0.75em;
        padding-right: 0.75em;
    }

    .table-scroll table {
        font-size: 0.85em;
    }
}


/* ------------------------------------------------------------
   Mobile-Kartenansicht für die Tabellen der Leistungsklasse A
   Wirkt nur auf Tabellen mit class="standings-table"
   und nur bis 600 px Bildschirmbreite.
   ------------------------------------------------------------ */
@media screen and (max-width: 600px) {
    .table-scroll.table-scroll--standings {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: visible !important;
        margin-bottom: 1.25em;
    }

    .table-scroll.table-scroll--standings table.standings-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        margin: 0;
    }

    .standings-table caption {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .standings-table thead {
        display: none !important;
    }

    .standings-table tbody {
        display: grid !important;
        gap: 0.75rem;
        width: 100%;
    }

    .standings-table tbody tr {
        display: grid !important;
        grid-template-columns: 2.65rem repeat(4, minmax(0, 1fr)) 4.15rem;
        grid-template-areas:
            "rank team team team team points"
            "games games wins wins losses losses"
            "sets sets sets sets diff diff";
        gap: 0.15rem 0.25rem;
        width: 100%;
        min-width: 0;
        padding: 0.45rem 0.5rem;
        border: 1px solid rgba(61, 68, 73, 0.18) !important;
        border-left: 4px solid #f56a6a !important;
        border-radius: 0.5rem;
        background: #fff !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .standings-table tbody tr:nth-child(2n + 1) {
        background: #fff !important;
    }

    .standings-table tbody tr.last-place {
        background: #fff3ef !important;
        border-left-color: tomato !important;
    }

    .standings-table tbody th,
    .standings-table tbody td {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        padding: 0.35rem 0.3rem !important;
        border: 0 !important;
        color: #3d4449;
        font-size: 0.88rem !important;
        line-height: 1.2;
        text-align: left;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .standings-table tbody th::before,
    .standings-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.18rem;
        color: #737b80;
        font-size: 0.61rem;
        font-weight: 600;
        line-height: 1.1;
        letter-spacing: 0.035em;
        text-transform: uppercase;
    }

    .standings-table .col-rank {
        grid-area: rank;
        align-items: center;
        text-align: center;
        font-size: 1.05rem !important;
        font-weight: 700;
    }

    .standings-table .col-team {
        grid-area: team;
        font-size: 0.92rem !important;
        font-weight: 700;
    }

    .standings-table .col-points {
        grid-area: points;
        align-items: center;
        padding: 0.3rem 0.15rem !important;
        border-radius: 0.35rem;
        background: rgba(245, 106, 106, 0.10);
        color: #b83f3f;
        font-size: 1rem !important;
        font-weight: 700;
        text-align: center;
    }

    .standings-table .col-games {
        grid-area: games;
    }

    .standings-table .col-wins {
        grid-area: wins;
    }

    .standings-table .col-losses {
        grid-area: losses;
    }

    .standings-table .col-sets {
        grid-area: sets;
    }

    .standings-table .col-difference {
        grid-area: diff;
    }
}

@media screen and (max-width: 600px) {
.standings-table tbody tr { grid-template-columns: 3.2rem repeat(4,minmax(0,1fr)) 4.15rem; }
.standings-table .col-rank::before { white-space: nowrap !important; overflow-wrap: normal !important; word-break: normal !important; }
}
