/*  List key-value pairs display */

// Override bootstrap3 header classes
dt.h3, dt.h4, dd.h3, dd.h4 {
    margin-top: 0;
    font-size: 1rem;
}

dd.h3, dd.h4 {
    font-weight: normal;
}

dl.key-value, dl.key-value-doc {
    margin: 0;

    .panel-body > & {
        margin: -10px 0;
    }

    dt, dd {
        display: block;
        float: none;
        margin: 0;
        padding: 0;
        line-height: 1.3;
        text-align: left;
        width: auto;
        word-wrap: break-word;
        word-break: break-word;
    }

    dd {
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        hyphens: auto;
    }

    dt {
        font-weight: 600;

        &::after {
            content: ":";
        }
    }

    [data-test] {
        clear: both;
        margin: 8px 0;
    }
}

// For displahing nucleotide sequences so that they’ll wrap without needing spaces.
.sequence {
    overflow-wrap: break-word;
    word-break: break-all;
}

@media screen and (min-width: $screen-xs-min) {
    dl.key-value {
        display: block;

        dt {
            flex: 0 0 140px;
            padding: 8px 0;

            .modal-body & {
                padding: 4px 0;
            }
        }

        dd {
            flex: 1 1 100%;
            padding: 8px 0 8px 10px;

            .modal-body & {
                padding: 4px 0 4px 10px;
            }
        }

        [data-test] {
            display: flex;
            margin: 0;
        }
    }
}

// Left-justified key-value
.key-value-left {
    @extend .key-value;

    dt, dd {
        width: auto;
        padding-top: 0 !important;
    }

    dt {
        float: none !important;
        display: block !important;
        text-align: left !important;
        margin-bottom: 0 !important;
    }

    dd {
        margin-left: 0 !important;

        &.key-value-left-indent {
            margin-left: 20px !important;
        }
    }
}

// When multiple items in a <dd> need to be displayed on their own lines.
// Apply to each <span> within a <dd> that needs its own line.
.line-item {
    &::before {
        content: ' ';
        display: block;
    }
}

.unit::before {
    content: " ";
}

dd ul, .multi-value {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;

    li {
        display: inline-block;
        margin-right: 5px;

        span {
            font-weight: normal;
        }
    }
}

dd ul, .multi-value-line {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;

    li {
        display: block;
        margin-right: 5px;

        span {
            font-weight: normal;
        }
    }
}

.multi-comma {
    margin-right: 0;

    &::after {
        content: ",\00a0";
    }

    &:last-child::after {
        content: normal;
    }
}

.multi-dd {
    margin-bottom: 10px;
}

.para-text {
    line-height: 1.6 !important;
}

.sw-step-versions {
    display: inline-block;
    margin-top: 8px;

    &:first-child {
        margin-top: 0;
    }
}

.software-version-list {
    display: inline;
}

.software-version {
    display: inline-block;
    padding: 0;
    margin-right: 5px;
    border-radius: 2px;
    border: 1px solid #c0c0c0;
    color: #333;
    font-size: 0.9rem;

    &:hover {
        color: #eee;
        background-color: #333;
        text-decoration: none;

        .version {
            color: #fff;
            background-color: #808080;
        }
    }

    .software {
        padding: 0 5px;
    }

    .version {
        padding: 0 5px;
        font-weight: bold;
        background-color: #e0e0e0;
    }
}

.data-display-array dl {
    margin-top: 10px;

    &:first-child {
        margin-top: 0;
    }
}

.supplementary-data {
    border-top: 1px solid #c0c0c0;

    &:first-child {
        margin-top: -10px;
        border-top: none;
    }

    &:last-child {
        margin-bottom: -10px;
    }
}
