@import "../imports/aui-colours";
@import "../imports/jira-colours";
@import "../imports/mixins/border-box";
@import "../imports/mixins/clearfix";
@import "../imports/mixins/grid";
@import "../imports/mixins/assistive";
@import "content/shorten.less";

@label-width: 140px;
// TODO: 3 blocks in grid terms...
@temp-color-item-label-foreground: var(--ds-text-subtlest, @aui-color-mid);

.issue-body-content {
    .module {
        > .mod-header {
            padding-left: 20px;
            + .mod-content {
                margin-top: 5px;
                padding-left: 20px;
            }

            .aui-button-compact {
                display: flex;
                align-items: center;
                justify-content: center;

                .aui-icon {
                    margin-top: 0;
                }
            }
        }
        + .module {
            margin-top: 15px;
            padding-top: 15px;
        }
    }
}

/* Issue Security Level */
#security-val .note {
    color: var(--ds-text-danger, #d04437);
}

#viewissuesidebar {
    width: 35%; // matches the width of the sidebar in AUI page
    padding-left: 30px; // double the standard due to the module twixies making the page feel cramped.
}

.user-content-block {
    overflow: auto;
    overflow-y: hidden;
}

.pin-icon {
    height: 16px;
    width: 16px;
    background: url("../../../images/pin.svg") 0 0 no-repeat;
}

/* Tab Panel Content styles */
.issue-data-block {
    @left-indent: 10px;
    @active-border-width: 5px;
    @active-border-color: var(--ds-border-accent-blue, #3572b0);

    border-bottom: 1px solid var(--ds-border, @aui-border-color);
    padding: @left-indent;

    .clearfix();

    &.focused {
        background-color: var(--ds-background-neutral, @aui-color-highlight-primary);
        .action-links a {
            opacity: 1;
        }
    }
}

.actionContainer .subText {
    font-size: 1em;
}

.issue-data-block .twixi {
    background: var(--ds-background-input, rgba(9, 30, 66, 0.08));
    border-radius: 3px;
    top: 4px;
    left: -4px;
    text-decoration: none;
    cursor: pointer;
    &:hover {
        background: var(--ds-background-discovery-hovered, rgba(9, 30, 66, 0.13));
    }
    .icon-default {
        display: block;
    }
}

.actionContainer ul.item-details dl dt {
    width: 19%;
}

.actionContainer ul.item-details dl dd {
    width: 79%;
}

.actionContainer .action-comment-actions {
    color: var(--ds-text-subtlest, @aui-color-mid);
    float: none;
    display: flex;
    align-items: center;

    > * {
        margin-top: 10px;
    }
}

jira-comment-reactions {
    display: none;
}

.issue-comment-action {
    color: var(--ds-text-subtlest, @aui-color-mid);
    &:hover {
        color: var(--ds-text-subtlest, @aui-color-mid);
    }
}

.issue-activity-sort-link {
    color: var(--ds-text-subtlest, @aui-color-mid);

    &:hover {
        color: var(--ds-text-subtlest, @aui-color-mid);
    }
}

#status-val {
    max-width: 100%;
    margin-right: -5px;

    .jira-issue-status-lozenge {
        .border-box();

        width: 100%;
    }
}

.status-view {
    display: inline-block;
    padding: 2px 0 2px 5px;
    white-space: nowrap;
}

.action-details {
    line-height: 1.5;
    text-align: left;

    .comment-created-date-link {
        color: inherit;
    }

    .update-info {
        color: var(--ds-text-subtlest, @aui-color-N300);
    }
}

.focused .action-details {
    text-align: left;
}

.action-links {
    float: right;

    &__divider {
        display: inline-block;
        background: var(--ds-text-subtlest, @aui-color-mid);
        border-radius: 50%;
        width: 2px;
        height: 2px;
        flex-shrink: 0;
        margin: 0 8px;

        &:last-child {
            display: none;
        }
    }
}

.action-body {
    overflow: auto;
    overflow-y: hidden;
    margin: 0;
    margin-top: 10px;
}

