/* ========== KickDash Basis Theme ========== */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;800&display=swap');

:root {
    --kd-primary: #0ea5e9;
    --kd-on-primary: #000233;
    --kd-fg: #0b1220;
    --kd-fg-2: #314159;
    --kd-bg: #f8fafc;
    --kd-card: #ffffff;
    --kd-hero-bg: linear-gradient(135deg, #e0f2fe 0%, #f8fafc 100%);
    /* Optional: Sekundärfarbe aktivieren
    --kd-secondary: #145a86;
    */
}

body {
    font-family: 'Rubik', sans-serif;
    background-color: var(--kd-bg);
    color: var(--kd-fg);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

h1, h2, h3 {
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.5rem;
    color: var(--kd-primary);
}

h2 {
    font-size: 1.75rem;
    color: var(--kd-fg);
}

h1:focus {
    outline: none;
}

body.using-keyboard h1:focus {
    outline: revert;
}

@media (prefers-color-scheme: dark) {
    :root {
        --kd-fg: #e6edf3;
        --kd-fg-2: #9fb0c3;
        --kd-bg: #0b1220;
        --kd-card: #0f172a;
        --kd-on-primary: #ffffff;
        --kd-hero-bg: linear-gradient(135deg, #1e293b 0%, #0b1220 100%);
    }
}

/* Hero (volle Höhe Variante) */
.kd-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: var(--kd-bg);
    overflow: hidden;
}

.kd-hero__bg {
    position: absolute;
    inset: -10% -10% auto -10%;
    height: 110%;
    background: radial-gradient(60rem 60rem at 10% -10%, rgba(14,165,233,.25), transparent 60%), radial-gradient(40rem 40rem at 110% 30%, rgba(59,130,246,.20), transparent 60%), radial-gradient(24rem 24rem at 70% 120%, rgba(236,72,153,.18), transparent 60%);
    z-index: -2;
}

.kd-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.35), rgba(0,0,0,0));
    opacity: .18;
    z-index: -1;
    pointer-events: none;
}

.kd-hero__content {
    width: min(100%, 1040px);
    padding: clamp(24px, 4vw, 64px) 24px;
    text-align: center;
    color: var(--kd-fg);
}

/* Klassischer Hero */
.kd-hero-classic {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 420px;
    max-width: 900px;
    margin: 48px auto 32px;
    border-radius: 32px;
    background: var(--kd-hero-bg);
    box-shadow: 0 8px 32px rgba(14,165,233,.12);
    overflow: hidden;
}

    .kd-hero-classic .kd-hero__bg {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        background: radial-gradient(30rem 30rem at 10% -10%, rgba(14,165,233,.35), transparent 60%), radial-gradient(20rem 20rem at 110% 30%, rgba(59,130,246,.25), transparent 60%), radial-gradient(12rem 12rem at 70% 120%, rgba(236,72,153,.22), transparent 60%);
        z-index: -2;
    }

    .kd-hero-classic .kd-hero__overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(0,0,0,.08), rgba(0,0,0,0));
        opacity: .08;
        z-index: -1;
        pointer-events: none;
    }

    .kd-hero-classic .kd-hero__content {
        position: relative;
        width: 100%;
        max-width: 700px;
        padding: 40px 24px;
        text-align: center;
        color: var(--kd-fg);
    }

/* Typo & Titles */
.kd-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.05;
    margin: 0 0 .6rem;
    letter-spacing: .2px;
}

    .kd-title span {
        color: var(--kd-on-primary);
        text-shadow: 0 1px 0 rgba(255,255,255,.15);
    }

.kd-title--matches {
    font-size: 2rem;
    font-weight: 800;
    color: var(--kd-primary);
    margin-bottom: 1.2rem;
    letter-spacing: .5px;
    text-shadow: 0 2px 12px rgba(14,165,233,.10);
    display: inline-block;
}

    .kd-title--matches span {
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

.kd-sub {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: var(--kd-fg-2);
    margin: 0 auto 1.4rem;
    max-width: 52rem;
}

/* CTA / Buttons */
.kd-cta {
    /*display: flex;*/
    gap: .8rem;
    justify-content: center;
    flex-wrap: wrap;
}

.kd-btn {
    --padY: .85rem;
    --padX: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: var(--padY) var(--padX);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
    transition: .2s ease;
}

.kd-btn--primary {
    background: var(--kd-primary);
    color: var(--kd-on-primary);
    box-shadow: 0 6px 18px rgba(14,165,233,.35);
}

    .kd-btn--primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 26px rgba(14,165,233,.45);
    }

.kd-btn--ghost {
    background: transparent;
    color: var(--kd-fg);
    border: 1px solid color-mix(in srgb, var(--kd-fg-2) 35%, transparent);
}

    .kd-btn--ghost:hover {
        background: rgba(255,255,255,.06);
    }

