/* ==========================================================================
   STYLES DÉDIÉS - PAGE CONFRONTATIONS
   ========================================================================== */

/* --- CORE & STYLES GLOBAUX PARTAGÉS --- */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --bg-gradient: radial-gradient(ellipse at top, hsl(228, 15%, 12%), #10121B);
    --container-bg: rgba(28, 32, 44, 0.65);
    --container-border: rgba(255, 255, 255, 0.1);
    
    --accent-color: #fefc54; /* Jaune vif */
    --accent-color-hover: #ffff8c; /* Jaune plus clair */
    --accent-color-active: #e6e34b; /* Jaune légèrement plus foncé */
    --accent-glow: rgba(254, 252, 84, 0.25); /* Ombre lumineuse jaune */
    
    --text-primary: #eef2f7; /* Texte principal clair */
    --text-secondary: #9aa5b8; /* Texte secondaire gris-bleu */
    --text-placeholder: #6c788e; /* Texte placeholder gris */
    
    --interactive-bg: rgba(255, 255, 255, 0.04); /* Fond des éléments interactifs */
    --interactive-bg-hover: rgba(255, 255, 255, 0.08); /* Fond au survol */
    --interactive-border: rgba(255, 255, 255, 0.12); /* Bordure des éléments interactifs */
    
    --table-header-bg: rgba(255, 255, 255, 0.05); /* Fond des entêtes de tableau */
    --table-row-hover-bg: rgba(255, 255, 255, 0.03); /* Fond des lignes au survol */
    --table-cell-border: rgba(255, 255, 255, 0.1); /* Bordure des cellules de tableau */

    --color-win-bg: rgba(20, 160, 120, 0.1); /* Fond victoire (vert) */
    --color-win-border: #14a078; /* Bordure victoire */
    --color-loss-bg: rgba(220, 50, 80, 0.1); /* Fond défaite (rouge) */
    --color-loss-border: #dc3250; /* Bordure défaite */
    --color-draw-bg: rgba(200, 200, 210, 0.05); /* Fond nul (gris) */
    --color-draw-border: #8892a1; /* Bordure nul */
    --data-bar-bg: linear-gradient(90deg, hsla(61, 100%, 50%, 0.35), hsla(61, 100%, 50%, 0.1)); /* Fond des barres de données */
    
    --color-rating-excellent: var(--accent-color); /* Note excellente */
    --color-rating-good: #14a078; /* Note bonne (vert) */
    --color-rating-average: #ffb86c; /* Note moyenne (orange) */
    --color-rating-poor: #dc3250; /* Note mauvaise (rouge) */
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --transition-fast: 0.2s ease-in-out;
    --transition-smooth: 0.3s ease-in-out;
}

/* --- STYLES DU LOADER --- */
.loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(16, 18, 27, 0.9);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; flex-direction: column;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}
.loader-overlay.active { 
    opacity: 1; 
    pointer-events: all; 
}
.loader {
    border: 5px solid rgba(243, 243, 243, 0.3);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%; width: 50px; height: 50px;
    animation: spin 1s linear infinite;
}
.loader-text { 
    color: var(--text-secondary); 
    margin-top: 15px; 
    font-size: 1em; 
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- STYLES DE BASE MODERNISÉS --- */
html {
    height: 100%;
}
body {
    font-family: var(--font-family); 
    margin: 0; 
    padding: 10px;
    background-color: #10121B;
    background-image: radial-gradient(hsla(61, 100%, 50%, 0.08) 1px, transparent 1px);
    background-size: 25px 25px;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    /* MODIFICATION START: Rétablissement du scroll global */
    /* On remet le scroll sur le body pour que la page soit scrollable normalement. */
    overflow: auto;
    /* MODIFICATION END */
    box-sizing: border-box;
}
.container {
    background: var(--container-bg); 
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3), 0 0 0 1px var(--container-border);
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    max-width: 98%;
    margin: 0 auto;
    transition: opacity var(--transition-fast);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 20px);
}
main, .view-progression-advanced {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* --- SYSTÈME D'ONGLETS --- */
.app-tabs-container {
    display: flex; 
    margin-bottom: 25px; 
    border-bottom: 1px solid var(--interactive-border);
    flex-shrink: 0;
}
.app-tab {
    padding: 12px 20px; 
    cursor: pointer; 
    color: var(--text-secondary);
    font-weight: 500; 
    border-bottom: 3px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    position: relative; 
    top: 1px;
    text-decoration: none;
    white-space: nowrap;
}
.app-tab.active {
    color: var(--accent-color); 
    font-weight: 600; 
    border-bottom-color: var(--accent-color);
}
.app-tab:hover:not(.active) { 
    color: var(--text-primary); 
}
.tab-content { 
    display: none; 
    flex-grow: 1;
    flex-direction: column;
    min-height: 0;
}
.tab-content.active { 
    display: flex;
    animation: fadeIn 0.5s ease-in-out; 
}
@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}
.tab-name-short { 
    display: none; 
}
.tab-name-long { 
    display: block; 
}

