@use '@mskcc/themes/tokens' as tk;
@use '@carbon/styles/scss/config' as *;
@use '@mskcc/fundamentals/src/_variables.scss' as v;
@use '@mskcc/fundamentals/src/_mixins.scss' as m;
@use '@mskcc/colors' as c;
@use '@carbon/styles/scss/components/structured-list';

@mixin msk-structured-list {
    @include structured-list.structured-list;

    .#{$prefix}--structured-list-row {
        .msk-icon.msk-structured-list-checked-icon {
            visibility: hidden;
        }

        &.#{$prefix}--structured-list-row--selected {
            .msk-icon.msk-structured-list-checked-icon {
                visibility: visible;
                color: tk.$msk--color-border-selected;
            }
        }
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row:hover:not(
            .#{$prefix}--structured-list-row--header-row
        )
        > .#{$prefix}--structured-list-td,
    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected
        > .#{$prefix}--structured-list-td {
        --#{$prefix}-text-primary: #{tk.$msk--color-content-primary};
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row:hover:not(
            .#{$prefix}--structured-list-row--header-row
        ):not(.#{$prefix}--structured-list-row--selected) {
        border-top-color: tk.$msk--color-border;
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row:hover:not(
            .#{$prefix}--structured-list-row--header-row
        ):not(.#{$prefix}--structured-list-row--selected)
        + .#{$prefix}--structured-list-row {
        --#{$prefix}-layer-hover: #{tk.$msk--color-border};
    }

    .#{$prefix}--structured-list-td {
        --#{$prefix}-text-secondary: #{tk.$msk--color-content-primary};
    }

    .#{$prefix}--structured-list-row {
        --#{$prefix}-border-subtle: #{tk.$msk--color-border};
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row:hover:not(
            .#{$prefix}--structured-list-row--header-row
        ):not(.#{$prefix}--structured-list-row--selected) {
        background-color: tk.$msk--color-bg-action-hover;
        color: tk.$msk--color-content-primary;
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row--selected
        + .#{$prefix}--structured-list-row {
        --#{$prefix}-layer-selected: #{tk.$msk--color-border-selected};
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected {
        --#{$prefix}-layer-selected: #{tk.$msk--color-bg-action-selected};
    }

    .#{$prefix}--structured-list--selection
        .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected {
        border-top-color: tk.$msk--color-border;
    }
}