.kd-select {
    appearance: none;
    padding: .85rem 1.1rem;
    font-size: 1rem;
    border-radius: 999px;
    border: 1px solid rgba(124,139,161,.18);
    background: var(--kd-card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='gray'><path d='M1.5 5.5l6.5 6 6.5-6'/></svg>") no-repeat right .8rem center;
    background-size: 1rem;
    font-family: 'Rubik', sans-serif;
    color: var(--kd-fg);
    cursor: pointer;
    min-width: 220px;
}

    .kd-select:focus {
        outline: none;
        border-color: var(--kd-primary);
        box-shadow: 0 0 0 3px rgba(14,165,233,.25);
    }

/* Highlights */
.kd-highlights {
    display: flex;
    gap: .8rem 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem auto 1.2rem;
    padding: 0;
    list-style: none;
    max-width: 60rem;
}

    .kd-highlights li {
        background: var(--kd-card);
        color: var(--kd-fg);
        border: 1px solid rgba(124,139,161,.18);
        padding: .55rem .8rem;
        border-radius: 999px;
        font-size: .95rem;
        white-space: nowrap;
        backdrop-filter: saturate(1.3) blur(2px);
    }

.kd-powered {
    margin-top: .6rem;
    font-size: .9rem;
    color: var(--kd-fg-2);
    opacity: .9;
}

/* Error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* Match Tiles */
.league-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.5rem;
}

.league-tile {
    background: #f8f9fa;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    padding-top: 1em;
    min-width: 320px;
    flex: 1 1 320px;
}

    .league-tile h3 {
        margin: 0 0 1rem;
        color: #2c3e50;
    }

/* Vereinfachtes Match-Layout (ersetzt komplexe Grid-Areas, Overlays, Animationen) */

/* Reset evtl. alter Positionsregeln aus vorherigem Abschnitt */
.match-item > .team:first-child,
.match-item > .vs,
.match-item > .team:nth-child(3),
.match-item > .match-date {
    grid-area: auto;
    justify-self: auto;
    align-self: center;
}

/* Basisliste */
.match-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Einfache, robuste 4-Spalten-Zeile: Team1 | vs/Ergebnis | Team2 | Datum/LIVE */
.match-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    column-gap: 1rem;
    row-gap: .25rem;
    padding: .6rem .6rem;
    border-bottom: 1px solid #e0e0e0;
    background: transparent;
    border-left: 0;
    box-shadow: none;
    position: relative;
}

    /* Teams und Icons */
    .match-item .team {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
        min-width: 0;
        overflow: hidden;
    }

        .match-item .team .team-icon {
            width: 24px;
            height: 24px;
            flex: 0 0 24px;
            object-fit: contain;
        }

    /* Ergebnis / vs */
    .match-item .vs,
    .match-item .result {
        font-weight: 700;
        text-align: center;
        min-width: 56px;
        white-space: nowrap;
    }

/* Datum + Live-Badge untereinander (Badge immer unter Datum) */
.match-date-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
}

.match-item .match-date {
    white-space: nowrap;
}

/* Live-Status: nur dezente Hinterlegung + linke Markierung */
.match-item.match-live {
    background: #fff5f5;
    border-left: 4px solid #ef4444;
}

    .match-item.match-live .result {
        color: #b91c1c;
    }

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .match-item.match-live {
        background: #2a0e12;
        border-left-color: #f87171;
    }

        .match-item.match-live .result {
            color: #fecaca;
        }
}

/* Live-Badge */
.match-item .live-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: #e53935;
    border-radius: 9999px;
    text-transform: uppercase;
}

/* Mobile: auf 2 Spalten umbrechen (Team1|vs / Team2|Datum) */
@media (max-width: 600px) {
    .match-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

        .match-item .team .team-icon {
            width: 20px;
            height: 20px;
            flex-basis: 20px;
        }
}

