.suivi-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 95%;
    height: 80vh;
    margin: 0 auto;
}

.pro-stats-container, .stats-container {
    gap: 20px;
    width: calc(100% - 40px);
    max-height: 80vh;
    padding: 20px;
    background: var(--cts-main);
    border-radius: 10px;
    position: relative;
    box-shadow: var(--box-shadow);

    h2 {
        margin: 10px 0;
        padding: 5px 20px;
        position: sticky;
        top: 0;
        background: var(--blocks);
        font-size: 1em;
        z-index: 2;
    }
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.pro-stats-container {
    display: flex;
    flex-direction: column;

    .summary {
        display: flex;
        flex-direction: row;
        gap: 20px;
        min-width: fit-content;

        h2 {
            text-align: center;
            font-size: 1.5em;
        }

        .ca-summary {
            display: flex;
            flex-direction: column;
            border-radius: 5px;
            padding: 20px;
            background: var(--blocks);
            box-shadow: var(--box-shadow);

            strong {
                text-align: center;
                font-size: 2em;
            }

            .previous {
                border-top: 1px solid var(--cts-main);
                padding-top: 20px;
                margin: 20px auto;
                display: grid;
                grid-template-rows: repeat(2, 1fr);
                text-align: right;

                .row {
                    display: grid;
                    grid-template-columns: repeat(3, 1fr);
                    gap: 10px;

                    strong {
                        font-size: unset;
                    }
                }
            }
        }
    }

    .table-wrapper {
        flex: 1;
        width: 100%;
        box-shadow: var(--box-shadow);
    }

    .table-pros {
        tbody tr:hover {
            filter: brightness(.9);
        }

        td {
            background: var(--blocks);
            text-align: center;

            &:first-child {
                white-space: wrap;
                text-align: left;
            }
        }

        .right {
            text-align: right;
        }

        .malus {
            background: #de8383;
        }

        .bonus {
            background: #94e594;
        }
    }

    .decreased, .increased {
        font-weight: bold;
    }

    .decreased {
        color: red;
    }

    .increased {
        color: #12ba12;
    }
}

.stats-wrapper {
    width: 100%;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
    padding: 0;
    background: var(--blocks);
    overflow: hidden;

    &:last-child {
        grid-column: 1 / -1;
    }
}

.stats-panel, .pro-stats-panel {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.pro-stats-panel {
    height: fit-content;
    display: flex;
    gap: 20px;
}

.salaries-chart {
    width: 95%;
    margin: auto;
    position: relative;
    display: flex;

    .salarie-name, .bar-container, .salarie-row {
        white-space: nowrap;
        font-size: 1em;
        padding: 0 10px;
    }

    .salarie-name, .salarie-row {
        margin: 5px 0;
    }

    .salarie-name {
        text-align: right;

        &:first-child:not(.repartition) {
            text-align: center;
            border-bottom: 1px solid black;
        }
    }

    .bars {
        position: relative;
        flex: 1;

        .avg-line {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 2px;
            background: red;
            z-index: 1;
            pointer-events: none;
        }

        .avg-line span {
            position: sticky;
            top: 80px;
            left: 0;
            display: inline-block;
            padding: 5px;
            background: red;
            color: white;
            white-space: nowrap;
            font-size: .8em;
            z-index: 1;
        }

        .avg-line.avg-line-left span {
            transform: translateX(0);
        }

        .avg-line.avg-line-right span {
            transform: translateX(-100%);
        }

        .bar-container, .bar {
            box-sizing: border-box;
        }

        .bar-container {
            background: rgba(0, 0, 0, 0.2);
            margin: 15px 0;

            &:nth-child(2) {
                margin-top: 11px;
            }

            &:last-of-type {
                margin-bottom: 5px;
            }
        }

        .bar {
            background: linear-gradient(90deg, var(--cts-main), var(--cts-alt));
            color: white;
            padding: 4px 0;
            white-space: nowrap;
            border-radius: 4px;
        }

        .stacked-bar {
            display: flex;
            height: 18px;
            overflow: hidden;
            background: var(--cts-alt-light);
            margin: 5px 0;
        }

        .bar-part {
            background-color: var(--cts-main);
            height: 100%;
        }

        .bar-pro {
            background-color: var(--cts-alt);
            height: 100%;
        }

        .bar-part, .bar-pro {
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: .8em;
        }

        .bar-container, .repartition-bars-container {
            flex: 1;
            border-radius: 4px;
            display: flex;
            align-items: center;
            padding: 0;
        }
    }

    .nb {
        text-align: right;
    }
}

[data-ajax-results] {
    position: relative;
}

[data-ajax-results].ajax-loading {
    pointer-events: none;
}

[data-ajax-results].ajax-loading > * {
    opacity: .6;
    transition: opacity .2s ease;
}

[data-ajax-results].ajax-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .55);
    border-radius: 10px;
    z-index: 50;
}

[data-ajax-results].ajax-loading::after {
    content: "";
    position: absolute;
    width: 34px;
    height: 34px;
    top: 50%;
    left: 50%;
    margin-top: -17px;
    margin-left: -17px;
    border: 3px solid var(--cts-alt-light);
    border-top-color: var(--cts-main);
    border-radius: 50%;
    animation: ajax-spin .9s linear infinite;
    z-index: 51;
}

@keyframes ajax-spin {
    to {
        transform: rotate(360deg);
    }
}

@media screen and (max-width: 764px) {
    .pro-stats-panel {
        flex-direction: column;
    }

    .chart-canvas-wrap {
        height: 240px;
    }

    .stats-container {
        display: flex;
        flex-wrap: wrap;
        max-height: none;
    }
}
