/*
 * nuLiga Tennis – Frontend
 * Alle Regeln sind unter .nlt gekapselt; Farben/Schriften kommen über CSS-Variablen (vom Elementor-Widget überschreibbar).
 * Standardfarben angelehnt an tcanderschirnau.de: Dunkelgrün, Terrakotta, Logo-Rot.
 */
.nlt {
    --nlt-primary: #1d2e2a;
    --nlt-accent: #a9552a;
    --nlt-highlight: #d6262c;
    --nlt-win: #2e7d4f;
    --nlt-bg: #ffffff;
    --nlt-surface: #f5f2ee;
    --nlt-border: #e6e0d8;
    --nlt-text: #1b2422;
    --nlt-muted: #6b7471;
    --nlt-radius: 14px;
    --nlt-font-display: inherit;
    --nlt-gap: clamp(12px, 2.5vw, 20px);

    color: var(--nlt-text);
    background: var(--nlt-bg);
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    box-sizing: border-box;
}
.nlt *, .nlt *::before, .nlt *::after { box-sizing: inherit; }

/* ---------- Kopf ---------- */
.nlt-head { margin-bottom: var(--nlt-gap); }
.nlt-kicker {
    margin: 0 0 4px;
    color: var(--nlt-accent);
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.nlt-title {
    margin: 0;
    font-family: var(--nlt-font-display);
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1;
    text-transform: uppercase;
    color: var(--nlt-primary);
}
.nlt-intro { margin: 10px 0 0; max-width: 60ch; color: var(--nlt-muted); }

/* ---------- Navigation ---------- */
.nlt-nav {
    position: sticky;
    top: var(--nlt-sticky-offset, 0px);
    z-index: 5;
    display: grid;
    gap: 10px;
    margin: 0 calc(var(--nlt-gap) * -1);
    padding: 12px var(--nlt-gap);
    background: color-mix(in srgb, var(--nlt-bg) 92%, transparent);
    backdrop-filter: blur(8px);
}
.nlt-nav__row { display: flex; gap: 8px; }
.nlt-nav__row--main { flex-wrap: wrap; row-gap: 8px; }

/* ---------- Mannschaftsauswahl: Desktop als Zeilen, Smartphone als Bottom Sheet ---------- */
.nlt-teams {
    margin: 0 calc(var(--nlt-gap) * -1) var(--nlt-gap);
    padding: 0 var(--nlt-gap) 12px;
    border-bottom: 1px solid var(--nlt-border);
}
.nlt-teams__panel { display: grid; gap: 10px; }
.nlt-teams__panel:focus { outline: none; }
.nlt-teams__toggle, .nlt-teams__backdrop, .nlt-teams__head { display: none; }
/* Eine Zeile je Kategorie (Damen, Herren, …); Mannschaften brechen innerhalb der Zeile um. */
.nlt-nav__row--teams {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.nlt-nav__row--teams { position: relative; padding-left: 72px; }
.nlt-nav__row--teams .nlt-nav__label { position: absolute; left: 0; top: 9px; }
.nlt-nav__label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--nlt-muted);
    margin-right: 2px;
}
.nlt-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border: 1px solid var(--nlt-border);
    border-radius: 999px;
    background: var(--nlt-bg);
    color: var(--nlt-text);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.nlt-chip:hover { border-color: var(--nlt-accent); color: var(--nlt-accent); }
