@import 'node_modules/argo-ui/src/styles/config';
@import 'node_modules/foundation-sites/scss/util/util';
@import 'node_modules/argo-ui/src/styles/theme';
@import '../../../shared/config.scss';

$header: 120px;

.application-details {
    height: 100vh;
    width: 100%;

    &__wrapper {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 2 * $top-bar-height);
        overflow: hidden;

        @media screen and (max-width: map-get($breakpoints, xxlarge)) {
            height: calc(100vh - 3 * $top-bar-height);
            margin-top: $top-bar-height;
        }
    }

    .white-box__details-row .columns.small-9 {
        line-height: 1.4;
        min-height: 50px;
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .argo-dropdown__content.is-menu {
        max-height: 500px;
    }

    &__tree {
        padding: 1em;

        flex: 1;
        overflow-x: auto;
        overflow-y: auto;
        overscroll-behavior-x: none;
    }

    &__sliding-panel-pagination-wrap {
        margin-top: 1.25em;
    }

    &__warning {
        font-size: 0.8em;
        color: darken($argo-status-warning-color, 20%);
        min-height: 1.2rem;
    }

    &__refreshing-label {
        color: $white-color;
        position: fixed;
        margin-top: -20px;
        left: 50%;
        background-color: $argo-color-gray-7;
        border: 1px solid $argo-color-gray-5;
        border-radius: 5px;
        padding: 5px 5px;
        font-size: 0.6em;
        z-index: 1;
    }

    &__tab-content-full-height {
        height: calc(100vh - 2 * 76px);
        div.row,
        div.columns {
            height: 100%;
        }
    }

    &__container {
        position: relative;
        text-transform: uppercase;
        margin-top: 0.5em;
        cursor: pointer;
        font-size: 0.8em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-left: 10px;

        i {
            position: absolute;
            left: 0px;
            top: 2px;
        }

        span {
            color: $argo-color-teal-5;
        }
    }

    .application-resource-tree {
        margin: 0 auto;
    }

    &__view-type {
        margin-bottom: -6px;
        display: inline-block;
        vertical-align: middle;
        white-space: nowrap;
        i {
            cursor: pointer;
            color: $argo-color-gray-5;
            margin: 0 0.5em;
            &::before {
                font-size: 1.5em;
            }
        }
        i.selected {
            cursor: default;
            color: $argo-color-gray-7;
        }
    }

    &__node-menu {
        position: absolute;
        right: 0;
        top: 0;
    }

    &__external_link {
        margin-left: 5px;
    }

    pre {
        font-family: monospace;
        line-height: normal;
        white-space: pre;
    }

    &__action-menu {
        text-transform: capitalize;

        &.disabled {
            cursor: default !important;
            color: $argo-color-gray-3 !important;
        }

        &:focus {
            background-color: $argo-color-gray-1;
            outline: none;
        }
    }

    .argo-button:has(.application-details__dropdown-anchor-inner):hover .application-details__dropdown-anchor-inner {
        background-color: $argo-color-gray-5;
    }

    &__dropdown-anchor-inner {
        cursor: pointer;
        border-radius: 0px 24px 24px 0px;
        border-left: 1px solid #ccc;
        justify-content: center;
        position: absolute;
        margin-left: 5px;
        right: -10px;
        top: 0;
        bottom: 0;
        width: 24px;
        transition: background-color 0.2s;

        &:hover {
            background-color: $argo-color-gray-4 !important;
        }
    }

    .argo-table-list__row {
        .columns.small-1.xxxlarge-1 {
            width: 60px;
            text-align: center;
        }
    }

    @media screen and (max-width: map-get($breakpoints, xxlarge)) {
        .page__content-wrapper {
            min-height: calc(100vh - 3 * 50px);
        }
        .top-bar.row {
            display: block;
            .top-bar__left-side,
            .top-bar__right-side {
                width: 100%;
                max-width: 100%;
                flex: auto;
            }
            .top-bar__left-side {
                .argo-button {
                    i {
                        @media screen and (max-width: map-get($breakpoints, large)) {
                            margin: 0 auto !important;
                        }
                    }
                }
            }
        }
    }

    @media screen and (max-width: map-get($breakpoints, large)) {
        .top-bar.row {
            .top-bar__left-side {
                > div {
                    display: flex;
                    justify-content: center;
                    height: 50px;
                    align-items: center;
                    .argo-button {
                        height: 34px;
                    }
                    .argo-split-button {
                        height: 34px;
                    }
                }
            }
            .top-bar__right-side {
                display: flex;
                justify-content: center;
            }
        }
    }

    &__commit-message {
        line-height: 1.5em;
    }

    .filters-group__panel {
        top: 230px;
    }

    .graph-options-panel {
        margin-left: 10px;
        z-index: 1;
        padding: 5px;
        display: inline-block;
        box-shadow: 1px 1px 3px $argo-color-gray-5;
        position: absolute;

        @include themify($themes) {
            background: themed('background-2');
        }


        a {
            padding: 5px;
            margin: 2px;
            color: $argo-color-gray-6;
            border: 1px solid transparent;
            border-radius: 5px;

            &.group-nodes-button {
                cursor: pointer;
                position: relative;
                display: inline-block;
                vertical-align: middle;
                font-weight: 500;
                line-height: 1.4;
                text-align: center;
                user-select: none;
                transition: background-color 0.2s, border 0.2s, color 0.2s;
                text-transform: uppercase;
                &:hover {
                    background-color: #d1d5d9;
                }
                &:active {
                    transition: background-color 0.2s, border 0.2s, color 0.2s;
                    border: 1px $argo-color-teal-5 solid;
                }
            }

            &.group-nodes-button-on {
                color: $argo-color-gray-1;
                background-color: $argo-color-gray-6;
                border: 3px solid $argo-color-teal-4;
                font-size: 14px;
                outline-style: solid;
                &:hover {
                    background-color: $argo-color-gray-5;
                }

            }
        }

        .separator {
            @include themify($themes) {
                border-right: 1px solid themed('border');
            }
            padding-top: 6px;
            padding-bottom: 6px;
        }

        .zoom-value {
            user-select: none;
            margin-top: 5px;
            margin-right: 6px;
            margin-left: 4px;
            font-size: 14px;
            text-align-last: right;
            float: right;
            width: 40px;
            border: 1px $argo-color-gray-5 solid;
            background-color: $argo-color-gray-3;
            padding: 2px;
            color: $argo-color-gray-7;
        }
    }


    @media screen and (max-width: map-get($breakpoints, large)) {
        .sliding-panel__body {
            padding: 4px !important;
        }
        .sliding-panel--is-middle .sliding-panel__wrapper {
            width: 90% !important;
        }
        .sliding-panel--is-middle .sliding-panel__body {
            padding: 18px !important;
        }
        .sliding-panel__close {
            z-index: 2 !important;
        }
        .top-bar__title {
            display: none;
        }

        .top-bar__left-side {
            white-space: normal !important;
        }
        .top-bar__left-side > div {
            display: block !important;
        }
        .top-bar__right-side {
            justify-content: right !important;
        }
        .application-status-panel.row {
            flex-flow: unset;
        }
        .application-status-panel__item label {
            margin-right: 0;
        }
        .application-status-panel__item {
            padding: 5px 10px;
        }

        .white-box, .tabs__content {
            padding: 4px !important;
        }
        .white-box__details-row .columns.small-3 {
            overflow-wrap: unset !important;
            overflow: scroll;
        }
        .white-box__details-row .columns.small-9{
            padding-left: 4px;
        }

        .resource-details__header h1 {
            font-size: 16px;
        }
        .resource-details__header {
            margin-top: 30px;
            padding-right: 4px;
        }

        .tabs__nav a:first-child, .tabs__nav a {
            margin-left: 0 !important;
        }

        .editable-panel__buttons {
            top: unset;
        }
    }
}

// DropDown portals menu content to document.body, so these rules cannot live under .application-details.
.argo-dropdown__content.is-menu {
    margin-left: -16px;

    ul li.application-details-app-dropdown__filter {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 5px 10px;
        border-bottom: none;

        .application-details-app-dropdown__filter-spacer {
            width: 14px;
            flex-shrink: 0;
        }

        .argo-field {
            flex: 1;
            min-width: 0;
            margin: 0;
        }
    }

    ul li.application-details-app-dropdown__item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 5px 10px;
        font-size: 14px;
        line-height: normal;
        color: $argo-color-gray-6;
        border-bottom: none;

        .application-details-app-dropdown__resource-icon.icon {
            font-size: 14px;
            line-height: 14px;
            width: 14px;
            height: 14px;
            vertical-align: middle;
            flex-shrink: 0;
        }
    }
}

.resource-parent-node-info-title {
    flex-direction: column;
    color: $argo-color-gray-6;

    &__label {
        display: flex;
        margin-bottom: 0.25em;
        flex-shrink: 1;
        div:first-child {
            margin-right: 10px;
            width: 60px;
            text-align: right;
        }
        div:last-child {
            font-weight: 500;
            width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            text-align: left;

        }
    }
}
