/* Webapp Neu: Badges + Doppel in Platzkachel (nur index_neu / archiv_neu) */

.player-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding-top: 4px;
    padding-bottom: 4px;
}

/*
 * Seed + Name: Inline-Flow (kein Flex).
 * Seed-Badge direkt vor dem Namen.
 */
.player-name-primary {
    display: block;
    max-width: 100%;
    width: 100%;
    line-height: 1.25;
    font-weight: 500;
}

.player-name-text {
    font-weight: inherit;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.player-name-partner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    max-width: 100%;
    width: 100%;
}

.player-name-partner .player-name-text {
    font-size: inherit;
    font-weight: 500;
    opacity: 1;
}

.player-badges,
.player-badges-below {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
    max-width: 100%;
    margin-top: 0;
    line-height: 1.1;
}

/* ITN / Verein etc. — nie im Badge umbrechen (kein Zeichen-Stack) */
.court-card .player-badge,
.match-queue-item .player-badge,
.match-queue-players .player-badge,
.archived-match-neu .player-badge {
    display: inline-block;
    font-size: 12px;
    line-height: 1.2;
    padding: 1px 3px;
    border-radius: 2px;
    background: #eef2ef;
    color: #015335;
    border: 1px solid #d5e0d9;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    flex: 0 0 auto;
    flex-shrink: 0;
    width: max-content;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-text-size-adjust: 100%;
}

/* Queue: Badges etwas kompakter als Platzkachel */
.match-queue-item .player-badge:not(.player-badge-seed),
.archived-match-neu .player-badge:not(.player-badge-seed) {
    font-size: 10px;
    line-height: 1.15;
    padding: 0 3px;
}

/* Seed: möglichst gleiche Höhe wie Namenszeile, inline vor dem Text */
.court-card .player-name-primary .player-badge.player-badge-seed,
.match-queue-item .player-name-primary .player-badge.player-badge-seed,
.archived-match-neu .player-name-primary .player-badge.player-badge-seed {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    top: -0.08em;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1;
    padding: 0 0.22em;
    margin: 0 0.2em 0 0;
    border-radius: 2px;
    background: #fff1e0;
    color: #a85a12;
    border: 1px solid #f0d0a8;
    white-space: nowrap;
    box-sizing: border-box;
    max-height: 1.15em;
}

/* Mehrzeilige Spielernamen: Scores vertikal mittig zur Zeile */
.player-row {
    align-items: center;
    min-height: 40px;
}

/*
 * Subtitle Neu (wie Live):
 * - Tablet/Desktop: wenn mind. ein Subtitle → bei allen Karten gleiche Header-Höhe
 * - Smartphone: leere Subtitles ausblenden
 * - Schriftgröße in rem (Chrome/Safari gleich)
 */
.court-card .court-header {
    font-size: inherit;
    font-weight: normal;
}

.court-card .court-header-title {
    font-size: 1.15rem;
    font-weight: bold;
    line-height: 1.2;
}