/* --- BOUTONS ET CONTRÔLES --- */
button, .button {
    transition: all var(--transition-fast);
}

.toggle-filters-btn, #dm-fetch-button, #dm-analyze-button,
.action-button-discreet, .filter-buttons-panel-top button,
.formation-tab, .stepper-btn,
.upcoming-controls .dm-actions-subgroup button,
.cell-action-button, td > button,
.radio-button-group label, .perspective-selector label,
#season-selector label, .season-selector-clone label {
    font-size: 0.9em;
}

.toggle-filters-btn, #dm-fetch-button, #dm-analyze-button {
    padding: 0 20px; 
    background: var(--accent-color); 
    color: #050a14;
    border: none; 
    border-radius: var(--radius-md); 
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
    height: 42px; 
    box-sizing: border-box;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-filters-btn .btn-text-mobile {
    display: none;
}
.toggle-filters-btn:hover, #dm-fetch-button:hover, #dm-analyze-button:hover {
    background-color: var(--accent-color-hover); 
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--accent-glow), 0 4px 10px rgba(0,0,0,0.2);
}
.toggle-filters-btn:active, #dm-fetch-button:active, #dm-analyze-button:active {
    background-color: var(--accent-color-active); 
    transform: translateY(0);
    box-shadow: 0 0 5px var(--accent-glow);
}
#dm-analyze-button:disabled, .analyze-opponent-matches-btn:disabled {
    background: var(--interactive-bg-hover); 
    color: var(--text-secondary);
    cursor: not-allowed; 
    box-shadow: none; 
    transform: none;
}
.action-button-discreet, .filter-buttons-panel-top button {
    padding: 6px 12px; 
    background: var(--interactive-bg); 
    color: var(--text-secondary);
    border: 1px solid var(--interactive-border);
    border-radius: var(--radius-md); 
    font-weight: 500;
}
.action-button-discreet:hover, .filter-buttons-panel-top button:hover {
    background: var(--interactive-bg-hover); 
    color: var(--text-primary);
    border-color: var(--accent-color);
}
.filter-buttons-panel-top { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 15px; 
}

/* --- BARRE SUPÉRIEURE DES VUES --- */
.view-top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center; /* Aligne verticalement les éléments */
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--interactive-border);
    flex-shrink: 0;
}

.view-top-bar-filters-line-1,
.view-top-bar-filters-line-2 {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

/* Disposition Desktop: tout sur une seule ligne */
@media (min-width: 1025px) {
    .view-top-bar {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 15px;
    }
    .season-name-long { display: block; }
    .season-name-short { display: none; }
}

/* --- LAYOUT & PANNEAUX DE FILTRES --- */
.main-content-area { 
    display: flex; 
    gap: 20px; 
    align-items: stretch; 
    margin-top:15px;
    position: relative;
    flex-grow: 1;
    min-height: 0;
}
.main-content-area.with-filters {
    gap: 0;
    transition: all var(--transition-smooth);
}
.filters-panel {
    position: absolute;
    top: 0;
    bottom: 0; 
    left: 0;
    z-index: 100;
    background: hsl(228, 15%, 15%);
    padding: 20px; 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--container-border); 
    display: flex; 
    flex-direction: column;
    height: 100%; 
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

#equipe-formation-filters-panel {
    overflow-y: auto;
    height: auto; 
    bottom: auto; 
}


.filters-panel.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
#recherche-equipes-view .main-content-area .filters-panel {
    top: 0;
}
.toggle-filters-btn.active {
    background-color: var(--accent-color-active);
    box-shadow: 0 0 10px var(--accent-glow);
}
.table-wrapper { 
    flex-grow: 1;
    overflow: auto;
    min-width: 0;
    min-height: 0;
    transition: margin-left var(--transition-smooth);
    border-radius: var(--radius-md); 
    display: flex;
    flex-direction: column;
}
.filter-panel-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding-bottom: 10px; 
    margin-bottom: 12px; 
    border-bottom: 1px solid var(--interactive-border); 
    flex-shrink: 0; 
}
.filters-panel h3, .filters-panel-collapsible .filters-panel-header h3 { 
    color: var(--text-primary); 
    font-size: 1em; 
    text-transform: uppercase; 
    letter-spacing: 0.8px; 
    margin: 0; 
    font-weight: 600; 
}
label.multiple-choice-label-inline { 
    align-items: center; 
    display: flex; 
    font-size: 0.9em; 
    color: var(--text-secondary); 
}
label.multiple-choice-label-inline input { 
    margin-right: 8px; 
}
#formation-b-checkbox-list {
    overflow-y: auto; 
    flex-grow: 1; 
}
.checkbox-list label, .checkbox-list-equipes-panel label {
    display: flex; 
    align-items: center; 
    margin-bottom: 2px;
    color: var(--text-secondary); 
    font-weight: 400; 
    font-size: 0.9em; 
    cursor: pointer;
    padding: 8px; 
    border-radius: var(--radius-md);
}
.checkbox-list label:hover, .checkbox-list-equipes-panel label:hover {
    background-color: var(--interactive-bg-hover); 
    color: var(--text-primary);
}
.checkbox-list input[type="checkbox"], 
.checkbox-list-equipes-panel input[type="checkbox"],
label.multiple-choice-label-inline input[type="checkbox"] { 
    margin-right: 10px;
    width: 1.2em;
    height: 1.2em;
    accent-color: var(--accent-color);
}
.placeholder-text { 
    text-align:center; 
    color: var(--text-secondary); 
    padding: 40px 20px; 
    font-style: italic; 
}

