/* présentation génrale si tableau avec filtres */
.table-w-filters{
    position: relative;
    display: flex;
    gap: 2rem;
    align-items: stretch;
  
}

.datatable-wrapper {
    position: relative;
    overflow: hidden;
    /*overflow-x: auto;*/
    scroll-behavior: smooth;
    flex: 1;
    max-width: 100%;
}

.datatable-scroll-container {
    overflow-x: auto;
    max-width: 100%;
}

.table-w-filters-column{
    flex-direction: column;
}
th {
    text-wrap: nowrap;
}
th .dt-column-order{
    padding-left: 10px;
}

.dataTable{
    border-collapse: collapse;
    width: 100% !important;
    overflow: hidden;
}

/* flèches de filtre */

table.dataTable thead tr:not(:has(+tr)){

    th:not(.dt-orderable-asc.dt-orderable-desc){
        .dt-column-order {width: 0}
    }
    th.dt-orderable-asc.dt-orderable-desc {

        &>*{
            width: 100%;
            display: block;
            position: relative;
            text-align: center;
            margin: 0;
            padding: 0 10px;
            line-height: 1;
        }

        .dt-column-order::before {
            content: "↕ filtrer";
            font-size: .7em;
            color: var(--noir-fixe);
            position: relative;
            font-weight: lighter;
        }

        &[aria-sort="ascending"] .dt-column-order::before {
            content: "⇡ ASC.";
        }
        &[aria-sort="descending"] .dt-column-order:before {
            content: "⇣ DESC.";
        }
        &:hover::before {
            color: var(--bleu);
        }
    }

}

/* Boutons de navigation scrollx */
.scroll-nav {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 10000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    max-width: 85vw;
    left: 10vw;
}

.scroll-btn {
    pointer-events: auto;
    background: var(--blanc-lo);
    color: var(--bleu);
    width: 50px;
    height: 50px;
    font-size: 25px;
    border-radius: 50%;
    border:none;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 19px 38px, rgba(0, 0, 0, 0.1) 0px 10px 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}
:root[data-theme="dark"] .scroll-btn{
    border: 2px solid var(--gris);
}
.scroll-btn:hover{
    background: var(--blanc);
    color: var(--bleu-2);
}

.datatable-wrapper:not(:has(td:last-of-type:hover)):hover .scroll-btn,
.datatable-wrapper .scroll-nav:hover .scroll-btn {
    visibility: visible;
    opacity: 1;
}

/* Nombre à afficher et Input de recherche */

/* tableaux avec btns d'exports */
.cpx-header{
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 5vh;

    .dt-export{
        background: var(--vert-sapin) !important;
        border-radius: var(--radius) !important;

        &:hover{
            background: var(--vert) !important;
            scale: none !important;
            transform: none !important;
        }
    }

    & > div{
        width: 100%;
    }
    & > div:last-child{
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap-reverse;
        column-gap: 30px;
        row-gap: 20px;
        padding: 10px;
        margin-top: 5vh;
        border-radius: var(--radius);
        background: var(--vert-sapin);

        label{
            color: var(--blanc-fixe) !important;
        }
        input, select{
            padding: 5px ;
            min-width: 100px;
        }
    }
}
/* tableau classique */
.dt-layout-row:first-of-type{
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap-reverse;
    column-gap: 30px;
    row-gap: 20px;
    padding: 10px;
    margin-bottom: 5vh;
    border-radius: var(--radius);
    background: var(--vert-sapin);

    label{
        color: var(--blanc-fixe) !important;
    }

    input, select{
        padding: 5px ;
        min-width: 100px;
    }
}

.dt-length label{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.dt-search{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;

    label{
        text-wrap: nowrap;
    }
}

/* Infos affichage */

.dt-info{
    text-align: center;
    padding: 5vh;
}

/* Navigation de bas de tableau */

div[id^="datatable-"] nav{
    display: flex;
    flex-wrap: wrap;
    justify-content: center !important;
    gap: 10px;
}

div[id^="datatable-"] .previous{
    margin-right: 20px;
}
div[id^="datatable-"] .next{
    margin-left: 20px;
}

div[id^="datatable-"] button:not(.scroll-btn) {
    background-color: var(--vert-sapin);
    color: var(--blanc);
    border: none;
    padding: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
}
.dt-paging-button.current{
    background: var(--bleu) !important;
}
.dt-paging-button.current:hover{
    background: var(--bleu-2) !important;
}
div[id^="datatable-"] button:not(.disabled, .scroll-btn):hover {
    background-color: var(--vert);
    transform: scale(1.05);
}

div[id^="datatable-"] .disabled {
    background-color: var(--gris) !important;
}

/* tableau */

.dataTable th{
    background: var(--vert);
    padding: 10px;
    text-align: center;
}
.dataTable thead tr:first-of-type{
    th:first-of-type {
        border-top-left-radius: var(--radius);
    }
    th:last-of-type {
        border-top-right-radius: var(--radius);
    }
    &:has(+tr){
        th{
            border-left: 2px solid var(--blanc);
            border-right: 2px solid var(--blanc);
        }
    }
}
.dataTable thead tr:not(:first-of-type){
    th{
        background: transparent !important;
        *{color: var(--noir) !important; line-height: 1.2 !important;}
    }
}
.dataTable tfoot tr{
    &:first-of-type{
        border-top: 1px solid var(--gris);
    }
    th{
        color: var(--noir) !important;

        &:first-of-type{
            background: transparent;
            text-align: right;
        }

        &:not(:first-of-type){
            background: transparent;
        }
    }
}



.dt-scroll-head{
    display: none !important;
}
.dataTable th {
    color: var(--noir-fixe);
}
.dataTable tr:not(:last-of-type){
    border-bottom: 1px solid var(--gris);
}

.dataTable td{
    position: relative;
    padding: 10px 5px;
    text-align: center;
}
.min-w-300{
    min-width: 300px;
}
.text-left {
    justify-content: left !important;
    text-align: left !important;
}
.max-h-overflow {
    position: relative;
    width: 100%;
    overflow-y: auto;
    -ms-overflow-y: auto;
    max-height: 150px;
}

.dataTable .actions{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.dataTable .actions-sub-group{
    display: flex;
    gap: inherit;
    justify-content: center;
    align-items: center;
}

.action-btn{
    width: 30px;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.action-btn svg{
    pointer-events: none;
}
.action-blue{
    background: var(--bleu) !important;
}
.action-green{
    background: var(--vert) !important;
}
.action-red{
    background: var(--erreur) !important;
}