/* ===========================================
   Game Log Table Responsive Styles
   Page : /player/<id> onglet Historique
   =========================================== */

/* Hide horizontal scrollbar */
.game-log-table .dash-spreadsheet-container {
    overflow-x: auto !important;
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE/Edge */
}

.game-log-table .dash-spreadsheet-container::-webkit-scrollbar {
    display: none !important; /* Chrome/Safari */
}

/* Base styles */
.game-log-table .dash-cell {
    font-size: 11px !important;
    padding: 5px 3px !important;
}

.game-log-table .dash-header {
    font-size: 11px !important;
    padding: 6px 3px !important;
}

/* Team logos in table cells */
.game-log-table .dash-cell img {
    width: 24px !important;
    height: 24px !important;
}

/* Extra large screens: 1600px+ */
@media (min-width: 1600px) {
    .game-log-table .dash-cell {
        font-size: 12px !important;
        padding: 6px 4px !important;
    }

    .game-log-table .dash-header {
        font-size: 12px !important;
        padding: 8px 4px !important;
    }

    .game-log-table .dash-cell img {
        width: 26px !important;
        height: 26px !important;
    }
}

/* Laptop screens: 1366px and below */
@media (max-width: 1366px) {
    .game-log-table .dash-cell {
        font-size: 10px !important;
        padding: 4px 2px !important;
    }

    .game-log-table .dash-header {
        font-size: 10px !important;
        padding: 5px 2px !important;
    }

    .game-log-table .dash-cell img {
        width: 20px !important;
        height: 20px !important;
    }
}

/* Small laptop: 1200px and below */
@media (max-width: 1200px) {
    .game-log-table .dash-cell {
        font-size: 9px !important;
        padding: 3px 2px !important;
    }

    .game-log-table .dash-header {
        font-size: 9px !important;
        padding: 4px 2px !important;
    }

    .game-log-table .dash-cell img {
        width: 18px !important;
        height: 18px !important;
    }
}

/* Tablets: 992px and below */
@media (max-width: 992px) {
    .game-log-table .dash-cell {
        font-size: 8px !important;
        padding: 3px 1px !important;
    }

    .game-log-table .dash-header {
        font-size: 8px !important;
        padding: 3px 1px !important;
    }

    .game-log-table .dash-cell img {
        width: 16px !important;
        height: 16px !important;
    }
}

/* Mobile: 768px and below */
@media (max-width: 768px) {
    .game-log-table .dash-cell {
        font-size: 7px !important;
        padding: 2px 1px !important;
    }

    .game-log-table .dash-header {
        font-size: 7px !important;
        padding: 2px 1px !important;
    }

    .game-log-table .dash-cell img {
        width: 14px !important;
        height: 14px !important;
    }
}

/* ===========================================
   FICHE JOUEUR — MOBILE (specs/mobile/player/SPEC.md)
   En-tete colle (mobile_header.py), onglets colles, filtres « ✎ Modifier ».
   Les filtres globaux (#filters-panel, coque de l'app) et ceux de l'onglet
   (#player-sidebar-col) sont replaces sous la ligne de pastilles sans les
   deplacer : les conteneurs intermediaires passent en display: contents et
   #content-wrapper devient une colonne ordonnee. Ouverture : classe .open
   sur #content-wrapper (bouton [data-toggle-target], mobile-ui.js).
   =========================================== */