.page-title__icon {
    width: 1.5em;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.results {
    padding-left: 1rem;
    padding-right: 1rem;
}

.tablepos-pos-big {
    font-size: 2.5rem;
    font-weight: 800;
    width: 2.5rem;
    text-align: center;
    color: var(--kd-primary);
}

/* Center the big table position number */
.tablepos-main {
    text-align: center; /* zentriert Text-Inhalte */
    width: 100%; /* volle Breite für zentrierte Ausrichtung */
}

.tablepos-pos-big {
    display: block; /* als Block-Element */
    margin: .5rem auto; /* horizontal zentrieren */
    text-align: center; /* Sicherheitshalber auch im Element */
}

/* Dark-Mode Lesbarkeit verbessern: Flächen abdunkeln, Kontraste anheben */
@media (prefers-color-scheme: dark) {
    /* Kacheln und Überschriften */
    .league-tile {
        background: var(--kd-card); /* #0f172a */
        color: var(--kd-fg); /* #e6edf3 */
        box-shadow: 0 2px 10px rgba(0,0,0,.5);
        border: 1px solid rgba(148,163,184,.15);
    }

        .league-tile h3 {
            color: var(--kd-fg);
        }

    /* Listen-Trenner und Sekundärtexte */
    .match-item {
        border-bottom: 1px solid rgba(148,163,184,.18);
    }

    .vs {
        color: #93a4b7;
    }
    /* neutraler Sekundärton */
    .match-date, .match-date-wrap {
        color: #93a4b7;
    }

    /* Zustandstöne für vergangen/kommend */
    .match-past {
        background: #0f172a; /* dunkle Fläche statt hellgrau */
        color: #9fb0c3; /* gut lesbar auf dunkel */
        opacity: 1; /* keine zusätzliche Transparenz im Dark Mode */
    }

    .match-future {
        background: rgba(56,189,248,.10); /* zarter Akzent auf dunkel */
        color: var(--kd-fg);
    }

    /* Ergebnisse im Dark Mode leicht akzentuieren */
    .result {
        color: #7dd3fc;
    }

    /* Highlights/Kleine Chips */
    .kd-highlights li {
        background: color-mix(in srgb, var(--kd-card) 85%, transparent);
        border-color: rgba(148,163,184,.20);
    }
}

/* Zusätzliche Anzeige für Liga-Name und Punkte */
.tablepos-league {
    font-size: 1rem;
    color: var(--kd-fg-2);
}

.tablepos-points {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--kd-primary);
}

.match-animated {
    animation: match-highlight 2s ease;
}

@keyframes match-highlight {
    0% {
        background-color: #ffe066;
    }

    80% {
        background-color: #ffe066;
    }

    100% {
        background-color: transparent;
    }
}

/* CurrentTablePosition: Nachbarn links/rechts + klickbarer Mittelpunkt */
.tablepos-neighbors {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center; /* zentriert Grid-Items horizontal je Spalte */
    gap: .75rem;
    width: 100%;
    margin-bottom: .5rem;
}

.tablepos-neighbor {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.tablepos-neighbor--left {
    justify-content: flex-start;
}

.tablepos-neighbor--right {
    justify-content: flex-end;
    text-align: right;
}

.tablepos-neighbor__icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
}

.tablepos-neighbor__text {
    min-width: 0;
}

.tablepos-neighbor__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 16ch;
}

.tablepos-neighbor__meta {
    font-size: .85rem;
    color: var(--kd-fg-2);
}

.tablepos-center-click {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

.tablepos-toggle-hint {
    font-size: .8rem;
    color: var(--kd-fg-2);
}

/* Tabelle (collapsible content) */
.tablepos-table {
    width: 100%;
    overflow-x: auto;
}

    .tablepos-table table {
        width: 100%;
        border-collapse: collapse;
    }

    .tablepos-table th,
    .tablepos-table td {
        padding: .4rem .5rem;
        border-bottom: 1px solid #e5e7eb;
        text-align: left;
    }

    .tablepos-table .team-cell {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
    }

        .tablepos-table .team-cell img {
            width: 18px;
            height: 18px;
            object-fit: contain;
        }

    .tablepos-table tr.is-current {
        background: rgba(14,165,233,.10);
        font-weight: 700;
    }

/* TeamFormStats */
.team-form-text {
    margin: .15rem0;
    text-align: center;
    font-size: 1rem;
}

    .team-form-text .form-num {
        font-weight: 900;
        color: var(--kd-primary);
        font-size: 1.25rem;
        margin-right: .35rem;
    }

    .team-form-text .form-num--loss {
        color: #ef4444;
    }

    .team-form-text .form-label {
        font-weight: 700;
        margin-right: .35rem;
    }

    .team-form-text .form-tail {
        color: var(--kd-fg-2);
    }

/* LeaguePositionChart */
.pos-chart {
    max-width: 100%;
    padding: .5rem0;
}

.pos-chart__header {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    justify-content: center;
}

.pos-chart__title {
    margin: 0;
    font-size: 1rem;
}

.pos-chart__meta {
    color: var(--kd-fg-2);
    font-size: .85rem;
}

.pos-chart__svg {
    width: 100%;
    height: 140px;
    display: block;
}

.pos-chart__grid line {
    stroke: #3f9ecc;
    stroke-width: .6;
}

.pos-chart__line {
    fill: none;
    stroke: var(--kd-primary);
    stroke-width: 2;
}

.pos-chart__dot {
    fill: var(--kd-primary);
    opacity: .9;
}

.pos-chart__dot--current {
    fill: #22c55e;
}

.pos-chart__legend {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--kd-fg-2);
    margin-top: .25rem;
}