/* --- FILTRES SPÉCIFIQUES & INPUTS --- */
.recherche-filters-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--interactive-border); 
    margin-bottom: 20px;
    flex-shrink: 0;
}
.recherche-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}
.filter-item {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    min-width: 200px;
}
.filter-item.button-wrapper {
    flex-grow: 0; 
    flex-basis: auto; 
}
.filter-item h4 {
    margin: 0 0 8px 0; 
    font-size: 0.8em; 
    color: var(--text-secondary); 
    font-weight: 500; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}
.filter-title-inline { display: none; }
@media(min-width: 769px) {
    .filter-item > h4 { display: block; }
}
@media(max-width: 768px) {
    .filter-item > h4 { display: none; }
    .filter-title-inline { display: block; }
}

#recherche-equipes-view input[type="text"],
#derniers-matchs-view input[type="number"],
#recherche-equipes-view input[type="number"],
.input-with-stepper-container,
#season-selector, .season-selector-clone {
    height: 42px;
}

#recherche-equipes-view input[type="text"],
#derniers-matchs-view input[type="number"],
#recherche-equipes-view input[type="number"] {
    padding: 0 12px; 
    font-size: 0.9em; 
    border-radius: var(--radius-md);
    border: 1px solid var(--interactive-border); 
    background-color: var(--interactive-bg);
    color: var(--text-primary); 
    width: 100%; 
    box-sizing: border-box;
}
#recherche-equipes-view input[type="text"]:focus,
#derniers-matchs-view input[type="number"]:focus,
#recherche-equipes-view input[type="number"]:focus {
    outline: none; 
    border-color: var(--accent-color); 
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.dm-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.dm-filter-group {
    display: flex; 
    flex-direction: column; 
    flex: 1 1 220px; 
    min-width: 180px;
    gap: 4px; 
}
.dm-filter-group h4 {
    font-size: 0.8em;
    margin: 0;
    color: var(--text-secondary);
}
.dm-filter-group.button-group {
    padding-top: 0; 
}

.dm-actions-subgroup {
    display: flex; 
    gap: 10px; 
    align-items: center;
    width: 100%;
}
.dm-actions-subgroup button {
    flex: 1;
}

.radio-button-group {
    display: inline-flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--interactive-border);
    box-sizing: border-box;
    height: 42px;
    width: auto;
}

#perspective-selector-container-confrontation {
    display: inline-flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--interactive-border);
    box-sizing: border-box;
    height: 42px;
    width: auto; /* S'adapte au contenu */
    flex-shrink: 0; /* Ne pas rétrécir */
}

.radio-button-group label {
    padding: 0 15px;
    text-align: center;
    cursor: pointer;
    background-color: var(--interactive-bg);
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.perspective-selector label {
    flex-grow: 0;
    flex-basis: auto;
    padding: 0 10px; 
    text-align: center;
    cursor: pointer;
    background-color: var(--interactive-bg);
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    transition: all var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
}

.radio-button-group input[type="radio"],
.perspective-selector input[type="radio"] { 
    position: absolute; 
    opacity: 0; 
    width: 0;
    height: 0;
}
.radio-button-group label:not(:last-child),
.perspective-selector label:not(:last-child) { 
    border-right: 1px solid var(--interactive-border); 
}
.radio-button-group input[type="radio"]:checked + label,
.perspective-selector input[type="radio"]:checked + label { 
    background-color: var(--accent-color); 
    color: #050a14; 
    font-weight: 700; 
}
.radio-button-group label:hover:not(input[type="radio"]:checked + label),
.perspective-selector label:hover:not(input[type="radio"]:checked + label) { 
    background-color: var(--interactive-bg-hover); 
    color: var(--text-primary); 
}
/* Règle spécifique pour les filtres qui doivent s'étirer */
#recherche-equipes-view .radio-button-group,
#derniers-matchs-view .radio-button-group {
    display: flex;
    width: 100%;
}
#recherche-equipes-view .radio-button-group label,
#derniers-matchs-view .radio-button-group label {
    flex-grow: 1;
    flex-basis: 0;
}


#derniers-matchs-view .dm-selection-controls { 
    display: flex; 
    gap: 15px; 
    align-items: center; 
    padding: 10px 0; 
    justify-content: flex-end;
}
#dm-selection-controls-container button {
    display: none;
}