.action-body blockquote {
    color: var(--ds-text, #333);
}

.action-body .item-details {
    margin-top: 0.5em;
}

.action-description {
    color: var(--ds-text, #666);
    margin-bottom: 1.5em;
}

/* Custom fields */
#customfieldmodule #customfield-tabs {
    .tabs-menu {
        margin-top: 20px;
        margin-left: -10px;
    }
}

/* Comments */
#addcomment {
    .addcomment-action {
        &--hidden {
            display: none;
        }
    }

    @keyframes pulsing {
        0%,
        to {
            opacity: 0.5;
        }
        35%,
        75% {
            opacity: 1;
        }
    }

    .comment-loading-skeleton {
        height: 40px;
        background-color: var(--ds-surface, @aui-color-N20);
        opacity: 0.5;
        animation: pulsing 3s infinite;
        border-radius: 3px;

        &--hidden {
            display: none;
        }
    }

    &.sticky {
        position: sticky;
        bottom: 0;
        padding-top: 16px;
        padding-bottom: 16px;
        background-color: var(--ds-surface, @aui-color-white);
        z-index: 1;
        border-top: 2px solid var(--ds-border, @aui-color-N30);

        &.active {
            padding-top: 8px;
        }

        #addcomment-inner {
            padding-left: 50px;
        }

        #footer-comment-button {
            display: flex;
            margin-bottom: 9px;
            height: 40px;
            border: 1px solid var(--ds-border, @aui-color-N40);
            border-radius: 3px;
            color: var(--ds-text, #999);
            text-decoration: none;
            cursor: text;

            span {
                display: inline-flex;
                align-items: center;
                padding-left: 12px;
                color: var(--ds-text-subtlest, @aui-color-N300);
            }
        }

        .hint-container {
            font-size: 12px;
            color: var(--ds-text-subtlest, @aui-color-N100);

            kbd {
                vertical-align: middle;
                line-height: 14px;
                font-size: 12px;
                min-width: 1.5em;
                position: relative;
                top: -1px;
            }
        }

        .mod-footer li {
            width: 100%;
        }

    }

}

#addcomment .mod-content {
    display: none;
}

#addcomment.active .mod-footer {
    display: none;
}

#addcomment.active .mod-content {
    display: block;
}

#addcomment textarea {
    max-height: none;
    min-height: 150px;
}

.ops-menus .aui-toolbar2-inner .icon {
    vertical-align: text-bottom;
}

.icon-comment {
    overflow: visible;
}

#issue-comment-add {
    #comment {
        max-width: none;
    }
    #issue-comment-add-cancel {
        margin-right: 9px;
    }
}

.buttons-container.buttons-container.buttons-container {
    margin-top: 1px;
}

/* Activity sort controller icons */
.activity-tab-sort-down,
.activity-tab-sort-up {
    &::before {
        content: '';
        width: 100%;
        height: 100%;
        margin-top: 1px;
        background-size: 100%;
    }
}

.activity-tab-sort-down::before {
    background: url("../../../images/icons/sort_down.svg") center no-repeat;
}

.activity-tab-sort-up::before {
    background: url("../../../images/icons/sort_up.svg") center no-repeat;
}

/* Activity */
#activitymodule {
    .aui-tabs {
        position: relative;

        &.horizontal-tabs {
            flex-direction: row;
        }

        #issue-tabs {
            position: static;
            padding-right: 20px;
            flex-grow: 1;

            &::before {
                width: 100%;
                left: 0;
                right: 0;
            }
        }

        .tabs-menu a {
            cursor: pointer;
            &:hover {
                color: @aui-color-B600;
            }
        }

        .tabs-pane {
            padding: 0;
        }
    }

    .mod-content {
        min-height: 5em; // To prevent jumping whilst switching between tabs and content is loading.

        #activity-panel-placeholder {
            height: 70px;
            background: url("../../../images/icons/activity-panel-placeholder.svg") center no-repeat;
        }
    }

    .issuePanelWrapper {
        position: relative;
        padding-top: 10px; // To push the message away from the bottom of the tabs.

        &.loading {
            .issuePanelProgress {
                background: url("../../../images/gadgets/loading.gif") center no-repeat;
                height: 60px;
                width: 100%;
                position: absolute;
                z-index: 1;
            }

            .issuePanelContainer {
                opacity: 0.3;
            }

            .issuePanelHeaderContainer {
                opacity: 0.3;
            }
        }
    }

    .issuePanelContainer {
        transition: opacity 0.2s;
    }

    .issuePanelHeaderContainer {
        transition: opacity 0.2s;
    }
}

.sortwrap {
    align-self: flex-end;
    margin-bottom: 3px;

    #sort-button {
        display: flex;
        align-items: center;
    }
    .activity-tab-sort-label {
        margin-right: 2px;
        color: var(--ds-text-subtlest, @aui-color-N500);
        font-size: 14px;
        font-weight: 600;
    }
}

