/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* Tables */

/* stylelint-disable-next-line at-rule-no-unknown */
@use 'sass:map';

@mixin fds-tables-theme($theme) {
    $primary-color: map.get(map.get($theme, primary), 500);
    $primary-color-hover: map.get(map.get($theme, primary), 100);
    $accent-color: map.get(map.get($theme, accent), 500);
    $accent-color-hover: map.get(map.get($theme, accent), 100);

    body[fds] {
        .td-data-table-cell .mat-icon-button {
            color: $accent-color;
        }

        .td-data-table-column .fa-caret-up,
        .td-data-table-column .fa-caret-down {
            color: $accent-color;
            font-size: 12px;
        }
    }

    body[fds] .td-data-table-cell {
        font-size: 13px;
        color: $grey2;
        padding: 0 28px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        height: 100%;
        line-height: 30px;
    }

    body[fds] .td-data-table-column {
        color: $grey3;
        font-weight: normal;
        font-size: 12px;
        height: 34px;
        line-height: 34px;
        padding: 0 28px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }

    body[fds] .td-data-table-row {
        height: 34px;
        border-top: 1px solid #fff;
        border-left: 1px solid #fff;
        border-right: 1px solid #fff;
        border-bottom: 1px solid $grey5;
    }

    body[fds] .td-data-table-row.selected {
        background-color: $grey5;
        border: 1px solid $grey5;
    }

    body[fds] .td-data-table-row:hover {
        background-color: $accent-color-hover;
        border: 1px solid $accent-color;
    }

    body[fds] .td-data-table-cell .mat-button,
    body[fds] .td-data-table-cell .mat-icon-button,
    body[fds] .td-data-table-cell .mat-raised-button {
        height: 24px;
        width: 24px;
        line-height: 0;

        &:disabled {
            color: $grey13;
            cursor: not-allowed;
        }
    }

    body[fds] .td-data-table-cell .mat-icon-button.badge {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    body[fds] .td-data-table-cell .mat-icon-button.badge[disabled] {
        opacity: 0.3;
    }

    body[fds] td-paging-bar {
        color: $grey3;
    }

    body[fds] td-paging-bar mat-select .mat-select-value,
    body[fds] td-paging-bar mat-select .mat-select-arrow {
        color: $blue-grey1;
    }

    body[fds] .table-title {
        font-size: 20px;
        color: $grey1;
        min-width: 250px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50%;
        margin-right: 10px;
    }

    body[fds] div .td-data-table {
        border-bottom: 2px solid $grey7;
        border-right: 1px transparent;
        border-left: 1px transparent;
        display: flex;
    }
}