.input-with-stepper-container {
    display: flex; 
    align-items: center; 
    border: 1px solid var(--interactive-border);
    border-radius: var(--radius-md); 
    background-color: var(--interactive-bg);
    width: 100%; 
    box-sizing: border-box; 
}
.input-with-stepper-container:focus-within {
    border-color: var(--accent-color); 
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-with-stepper-container input[type="number"] {
    -moz-appearance: textfield; 
    flex-grow: 1; 
    border: none; 
    background: transparent;
    padding: 0 12px; 
    color: var(--text-primary); 
    font-size: 0.9em; 
    width: 100%;
    height: 100%;
}
.input-with-stepper-container input[type="number"]::-webkit-outer-spin-button, 
.input-with-stepper-container input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none; 
    margin: 0;
}
.input-with-stepper-container input[type="number"]:focus { 
    outline: none; 
}
.stepper-buttons { 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    padding-right: 5px; 
}
.stepper-btn {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background-color: transparent;
    border: none; 
    color: var(--text-secondary); 
    cursor: pointer; 
    padding: 2px 4px; 
    height: 50%;
}
.stepper-btn:hover { 
    color: var(--text-primary); 
}

/* --- TABLEAUX --- */
table { 
    width: 100%; 
    border-collapse: separate;
    border-spacing: 0; 
    font-size: 0.9em; 
    table-layout: fixed;
} 
table.table-adaptive {
    table-layout: auto;
}
thead { 
    position: sticky; 
    top: 0; 
    z-index: 10; 
    background-color: #121620;
}
th { 
    background-color: var(--table-header-bg); 
    color: var(--text-secondary); 
    padding: 4px 8px;
    text-transform: uppercase; 
    font-size: 0.75em; 
    font-weight: 600; 
    letter-spacing: 0.5px; 
    position: relative;
    z-index: 2;
    border-bottom: 1px solid var(--table-cell-border);
    border-left: 1px solid var(--table-cell-border);
    text-align: center;
    white-space: nowrap;
}
#derniers-matchs-output th:first-child .select-all-indicator,
.opponent-matches-output-container th:first-child .select-all-indicator {
    font-size: 0.8em;
    margin-left: 4px;
    color: var(--text-placeholder);
    display: inline-block;
}
#derniers-matchs-output th:first-child,
.opponent-matches-output th:first-child {
    cursor: pointer;
}
th:first-child {
    border-left: none;
    width: auto;
    white-space: nowrap;
}
th[rowspan="2"] {
    vertical-align: middle;
}
th[data-tooltip-text] { 
    cursor: help; 
}
th:first-child { 
    border-radius: var(--radius-md) 0 0 0; 
}
th:last-child { 
    border-radius: 0 var(--radius-md) 0 0; 
}
th[aria-sort] {
    cursor: pointer;
}
th[aria-sort]::after {
    content: ''; 
    position: absolute; 
    right: 8px; 
    top: 50%;
    transform: translateY(-50%); 
    width: 0; 
    height: 0;
    border-left: 5px solid transparent; 
    border-right: 5px solid transparent;
    opacity: 0.5; 
    transition: opacity var(--transition-fast);
}
th[aria-sort]:hover::after { 
    opacity: 1; 
}
th[aria-sort="ascending"]::after { 
    border-bottom: 5px solid var(--text-primary); 
    opacity: 1; 
}
th[aria-sort="descending"]::after { 
    border-top: 5px solid var(--text-primary); 
    opacity: 1; 
}
tbody tr:hover { 
    background-color: var(--table-row-hover-bg); 
}
td { 
    border-bottom: 1px solid var(--table-cell-border); 
    border-left: 1px solid var(--table-cell-border);
    padding: 4px 6px;
    text-align: center; 
    vertical-align: middle; 
    white-space: nowrap;
}
td:first-child {
    border-left: none;
}

.data-bar-cell { 
    padding: 0;
    position: relative; 
} 
.data-bar-cell > span { 
    position: relative; 
    z-index: 1; 
    display: block;
    padding: 4px 6px;
} 
.data-bar { 
    position: absolute; 
    left: 0; 
    top: 0; 
    height: 100%; 
    background: var(--data-bar-bg); 
    z-index: 0; 
    transition: width 0.3s ease-in-out; 
}
.dm-result-win td:first-child { border-left: 5px solid var(--color-win-border); }
.dm-result-loss td:first-child { border-left: 5px solid var(--color-loss-border); }
.dm-result-draw td:first-child { border-left: 5px solid var(--color-draw-border); }
#derniers-matchs-output input[type="checkbox"],
.opponent-matches-output-container input[type="checkbox"] { 
    accent-color: var(--accent-color); 
    width: 1.3em; 
    height: 1.3em; 
    cursor: pointer; 
}