.links-list {
    margin: 0;
}

.links-list:last-child {
    border-bottom: none;
}

.links-list .resolution {
    text-decoration: line-through;
}

.links-list img {
    vertical-align: text-top;
}

/* JRADEV-7116 FFX specific hack to prebvent the alt text blowing out the layout on broken images */
.links-list img:-moz-broken,
.links-list img:-moz-user-disabled {
    -moz-force-broken-image-icon: 1;
    height: 16px;
    width: 16px;
}

.links-list dt {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-top: 5px;
    width: 142px;
}

.links-list dd {
    margin-left: 0;
    padding-left: 10px;
    border-bottom: 1px solid var(--ds-border, @aui-color-N40);
    position: relative;
    padding-right: 24px;
}

.links-list .link-content {
    .border-box();
    display: table;
    padding: 5px;
    table-layout: fixed;
    width: 100%;
    word-wrap: normal;
}

.links-list .link-content > p,
.links-list .link-content > div,
.links-list .link-content > ul {
    display: table-cell;
}

.links-list .link-content > p {
    .border-box();
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.links-list ul.link-snapshot {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: right;
    width: 136px;
    white-space: nowrap;
}

.links-list ul.link-snapshot .status {
    width: 100px;
    text-align: left;
    display: inline-block;
}

.links-list ul.link-snapshot li {
    display: inline;
    margin: 0 4px;
}

.links-list ul.link-snapshot li > span,
.links-list ul.link-snapshot li > img {
    vertical-align: text-bottom;
}

/* align statuses and priorities the same way */
.links-list dd {
    &:hover {
        background-color: var(--ds-background-neutral, @aui-color-highlight-primary);
    }

    .delete-link a {
        .assistive();
    }

    .delete-link .icon-default {
        color: var(--ds-text-subtlest, @aui-color-N500);
    }

    &:hover .delete-link a,
    & .delete-link a:focus {
        position: absolute;
        text-align: center;
        width: 24px;
        height: auto;
        top: 7px;
        right: 2px;
        clip: auto;
    }
}

.links-list .link-loading,
.link-loading-failed {
    color: var(--ds-text-warning, #666);
}

.collapsed-links-list {
    display: none;
}

.collapsed-link {
    display: none;
}

#show-more-links {
    border-top: 1px solid var(--ds-border, @aui-border-color);
    padding-top: 5px;
}

#show-more-links span {
    color: var(--ds-text-subtlest, @aui-color-mid);
}

/* Subtasks */
#view-subtasks td {
    white-space: normal;
}

#view-subtasks td.stsummary {
    min-width: 200px;
    width: 100%;
}

#view-subtasks td.assignee .tinylink {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    word-wrap: normal;
}

.subtask-table-container {
    overflow-x: auto;
    #issuetable {
        margin: 0;
    }
}

.subtask-prog-wrap {
    background-color: var(--ds-surface, #fff);
    display: block;
    float: right;
    margin: 0;
    margin-top: 3px;
    padding: 0 @grid 0 @grid;
}

.subtask-prog-wrap span {
    color: var(--ds-text, #808080);
    float: left;
    margin: 0 0.429em 0 0;
}

#subtasks_resolution_percentage {
    float: left;
    position: relative;
    top: 3px;
    width: 10em;
    line-height: 1em;
}

#subtasks_resolution_percentage td,
#subtasks_resolution_percentage td img {
    height: 10px;
}

/* Voters and watchers */
#vote-label,
#watch-label {
    color: var(--ds-text-subtle, @jira-color-subtle-text);
}

/* View Voters */
.tickLabel {
    font-size: 11px;
}

.issue-drop-zone {
    &__button {
        color: var(--ds-link, @aui-color-B400);
    }
}

/* Attachments */
.item-attachments {
    list-style: none;
    margin: 0;
    padding: 0;
    &::after {
        clear: both;
        content: ".";
        display: block;
        height: 0;
        visibility: hidden;
    }
    .attachment-content {
        .clearfix();
        padding: 5px 5px 5px 20px;

        &::after,
        .twixi-block::after {
            content: ".";
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
        }
    }

    .attachment-icon::before {
        color: var(--ds-icon, #707070);
    }

    .attachment-thumbnail-icon {
        --aui-icon-size: 80px;
    }
}

// override styles coming from JIRA Drag & Drop Attachments Plugin
#attachmentmodule #attachment_thumbnails.item-attachments {
    .attachment-content {
        .attachment-thumbnail-icon {
            &::before {
                color: var(--ds-text-subtle, @aui-color-N90);
            }
        }

        &:hover {
            background-color: var(--ds-background-neutral, @aui-color-highlight-primary);

            .attachment-thumb .no-image {
                fill: var(--ds-text-subtle, @aui-color-N200);
            }

            .attachment-thumbnail-icon {
                &::before {
                    color: var(--ds-text-subtle, @aui-color-N200);
                }
            }
        }

        dl .attachment-date {
            color: var(--ds-text-subtle, @aui-color-N200);
        }
    }
}

