/* Habillage aux couleurs du club Le Logis Auderghem, par-dessus Tabler */
:root {
    --club-rouge: #E50202;
    --club-bleu: #0D062E;
    --club-vert: #42A735;

    --tblr-primary: var(--club-rouge);
    --tblr-primary-rgb: 229, 2, 2;
    --tblr-link-color: var(--club-rouge);
    --tblr-link-color-rgb: 229, 2, 2;
}

/* Tabler pose margin-left: calc(100vw - 100%) sur :root des 992px : cela laisse un vide a gauche
   des que la page defile. */
@media (min-width: 992px) {
    :root {
        margin-left: 0;
    }
}

.btn-primary {
    background-color: var(--club-rouge);
    border-color: var(--club-rouge);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #c00202;
    border-color: #c00202;
}

.app-navbar {
    z-index: 1030;
}

:root:not([data-bs-theme="dark"]) .app-navbar {
    background-color: #fff;
}

.navbar-brand-image {
    height: 2.2rem;
}

.app-navbar .navbar-brand {
    flex-shrink: 0;
}

.app-navbar .navbar-nav .nav-link {
    padding-left: .5rem;
    padding-right: .5rem;
}

/* Les icones des outils (TV, aide, deconnexion) restent visibles : certains n'ont qu'elle. Entre 992 et
   1200 px, Tabler efface celles des rubriques, ce qui laisse tenir le menu sur une ligne. */
.app-navbar .navbar-collapse .menu-tools .nav-link-icon {
    display: inline-flex;
}

/* Smartphone et tablette : un menu deroulant par-dessus la page, comme sur le site des tournois */
@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
        padding: .5rem 1rem 1rem;
        background: var(--tblr-bg-surface, #fff);
        border-bottom: 1px solid var(--tblr-border-color);
        box-shadow: 0 8px 16px rgba(0, 0, 0, .12);
    }

    .app-navbar .navbar-collapse .navbar-nav {
        width: 100%;
    }

    .app-navbar .navbar-collapse .nav-link {
        justify-content: flex-start;
        min-height: 2.75rem;
    }
}

@media (max-width: 575.98px) {
    .app-navbar .debug-label {
        display: none;
    }

    .app-navbar .debug-badge i {
        margin: 0;
    }
}

/* Bouton flottant « haut de page », comme sur le site des tournois */
.btn-back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1030;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background-color: var(--club-rouge);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s, visibility .2s;
}

.btn-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-back-to-top:hover {
    background-color: #c00202;
    color: #fff;
}

/* Absent la ou il couvrirait la barre « Enregistrer » */
body:has(.action-bar) .btn-back-to-top {
    display: none;
}

/* Smartphone : le bouton ne recouvre pas le pied de page */
@media (max-width: 575.98px) {
    .page-wrapper > .footer {
        padding-bottom: 5rem;
    }
}

.login-page {
    background-color: var(--club-bleu);
}

/* Tabler pose img { height: auto } : la taille se regle ici */
.login-logo {
    height: 100px;
    width: auto;
}

.min-w-0 {
    min-width: 0;
}

/* Cartes a fond colore : le titre prend la couleur du texte de la carte */
.card[class*="-fg"] .card-title {
    color: inherit;
}

/* --- Journee de competition --------------------------------------------------------------- */

.date-nav .form-control {
    font-weight: 600;
}

.time-heading {
    margin: .25rem 0 .5rem;
}

.match-card .card-body {
    padding: .75rem 1rem;
}

.match-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .5rem;
    font-size: .8125rem;
    color: var(--tblr-secondary);
}