td > span {
    padding: 0;
}
td > a,
td > button {
    display: block;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    width: 100%;
    color: inherit;
}
td > a {
    color: var(--accent-color);
    font-weight: 500;
    text-decoration: none;
    padding: 4px 6px;
}
td > a:hover {
    color: var(--accent-color-hover);
    text-decoration: underline;
}
.cell-action-button {
    color: var(--text-primary);
    font-weight: 400;
    padding: 4px 6px;
}
.cell-action-button:hover {
    color: var(--accent-color);
    text-decoration: underline;
}
td .action-button-discreet {
    display: inline-block;
    width: auto;
    padding: 6px 12px;
    background: var(--interactive-bg);
    color: var(--text-secondary);
    border: 1px solid var(--interactive-border);
    border-radius: var(--radius-md);
    font-weight: 500;
}
td .action-button-discreet:hover {
    color: var(--text-primary);
    background: var(--interactive-bg-hover);
    border-color: var(--accent-color);
    text-decoration: none;
}

#season-selector, .season-selector-clone {
    display: inline-flex;
    border-radius: var(--radius-md); 
    overflow-x: auto;
    background-color: var(--interactive-bg); 
    border: 1px solid var(--interactive-border);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#season-selector::-webkit-scrollbar, .season-selector-clone::-webkit-scrollbar {
    display: none;
}

#season-selector input[type="radio"], .season-selector-clone input[type="radio"] { 
    position: absolute; 
    opacity: 0; 
}
#season-selector label, .season-selector-clone label {
    padding: 0 15px;
    cursor: pointer; 
    color: var(--text-secondary); 
    font-weight: 500;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
#season-selector label:not(:last-of-type), .season-selector-clone label:not(:last-of-type) {
    border-right: 1px solid var(--interactive-border);
}
#season-selector label:hover, .season-selector-clone label:hover {
    background-color: var(--interactive-bg-hover); 
    color: var(--text-primary);
}
#season-selector input[type="radio"]:checked + label, 
.season-selector-clone input[type="radio"]:checked + label {
    background-color: var(--accent-color); 
    color: #050a14; 
    font-weight: 700;
}

/* --- VUE: ANALYSE PAR CONFRONTATION --- */
#confrontations-view table {
    table-layout: auto;
}

#confrontations-view table th,
#global-ratios-view table th,
#recherche-equipes-view table th {
    font-size: 0.9em; 
    font-weight: 700;
    letter-spacing: 0.6px;
}

#confrontations-view table td,
#global-ratios-view table td,
#recherche-equipes-view table td {
    font-size: 1.25em; 
    font-weight: 400;
}

/* --- VUE: PROCHAINS MATCHS --- */
#prochains-matchs-content-area {
    display: flex; flex-direction: column; gap: 15px;
}
.manager-collapsible {
    border: 1px solid var(--interactive-border); border-radius: var(--radius-md); overflow: hidden;
}
.manager-header {
    display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background-color: var(--interactive-bg); cursor: pointer; transition: background-color var(--transition-fast);
}
.manager-header:hover {
    background-color: var(--interactive-bg-hover);
}
.manager-header h3 {
    margin: 0; font-size: 1.2em;
}
.manager-header .collapse-icon {
    transition: transform 0.3s ease; font-size: 1.2em;
}
.manager-header.active .collapse-icon {
    transform: rotate(180deg);
}
.clubs-container {
    padding: 0; background-color: rgba(0,0,0,0.15); max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out;
}
.clubs-container.active {
    max-height: 500px;
}
.manager-table {
    table-layout: fixed; width: 100%;
}
.manager-table th:nth-child(1), .manager-table td:nth-child(1) { width: 10%; text-align: center;}
.manager-table th:nth-child(2), .manager-table td:nth-child(2) { width: 45%; }
.manager-table th:nth-child(3), .manager-table td:nth-child(3) { width: 15%; text-align: center;}
.manager-table th:nth-child(4), .manager-table td:nth-child(4) { width: 15%; text-align: center;}
.manager-table th:nth-child(5), .manager-table td:nth-child(5) { width: 15%; text-align: center;}
.manager-table td {
    padding-top: 12px; padding-bottom: 12px; vertical-align: middle;
}
.club-logo-small {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle;
}