.court-card .court-header-subtitle {
    margin-top: 2px;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.25;
    opacity: 0.92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.court-card .court-header-subtitle:empty {
    display: none;
    min-height: 0;
    margin: 0;
    padding: 0;
}

@media (min-width: 768px) {
    /* Desktop: nur hellgrüne Meta-Badges etwas kleiner (Seed unverändert) */
    .court-card .player-badge:not(.player-badge-seed) {
        font-size: 11px;
    }

    .match-queue-item .player-badge:not(.player-badge-seed),
    .archived-match-neu .player-badge:not(.player-badge-seed) {
        font-size: 10px;
    }

    .courts-grid.has-court-subtitles .court-card .court-header-subtitle {
        display: block;
        min-height: 1rem; /* ~0.8rem * 1.25 line-height */
    }

    .courts-grid.has-court-subtitles .court-card .court-header-subtitle:empty {
        display: block;
        visibility: hidden;
        min-height: 1rem;
        margin-top: 2px;
    }

}

/* Nächste Spielpaarungen: untereinander wie Dashboard */
.match-queue-card {
    background-color: var(--background-color); /* wie .court-card: rgba(255,255,255,0.9) */
}

.match-queue-item:not(.match-queue-info-item) {
    align-items: stretch;
    flex-direction: column;
}

.match-queue-body-neu {
    width: 100%;
    min-width: 0;
}

.match-queue-players.match-queue-players-neu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* Name links, Platz-Badge rechts auf gleicher Höhe */
.match-queue-side-top {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.match-queue-side-top > .player-name-primary {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important; /* überschreibt .player-name-primary { width:100% } */
    max-width: none;
}

/* Platz-Badge: wieder grün/fett, eine Zeile, rechts neben Name */
.match-queue-players-neu .match-queue-side-top > .match-queue-court {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    flex-shrink: 0;
    margin: 0 0 0 auto;
    align-self: center;
    max-width: none;
    width: max-content;
    min-width: max-content;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9em;
    padding: 4px 10px;
    background-color: rgba(0, 104, 56, 0.1);
    border-radius: 6px;
    text-align: center;
    box-sizing: border-box;
}

.match-queue-players-neu .match-queue-side-top > .match-queue-court .match-queue-court-inner {
    display: inline;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    color: inherit;
    font-weight: inherit;
    max-width: none;
}

/* Live styles.css zielt auf .match-queue-players span — Namen ja, Badges/Platz nein */
.match-queue-players-neu span:not(.player-badge):not(.match-queue-court):not(.match-queue-court-inner) {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    flex-shrink: 1;
    color: inherit;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Live first/last-child max-width:45% + word-break darf Badges nicht quetschen */
.match-queue-players span.player-badge,
.match-queue-players span.player-badge:first-child,
.match-queue-players span.player-badge:last-child,
.match-queue-players-neu .player-badge {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    max-width: none;
    width: max-content;
    flex: 0 0 auto;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #015335;
}

.match-queue-players-neu .match-queue-side {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.match-queue-side-divider {
    height: 0;
    border: none;
    border-top: 1px solid #e0e6e2;
    margin: 6px 0;
    width: 80%;
    align-self: flex-start;
}

/* Klare Trennung zwischen Spielpaarungen (nicht nur zwischen den beiden Seiten) */
.match-queue-list > .match-queue-item:not(.match-queue-info-item) {
    border-bottom: 2px solid rgba(0, 104, 56, 0.28);
    padding-top: 12px;
    padding-bottom: 12px;
}

.match-queue-list > .match-queue-item:not(.match-queue-info-item):last-child {
    border-bottom: none;
}

.match-queue-players-neu .player-name-primary {
    font-size: inherit;
    line-height: 1.25;
}

.match-queue-players-neu .match-queue-side-top > .player-name-primary {
    width: auto;
}

.match-queue-players-neu .player-name-partner .player-name-primary {
    width: 100%;
}

.match-queue-players-neu .player-badges-below {
    margin-top: 1px;
}

.match-queue-players-neu .player-name-partner {
    margin-top: 2px;
}

@media (max-width: 767px) {
    .courts-grid.has-court-subtitles .court-card .court-header-subtitle:empty {
        display: none;
        visibility: visible;
        min-height: 0;
        margin: 0;
    }

    .match-queue-side-divider {
        margin: 5px 0;
    }
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
    .court-card .player-badge {
        font-size: 12px;
        line-height: 1.25;
        padding: 1px 3px;
    }

    .match-queue-item .player-badge,
    .archived-match-neu .player-badge {
        font-size: 11px;
        line-height: 1.2;
        padding: 1px 3px;
    }
}

/* Archiv Neu: kompakter, Abstände um die Trennlinie ausgeglichen */
.archiv-content .archived-matches-list {
    gap: 8px;
}

.archived-item.archived-match-neu {
    gap: 0;
    padding: 5px 10px 8px;
    margin-bottom: 6px;
    background-color: var(--background-color);
}

.archived-match-neu .archived-meta-hint {
    font-size: 0.8em;
    color: #015335;
    margin-bottom: 4px;
}

.archived-match-neu .archived-match-top-meta {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;
    max-width: 48%;
    text-align: right;
    font-size: 0.78em;
    line-height: 1.2;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archived-match-neu .match-queue-players-neu .match-queue-side {
    gap: 1px;
}

.archived-match-neu .match-queue-players-neu .player-badges-below {
    margin-top: 0;
}

.archived-match-neu .match-queue-players-neu .player-name-partner {
    margin-top: 1px;
}

/* Ergebnis rechts auf der Trennlinie — Abstand wie Name1 nach oben (5px) */
.archived-match-neu .archived-match-divider-row {
    position: relative;
    width: 100%;
    align-self: stretch;
    height: 0;
    margin: 5px 0;
    border: none;
}

.archived-match-neu .archived-match-divider-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 0;
    border-top: 1px solid #e0e6e2;
    max-width: calc(100% - 7.5em); /* Platz für Ergebnis rechts */
}

.archived-match-neu .archived-match-divider-line:last-child {
    display: none;
}

.archived-match-neu .archived-match-score-mid {
    position: absolute;
    right: 0;
    top: 0;
    transform: translateY(-50%);
    font-size: 0.82em;
    line-height: 1;
    color: #333;
    white-space: nowrap;
    background: var(--background-color);
    padding-left: 6px;
}

.archived-match-neu .archived-match-score-mid strong {
    word-spacing: 0.55em;
}

.archived-match-neu .archived-wo-ret {
    color: #d32f2f;
    font-weight: 600;
}

.archived-match-neu .player-badge:not(.player-badge-seed) {
    font-size: 10px;
    line-height: 1.15;
    padding: 0 3px;
}
