// main: brackets-git.less

.commit-author-avatar-mixin(@size) {
    position: relative;
    width: @size;
    height: @size;
    text-align: center;
    span, img {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        height: @size;
        width: @size;
        border-radius: 2px;
    }
    span {
        color: @bc-text;
        font-weight: 500;
        font-size: @size;
        line-height: @size;
        text-transform: uppercase;
        &.avatar-bw {
            -webkit-filter: grayscale(100%);
        }

        .dark & {
            color: @dark-bc-text;
        }
    }
}

#git-history-list {
    table-layout: fixed;
    tbody tr td {
        vertical-align: middle;
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        &:nth-child(1) { // author avatar
            width: 30px;
            .commit-author-avatar {
                .commit-author-avatar-mixin(18px);
            }
        }
        &:nth-child(2) { // commit date/author
            width: 250px;
            .commit-author {
                font-weight: 500;
            }
        }
        &:nth-child(3) { // commit title
            .commit-tags {
                float: right;
                max-width: 150px;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
        &:last-child { // commit hash
            width: 50px;
        }
    }
}

#history-viewer {
    position: absolute;
    z-index: @baseZindex;
    top: 0px;
    right: 0px;
    bottom: 0px;
    left: 0px;
    overflow: hidden;
    background: @bc-panel-bg;
    .flex-box(column);

    .dark & {
        background: @dark-bc-panel-bg;
    }

    > .header {
        .flex-item(0, 0);
        .author-line {
            margin-bottom: 1em;
        }
        .commit-author {
            @lineHeight: 36px;
            height: @lineHeight;
            line-height: @lineHeight;
            .commit-author-avatar {
                .commit-author-avatar-mixin(@lineHeight);
                display: inline-block;
                top: @lineHeight / 3;
            }
            .commit-author-name, .commit-author-email {
                margin-left: 1em;
                .selectable-text();
            }
        }
        padding: 25px 30px 5px;
        &.shadow {
            box-shadow: 0 -1px 3px 2px rgba(0, 0, 0, 0.15);
            z-index: 1;
        }
        .commit-title {
            font-size: 20px;
            line-height: 24px;
            font-weight: 500;
            margin: 0 0 5px;
            width: 90%
        }
        .close {
            margin: -5px -3px 0 0;
            padding-left: 50px;
        }
        .commit-hash, .commit-author, .commit-time {
            margin-right: 10px;
            display: inline-block;
            color: @bc-text-thin-quiet;

            .dark & {
                color: @dark-bc-text-thin-quiet;
            }
            i {
                color: @bc-text-thin-quiet;
                margin-right: 2px;

                .dark & {
                    color: @dark-bc-text-thin-quiet;
                }
            }
        }
        .actions {
            float: right;
            margin: -10px;
            >* {
                margin-right: 10px;
                display: inline-block;
            }
            .git-reset-label + .caret {
                margin-left: 5px;
            }
            .dropdown-menu {
                left: auto;
                right: 0;
                line-height: 28px;
            }
        }

    }
    > .body {
        .flex-item(1, 1);
        position: relative;
        overflow-y: scroll;
        li > a {
            background: @bc-btn-bg;
            border: 1px solid transparent;
            border-right: 0;
            border-left: 0;
            color: @bc-text;
            margin: 10px;
            margin-bottom: 0;

            .dark & {
                background: @dark-bc-btn-bg;
                color: @dark-bc-text;
            }
        }
        .commit-diff {
            > pre {
                white-space: pre-line
            }
            max-height: 0px;
            margin: 10px;
            opacity: 0;
            transition: all ease 0.3s;
            transition-property: padding, height, opacity;
            padding-top: 0;
            padding-bottom: 0;
            border-top: 0;
            margin-top: 0px;
            border-radius: 0 0 3px 3px;
            border-color: @bc-btn-border;
            margin-bottom: 0;

            .dark & {
                border-color: @dark-bc-btn-border;
            }
            .separator, .meta-file {
                display: none;
            }
        }
        .active+.commit-diff {
            max-height: 99999px;
            opacity: 1;
            border-color: @bc-btn-border;
            margin-bottom: 10px;
            padding: 10px 0;

            .dark & {
                border-color: @dark-bc-btn-border;
            }
        }
        .opened {
            display: none;
            margin-top: 7px;
        }
        .closed {
            display: inline-block;
            margin-top: 5px;
        }
        .active {
            background: @bc-menu-bg;
            border: 1px solid @bc-btn-border;
            margin-bottom: 0;
            border-bottom: 0;
            border-radius: 4px 4px 0 0;

            .dark & {
                background: @dark-bc-menu-bg;
                border: 1px solid @dark-bc-btn-border;
            }

            a {
                border: none;
                background-color: transparent;
            }
            .opened {
                display: inline-block;
            }
            .closed {
                display: none;
            }
        }
        .caret {
            border-left: 4px solid transparent;
            border-right: 4px solid transparent;
            border-top: 5px solid @bc-text;
            margin-right: 2px;

            .dark & {
                border-top: 5px solid @dark-bc-text;
            }
        }
        .caret.caret-right {
            border-bottom: 4px solid transparent;
            border-top: 4px solid transparent;
            border-left: 5px solid @bc-text;
            margin-right: -1px;
            margin-left: 3px;

            .dark & {
                border-left: 5px solid @dark-bc-text;
            }
        }
        .commitBody {
            padding: 0 30px;
        }
        .commit-files {
            padding: 0 20px;
            .openFile, .difftool {
                vertical-align: -1px;
                margin-left: 10px;
                cursor: pointer;
                opacity: 0.7;
            }
        }
        .filesContainer {
            margin-bottom: 10px;
        }
        .loadMore {
            margin-bottom: 10px;
            margin-left: 10px;
        }
    }
    .message {
        display: block;
        padding: 10px;
    }

    .dropdown-menu();

    .toggle-diffs {
        cursor: pointer;
        margin-right: -10px;
        margin-top: 14px;
        .collapse {
            display: none;
        }
        span.collapse {
                height: auto;
        }
        .expand {
            vertical-align: middle;
        }
        span.expand {
            margin-left: 2px;
        }
        &.opened {
            .expand {
                display: none;
            }
            .collapse {
                display: inline-block;
                vertical-align: middle;
            }
        }
    }
}