/* --- MODALES SPÉCIFIQUES (ANALYSE TACTIQUE & ADVERSAIRES) --- */
.analysis-modal-overlay{
    position:fixed;top:0;left:0;width:100%;height:100%;
    background:rgba(16,18,27,.9);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
    display:none;justify-content:center;align-items:center;z-index:10000;
    opacity:0;
}
.analysis-modal-overlay.visible{
    display:flex;
    animation:modalFadeIn .3s ease-out forwards;
}
@keyframes modalFadeIn{from{opacity:0}to{opacity:1}}
.analysis-modal-content{
    background-color:#121620;border:1px solid var(--container-border);
    border-radius:var(--radius-lg);padding:2vh 2vw;width:95%;max-width:1400px;
    height:95vh;display:flex;flex-direction:column;overflow:hidden;
    box-shadow:0 15px 50px rgba(0,0,0,.5);position:relative;
    animation:modalScaleUp .3s ease-out forwards;
}
@keyframes modalScaleUp{from{transform:scale(.95)}to{transform:scale(1)}}
.analysis-modal-header{
    display:flex;justify-content:space-between;align-items:flex-start;
    border-bottom:1px solid var(--interactive-border);padding-bottom:15px;margin-bottom:15px;
    flex-shrink:0;
}
.analysis-modal-header h2{
    margin:0;font-size:1.8em;color:var(--text-primary);line-height:1.2;
}
.analysis-modal-header h2 small{
    display:block;font-size:.5em;font-weight:400;color:var(--text-secondary);margin-top:4px;
}
.analysis-modal-close-btn{
    background:transparent;border:none;color:var(--text-secondary);
    font-size:2em;cursor:pointer;line-height:1;padding:0 5px;
    transition:color var(--transition-fast),transform var(--transition-fast);
}
.analysis-modal-close-btn:hover{
    color:var(--text-primary);transform:rotate(90deg);
}
.analysis-formation-tabs{
    display:flex;gap:8px;margin-bottom:15px;flex-wrap:wrap;flex-shrink:0;
}
.formation-tab{
    padding:8px 16px;font-weight:500;
    background-color:var(--interactive-bg);color:var(--text-secondary);
    border:1px solid var(--interactive-border);border-radius:var(--radius-md);cursor:pointer;
}
.formation-tab:hover{
    background-color:var(--interactive-bg-hover);color:var(--text-primary);border-color:var(--accent-color);
}
.formation-tab.active{
    background-color:var(--accent-color);color:#050a14;font-weight:700;
    border-color:var(--accent-color);box-shadow:0 0 10px var(--accent-glow);
}

#squad-analysis-output {
    flex-grow: 1;
    overflow: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch; 
}

.squad-analysis-container.grid-layout {
    display: grid;
    grid-template-columns: repeat(5, 180px);
    grid-template-rows: repeat(7, auto);
    gap: 10px;
    max-width: 1200px;
    min-width: 940px;
    margin: 0 auto;
}

.position-card {
    position: relative;
    overflow: hidden;
    background: transparent;
    border-radius: var(--radius-md);
    padding: 15px;
    transition: all .2s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.position-card::before,
.position-card::after,
.card-overlay {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    transition: all .2s ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.card-overlay {
    background: linear-gradient(135deg, hsla(220, 20%, 15%, 0.8), hsla(220, 25%, 8%, 0.8));
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.position-card::before {
    inset: -1px;
    border: 1px solid var(--container-border);
    opacity: 0.8;
    z-index: 2;
}

.position-card::after {
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.05) 0%, transparent 70%);
    opacity: 0;
    filter: blur(8px);
    z-index: 3;
}

.position-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 25px var(--accent-glow);
}
.position-card:hover::before {
    border-color: var(--accent-color);
    opacity: 1;
}
.position-card:hover::after {
    opacity: 0.5;
}

.card-content-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 15px;
}

.card-main-stat-container {
    display: flex;
    flex-direction: column;
}
.card-main-stat-container:last-child {
    align-items: flex-end;
}

.card-rating-display {
    font-size: 2em;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0 8px rgba(254, 252, 84, 0.4);
}

.pass-values-wrapper {
    display: flex;
    align-items: baseline;
}

.passes-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.passes-percentage {
    font-size: 0.7em;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-left: 5px;
}