.attachment-content dl {
    margin: 0;
}

.attachment-content dt {
    float: left;
}

.attachment-content dd {
    float: right;
    margin: 0;
}

.attachment-content dd.zip-contents {
    float: none;
    padding: 0 215px 0 20px;
}

.attachment-content dd.zip-contents ol {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.attachment-content dd.zip-contents ol li {
    clear: both;
}

.attachment-content dd.zip-contents .attachment-size {
    color: var(--ds-text-subtle, #bbb);
    float: right;
}

.attachment-content .attachment-delete {
    width: 20px;
    padding-left: 5px;
    .aui-icon {
        color: var(--ds-text-subtlest, @aui-color-mid);
    }
}

.attachment-content {
    .attachment-delete a {
        .assistive();
    }

    &:hover .attachment-delete a,
    .attachment-delete a:focus {
        width: auto;
        height: auto;
        clip: auto;
    }
}

.attachment-content .twixi-block {
    margin-left: -20px; // equal to the left padding on .attachment-content
}

.zip-contents-trailer {
    color: var(--ds-text-subtle, #bbb);
}

#attachment_thumbnails {
    float: left;
    width: 100%;
}

#file_attachments + #attachment_thumbnails {
    border-top: 1px solid var(--ds-border, @aui-border-color);
    margin-top: @grid;
    padding-top: @grid;
}

.attachment-thumb {
    float: left;
    margin-right: 0.581em;

    a:hover {
        text-decoration: none;
    }
}

.attachment-thumb .no-image {
    height: 80px;
    fill: var(--ds-text-subtle, @aui-color-N90);
}

.attachment-thumb img {
    vertical-align: text-top;
    max-width: 200px;
    max-height: 200px;
}

.earlier-version a:link,
.earlier-version a:visited {
    color: var(--ds-link-visited, #666);
}

.attachment-size {
    color: var(--ds-text, #666);
    margin: 0 5px;
}

.attachment-author {
    display: none;
}

dd.attachment-date {
    text-align: right;
    width: 180px;
    padding: 0 5px;
}

/* large thumbnails */

.blender {
    position: absolute;
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: 3em;
    height: 100%;
    background-size: 100% 100%;
    background-image: linear-gradient(to right, var(--ds-background-neutral-subtle, rgba(255, 255, 255, 0)) 0%, var(--ds-surface, @aui-color-page) 100%);
    pointer-events: none;
}

/* little fade for view_attachments.jsp */
#attachment_thumbnails .attachment-content:hover .blender {
    background-image: linear-gradient(to right, var(--ds-surface, rgba(255, 255, 255, 0)) 0%, var(--ds-background-neutral, @aui-color-highlight-primary) 100%);
}

#attachment_thumbnails .attachment-delete {
    position: absolute;
    left: auto;
    right: 0;
    padding: 0;
    margin: 0;

}

#attachment_thumbnails .attachment-delete .icon {
    margin: 0;
}

#attachment_thumbnails .attachment-content {
    border: 1px solid var(--ds-surface, #f0f0f0);
    float: left;
    height: 242px;
    margin: 0 6px 6px 0;
    padding: 6px 10px;
    width: 200px;
    text-align: center;
}

#attachment_thumbnails .attachment-thumb,
#attachment_thumbnails .attachment-thumb .gallery {
    display: flex;
    justify-content: center;
    align-items: center;
    float: none;
    height: 200px;
    width: 200px;
}

#attachment_thumbnails dl {
    clear: left;
    display: block;
    height: 42px;
    overflow: hidden;
    width: 200px;
}

#attachment_thumbnails dt,
#attachment_thumbnails dd {
    position: relative;
    text-align: left;
}

#attachment_thumbnails .attachment-title {
    display: block;
    float: none;
    height: 21px;
    white-space: nowrap;
    width: 200px;
    word-wrap: normal;
}

