@import "typography";
@import "colors";

.qms-table {
    .mat-checkbox.qms-group-options {

        .mat-checkbox-inner-container {
            width: 18px;
            height: 18px;
            margin: 0 !important;
        }

        &.mat-checkbox-indeterminate .mat-checkbox-background, &.mat-checkbox-checked .mat-checkbox-background {
            background-color: $primary !important;
        }

        &.mat-checkbox-checked {
            background: unset;
        }
    }

    .mat-header-cell:first-child {
        padding-left: 20px;
    }

    a {
        text-decoration: none;
        color: #323232;
        word-break: break-word;
        margin: -9px -2px;
        padding: 9px 2px;

        &:hover, &:focus-visible {
            outline: unset;
            color: #1954A9;
            text-decoration: underline;
        }
    }

    .clickable-container {
        margin: -9px 0;
        padding: 9px 0!important;
    }

    .clickable-content {
        padding: 8px 6px;
        border-radius: 5px;
        cursor: pointer;

        &:hover {
            outline: unset;
            background: rgba(0, 0, 0, 0.12);
        }
    }

    .qms-table-row {
        padding: 8px 0 8px 20px;
        background: #FFFFFF;
        border: 1px solid #E0E0E0;
        border-radius: 4px;
        margin-top: 8px;
        min-height: 40px;
        font-size: 14px;
        line-height: 20px;
        font-family: 'Open Sans';
        font-weight: normal;
        color: #323232;
        align-items: stretch;
        cursor: pointer;

        mat-cell:first-of-type {
            padding: 0;
        }

        mat-cell:last-of-type {
            padding-right: 16px;
        }

        &[tabindex]:focus-visible {
            outline: 2px auto $primary;
        }

        &:active, &:hover {
            background: rgba(0, 0, 0, 0.08);
        }

        &-selected {
            background: $tab-focus-background;

            &:hover {
                background: rgba(40, 115, 223, 0.06);
            }
        }

        &-disabled {
            background: #E4E4E4;
            color: rgba(0, 0, 0, 0.38);
            pointer-events: none;

            mat-cell {
                opacity: 0.38;
            }
        }

        &-draft {
            border: 2px dashed rgba(0, 0, 0, 0.12);
        }

        .qms-btn-icon {
            width: 40px;
            height: 40px;
            line-height: 40px;

            .qms-btn-icon-wrapper .mat-icon {
                line-height: 20px;
            }
        }
    }

    //padding for table types
    &.qms-checkbox-table {
        .mat-header-cell:first-child {
            align-items: stretch!important;
            flex: unset;
            padding-left: 4px;
    
            .qms-row-checkbox {
                padding: 0 19px;
                display: flex;
                align-items: center;
            }
        }

        .qms-table-row {
            padding-left: 4px;

            .qms-row-checkbox-container:first-child {
                align-items: stretch!important;
                flex: unset;
    
                .qms-row-checkbox {
                    padding: 0 19px;
                    display: flex;
                    align-items: center;
                }
            }
        }
    }

    &.qms-expand-table {
        .mat-header-cell {
            padding-left: 0;
            
            .expand-icon-header {
                margin-left: 15px;
            }
        }

        .qms-table-row {
            padding-left: 3px;

            .expand-icon {
                user-select: none;
                transition: transform 0.2s;
                margin: 0 10px;
            }

            &.qms-row-expanded {
                background: #F2F7FD;
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;

                &:hover {
                    background: rgba(40, 115, 223, 0.06);
                }

                .expand-icon {
                    user-select: none;
                    transition: transform 0.2s;
                    transform: rotate(180deg);
                }

                mat-icon {
                    color: $primary;
                }
            }
        }

        .qms-row-detail {
            border: 1px solid #E0E0E0;
            border-top: none;
        }
    }

    &.qms-group-table {
        .qms-table-row {
            &.expandable-group {
                padding-left: 0!important;
                border-left: 4px solid $primary-light-32-opacity;
                border-radius: 4px 4px 0 0;
            }
        }

        .qms-collapse-group {
            border: 1px solid #E0E0E0;
            border-left: 4px solid $primary-light-32-opacity;
            border-bottom-left-radius: 4px;
            border-bottom-right-radius: 4px;
            border-top: none;
            padding-left: 12px;
            padding-top: 6px;
            background: $background-area;

            cursor: pointer;

            &[tabindex]:focus-visible {
                outline: 2px auto $primary;
            }
            
            .mat-icon {
                color: $primary;
            }
            .qms-text-collapse {
                vertical-align: super;
                color: $primary;
                font-weight: 600;
                font-size: 12px;
                line-height: 16px;
                font-family: Open Sans;
            }
        }

        .qms-row-children {
            margin-top: unset;
            border-radius: unset;
            padding-left: 0!important;
            border-left: 4px solid $primary-light-32-opacity;
        }
    }

    &.qms-checkbox-table.qms-expand-table {
        .qms-table-row .qms-row-checkbox {
            border-right: 1px solid rgba(0, 0, 0, 0.12);
            border-radius: 0;
        }
    }
}