/* Le Peloton, onglet Mes équipes : la saison en frise, course par course.
   Les jetons --lgb-* viennent de lgb-tiles.css, les couleurs --race-* de race-style-card.css.
   .mt est le conteneur : la frise passe sur deux colonnes quand la place le permet, pas selon la taille de l'écran. */

.mt {
    --mt-gold: #F5C542;
    --mt-silver: #C5CAD6;
    --mt-bronze: #D9A070;
    container-type: inline-size;
    container-name: my-teams;
    min-width: 0;
    max-width: 1120px;
    padding: 4px 4px 16px 4px;
    color: var(--lgb-ink);
}

.mt-in {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Barre d'outils : la saison, et de quoi rejoindre une course */
.mt-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

/* MudBlazor pose la classe à l'intérieur : c'est son enveloppe .mud-select qui prend la place dans la barre */
.mt-bar > .mud-select {
    flex: 0 1 200px;
    min-width: 0;
}

.mt-season-name {
    margin: 0;
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 22px;
    line-height: 1;
    text-transform: uppercase;
}

.mt-join {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px 0 10px;
    border: 0;
    border-radius: 999px;
    background: var(--lgb-violet);
    color: #FFFFFF;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mt-join svg {
    width: 17px;
    height: 17px;
}

.mt-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: #FF9F1C;
    color: #3D1F00;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.mt-icon-btn {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--lgb-ink-2);
    cursor: pointer;
}

.mt-icon-btn svg {
    width: 20px;
    height: 20px;
}

@media (hover: hover) {
    .mt-join:hover { background: var(--lgb-violet-deep); }
    .mt-cta:hover { background: #F08C00; }
    .mt-icon-btn:hover { background: var(--lgb-red-soft); color: var(--lgb-red); }
}

/* Le bilan de la saison */
.mt-sky {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: var(--lgb-radius);
    background: linear-gradient(150deg, #120B2E 0%, var(--lgb-night) 48%, var(--lgb-violet-deep) 100%);
    color: #FFFFFF;
}

.mt-sky-k {
    font-size: 12.5px;
    color: var(--lgb-lilac);
}

.mt-sky-t {
    margin: 1px 0 0 0;
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 34px;
    line-height: 0.92;
    text-transform: uppercase;
}

.mt-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mt-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border-radius: var(--lgb-radius);
    background: rgba(255, 255, 255, 0.1);
}

.mt-kpi b {
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 30px;
    line-height: 1;
}

.mt-kpi b sup {
    font-size: 0.5em;
    vertical-align: 0.7em;
}

.mt-kpi span {
    font-size: 12px;
    line-height: 1.2;
    color: var(--lgb-lilac);
}

.mt-sky-line {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.35;
}

.mt-sky-line b {
    color: var(--mt-gold);
    font-weight: 700;
}

.mt-empty {
    margin: 0;
    padding: 18px 16px;
    border-radius: var(--lgb-radius);
    background: var(--lgb-surface);
    color: var(--lgb-ink-2);
    font-size: 14px;
    text-align: center;
}

/* La frise : un rail continu, un mois par étiquette, une étape par course */
.mt-cal {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mt-cal::before {
    content: "";
    position: absolute;
    left: 60px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: #D9D5E2;
}

.mt-month {
    position: relative;
    margin: 10px 0 6px 76px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lgb-ink-2);
}

.mt-cal > .mt-month:first-child {
    margin-top: 0;
}

.mt-stop,
.mt-today {
    position: relative;
    display: grid;
    grid-template-columns: 46px 14px minmax(0, 1fr);
    gap: 0 8px;
    padding-bottom: 8px;
}

.mt-stop {
    align-items: stretch;
}

.mt-stop-date {
    padding-top: 13px;
    font-size: 11.5px;
    line-height: 1.1;
    color: var(--lgb-ink-2);
    text-align: right;
}

.mt-stop-date b {
    display: block;
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 21px;
    line-height: 1;
    color: var(--lgb-ink);
}

.mt-rail {
    position: relative;
}

.mt-rail i {
    position: absolute;
    left: 0;
    top: 16px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--race-bg, var(--lgb-violet));
    box-shadow: 0 0 0 3px var(--lgb-page), inset 0 0 0 1px rgba(21, 18, 31, 0.2);
}

.mt-stop-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--lgb-radius);
    background: var(--lgb-surface);
    box-shadow: var(--lgb-shadow);
    color: inherit;
    text-decoration: none;
}

a.mt-stop-card:hover {
    color: inherit;
    text-decoration: none;
}