.nlt-chip:focus-visible, .nlt-segment__btn:focus-visible, .nlt-link:focus-visible {
    outline: 2px solid var(--nlt-accent);
    outline-offset: 2px;
}
.nlt-chip.is-active { background: var(--nlt-primary); border-color: var(--nlt-primary); color: #fff; }
.nlt-chip--main { font-size: .95rem; padding: 8px 18px; }
.nlt-chip--main.is-active { background: var(--nlt-accent); border-color: var(--nlt-accent); }

@media (max-width: 782px) {
    /* Filter: eine wischbare Zeile, nur sie bleibt beim Scrollen fixiert. */
    .nlt-nav { padding-top: 10px; padding-bottom: 10px; }
    .nlt-nav__row--main {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        padding-right: 24px;
    }
    .nlt-nav__row--main::-webkit-scrollbar { display: none; }
    .nlt-nav__row--main .nlt-chip { scroll-snap-align: start; padding: 7px 14px; font-size: .9rem; }

    .nlt-teams { padding-top: 2px; }
    .nlt-teams__toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        padding: 10px 16px;
        border: 1px solid var(--nlt-border);
        border-radius: 12px;
        background: var(--nlt-surface);
        color: var(--nlt-text);
        font: inherit;
        font-size: .95rem;
        font-weight: 700;
        text-align: left;
        cursor: pointer;
    }
    .nlt-teams__toggle.is-active { background: var(--nlt-primary); border-color: var(--nlt-primary); color: #fff; }
    .nlt-teams__toggle:focus-visible { outline: 2px solid var(--nlt-accent); outline-offset: 2px; }
    .nlt-teams__caret {
        width: 9px;
        height: 9px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-2px) rotate(45deg);
        flex: 0 0 auto;
    }

    .nlt-teams__backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99998;
        background: rgb(0 0 0 / .45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .nlt-teams__panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 99999;
        gap: 14px;
        max-height: 80vh;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0 16px calc(20px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        background: var(--nlt-bg);
        box-shadow: 0 -8px 30px rgb(0 0 0 / .18);
        transform: translateY(100%);
        visibility: hidden;
        transition: transform .28s ease, visibility 0s linear .28s;
    }
    .nlt-teams.is-open .nlt-teams__backdrop { opacity: 1; pointer-events: auto; }
    .nlt-teams.is-open .nlt-teams__panel { transform: none; visibility: visible; transition: transform .28s ease; }
    .nlt-teams__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 18px 0 8px;
        background: var(--nlt-bg);
    }
    .nlt-teams__head::before {
        content: "";
        position: absolute;
        top: 7px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 2px;
        background: var(--nlt-border);
    }
    .nlt-teams__title { font-family: var(--nlt-font-display); font-size: 1.15rem; font-weight: 700; color: var(--nlt-primary); text-transform: uppercase; }
    .nlt-teams__close {
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 50%;
        background: var(--nlt-surface);
        color: var(--nlt-text);
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
    }
    .nlt-teams__panel .nlt-nav__row--teams { padding-left: 0; gap: 8px; }
    .nlt-teams__panel .nlt-nav__label { position: static; flex-basis: 100%; margin-bottom: 2px; }
    .nlt-teams__panel .nlt-chip { padding: 10px 16px; font-size: .95rem; }
}
html.nlt-sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
    .nlt-teams__panel, .nlt-teams__backdrop { transition: none !important; }
}

/* ---------- Segment-Umschalter ---------- */
.nlt-segment {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: var(--nlt-gap);
    border-radius: 999px;
    background: var(--nlt-surface);
}
.nlt-segment__btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 7px 16px;
    background: transparent;
    color: var(--nlt-muted);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}
.nlt-segment__btn.is-active { background: var(--nlt-bg); color: var(--nlt-primary); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

/* ---------- Ansichtswechsel ---------- */
.nlt-view.is-entering { animation: nlt-in .28s ease both; }
@keyframes nlt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .nlt-view.is-entering { animation: none; }
    .nlt-chip, .nlt-segment__btn { transition: none; }
}

/* ---------- Übersicht (Aktuelle Ergebnisse | Nächste Spiele) ---------- */
.nlt-overview { display: grid; gap: calc(var(--nlt-gap) * 1.5); }
.nlt-overview__title, .nlt-next .nlt-next__title {
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--nlt-accent);
    font-family: var(--nlt-font-display);
    font-size: 1.15rem;
    text-transform: uppercase;
    color: var(--nlt-primary);
}
.nlt-overview__col--next .nlt-overview__title, .nlt-next:not(.nlt-results) .nlt-next__title { border-bottom-color: var(--nlt-primary); }

