@import "./ngbIdentificationsTab.variables";
@import "../../../shared/components/ngbTags/ngbTags";

@mixin maxLines ($line-height, $lines-count: 3) {
    max-height: $lines-count * $line-height;

    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: $lines-count;
    line-clamp: $lines-count;
    -webkit-box-orient: vertical;
}

ngb-identifications-tab {
    overflow: auto;
    font-size: $tab-font-size;
    color: $general-font-color;

    md-content.identification {
        padding: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: auto;
    }

    .identification-header {
        $line-height: min(calc(1.5 * $title-font-size), 28px);

        display: flex;
        align-items: center;
        justify-content: flex-start;
        margin-bottom: 10px;
        line-height: $line-height;
        min-height: $line-height;


        .identification-title {
            font-size: $title-font-size;
            margin: 0;
            font-weight: bold;
        }

        .identification-actions {
            line-height: 1;
            margin-left: auto;
            display: inline-flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;

            >*:not(:first-child) {
                margin-left: 10px;
            }

            .identification-action {
                color: rgb(51, 103, 214);
                white-space: nowrap;

                ng-md-icon {
                    fill: currentColor;
                }

                &:not([disabled]):hover {
                    text-decoration: underline;
                }
            }
        }
    }

    .identification-content {
        flex: 1;
        overflow: auto;
    }

    .identification-header,
    .identification-content {
        padding: 0 5px;
    }

    a {
        text-decoration: none;
        color: rgb(51, 103, 214);
        cursor: pointer;
    }

    .main-info-row {
        min-height: $main-info-row-height;
        line-height: $main-info-row-height;
        display: flex;
        align-items: flex-start;
        margin: 1px 0;

        .main-info-title {
            min-width: 90px;
            font-weight: bold;
            margin-right: 5px;
        }

        ngb-tags.main-info {
            @include ngb-tags($main-info-row-height);
        }

        $main-info-descriptions-line-height: calc($tab-font-size * 1.3);

        .main-info {
            flex: 1;

            .descriptions {
                line-height: $main-info-descriptions-line-height;
                margin-top: max(0, calc(($main-info-row-height - $main-info-descriptions-line-height) / 2.0));

                &.collapsed {
                    .identification-description {
                        @include maxLines($main-info-descriptions-line-height, $main-info-description-max-lines);
                    }
                }

                .identification-description {
                    &:not(:last-child) {
                        margin-bottom: 5px;
                    }
                    .identification-description-title {
                        float: left;

                        &::after {
                            content: '. ';
                            white-space: pre;
                        }
                    }
                }
            }

            .main-info-parts {
                display: inline;

                .main-info-part {
                    display: inline-block;

                    &:not(:last-child) {
                        margin-right: 5px;

                        &::after {
                            content: ',';
                        }
                    }

                    .main-info-part-count {
                        font-weight: bold;
                    }
                }
            }

            .main-info-link-part {
                display: inline;
            }
        }
    }

    .section {
        display: flex;
        flex-direction: row;
        align-items: center;

        .section-title {
            font-weight: bold;
            flex: 1;
        }

        .section-title-part {
            font-weight: normal;
            text-transform: none;
            display: inline-block;

            &:not(:last-child) {
                margin-right: 5px;

                &::after {
                    content: ',';
                }
            }

            .section-title-part-count {
                font-weight: bold;
            }
        }
    }

    .identification-description-text {
        a {
            margin-left: 3px;
            margin-right: 3px;
        }
    }

    .pivot-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding-bottom: 32px;

        md-whiteframe {
            margin: 10px;
            min-height: 80px;
            height: auto;
            width: 220px;
            box-shadow: none;
            border: 1px solid #cacaca;
            border-radius: 10px;
        }

        .whiteframe-content {
            display: flex;
            justify-content: flex-end;
            height: 50%;
            align-items: center;

            span {
                font-size: 14px;
                margin: 0 10px;
            }

            .description-span {
                margin-top: 10px;

                .element-wrapper {
                    font-size: 0;
                }

                span, a {
                    font-size: 11px;
                    margin: 0;
                }

                a {
                    display: inline-block;
                    text-decoration: none;
                    color: rgb(102, 153, 255);
                    cursor: pointer;
                }
            }
        }
    }

    $border-radius: 3px;
    $header-background: #eeeeee;

    collapsible-panel .collapsible-trigger {
        margin: 5px 0 0;
        background: $header-background;
        border-radius: $border-radius;
    }

    collapsible-panel.open-panel .collapsible-trigger {
        border-radius: $border-radius $border-radius 0 0;
    }

    collapsible-panel .collapsible-panel-body {
        border: 1px solid $header-background;
        border-radius: 0 0 $border-radius $border-radius;
        border-top: 0;
        padding: 0;
    }
}