.mt-stop-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mt-logo {
    flex-shrink: 0;
    display: block;
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.mt-stop-race {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mt-stop-n {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.15;
}

.mt-stop-s {
    font-size: 12px;
    line-height: 1.25;
    color: var(--lgb-ink-2);
}

/* Course ratée ou pas encore ouverte : en creux */
.mt-stop--skip .mt-stop-card {
    background: transparent;
    box-shadow: inset 0 0 0 1px #D2CDDB;
    color: var(--lgb-ink-2);
}

.mt-stop--skip .mt-stop-n {
    color: #4A4556;
}

.mt-stop--skip .mt-logo {
    opacity: 0.5;
    filter: grayscale(1);
}

.mt-stop--live .mt-stop-card {
    box-shadow: 0 0 0 2px var(--lgb-ink);
}

/* Course où il manque ta team : on la voit de loin */
.mt-stop--join .mt-stop-card {
    box-shadow: inset 0 0 0 2px #FFB866;
}

/* Tes teams sur la course */
.mt-stop-teams {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--lgb-line);
}

.mt-stop-team {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding-top: 6px;
    color: inherit;
    text-decoration: none;
}

.mt-stop-team + .mt-stop-team {
    border-top: 1px solid var(--lgb-line);
}

a.mt-stop-team:hover {
    color: inherit;
    text-decoration: none;
}

@media (hover: hover) {
    a.mt-stop-card:hover,
    a.mt-stop-team:hover .mt-team-name > span:first-child {
        color: var(--lgb-violet-deep);
    }

    a.mt-stop-card:hover {
        box-shadow: var(--lgb-shadow-hover);
    }
}

.mt-team-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mt-team-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.15;
}

.mt-team-name > span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-team-name .lgb-chip {
    flex-shrink: 0;
}

.mt-team-sub {
    font-size: 12px;
    line-height: 1.2;
    color: var(--lgb-ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-team-side {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mt-best {
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--lgb-gold-soft);
    color: #6B4A00;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.mt-chev {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #A8A2B5;
}

/* Place et points */
.mt-rk {
    flex-shrink: 0;
    text-align: right;
}

.mt-rk b {
    display: block;
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 21px;
    line-height: 1;
    white-space: nowrap;
}

.mt-rk b sup {
    font-size: 0.55em;
    vertical-align: 0.55em;
}

.mt-rk b small {
    font-size: 13px;
    color: var(--lgb-ink-2);
}

.mt-rk span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--lgb-ink-2);
    white-space: nowrap;
}

.mt-medal {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--mt-gold);
    color: #2B2000;
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 14px;
    line-height: 1;
}

.mt-medal--2 { background: var(--mt-silver); color: #191B24; }
.mt-medal--3 { background: var(--mt-bronze); color: #3A1D05; }

/* Le repère du jour */
.mt-today {
    align-items: center;
    min-height: 26px;
}

.mt-today-l {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lgb-red);
    text-align: right;
}

.mt-today .mt-rail {
    align-self: stretch;
}

.mt-today .mt-rail i {
    top: 50%;
    left: 2px;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    background: var(--lgb-red);
    box-shadow: 0 0 0 3px var(--lgb-page);
}

.mt-today-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--lgb-red);
}

.mt-today-line::after {
    content: "";
    flex: 1;
    height: 2px;
    background: var(--lgb-red);
}

/* Où tu finis : la place rapportée à la taille de chaque ligue. Sur bureau seulement, le téléphone a déjà les places dans la frise */
.mt-tops-tile {
    display: none;
    gap: 12px;
    padding: 14px 16px;
}

.mt-tile-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mt-tile-t {
    margin: 0;
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 22px;
    line-height: 1;
    text-transform: uppercase;
}

.mt-tile-s {
    font-size: 12.5px;
    color: var(--lgb-ink-2);
}

.mt-tops {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.mt-top {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 68px;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: inherit;
    text-decoration: none;
}

a.mt-top:hover {
    color: var(--lgb-violet-deep);
    text-decoration: none;
}

.mt-top img {
    display: block;
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.mt-top-n {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mt-top-n > span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-top-n small {
    font-size: 11.5px;
    color: var(--lgb-ink-2);
}

.mt-top-track {
    display: block;
    height: 8px;
    border-radius: 0 4px 4px 0;
    background: #F0EEF4;
    overflow: hidden;
}

.mt-top-track i {
    display: block;
    height: 100%;
    border-radius: 0 4px 4px 0;
    background: var(--lgb-violet);
}

.mt-top-track--live i {
    background: #A08CFF;
}

.mt-top b {
    font-family: 'LGB-Garaje', sans-serif;
    font-weight: 900;
    font-size: 17px;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
}

/* Sans ligue */
.mt-section-sub {
    min-width: 0;
    font-size: 0.8rem;
    color: var(--lgb-ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bureau : la frise à gauche, le bilan et les places à droite */
@container my-teams (min-width: 860px) {
    .mt-in {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 400px;
        grid-template-areas:
            "bar bar"
            "cal sky"
            "cal tops"
            "cal orphans"
            "cal .";
        grid-template-rows: auto auto auto auto 1fr;
        column-gap: 24px;
        row-gap: 14px;
        align-items: start;
    }

    .mt-bar { grid-area: bar; }
    .mt-sky { grid-area: sky; }
    .mt-cal,
    .mt-empty { grid-area: cal; }
    .mt-tops-tile { grid-area: tops; display: flex; }
    .mt-orphans { grid-area: orphans; }

    .mt-stop-teams {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 20px;
    }

    .mt-stop-team + .mt-stop-team {
        border-top: 0;
    }

    .mt-stop-team:nth-child(n + 3) {
        border-top: 1px solid var(--lgb-line);
    }
}