/* ---------- Spieltage & Spiele ---------- */
.nlt-day + .nlt-day { margin-top: calc(var(--nlt-gap) * 1.25); }
.nlt-day__title {
    margin: 0 0 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--nlt-accent);
}
.nlt-matches, .nlt-fixtures { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nlt-match {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--nlt-radius);
    background: var(--nlt-surface);
    border-left: 4px solid transparent;
}
.nlt-day__next {
    display: inline-block;
    margin-right: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--nlt-highlight);
    color: #fff;
    font-size: .7rem;
    letter-spacing: .04em;
}
.nlt-day.is-next .nlt-match { border-left-color: var(--nlt-highlight); }
.nlt-match.is-cancelled { opacity: .55; }
.nlt-match.is-cancelled .nlt-match__opp { text-decoration: line-through; }
.nlt-match__time, .nlt-match__date {
    font-family: var(--nlt-font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--nlt-primary);
    line-height: 1;
}
.nlt-match__date { display: grid; gap: 2px; font-size: 1.1rem; }
.nlt-match:has(.nlt-match__date) { grid-template-columns: 84px 1fr auto; }
.nlt-match__day { white-space: nowrap; }
.nlt-overview .nlt-match__opp { font-size: .95em; }
.nlt-match__clock { font-size: .85rem; color: var(--nlt-muted); font-weight: 600; }
.nlt-match__team { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nlt-match__opp { color: var(--nlt-text); }
.nlt-match__meta { margin-top: 2px; font-size: .82rem; color: var(--nlt-muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.nlt-match__score {
    min-width: 56px;
    padding: 6px 10px;
    border-radius: 10px;
    text-align: center;
    font-family: var(--nlt-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--nlt-bg);
    color: var(--nlt-primary);
}
a.nlt-match__score { text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
a.nlt-match__score::after { content: "\2197"; margin-left: 4px; font-size: .7em; opacity: .75; vertical-align: super; }
a.nlt-match__score:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgb(0 0 0 / .18); }
a.nlt-match__score:focus-visible { outline: 2px solid var(--nlt-accent); outline-offset: 2px; }
.nlt-result { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nlt-outcome {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.5;
}
.nlt-outcome--win { background: color-mix(in srgb, var(--nlt-win) 14%, var(--nlt-bg)); color: var(--nlt-win); }
.nlt-outcome--loss { background: color-mix(in srgb, var(--nlt-highlight) 12%, var(--nlt-bg)); color: var(--nlt-highlight); }
.nlt-outcome--draw { background: var(--nlt-border); color: var(--nlt-muted); }
.nlt-match--win .nlt-match__score { background: var(--nlt-win); color: #fff; }
.nlt-match--loss .nlt-match__score { background: var(--nlt-highlight); color: #fff; }
.nlt-match--draw .nlt-match__score { background: var(--nlt-muted); color: #fff; }

.nlt-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.nlt-badge--home { background: var(--nlt-primary); color: #fff; }
.nlt-badge--away { background: var(--nlt-border); color: var(--nlt-text); }
.nlt-venue::before { content: "\1F4CD"; margin-right: 3px; font-size: .85em; }
.nlt-venue.is-different { color: var(--nlt-accent); font-weight: 700; }
.nlt-link { color: var(--nlt-accent); font-weight: 600; text-decoration: none; }
.nlt-link:hover { text-decoration: underline; }
.nlt-muted { color: var(--nlt-muted); }
.nlt-strong { font-weight: 700; }
.nlt-empty { padding: 24px; border-radius: var(--nlt-radius); background: var(--nlt-surface); color: var(--nlt-muted); text-align: center; }

/* ---------- Mannschaftsansicht ---------- */
.nlt-team {
    display: grid;
    gap: var(--nlt-gap);
    margin-bottom: var(--nlt-gap);
    padding: var(--nlt-gap);
    border-radius: var(--nlt-radius);
    background: var(--nlt-primary);
    color: #fff;
}
.nlt-team.has-photo { grid-template-columns: minmax(0, 220px) 1fr; align-items: center; }
.nlt-team__photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: calc(var(--nlt-radius) - 4px); }
.nlt-team__name { margin: 0; font-family: var(--nlt-font-display); font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.05; text-transform: uppercase; color: #fff; }
.nlt-team__league { margin: 4px 0 10px; opacity: .85; }
.nlt-team__pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nlt-pill { padding: 4px 12px; border-radius: 999px; background: rgb(255 255 255 / .14); font-weight: 600; font-size: .85rem; }
.nlt-pill--rank { background: var(--nlt-accent); }
.nlt-team__text { margin: 0 0 10px; opacity: .92; }
.nlt-team .nlt-link { color: #fff; opacity: .9; }

/* ---------- Ligaspielplan ---------- */
.nlt-fixture {
    display: grid;
    grid-template-columns: 52px 1fr 64px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--nlt-surface);
    font-size: .92rem;
}
.nlt-fixture.is-own { box-shadow: inset 4px 0 0 var(--nlt-accent); }
.nlt-fixture.is-cancelled { opacity: .55; }
.nlt-fixture__time { color: var(--nlt-muted); font-weight: 600; }
.nlt-fixture__home { text-align: right; }
.nlt-fixture__score { text-align: center; font-weight: 700; }
.nlt-fixture__score a { color: inherit; text-decoration: underline dotted; }
.nlt-fixture__score a:hover { color: var(--nlt-accent); }

/* ---------- Tabelle ---------- */
.nlt-table-wrap { overflow-x: auto; border-radius: var(--nlt-radius); border: 1px solid var(--nlt-border); }
.nlt-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 0; }
.nlt-table th, .nlt-table td { padding: 10px 12px; border: 0; border-bottom: 1px solid var(--nlt-border); text-align: left; }
.nlt-table thead th { background: var(--nlt-surface); font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--nlt-muted); }
.nlt-table tbody tr:last-child td { border-bottom: 0; }
.nlt-table tr.is-own td { background: color-mix(in srgb, var(--nlt-accent) 12%, var(--nlt-bg)); font-weight: 700; }
.nlt-table .nlt-num { text-align: center; white-space: nowrap; }
.nlt-marker { font-size: .7rem; color: var(--nlt-muted); }

/* ---------- Fuß ---------- */
.nlt-foot { margin-top: calc(var(--nlt-gap) * 1.5); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: .8rem; color: var(--nlt-muted); }

/* ---------- Widgets ---------- */
.nlt-table-widget__title { margin: 0 0 10px; font-family: var(--nlt-font-display); text-transform: uppercase; color: var(--nlt-primary); }
.nlt-table-widget__league { margin: -6px 0 12px; color: var(--nlt-muted); }
.nlt-matches--compact .nlt-match { grid-template-columns: 84px 1fr; padding: 10px 14px; }
.nlt-match__teamlink { color: inherit; text-decoration: none; }
.nlt-match__teamlink:hover, .nlt-match__teamlink:focus-visible { color: var(--nlt-accent); text-decoration: underline; text-underline-offset: 3px; }
.nlt-match__teamlink::after { content: " \203A"; color: var(--nlt-accent); }
.nlt-next__more { display: inline-block; margin-top: 12px; color: var(--nlt-accent); font-weight: 700; text-decoration: none; }

/* ---------- Klein ---------- */
@media (max-width: 600px) {
    .nlt-match { grid-template-columns: 52px 1fr auto; padding: 10px 12px; gap: 10px; }
    .nlt-match__time { font-size: 1.1rem; }
    .nlt-match__date { font-size: .95rem; }
    .nlt-match:has(.nlt-match__date) { grid-template-columns: 72px 1fr auto; }
    .nlt-team.has-photo { grid-template-columns: 1fr; }
    .nlt-fixture { grid-template-columns: 44px 1fr 52px 1fr; font-size: .85rem; gap: 6px; padding: 8px 10px; }
    .nlt-hide-sm { display: none; }
    .nlt-segment { display: flex; width: 100%; }
    .nlt-segment__btn { flex: 1 1 0; padding: 7px 6px; font-size: .8rem; white-space: nowrap; }
    .nlt-table { font-size: .85rem; }
    .nlt-table th, .nlt-table td { padding: 8px 6px; }
    .nlt-table thead th { font-size: .65rem; letter-spacing: .02em; }
    .nlt-match__score { min-width: 48px; font-size: 1.1rem; }
    .nlt-outcome { padding: 0 6px; font-size: .58rem; letter-spacing: .02em; }
}
