@import '~@gravity-ui/uikit/styles/mixins';

.dl-core-navigation-table-view {
    $class: &;
    $checkboxWidth: 30px;

    width: 100%;
    height: 100%;
    position: relative;

    &__row-link-wrap {
        display: flex;
        align-items: center;
        width: 100%;
    }

    &__row {
        display: flex;
        align-items: center;
        padding: 0 20px;

        &:hover {
            cursor: pointer;
            background: var(--g-color-base-simple-hover);
        }

        &_hovered {
            background: var(--g-color-base-simple-hover);
        }

        &_highlight {
            background: var(--g-color-base-selection);
        }

        &_hidden {
            #{$class}__name {
                color: var(--g-color-text-utility);
            }
        }

        &_inactive {
            cursor: default;
            pointer-events: none;

            #{$class}__name,
            #{$class}__icon {
                opacity: 0.5;
            }
        }

        &_locked {
            #{$class}__row-btns {
                visibility: hidden;
            }
        }

        &_checked {
            background: var(--g-color-base-selection);
        }

        &_checked:hover,
        &_checked#{$class}__row_hovered {
            background: var(--g-color-base-selection-hover);
        }

        &_withCheckbox {
            #{$class}__link {
                width: calc(100% - #{$checkboxWidth});
            }
        }
    }

    &__row_header {
        height: 40px;
        background: var(--g-color-base-background);
        position: sticky;
        z-index: 2;
        top: 0;
        left: 0;
        width: 100%;

        &:hover {
            background: var(--g-color-base-background);
            cursor: initial;
        }

        #{$class}__name {
            @include text-subheader-1();
            margin-right: 12px;
            padding-left: 2px;
        }

        #{$class}__createdBy {
            @include text-subheader-1();
            opacity: initial;
            padding: 0 10px 0 18px;
        }

        #{$class}__date {
            @include text-subheader-1();
            opacity: initial;
            padding-right: 2px;
            color: var(--g-color-text-primary);
        }
    }

    &__row_mode_modal#{$class}__row_header {
        #{$class}__date {
            justify-content: flex-start;
            padding-left: 20px;
        }
    }

    &__row_withParentFolder#{$class}__row_mode_modal#{$class}__row_header {
        #{$class}__createdBy {
            padding: 0 10px;
        }
    }

    &__row_withParentFolder#{$class}__row_header {
        #{$class}__createdBy {
            padding: 0 10px 0 14px;
        }
    }

    &__row_withParentFolder {
        #{$class}__createdBy {
            flex: 1 0 10%;
        }

        #{$class}__parent-folder {
            flex: 0 0 30%;
        }

        #{$class}__name {
            flex: 3 1 60%;
        }
    }

    &__row_mode_minimal {
        padding: 0 20px;

        #{$class}__createdBy {
            display: none;
        }

        #{$class}__info {
            padding-right: 0;
        }

        #{$class}__row-btns {
            display: none;
        }

        #{$class}__date {
            flex: 0 0 60px;
            min-width: auto;
        }
    }

    &__row_mode_modal {
        #{$class}__date {
            flex: 0 0 70px;
            min-width: auto;
        }
    }

    &__row-loader-more {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    &__icon {
        margin-right: 12px;
        position: relative;
        flex: 0 0 auto;
    }

    $rowBtnsWidth: 86px;

    &__info {
        width: 100%;
        display: flex;
        align-items: center;
        min-height: 40px;
        position: relative;
        padding-right: $rowBtnsWidth;
        overflow: hidden;
    }

    &__row-btns {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: $rowBtnsWidth;
        padding-left: 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    &__row-btn {
        visibility: hidden;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 4px;

        #{$class}__row:hover &,
        #{$class}__row_hovered & {
            visibility: visible;
        }

        &:hover,
        &_hovered {
            background: var(--g-color-base-simple-hover);
        }

        & {
            color: var(--g-color-text-secondary);
        }
    }

    &__btn-change-favorite {
        visibility: hidden;
        color: var(--g-color-base-misc-heavy-hover);

        &_isFavorite {
            visibility: visible;
        }

        #{$class}__row:hover &,
        #{$class}__row_hovered & {
            &:not(#{$class}__btn-change-favorite_isFavorite) {
                color: var(--g-color-text-secondary);

                #{$class}__icon-star-stroke {
                    display: block;
                }

                #{$class}__icon-star-fill {
                    display: none;
                }
            }
        }
    }

    &__edit-favorites-alias-btn {
        visibility: hidden;

        &_visible {
            visibility: visible;
        }

        #{$class}__row:hover &,
        #{$class}__row_hovered & {
            visibility: visible;
        }
    }

    &__icon-star-stroke {
        display: none;
    }

    #{$class} &__lock {
        margin: 2px 5px 0 10px;
        flex: 0 0 16px;
        color: var(--g-color-text-hint);
    }

    &__name {
        flex: 3 1 30%;
        display: flex;
        align-items: center;
        overflow: hidden;
        min-width: 100px;
        color: var(--g-color-text-primary);

        span,
        a {
            @include overflow-ellipsis();
        }
    }

    &__createdBy {
        flex: 1 0 20%;
        display: flex;
        min-width: 100px;
        overflow: hidden;
        padding: 0 10px;
    }

    &__date {
        flex: 0 0 140px;
        display: flex;
        justify-content: flex-end;
        color: var(--g-color-text-secondary);
        align-items: center;
        min-width: 100px;
        overflow: hidden;

        > span {
            @include overflow-ellipsis();
        }
    }

    &__link {
        width: 100%;

        &,
        &:hover,
        &:active,
        &:visited,
        &:focus {
            text-decoration: none;
            outline: none;
            color: inherit;
        }
    }

    &__list {
        margin-bottom: 20px;

        &_showBatchPanel {
            margin-bottom: 60px;
        }
    }

    &__name-line {
        display: flex;
        flex: 1 1 auto;
        line-height: 20px;
        overflow: hidden;
    }

    &__parent-folder {
        height: 20px;
        display: flex;
        align-items: center;
        flex: 0 0 50%;
        font-size: 13px;
        overflow: hidden;
    }

    &__folder-inline {
        flex: 0 0 16px;
        color: var(--g-color-text-hint);
        margin-right: 2px;
    }

    &__parent-folder-name {
        opacity: 0.5;

        &:hover {
            opacity: 0.7;
        }
    }

    &__selection-checkbox {
        padding-right: 14px;
        display: flex;
        align-items: center;
        align-self: stretch;
    }

    &__batch-panel {
        position: absolute;
        width: calc(100% - 44px);
        bottom: 8px;
        left: 22px;
    }

    &_mobile {
        @include text-body-2();

        #{$class}__icon {
            margin-right: 6px;
        }

        #{$class}__row_mode_minimal {
            padding: 0 16px;
        }

        #{$class}__list > #{$class}__row-container:not(:last-child) #{$class}__link {
            border-bottom: 1px solid var(--g-color-line-generic);
        }
    }
}