@media (max-width: 1023.98px) {   /* bp mobile */
    #content-wrapper:has(#player-content) {
        display: flex;
        flex-direction: column;
        padding: 12px 12px calc(var(--app-bar-h) + env(safe-area-inset-bottom) + 16px);
        --m-head-h: 64px;   /* hauteur de .phead */
    }
    /* !important : main_layout porte display: flex en style inline */
    #content-wrapper:has(#player-content) :is(:has(#player-sidebar-col), :has(.phead)):not(.phead) {
        display: contents !important;
    }
    #content-wrapper:has(#player-content) #degraded-banner { order: 0; }
    #content-wrapper:has(#player-content) .phead,
    #content-wrapper:has(#player-content) .mobile-player-header .ext-block { order: 1; }
    #content-wrapper:has(#player-content) #player-tabs { order: 2; }
    #content-wrapper:has(#player-content) .player-filters-bar { order: 3; margin-top: 8px; }
    #content-wrapper:has(#player-content) #filters-panel { order: 4; }
    #content-wrapper:has(#player-content) #player-sidebar-col { order: 5; }
    #content-wrapper:has(#player-content) .player-filters-close { order: 6; }
    #content-wrapper:has(#player-content) #player-right-col { order: 7; margin-top: 8px; }
    .player-filters-close {
        min-height: 44px;
        margin: 8px 0 4px;
        border: none;
        border-radius: 10px;
        background: var(--color-primary);
        color: var(--color-text-primary);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }
    #content-wrapper:not(.open) .player-filters-close { display: none !important; }

    /* Filtres replies tant que « ✎ Modifier » n'est pas ouvert */
    #content-wrapper:not(.open) #filters-panel,
    #content-wrapper:has(#player-content):not(.open) #player-sidebar-col { display: none !important; }
    #content-wrapper.open #filters-panel {
        border: 1px solid var(--color-border);
        border-bottom: none;
        border-radius: 12px 12px 0 0;
        background: var(--color-bg-surface);
    }
    #content-wrapper.open #player-sidebar-col {
        flex: none !important;
        padding: 0 16px 12px;
        border: 1px solid var(--color-border);
        border-top: none;
        border-radius: 0 0 12px 12px;
        background: var(--color-bg-surface);
    }
    #player-sidebar-col > div,
    #player-sidebar-col [id$="-filters"] { width: 100% !important; min-width: 0 !important; }

    /* En-tete colle */
    .phead {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 -12px;
        padding: 8px 12px;
        border-bottom: 1px solid var(--color-border-light);
    }
    .ph-photo {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
        border-radius: 50%;
        object-fit: cover;
        background: var(--color-bg-surface-alt);
    }
    .ph-id { flex: 1; min-width: 0; }
    .ph-name {
        overflow: hidden;
        color: var(--color-text-primary);
        font-size: 16px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ph-team, .ph-team:visited { color: var(--color-primary-hover) !important; font-size: 12px; text-decoration: none; }
    .ph-stats { display: flex; gap: 10px; }
    .ph-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
    .ph-stat b { color: var(--color-text-primary); font-size: 15px; font-variant-numeric: tabular-nums; }
    .ph-stat small { color: var(--color-text-muted); font-size: 10px; }
    .ph-bio { margin-bottom: 10px; }
    .ph-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
    .ph-badge > * { min-width: 0 !important; }
    .ph-radar { height: 240px; }

    /* Carrousel KPI (S16) : une ligne qui defile.
       Structure : #<stat>-badges > div (rangee) > #<stat>-<type>-badge (cartes) */
    #tab-badges-container [id$="-badges"] > div {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }
    /* Cartes reduites d'un quart (contenu rendu par callback : zoom global) */
    #tab-badges-container [id$="-badges"] > div > [id$="-badge"] {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        width: 190px !important;
        zoom: 0.75;
        scroll-snap-align: start;
    }

    /* Historique : lieu / B2B puis, dessous, la carte de comparaison reduite */
    .gl-filter-row {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .gl-filter-row > div:first-child { flex-wrap: wrap; row-gap: 8px; }
    .gl-filter-row > div:not(:first-child) {
        align-self: flex-start;
        min-width: 0 !important;
        zoom: 0.75;
    }

    /* Disponibilite : en-tete compact, legende plus petite */
    .syn-card { padding: 12px !important; margin-bottom: 12px !important; }
    .syn-head {
        display: flex;
        justify-content: space-between;
        margin-bottom: 8px;
        color: var(--color-text-muted);
        font-size: 13px;
    }
    .syn-head b { color: var(--color-text-primary); font-size: 16px; }
    .syn-head .syn-played { color: var(--color-success); font-size: 20px; }
    .syn-head .syn-dnp { color: var(--color-danger); font-size: 20px; }
    .syn-legend span { font-size: 11px !important; margin-right: 8px !important; }
}

@media (min-width: 768px) and (max-width: 1023.98px) {   /* bp tablette */
    #content-wrapper:has(#player-content) {
        padding-left: max(12px, calc((100% - 720px) / 2));
        padding-right: max(12px, calc((100% - 720px) / 2));
    }
    .ph-grid { grid-template-columns: 1fr 1fr; }
}