.passes-label {
    font-size: 0.7em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.card-position-label {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-secondary-stats {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding-top: 15px;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.secondary-stat-row {
    display: contents;
}

.card-secondary-stats .stat-label {
    color: var(--text-secondary);
    font-size: 0.8em;
    text-transform: uppercase;
    text-align: left;
}

.card-secondary-stats .stat-value {
    font-weight: 600;
    text-align: right;
    font-size: 0.9em;
    color: var(--text-primary);
}

.player-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(24, 29, 41, .97);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: inherit;
    padding: 8px;
    box-sizing: border-box;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.position-card:hover .player-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.position-card:hover .card-content-wrapper {
    opacity: 0;
    pointer-events: none;
}

.grid-pos-1-1{grid-column:1;grid-row:1}.grid-pos-1-2{grid-column:2;grid-row:1}.grid-pos-1-3{grid-column:3;grid-row:1}.grid-pos-1-4{grid-column:4;grid-row:1}.grid-pos-1-5{grid-column:5;grid-row:1}.grid-pos-2-1{grid-column:1;grid-row:2}.grid-pos-2-2{grid-column:2;grid-row:2}.grid-pos-2-3{grid-column:3;grid-row:2}.grid-pos-2-4{grid-column:4;grid-row:2}.grid-pos-2-5{grid-column:5;grid-row:2}.grid-pos-3-1{grid-column:1;grid-row:3}.grid-pos-3-2{grid-column:2;grid-row:3}.grid-pos-3-3{grid-column:3;grid-row:3}.grid-pos-3-4{grid-column:4;grid-row:3}.grid-pos-3-5{grid-column:5;grid-row:3}.grid-pos-4-1{grid-column:1;grid-row:4}.grid-pos-4-2{grid-column:2;grid-row:4}.grid-pos-4-3{grid-column:3;grid-row:4}.grid-pos-4-4{grid-column:4;grid-row:4}.grid-pos-4-5{grid-column:5;grid-row:4}.grid-pos-5-1{grid-column:1;grid-row:5}.grid-pos-5-2{grid-column:2;grid-row:5}.grid-pos-5-3{grid-column:3;grid-row:5}.grid-pos-5-4{grid-column:4;grid-row:5}.grid-pos-5-5{grid-column:5;grid-row:5}.grid-pos-6-1{grid-column:1;grid-row:6}.grid-pos-6-2{grid-column:2;grid-row:6}.grid-pos-6-3{grid-column:3;grid-row:6}.grid-pos-6-4{grid-column:4;grid-row:6}.grid-pos-6-5{grid-column:5;grid-row:6}.grid-pos-7-1{grid-column:1;grid-row:7}.grid-pos-7-2{grid-column:2;grid-row:7}.grid-pos-7-3{grid-column:3;grid-row:7}.grid-pos-7-4{grid-column:4;grid-row:7}.grid-pos-7-5{grid-column:5;grid-row:7}

#upcoming-modal { z-index: 9998; }
#analysis-modal { z-index: 10000; }

#upcoming-modal-body {
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}
.opponents-grid {
    display: flex; 
    gap: 15px; 
    margin-bottom: 20px; 
    padding: 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: center; /* MODIFICATION : Centrage de la grille */
    padding-bottom: 15px; 
}
.opponent-card {
    flex-shrink: 0; 
}
.opponent-card label {
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    gap: 5px; padding: 10px; border: 2px solid transparent; 
    border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); 
    background-color: var(--interactive-bg);
    width: 140px; height: 140px;
    box-sizing: border-box;
}
.opponent-card .opponent-radio { position: absolute; opacity: 0; width: 0; height: 0; }
.opponent-card .opponent-logo { width: 70px; height: 70px; border-radius: var(--radius-md); object-fit: cover; }
.opponent-card .opponent-name { 
    font-size: 0.8em; font-weight: 500; text-align: center; 
    height: 35px; display: flex; align-items: center; justify-content: center;
    line-height: 1.2;
}
.opponent-card .opponent-radio:checked + label { border-color: var(--accent-color); background-color: var(--interactive-bg-hover); transform: scale(1.05); }
.upcoming-controls {
    display: flex; 
    flex-wrap: wrap; 
    gap: 15px; 
    padding: 15px; 
    border-top: 1px solid var(--interactive-border); 
    border-bottom: 1px solid var(--interactive-border); 
    margin-bottom: 20px;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
}
.upcoming-controls .dm-filter-group { 
    flex-grow: 1; 
    flex-shrink: 1;
    min-width: 200px;
    gap: 5px;
}
.upcoming-controls h4 {
    font-size: 0.8em;
    margin: 0;
}
.opponent-matches-output-container { 
    flex-grow: 0;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.opponent-matches-output-container table { font-size: 0.9em; }
.opponent-matches-output-container thead { position: sticky; top: -1px; z-index: 11; }
.mini-loader-container { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 150px; }

.upcoming-controls .radio-button-group {
    display: flex;
    width: 100%;
}
.upcoming-controls .radio-button-group label {
    flex: 1;
}

.upcoming-controls .action-button-discreet {
    padding: 0 20px; font-weight: 600; height: 42px; box-sizing: border-box; background: var(--interactive-bg); color: var(--text-secondary); border: 1px solid var(--interactive-border); border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast);
}
.upcoming-controls .action-button-discreet:hover {
    background: var(--interactive-bg-hover); color: var(--text-primary); border-color: var(--accent-color); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.upcoming-controls .action-button-discreet:disabled {
    background: var(--interactive-bg-hover) !important; color: var(--text-secondary) !important; cursor: not-allowed; box-shadow: none; transform: none; border-color: var(--interactive-border) !important;
}
.upcoming-controls .selection-counter {
    display: none; 
}
.upcoming-controls .dm-actions-subgroup { display: flex; gap: 10px; width: 100%; height: 100%; }
.upcoming-controls .dm-actions-subgroup button,
.upcoming-controls .dm-actions-subgroup .action-button-discreet {
    flex-grow: 1; padding: 0 12px; background: var(--interactive-bg); color: var(--text-secondary); border: 1px solid var(--interactive-border); border-radius: var(--radius-md); font-weight: 500; cursor: pointer; transition: all var(--transition-fast); display: flex; align-items: center; justify-content: center; height: 42px; box-sizing: border-box;
}
.upcoming-controls .dm-actions-subgroup button:hover,
.upcoming-controls .dm-actions-subgroup .action-button-discreet:hover {
    background: var(--interactive-bg-hover); color: var(--text-primary); border-color: var(--accent-color); transform: translateY(-2px); box-shadow: 0 0 10px var(--accent-glow), 0 4px 8px rgba(0,0,0,0.2);
}
.upcoming-controls .dm-actions-subgroup button:disabled,
.upcoming-controls .dm-actions-subgroup .action-button-discreet:disabled {
    background: var(--interactive-bg-hover) !important; color: var(--text-secondary) !important; cursor: not-allowed; box-shadow: none; transform: none; border-color: var(--interactive-border) !important;
}

.analysis-modal-content.fullscreen {
    width: 100%; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; padding: 20px; box-sizing: border-box;
}

/* --- COMPOSANTS COMMUNS --- */
.custom-tooltip{
    position:fixed;background-color:var(--accent-color);color:#050a14;
    padding:6px 12px;border-radius:var(--radius-md);font-size:.85em;font-weight:500;
    line-height:1.4;max-width:250px;z-index:10001;pointer-events:none;
    opacity:0;transform:translateY(10px) scale(.95);
    transition:opacity .15s ease-out,transform .15s ease-out;
    box-shadow:0 4px 15px rgba(0,0,0,.3);
}
.custom-tooltip.visible{
    opacity:1;transform:translateY(0) scale(1)
}

/* --- MEDIA QUERIES --- */
@media (min-width: 769px) {
    .upcoming-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1024px) {
    .season-name-long { display: none; }
    .season-name-short { display: block; }
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .toggle-filters-btn .btn-text-desktop {
        display: none;
    }
    .toggle-filters-btn .btn-text-mobile {
        display: block;
    }

    @media (orientation: landscape) {
        .toggle-filters-btn .btn-text-desktop {
            display: block;
        }
        .toggle-filters-btn .btn-text-mobile {
            display: none;
        }
        /* MODIFICATION START: Réorganisation des contrôles en mobile paysage */
        .dm-controls-row {
            flex-wrap: wrap;
        }
        .dm-controls-row > .dm-filter-group:first-child {
            flex-basis: 100%; /* Le champ ID prend toute la largeur */
            min-width: 100%;
        }
        /* FIN DE LA MODIFICATION */
    }
    .view-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .view-top-bar-filters-line-1,
    .view-top-bar-filters-line-2 {
        width: 100%;
    }
    #ovr-tabs-container-confrontation {
        margin-left: auto; 
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #season-selector, .season-selector-clone {
        margin-left: auto;
    }
}


@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 15px; }
    
    .app-tabs-container { 
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    .app-tab { 
        flex-shrink: 0; 
    }
    
    .main-content-area { 
        flex-direction: column; 
        gap: 15px; 
    }
    
    .main-content-area .filters-panel {
        position: absolute;
        left: 10px; right: 10px; width: auto;
        top: 40px; 
        max-width: none; 
        bottom: 10px;
        transform: translateY(-10px);
        height: auto;
    }
    .main-content-area .filters-panel.active {
        transform: translateY(0);
    }

    #recherche-equipes-view .main-content-area .filters-panel {
       top: 0;
       bottom: auto;
       height: auto; 
    }

    .table-wrapper, #confrontations-view table {
        min-height: 200px;
    }
    
    #global-ratios-view table,
    #derniers-matchs-view table {
        table-layout: auto;
    }

    #confrontations-view table td, #confrontations-view table th,
    #global-ratios-view table td, #global-ratios-view table th,
    #derniers-matchs-view table td, #derniers-matchs-view table th {
        white-space: nowrap;
    }

    .analysis-modal-content { width: 98%; padding: 15px; }
    
    /* Recherche d'équipes */
    .recherche-filters-container { margin-bottom: 15px; }
    .recherche-filter-row { flex-direction: column; align-items: stretch; gap: 15px; }
    .filter-item { min-width: unset; flex-basis: auto; height: auto; }
    
    /* 15 Derniers Matchs */
    .dm-controls-row { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 10px;
    }
    .dm-filter-group { 
        min-width: unset; 
        flex: 1; 
    }
    .dm-filter-group.button-group {
        padding-top: 0;
    }
    #dm-selection-controls-container .action-button-discreet { display: none; }
    
    /* 5 Prochains Matchs (dans modale) */
    .upcoming-controls .dm-actions-subgroup { flex-direction: row; }
    .upcoming-controls .dm-actions-subgroup button { flex: 1; }
    .opponent-card .opponent-name { white-space: normal; }

    .position-card { padding: 10px; min-height: 150px; }
    .card-rating-display { font-size: 1.6em; }
    .card-position-label { font-size: 1.1em; }
    .passes-value { font-size: 1.5em; }
    .passes-percentage { font-size: 0.7em; }
    .passes-label { font-size: 0.65em; }
    .card-secondary-stats .stat-label, .card-secondary-stats .stat-value { font-size: 0.75em; }
}

@media (max-width: 480px) {
    body { padding: 5px; }
    .container { padding: 10px; border-radius: var(--radius-lg); }
    .app-tab { padding: 10px 15px; font-size: 0.8em; }
    .view-top-bar { padding-bottom: 10px; }

    .radio-button-group label,
    .perspective-selector label {
        padding: 0 10px;
    }
    #season-selector label, .season-selector-clone label { padding: 0 10px; }
    .filters-panel { padding: 15px; }
    .analysis-modal-header h2 { font-size: 1.4em; }
    .analysis-modal-close-btn { font-size: 1.8em; }
}