/* ========================================
   CONTENEURS ET GRAPHIQUES
======================================== */
.statistics-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.centered-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.statistics-graph {
    margin: 0 50px 30px 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    background-color: white;
}

/* ========================================
   SÉLECTEUR DE STRATÉGIE
======================================== */
.strategy-intro {
    text-align: center;
    margin: 22px auto 6px auto;
    width: 80%;
    color: gray;
    font-size: 15px;
    font-weight: bold;
    font-family: "Arial", sans-serif;
}

#strategy-description {
    text-align: center;
    margin: 8px auto;
    width: 80%;
    color: gray;
    font-size: 15px;
    font-weight: bold;
    font-family: "Arial", sans-serif;
}

.strategy-selector {
    display: flex;
    justify-content: center;
    padding: 10px;
    flex-wrap: wrap;
}

.strategy-button {
    padding: 10px 20px;
    margin: 10px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    border-radius: 20px;
    outline: none;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
    position: relative;
}

.strategy-button:hover {
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);
}

.strategy-button.active, .strategy-button:focus {
    background-color: #007C70;
    color: white;
    outline: none;
    border: 1px solid #007C70;
}

/* ========================================
   BOÎTES STATISTIQUES PRINCIPALES
======================================== */
.square-box {
    width: 170px;
    height: 170px;
    border: 1px solid #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    border-radius: 10px;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.statistics-item.square-box {
    margin-top: 20px;
    margin-bottom: 20px;
}

.statistics-item {
    margin: 0 20px;
    position: relative;
}

.statistics-item h2 {
    font-size: 25px;
    font-weight: bold;
    font-family: "Arial", sans-serif;
    margin-bottom: 1px;
    text-align: center;
}

.statistics-value {
    font-size: 30px;
    font-weight: bold;
    color: #007C70;
    font-family: "Arial", sans-serif;
}

.statistics-status {
    font-size: 3px;
}

/* ========================================
   ICÔNES INFORMATIVES ET TOOLTIPS
======================================== */
.info-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    color: #576279;
    cursor: help;
    z-index: 10;
    font-family: Arial, sans-serif;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* TOOLTIP - VERSION RESPONSIVE OPTIMISÉE */
.tooltip-text {
    /* Masquage par défaut */
    visibility: hidden;
    opacity: 0;

    /* Dimensions adaptatives */
    width: 280px;
    max-width: calc(100vw - 40px); /* S'adapte à la largeur d'écran */
    min-width: 200px;

    /* Apparence */
    background-color: #2c3e50;
    color: white;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);

    /* Contenu */
    padding: 12px 16px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;

    /* Position */
    position: absolute;
    z-index: 9999;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);

    /* Empêche le débordement */
    box-sizing: border-box;

    /* Animation */
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Flèche du tooltip */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2c3e50;
}

/* Activation du tooltip */
.info-icon:hover .tooltip-text,
.info-icon:focus .tooltip-text,
.info-icon:active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Style pour boutons de stratégie */
.strategy-button .info-icon {
    font-size: 8px;
    width: 12px;
    height: 12px;
    margin-top: -3px;
    margin-right: 2px;
}

.strategy-button.active .info-icon {
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========================================
   TABLEAUX
======================================== */
.statistics-ligue-table,
.statistics-team-table {
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    background-color: white;
    overflow-x: auto;
    margin: 5px auto 45px auto;
    width: 90%;
    max-width: 600px;
}

table {
    border-collapse: collapse;
    width: 85%;
    font-size: 13px;
    border-spacing: 10px;
    margin: 20px;
}

table th, table td {
    padding: 8px;
    text-align: center;
    border-top: 1px solid #E8E8E8;
    border-bottom: 1px solid #E8E8E8;
    font-family: "Arial", sans-serif;
}

table th {
    background-color: #EDEDED;
    color: black;
    font-weight: bold;
    padding: 10px;
    font-size: 15px;
}

table tr:hover {
    background-color: #f5f5f5;
}

/* ========================================
   CLASSES UTILITAIRES
======================================== */
.align-left { text-align: left; }
.align-right { text-align: right; }
.align-center { text-align: center; }
.bold-text { font-weight: bold; }
.positive-value { color: #007C70; }
.negative-value { color: #836C2F; }

/* ========================================
   PLOTLY GRAPHIQUES
======================================== */
.js-plotly-plot .plot-container .svg-container {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.plotly .modebar {
    display: none !important;
}

.statistics-item .plotly-graph-div {
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
======================================== */
@media (max-width: 800px) {

    /* TOOLTIPS MOBILE - OPTIMISATION POUR ÉVITER LE DÉBORDEMENT */
    .tooltip-text {
        width: 240px;
        max-width: calc(100vw - 30px);
        font-size: 12px;
        padding: 10px 14px;
        line-height: 1.4;

        /* Position intelligente pour éviter les débordements */
        left: auto;
        right: auto;
        transform: none;

        /* Centrage manuel adaptatif */
        margin-left: calc(-120px + 50%);
        margin-right: auto;
    }

    /* Ajustement pour les tooltips près du bord droit */
    .statistics-item:last-child .tooltip-text,
    .square-box:last-child .tooltip-text {
        margin-left: calc(-200px + 50%);
    }

    /* Ajustement pour les tooltips près du bord gauche */
    .statistics-item:first-child .tooltip-text,
    .square-box:first-child .tooltip-text {
        margin-left: calc(-40px + 50%);
    }

    /* ICÔNES MOBILE */
    .info-icon {
        font-size: 14px;
        width: 20px;
        height: 20px;
    }

    /* CONTENEURS MOBILE */
    .statistics-container {
        flex-direction: column;
        align-items: center;
        padding: 0 10px;
    }

    .statistics-item {
        margin: 10px 0;
        width: 100%;
        max-width: 200px;
    }

    .statistics-item.square-box {
        margin: 10px auto;
    }

    .square-box {
        width: 160px;
        height: 160px;
    }

    /* GRAPHIQUES MOBILE */
    .statistics-graph {
        margin: 0 20px 20px 20px;
    }

    /* TABLEAUX MOBILE */
    .statistics-ligue-table,
    .statistics-team-table {
        margin: 20px auto;
        width: calc(100% - 20px);
        max-width: 500px;
    }

    table {
        width: 90%;
        font-size: 11px;
        margin: 15px auto;
    }

    table th, table td {
        padding: 6px 4px;
        font-size: 10px;
    }

    /* STRATÉGIE MOBILE */
    .strategy-button {
        margin: 5px;
        padding: 8px 16px;
        font-size: 14px;
    }

    .strategy-intro,
    #strategy-description {
        width: 95%;
        font-size: 14px;
        margin: 15px auto;
    }
}