#attachment_thumbnails .attachment-size {
    float: left;
    margin: 0;
    top: -0.213em;
    width: auto;
}

#attachment_thumbnails .attachment-date {
    top: -0.213em;
    width: auto;
}

/* Time (tracking) module RHS */

.tt_inner dl {
    display: table;
    table-layout: fixed;
    width: 100%;
}

.tt_inner dt,
.tt_inner dd {
    .border-box();
    display: table-cell;
    margin: 0;
}

dt.tt_text {
    color: @temp-color-item-label-foreground;
    padding: 2px 5px 2px 0;
    width: @label-width;
}

dd.tt_values {
    padding: 2px 0 2px 5px;

}

dd.tt_graph {
    vertical-align: text-bottom;

}

#tt_include_subtasks label {
    color: @temp-color-item-label-foreground;
    margin-left: 0.5em;
}

/* Tab Panel Change History - Fisheye overrides? */
.activity-name {
    color: var(--ds-text, #666);
    min-width: 150px;
}

.activity-old-val,
.activity-new-val {
    min-width: 250px;
}

/* The file upload progress bar */
.file-progress .progress-fill-color {
    background-color: var(--ds-background-input, #cccccc);
}

.file-progress {
    position: relative;
    height: 2px;
    width: 320px;
    padding: 5px 0;
}

/* Fix for Participants custom field in the toolkit plugin See JRADEV-11039 */
.cf-participant {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: text-top;
    white-space: nowrap;
}

.people-details {
    border-spacing: 0;
}

dl.people-list,
dl.dates-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 2px 5px;

    dt {
        box-sizing: border-box;
        color: var(--ds-text-subtlest, @aui-color-mid);
        line-height: 24px;
        padding: 2px 5px 2px 0;
    }

    dd {
        box-sizing: border-box;
        margin: 0;
        >  span:not(.icon) {
            padding-left: 0;
            width: 100%;
        }
    }

    dd:first-of-type {
        display: flex;
        flex-direction: column;
    }

}

dl.people-list-composed {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 2px 5px;

    dd > .editable-field {
        margin: -2px 0 -2px -5px;
    }

    dt {
        box-sizing: border-box;
        color: var(--ds-text-subtlest, @aui-color-mid);
        line-height: 24px;
    }

    dd {
        box-sizing: border-box;
        margin: 0;
        span {
            padding-left: 0;
            width: fit-content;
        }
    }
}

dl.people-list {
    margin-top: 3px;
}

.people-details {
    > dl:first-child {
        line-height: 24px;
        + dl {
            line-height: 24px;
        }
    }

    .assign-to-me-link {
        display: block;
    }

    .aui-avatar {
        vertical-align: middle;
    }
}

/* Collapsible issue actions */
.collapsed-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-right: none;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;

    &:not([busy]) .shift-key-icon {
        display: inline-block;
        margin: 0 7px;
        width: 44px;
        height: 24px;
        box-sizing: border-box;
        border: 2px solid var(--ds-border, @aui-color-N50);
        border-radius: 6px;
        background-color: var(--ds-surface, @aui-color-N20);

        &--hidden {
            display: none;
        }
    }
}

.collapsed-actions:hover {
    text-decoration: none;
}

.issue-data-block {
    .action-head {
        cursor: pointer;
    }
}

.issueaction-aui-icon {
    color: var(--ds-icon-subtle, @aui-color-N500);
    &:hover {
        color: var(--ds-text-subtlest, @aui-color-mid);
        text-decoration: none;
    }
}

/* "Responsive" Layout stuff - leave at the end */
/* THERE SHOULD BE NOTHING AFTER THE RESPONSIVE STUFF IN THIS STYLE SHEET */
/* using mixins here as the same changes are needed for normal view issue and split-view, but SV uses JS to trigger layout changes */
@import "responsive/issue-view/responsive-issue-view.less";

@media all and (max-width: 1190px) {
    .responsive-links();

    #viewissuesidebar {
        #peopledetails {
            line-height: 20px;
        }

        .responsive-item-details();

        .responsive-time-tracking();

    }

    dl.people-list,
    dl.dates-list {
        grid-template-columns: 1fr;

        dt,
        dd {
            grid-column: span 1;
        }
    }
}

/* END "Responsive" Layout stuff - leave at the end
THERE SHOULD BE NOTHING AFTER THIS IN THIS STYLE SHEET
*/