.match-teams {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.match-teams > div + div {
    border-top: 1px solid var(--tblr-border-color);
    margin-top: .25rem;
    padding-top: .25rem;
}

/* Carte a cocher : toute la surface est cliquable */
label.match-choice {
    cursor: pointer;
    margin: 0;
}

label.match-choice:has(input:checked) {
    border-color: var(--club-rouge);
    box-shadow: 0 0 0 1px var(--club-rouge);
}

label.match-choice:has(input:focus-visible) {
    outline: 2px solid var(--club-rouge);
    outline-offset: 2px;
}

/* Barre d'action toujours visible en bas de l'ecran */
.action-bar {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
}

/* Carte d'interclub cliquable : le lien couvre la carte, les boutons restent au-dessus */
.match-card .stretched-link {
    color: inherit;
}

.match-card .match-actions {
    position: relative;
    z-index: 2;
    white-space: nowrap;
}

/* --- Preparation d'un interclub ----------------------------------------------------------- */

.lineup-position {
    flex: none;
    font-weight: 700;
}

.lineup-name {
    overflow-wrap: anywhere;
}

/* --- Salles et tables --------------------------------------------------------------------- */

.table-card.status-libre { border-left: 4px solid var(--club-vert); }
.table-card.status-occupee { border-left: 4px solid var(--club-rouge); }
.table-card.status-hors-service { border-left: 4px solid #6c757d; opacity: .7; }

.room-handle { cursor: grab; color: #6c757d; padding: .25rem .5rem; touch-action: none; }
.room-add { max-width: 20rem; }
.room-tables { min-height: 3.5rem; }
.sortable-ghost { opacity: .4; }
.sortable-chosen .table-card, .room-block.sortable-chosen { box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .18); }

.table-choice {
    min-width: 3.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.match-score {
    font-size: 1.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* --- Encodage des resultats --------------------------------------------------------------- */

.switcher {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .25rem;
}

.switcher > * {
    flex: none;
}

.switcher-item {
    gap: .5rem;
    text-align: left;
    line-height: 1.2;
}

.switcher-item.active {
    border-color: var(--club-rouge);
    box-shadow: 0 0 0 1px var(--club-rouge);
}

.switcher-teams {
    font-size: .75rem;
    max-width: 10rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.switcher-score {
    font-weight: 800;
    font-size: .85rem;
    text-align: right;
}

/* Le score reste visible pendant qu'on descend dans la liste des matchs */
.scoreboard {
    position: sticky;
    top: 3.7rem; /* sous le menu */
    z-index: 1020;
}

.game {
    scroll-margin-top: 12rem;
}

.scoreboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
}

.scoreboard-team {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.scoreboard-score {
    font-size: 2.25rem;
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.jump {
    max-width: 14rem;
}

.game {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 13rem minmax(0, 1fr) 4.5rem auto;
    grid-template-areas: "number home entry away result menu";
    align-items: center;
    gap: .5rem .75rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
}

.game-number { grid-area: number; font-weight: 700; }
.game-home { grid-area: home; text-align: right; }
.game-away { grid-area: away; }
.game-entry { grid-area: entry; text-align: center; }
.game-result { grid-area: result; display: flex; flex-direction: column; align-items: center; }
.game-menu { grid-area: menu; }

.game-home .double-choice { justify-content: flex-end; }
.game-side { overflow-wrap: anywhere; }
.game-side.is-winner .game-name { font-weight: 800; color: var(--club-vert); }
.game-preview { min-height: 1.2em; }

.game:focus-within {
    background: rgba(229, 2, 2, .06);
}

@media (max-width: 767.98px) {
    .game {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "number home result menu"
            "number away result menu"
            "entry entry entry entry";
    }

    .game-home { text-align: left; }
    .game-home .double-choice { justify-content: flex-start; }
}

.upload-preview {
    white-space: pre-wrap;
    word-break: break-all;
}

.upload-value {
    overflow-wrap: anywhere;
}

/* Liste des rencontres du club (fenetre) */
#picker-table td {
    cursor: pointer;
}

#picker-table td:first-child {
    width: 1%;
    padding-right: 0;
}
/* Rencontres a l'exterieur : une ligne chacune, elles peuvent etre nombreuses */
.away-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem .5rem 1rem;
}

.away-row-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: .25rem;
}

.away-row-teams {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
    font-weight: 600;
}

.away-row-teams .small {
    font-weight: 400;
}

label.away-row {
    margin: 0;
    cursor: pointer;
}
