/*
    Spécifique AG Grid
*/

.ag-tabs-body.ag-menu-body .ag-set-filter-body-wrapper .ag-set-filter {
    min-width: 400px;
}

.ag-header-group-text {
    font-weight: bold;
    font-size: 1.1em;
}

.ag-cell {
    &.left {
        justify-content: flex-start;
        text-align: left;

        .ag-react-container,
        .ag-cell-wrapper {
            justify-content: flex-start;
            text-align: left;
        }
    }

    &.center {
        justify-content: center;
        text-align: center;

        .ag-react-container,
        .ag-cell-wrapper {
            justify-content: center;
            text-align: center;
        }
    }

    &.right {
        justify-content: flex-end;
        text-align: right;

        .ag-react-container,
        .ag-cell-wrapper {
            justify-content: flex-end;
            text-align: right;
        }
    }

    &.justify {
        justify-content: justify;
        text-align: justify;

        .ag-react-container,
        .ag-cell-wrapper {
            justify-content: justify;
            text-align: justify;
        }
    }

    &.editable {
        cursor: pointer;
        background-color: lighten(#007bff, 47%); //TODO mettre les couleurs de base sous forme de variables
    }

    &.editableNoBackground {
        cursor: pointer;
    }

    /* Mise en avant d'une cellule dont la valeur a changé */
    &.valeurModifiee {
        color: #d00;
    }

    .text-ellipsis {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.ag-header-container {
    .ag-header-row {
        .ag-header-group-cell {
            .ag-header-group-cell-label {
                .ag-header-group-text {
                    line-height: 100%;
                    overflow: visible;

                    white-space: normal;
                    -webkit-hyphens: auto;
                    -ms-hyphens: auto;
                    hyphens: auto;
                }
            }
        }

        .ag-header-cell {
            .ag-cell-label-container {
                .ag-header-cell-label {
                    .ag-header-cell-text {
                        line-height: 100%;
                        overflow: visible;

                        white-space: normal;
                        -webkit-hyphens: auto;
                        -ms-hyphens: auto;
                        hyphens: auto;
                    }
                }
            }
        }
    }
}

/*
@-moz-document url-prefix() {
    .ag-header-container {
        .ag-header-row {
            .ag-header-group-cell {
                .ag-header-group-cell-label {
                    .ag-header-group-text {
                        //word-break: break-all;
                    }
                }
            }

            .ag-header-cell {
                .ag-cell-label-container {
                    .ag-header-cell-label {
                        .ag-header-cell-text {
                            //word-break: break-all;
                        }
                    }
                }
            }
        }
    }
}
*/

.ag-row {
    // TODO voir pour utiliser plutôt la syntaxe @at-root ? https://sass-lang.com/documentation/at-rules/at-root
    &.ag-row-odd {
        .ag-cell.editable {
            background-color: desaturate(lighten(#007bff, 46%), $amount: 50%);
        }
    }

    // TODO voir pour utiliser plutôt la syntaxe @at-root ? https://sass-lang.com/documentation/at-rules/at-root
    &.ag-row-hover {
        .ag-cell.editable {
            background-color: lighten(#007bff, 44%);
        }
    }

    // TODO voir pour utiliser plutôt la syntaxe @at-root ? https://sass-lang.com/documentation/at-rules/at-root
    &.ag-row-selected {
        border-top: 1px solid #007bff;
        border-bottom: 1px solid #007bff;

        background-color: var(--ag-selected-row-background-color, #b7e4ff);

        .ag-cell {
            line-height: 25px;

            &.editable {
                background-color: lighten(#007bff, 42%);
            }
        }

        &.ag-row-hover {
            background-color: darken(#b7e4ff, 5%);

            .ag-cell.editable {
                background-color: lighten(#007bff, 40%);
            }
        }
    }

    &.misEnAvant {
        background-color: lighten(#007bff, 45%);

        &.ag-row-hover {
            background-color: lighten(#007bff, 43%);

            .ag-cell.editable {
                background-color: lighten(#007bff, 40%);
            }
        }
    }
}

.ag-row-selected + .ag-row-selected {
    border-top: none;
}

/* Nécessaire afin qu'une checkbox invisible ne réserve pas l'espace nécessaire */
.ag-selection-checkbox.ag-invisible {
    display: none !important;
}

.ag-menu-option {
    .ag-menu-option-text {
        max-width: 25em;

        white-space: normal;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        hyphens: auto;
    }

    //ag-menu-option-disabled
    &.titreMenuContextuel {
        position: relative;
        top: -4px;
        opacity: 1;
        background-color: #ddd;

        .ag-menu-option-text {
            position: relative;

            > span {
                position: relative;
                display: block;
                margin: 0 0 0 -24px;
            }
            font-weight: bold;
            font-size: 1.1em;
        }

        &.menuHasShortcuts {
            .ag-menu-option-text {
                > span {
                    margin-right: -5em;
                }
            }
        }
    }

    .ag-menu-option-icon {
        min-width: 24px; /* 16px + 8px */
    }

    &.noIcon {
        .ag-menu-option-icon {
            display: none !important;
        }
    }

    &.svgIcon {
        &.subMenu {
            .ag-menu-option-icon {
                padding-left: 22px;
            }
        }

        .ag-menu-option-icon {
            /*
            display: inline-block;
            height: 16px;
            width: 16px;*/
            background-size: 16px 16px;

            background-color: transparent;
            background-position: 100% 50%;
            background-repeat: no-repeat;
        }

        &.avis {
            .ag-menu-option-icon {
                display: none;
            }
        }

        &.ficheDetaillee {
            .ag-menu-option-icon {
                background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 16 16' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 8a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z'%3E%3C/path%3E%3Cpath fill-rule='evenodd' d='M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7z' clip-rule='evenodd'%3E%3C/path%3E%3C/svg%3E");
            }
        }

        &.localiser {
            .ag-menu-option-icon {
                background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 24 24' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3Cpath d='M13,4.069V2h-2v2.069C7.389,4.522,4.522,7.389,4.069,11H2v2h2.069c0.453,3.611,3.319,6.478,6.931,6.931V22h2v-2.069 c3.611-0.453,6.478-3.319,6.931-6.931H22v-2h-2.069C19.478,7.389,16.611,4.522,13,4.069z M12,18c-3.309,0-6-2.691-6-6s2.691-6,6-6 s6,2.691,6,6S15.309,18,12,18z'%3E%3C/path%3E%3C/svg%3E");
            }
        }

        &.changerDecision {
            .ag-menu-option-icon {
                background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 24 24' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.465,11.293c1.133-1.133,3.109-1.133,4.242,0L13.414,12l1.414-1.414l-0.707-0.707c-0.943-0.944-2.199-1.465-3.535-1.465 S7.994,8.935,7.051,9.879L4.929,12c-1.948,1.949-1.948,5.122,0,7.071c0.975,0.975,2.255,1.462,3.535,1.462 c1.281,0,2.562-0.487,3.536-1.462l0.707-0.707l-1.414-1.414l-0.707,0.707c-1.17,1.167-3.073,1.169-4.243,0 c-1.169-1.17-1.169-3.073,0-4.243L8.465,11.293z'%3E%3C/path%3E%3Cpath d='M12,4.929l-0.707,0.707l1.414,1.414l0.707-0.707c1.169-1.167,3.072-1.169,4.243,0c1.169,1.17,1.169,3.073,0,4.243 l-2.122,2.121c-1.133,1.133-3.109,1.133-4.242,0L10.586,12l-1.414,1.414l0.707,0.707c0.943,0.944,2.199,1.465,3.535,1.465 s2.592-0.521,3.535-1.465L19.071,12c1.948-1.949,1.948-5.122,0-7.071C17.121,2.979,13.948,2.98,12,4.929z'%3E%3C/path%3E%3C/svg%3E");
            }
        }

        &.annulerDecision {
            .ag-menu-option-icon {
                background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 24 24' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.949 14.121L19.071 12c1.948-1.949 1.948-5.122 0-7.071-1.95-1.95-5.123-1.948-7.071 0l-.707.707 1.414 1.414.707-.707c1.169-1.167 3.072-1.169 4.243 0 1.169 1.17 1.169 3.073 0 4.243l-2.122 2.121c-.247.247-.534.435-.844.57L13.414 12l1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465-.235 0-.464.032-.691.066L3.707 2.293 2.293 3.707l18 18 1.414-1.414-5.536-5.536C16.448 14.573 16.709 14.361 16.949 14.121zM10.586 17.657c-1.169 1.167-3.072 1.169-4.243 0-1.169-1.17-1.169-3.073 0-4.243l1.476-1.475-1.414-1.414L4.929 12c-1.948 1.949-1.948 5.122 0 7.071.975.975 2.255 1.462 3.535 1.462 1.281 0 2.562-.487 3.536-1.462l.707-.707-1.414-1.414L10.586 17.657z'%3E%3C/path%3E%3C/svg%3E");
            }
        }

        &.exclureAdministreSV {
            .ag-menu-option-icon {
                background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 640 512' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M624 208H432c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h192c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm-400 48c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z'%3E%3C/path%3E%3C/svg%3E");
            }
        }

        &.decision {
            .ag-menu-option-icon {
                display: none;
            }
            /*
            &.PREPOSITIONNE {
                .ag-menu-option-icon {
                    background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 512 512' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M256 96V56m0 400v-40'%3E%3C/path%3E%3Cpath fill='none' stroke-miterlimit='10' stroke-width='32' d='M256 112a144 144 0 10144 144 144 144 0 00-144-144z'%3E%3C/path%3E%3Cpath fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M416 256h40m-400 0h40'%3E%3C/path%3E%3C/svg%3E");
                }
            }

            &.POSITIONNE {
                .ag-menu-option-icon {
                    background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 512 512' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M256 176c-44.004 0-80.001 36-80.001 80 0 44.004 35.997 80 80.001 80 44.005 0 79.999-35.996 79.999-80 0-44-35.994-80-79.999-80zm190.938 58.667c-9.605-88.531-81.074-160-169.605-169.599V32h-42.666v33.067c-88.531 9.599-160 81.068-169.604 169.599H32v42.667h33.062c9.604 88.531 81.072 160 169.604 169.604V480h42.666v-33.062c88.531-9.604 160-81.073 169.605-169.604H480v-42.667h-33.062zM256 405.333c-82.137 0-149.334-67.198-149.334-149.333 0-82.136 67.197-149.333 149.334-149.333 82.135 0 149.332 67.198 149.332 149.333S338.135 405.333 256 405.333z'%3E%3C/path%3E%3C/svg%3E");
                }
            }

            &.OMI_EN_COURS {
                .ag-menu-option-icon {
                }
            }

            &.OMI_ACTIVE {
                .ag-menu-option-icon {
                }
            }
            */
        }
        &.modificationMultiple {
            .ag-menu-option-icon {
                background-image: url("data:image/svg+xml,%3Csvg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 24 24' height='1em' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7,17.013l4.413-0.015l9.632-9.54c0.378-0.378,0.586-0.88,0.586-1.414s-0.208-1.036-0.586-1.414l-1.586-1.586	c-0.756-0.756-2.075-0.752-2.825-0.003L7,12.583V17.013z M18.045,4.458l1.589,1.583l-1.597,1.582l-1.586-1.585L18.045,4.458z M9,13.417l6.03-5.973l1.586,1.586l-6.029,5.971L9,15.006V13.417z'%3E%3C/path%3E%3Cpath d='M5,21h14c1.103,0,2-0.897,2-2v-8.668l-2,2V19H8.158c-0.026,0-0.053,0.01-0.079,0.01c-0.033,0-0.066-0.009-0.1-0.01H5V5	h6.847l2-2H5C3.897,3,3,3.897,3,5v14C3,20.103,3.897,21,5,21z'%3E%3C/path%3E%3C/svg%3E");
            }
        }
    }
}