.pos-chart__empty {
    color: var(--kd-fg-2);
    text-align: center;
}
/* Neue Labels über den Punkten */
.pos-chart__label {
    fill: var(--kd-primary);
    font-size: 9px;
    font-weight: 700;
    dominant-baseline: alphabetic;
}

/* Action button for table toggle */
.kd-action-btn.tablepos-action {
    position: absolute;
    top: .5rem;
    right: .75rem;
    padding: .35rem .6rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--kd-on-primary);
    background: var(--kd-primary);
    border: 0;
    border-radius: 999px;
    box-shadow: 02px10px rgba(14,165,233,.25);
    cursor: pointer;
}

    .kd-action-btn.tablepos-action:hover {
        box-shadow: 04px14px rgba(14,165,233,.35);
        transform: translateY(-1px);
    }

    .kd-action-btn.tablepos-action:focus-visible {
        outline: none;
        box-shadow: 0003px rgba(14,165,233,.35);
    }

/* Ensure container can position absolute children */
.league-tile.kd-card--tablepos {
    position: relative;
}

/* Widgets row: TeamFormStats + LeaguePositionChart side-by-side */
.widgets-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 1rem;
    align-items: start;
}

    .widgets-row > * {
        min-width: 0;
    }

    .widgets-row .widget-col {
        min-width: 0;
    }

        .widgets-row .widget-col > * {
            width: 100%;
            display: block;
        }

@media (max-width:800px) {
    .widgets-row {
        grid-template-columns: 1fr;
    }
}

/* Home example links: bulletless, pretty cards */
.kd-links ul {
    list-style: none;
    margin: .5rem00;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
    gap: .6rem;
}

.kd-links li {
    margin: 0;
}

.kd-links a {
    display: block;
    background: var(--kd-card);
    color: var(--kd-fg);
    text-decoration: none;
    padding: .75rem1rem;
    border-radius: 12px;
    border: 1px solid rgba(124,139,161,.18);
    box-shadow: 02px8px rgba(0,0,0,.06);
    font-weight: 700;
    transition: .2s ease;
}

    .kd-links a:hover {
        transform: translateY(-1px);
        box-shadow: 06px16px rgba(14,165,233,.18);
        border-color: var(--kd-primary);
    }

@media (prefers-color-scheme: dark) {
    .kd-links a {
        box-shadow: 02px10px rgba(0,0,0,.35);
    }
}

/* Beispiel: Variablen verwenden */
.team-theme {
    --team-primary: #222;
    --team-accent: #ffcc00;
    --team-text: #fff;
}

    .team-theme .kd-card--tablepos,
    .team-theme .league-tile {
        border-color: var(--team-accent);
    }

    .team-theme .page-header,
    team-theme .tablepos-main {
        background: var(--team-primary);
        color: var(--team-text);
    }

    .team-theme .kd-action-btn {
        background: var(--team-accent);
        color: #000;
    }

.page-title__ {
    color: var(--team-primary);
}

.page-title {
    color: var(--team-primary);
}

.kd-home-btn {
    color: var(--team-primary);
    background-color: var(--team-accent);
}

/* Hintergrund auf Teamfarbe setzen (nur auf dem TeamDashboard) */
.team-theme {
    position: relative;
    min-height: 100dvh;
    background-color: var(--team-text) !important;
    padding-top: 1rem;
    padding-bottom: 2rem;
}

    /* Vollflächiger Hintergrund hinter dem Inhalt */
    .team-theme::before {
        content: "";
        position: fixed;
        inset: 0;
        background: var(--team-primary, #222);
        z-index: -1;
    }
/* Dezenter Home-Button rechts neben dem Titel */
.page-title-wrap { display:flex; align-items:center; justify-content:space-between; gap:.75rem; }
.kd-home-btn {
  display:inline-grid; place-items:center;
  width:32px; height:32px; border-radius:999px;
  background: var(--kd-card);
  border:1px solid rgba(124,139,161,.18);
  text-decoration:none;
  margin-right: 1em;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.kd-home-btn svg { width:18px; height:18px; fill: var(--kd-fg); }
.kd-home-btn:hover { box-shadow: 0 2px 8px rgba(14,165,233,.20); border-color: var(--team-primary); }
@media (prefers-color-scheme: dark) {
  .kd-home-btn { background: color-mix(in srgb, var(--kd-card) 85%, transparent); }
}

/* Page-Title zentrieren, Home-Button rechts */
.page-title-wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.page-title-wrap .page-title {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.page-title-wrap .kd-home-btn {
  grid-column: 3;
  justify-self: end;
}
