@import "../imports/aui-colours";
@import "../imports/mixins/grid";

#issuetable,
.issue-table {
    background-color: var(--ds-surface, #fff);
    border-collapse: collapse;
    margin: 0 0 @grid;
    width: 100%;
    > caption {
        background-color: var(--ds-surface, @aui-color-faint);
        border-bottom: 1px solid var(--ds-border, @aui-border-color);
        caption-side: top;
        color: var(--ds-text-subtlest, @aui-color-mid);
        padding: 7px 10px;
        text-align: left;
    }
    > tbody > tr,
    > tfoot > tr {
        background-color: var(--ds-surface, #fff);
        color: var(--ds-text, @aui-color-text);
    }
    > thead > tr > th {
        color: var(--ds-text-subtlest, @aui-color-N300);
        font-size: 12px;
        white-space: nowrap;

        > .btn-wrap {
            height: 100%;
            width: 100%;
            text-align: inherit;
            border: unset;
            color: inherit;
            background: inherit;
            font-size: inherit;
            font-weight: 600;
            line-height: inherit;
            letter-spacing: inherit;
            -webkit-touch-callout: none;
            -webkit-user-select: none; /* It is 2025 and Safari still needs it */
            user-select: none;
        }
    }
    > tbody > tr > th {
        background-color: var(--ds-surface, #fff);
        color: var(--ds-text, @aui-color-text);
    }
    > thead > tr > th,
    > tbody > tr > th,
    > thead > tr > td,
    > tbody > tr > td,
    > tfoot > tr > td {
        border-bottom: 1px solid var(--ds-border, @aui-border-color);
        overflow: hidden;
        padding: 5px 10px;
        text-align: left;
        vertical-align: top;

        &:first-child {
            padding-left: 20px;
        }

        &:last-child {
            padding-right: 20px;
        }
    }
    > thead {
        .sortable {
            cursor: pointer;
        }
        .sortable:hover {
            background-color: var(--ds-surface, @aui-color-faint);
            color: var(--ds-text, @aui-color-N400);
        }
        .active {
            color: var(--ds-text-subtle, @aui-color-N300);
            background-color: var(--ds-surface, @aui-color-faint);

            &:hover {
                background-color: var(--ds-surface-hovered, @aui-color-highlight-secondary);
            }

            .issuetable-header-sort-icon {
                position: relative;
                top: -1px;

                &::before {
                    margin-top: 2px;
                }
            }
        }
    }

    //highlight the active row
    > thead > tr > th:first-child,
    > tbody > tr > th:first-child,
    > tbody > tr > td:first-child {
        border-left: 2px solid transparent;
    }
    //row hover state
    > tbody > tr {
        &:hover {
            background-color: var(--ds-surface-hovered, @aui-color-highlight-secondary);
        }
    }
    tr.focused {
        background-color: var(--ds-surface-overlay-pressed, @aui-color-selection-background);
        > td:first-child {
            border-left-color: var(--ds-border, @aui-color-mid);
        }
    }
    &.hide-carrot {
        tr.issueactioneddissapearing,
        tr.issueactioned {
            background-color: var(--ds-background-accent-yellow-subtler, #ffd);
        }
        tr.focused {
            background-color: transparent;
            > td:first-child {
                border-left-color: transparent;
            }
            &:hover {
                background-color: var(--ds-surface, @aui-color-faint);
            }
        }
    }
    tr.issueactioneddissapearing,
    tr.issueactioned {
        background-color: var(--ds-background-accent-yellow-subtler, #ffd);
    }
    .rowHeader,
    .rowNormal,
    .rowAlternate {
        background-color: transparent;
    }
    .parentIssue {
        color: var(--ds-text, #666);
    }
    .parentIssue::after {
        content: "/";
        padding: 0 0.3em;
        pointer-events: none;
        text-decoration: none;
    }
    //images
    img,
    .aui-lozenge {
        vertical-align: text-bottom;
    }
    //link colours
    td:not(.issuekey, .summary, .stsummary) {
        a,
        a.parentIssue {
            color: var(--ds-text, @aui-color-text);
        }
    }

    //widths
    /* min-width */
    .issuetype,
    .issuekey,
    .priority,
    .status {
        white-space: nowrap;
        width: 16px;
    }
    /* tight-width */
    .resolution,
    .created,
    .updated {
        max-width: 25em;
        white-space: nowrap;
    }
    /* generous-width */
    .assignee,
    .reporter,
    .versions,
    .components,
    .fixVersions {
        max-width: 60em;
        min-width: 80px;
    }

    .versions .tinylink,
    .components .tinylink,
    .fixVersions .tinylink {
        white-space: nowrap;
    }
    /* wide (summary) */
    .summary,
    .description {
        > p {
            min-width: 300px;
            margin: 0;
            max-width: 1400px;
            white-space: normal;
        }
    }
    .issueCount {
        text-align: center;
    }
    .stsequence {
        white-space: nowrap;
    }
    /* progress bars */
    td.progress,
    td.aggregateprogress {
        min-width: 150px;
        max-width: 150px;
        text-align: right;
        width: 150px;
    }
    td.progress > table,
    td.aggregateprogress > table {
        font-size: 1em;
        margin-top: 2px;
        width: 150px;
    }
    td.progress td,
    td.aggregateprogress td {
        line-height: 1;
        padding: 0;
        vertical-align: top;
    }
    table.tt_graph {
        width: 100%;
    }
    td.progress td.tt_graph_percentage,
    td.aggregateprogress td.tt_graph_percentage {
        color: var(--ds-text, #999);
        padding-right: 3px;
        min-width: 0;
        width: auto;
    }
    td.progress td.tt_graph_percentage p,
    td.aggregateprogress td.tt_graph_percentage p {
        width: 3em;
    }
    td.progress table.tt_graph,
    td.aggregateprogress table.tt_graph {
        height: 6px;
    }
    /* subtask reorder */
    .streorder {
        width: 10px;
    }
    .issuerow.focused .streorder div,
    .issuerow.issue-table-draggable:hover {
        cursor: all-scroll;
    }
    .issuerow.issue-table-draggable.ui-sortable-helper {
        cursor: all-scroll;
        border-top: 1px solid var(--ds-border-accent-gray, #ccc);
        border-left: 1px solid var(--ds-border-accent-gray, #ccc);
        border-right: 1px solid var(--ds-border-accent-gray, #ccc);
        background-color: var(--ds-surface, @aui-color-faint);
        box-shadow: var(--ds-shadow-overflow-spread, 0 2px 2px 0 rgba(0, 0, 0, 0.2));
    }

    // make the actions links accessible
    .subtask-reorder a {
        opacity: 0;
    }
    .issuerow:hover .subtask-reorder a,
    .issuerow .subtask-reorder a:focus {
        opacity: 1;
    }

    /* actions 'cog' menus */
    .issuerow .issue-actions-trigger {
        opacity: 0;
    }
    .issuerow.focused .issue-actions-trigger:hover,
    .issuerow:hover .issue-actions-trigger,
    .issuerow .issue-actions-trigger:focus,
    .issuerow .issue-actions-trigger.active {
        opacity: 1;
    }

    .issuerow .issue-actions-trigger.active {
        // border is needed as the trigger isn't really dropdown2 trigger
        border: 1px solid var(--ds-border-accent-gray, #ccc);
    }

}

.list-view #issuetable thead {
    > tr > th {
        &:hover {
            background-image: url('../../../images/issuetable/dots.svg');
            background-position: 2px 50%;
            background-repeat: no-repeat;
            /* no shorthand here to prevent the :hover background colour being overridden */
        }
        &:first-child:hover {
            background-position-x: 12px;
        }
        &.headerrow-actions:hover {
            background: none;
        }

    }
}

@import "content/pagination.less";

/* IE
    widths */
.msie {
    #issuetable,
    .issuetable {
        .issuekey,
        .status {
            width: 1%;
        }
    }
}

//gadget specific
.gadget {
    #issuetable,
    .issuetable {
        .parentIssue {
            background-position: 100% 1px;
        }
        /* wide (summary) */
        .summary,
        .description {
            > p {
                margin: 0;
                min-width: 100px;
            }
        }
        tr.hover .issue_actions a.aui-dd-link {
            left: 0;
            top: 0;
        }
    }
}

/* Used for J/K navigation of issue rows */
a.hidden-link {
    display: block;
    font-size: 0;
    height: 1px;
    line-height: 0;
    outline: 0 none var(--ds-surface, white);
    width: 1px;
    span {
        display: none;
    }
}

/* This is here to vertically align icons of issue status, which are rendered by Issue Status Plugin */
#bulkedit {
    .jira-issue-status-icon {
        vertical-align: middle;
    }

    #unavailableActionsTable {
        .twixi-wrap {
            padding-left: 0;
        }

        .twixi-wrap {
            padding-left: 0;
        }

        .unavailable-actions-content {
            padding: 10px 0;
        }
    }
}
