@import "../ngbTargetsForm.variables.scss";

ngb-target-genes-table {

    .ui-grid-container {
        height: auto;
    }

    .ui-grid {
        border: none;
        border-top: $table-border;
        border-bottom: $table-border;

        .ui-grid-viewport {
            height: 100% !important;
        }

        .ui-grid-row > div:first-child {
            height: 100%;
        }

        .ui-grid-cell-contents {
            white-space: nowrap;
        }

        .ui-grid-column-menu-button {
            width: 12px;

            .ui-grid-icon-angle-down {
                width: 10px;
            }

            [class^="ui-grid-icon"]:before,
            [class*=" ui-grid-icon"]:before {
                width: 0.7em;
                margin-right: 0.3em;
                margin-left: 0;
            }
        }

        .table-cell-wrapper {
            overflow-y: auto;
            box-sizing: border-box;
            height: 100%;
            width: 100%;
            background: #fafafa;
        }

        .table-cell {
            padding: 2px 5px;
        }

        .table-cell-item {
            display: flex;
            justify-content: space-between;
        }

        .table-cell-input,
        .table-cell-input.ng-valid {
            width: 58%;
            border-radius: 0;
            border: none;
            background: #fafafa;
            color: #444444;
            padding: 0 4px;
            box-sizing: border-box;

            &:focus {
                border-bottom: 1px solid #c7c7c7;
            }

            &.error {
                border-bottom: 1px solid red;
            }
        }

        .table-cell-input:nth-child(2),
        .table-cell-input:nth-child(2).ng-valid {
            width: 30%;
        }

        .table-cell-remove-btn {
            min-height: 10px;
            min-width: 12px;
            line-height: 10px;
            padding: 0 2px;
            margin: 1px 2px;
        }
    }

    .ui-grid-container .ui-grid-render-container {
        min-height: 250px;
    }

    .ui-grid-header-cell.ui-grid-clearfix,
    .ui-grid-header-cell.ui-grid-clearfix.movingColumn {
        height: 100%;

        .layout-column {
            height: 100%;

            div.flex {
                height: 100%;
            }
        }
    }

    .ui-grid-container .ui-grid-cell-contents.md-button {
        min-height: unset;
        height: 100%;
        display: grid;
        grid-template-columns: repeat(50, 1fr);
    }

    .ui-grid-header-cell-label-container {
        display: flex;
        justify-content: center;
        min-width: 0;
        grid-column: 1 / 49;
        grid-row: 1;
        height: 100%;
    }

    .ui-grid-header-cell-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sort-icon {
        grid-column: 50 / 50;
        grid-row: 1;

        ng-md-icon {
            margin-right: 3px;
        }
    }

    .input-cell {
        width: 100%;
        height: 100%;

        input.ngb-targets-form-table-input {
            flex: 1;
            margin: 2px 0;
            border-radius: $table-control-border-radius;
            border: none;
            background: $table-control-background;
            height: 100%;
            color: $table-control-font-color;
            padding: $table-control-padding;
            font-size: $table-control-font-size;
            box-sizing: border-box;
            border-bottom: 1px solid darken($table-control-background, 20%);
        
            &.error {
                border-bottom: 1px solid red;
                margin: 0;
            }
        
            &:hover:not(:focus) {
                background: $table-control-hover-background;
            }
            &:hover,
            &:active,
            &:focus {
                outline: none;
            }
        }
    }

    .select-cell {
        width: 100%;

        md-select.ngb-targets-form-table-select {
            margin: 0;
            border-radius: $table-control-border-radius;
            border: $table-control-border;
            background: $table-control-background;
            height: 100%;
            color: $table-control-font-color;
            box-sizing: border-box;

            &:hover {
                background: $table-control-hover-background;
            }
        }
    
        .md-select-value {
            padding: 0 5px;
            border-bottom-width: 0;
            min-height: calc($table-control-height - 2px);
            color: $table-control-font-color;
            font-size: $table-control-font-size;
        }
    
        md-select-menu {
            md-select-menu:not(.md-overflow) md-content {
                padding: 0;
            }
        }
    
        md-option {
            padding: 0 10px;
            height: $table-control-height;
            color: $table-control-font-color;
        }
    
        .md-select-value .md-select-icon {
            width: calc(($table-control-height - 2px) / 2.0);
            margin: 0 2px;
        }
    
        md-select.ngb-targets-form-table-select.md-default-theme:not([disabled]):focus .md-select-value,
        md-select.ngb-targets-form-table-select:not([disabled]):focus .md-select-value {
            border-radius: $table-control-border-radius;
            border-bottom: none;
        }
    }

    .remove-btn {
        min-height: $table-control-height;
        min-width: $table-control-height;
        width: $table-control-height;
        height: $table-control-height;
        line-height: $table-control-height;
        padding: 0;
        margin: auto 5px;
    }

    .list-cell {
        width: 100%;
    }

    .cell-content {
        font-size: 12px;
        align-self: center;
        padding: 5px;
    }

    .cell-content p {
        margin: 2px 0;
    }

    .others-button,
    .add-button {
        text-decoration: underline;
        font-style: italic;
        white-space: nowrap;
    }

    .others-button:hover,
    .add-button:hover {
        text-decoration: none;
    }

    .md-button.md-icon-button .icon-launch {
        fill: rgb(102, 153, 255);
    }
}

.select-cell-container {
    md-select-menu:not(.md-overflow) md-content {
        padding: 0;
    }

    md-select-menu md-content {
        min-width: calc($table-control-height * 3.0);
    }

    md-option {
        padding: $table-control-padding;
        height: $table-control-height;
        color: $table-control-font-color;
    }
}

.delete-gene-dialog,
.confirm-changes-dialog {
    width: 400px;
    min-width: 400px;

    md-dialog-content {
        min-width: 400px;
        width: 400px;
    }

    h4 {
        margin: 15px;
    }
}

md-tooltip.target-genes-table-tooltip {
    max-width: 50%;
    font-size: 13px;

    .md-content {
        height: auto;
        line-break: auto;
        text-wrap: wrap;
        line-height: 13px;
        padding: 5px;
        margin: 0;
    }
}
