@import url('./flamechart/index.css');

.view-flamechart {
    position: relative;
    margin: 4px 0;
    padding: 4px 0;
    background-color: rgba(136, 136, 136, .05);
    min-height: 150px;
    max-height: 50vh;
    max-height: min(40vh, 300px);
    overflow: clip;
    contain: strict;
}

.view-flamechart__content {
    box-sizing: border-box;
    height: 100%;
    padding-bottom: var(--details-height);
    overflow: hidden;
    overflow-y: auto;
    contain: strict;
    will-change: padding;
}
.view-flamechart.lock-scrolling.disable-scrolling .view-flamechart__content {
    overflow: hidden;
}

.view-flamechart .flamechart .root-content {
    display: flex;
    gap: 8px;
}
.view-flamechart .flamechart .root-content > .view-duration::before {
    content: '›';
    padding-right: 2px;
    color: #888;
}
.view-flamechart .flamechart .root-content .fraction {
    font-size: inherit;
    width: auto;
}
.view-flamechart .flamechart .root-content .zoom-timings {
    display: inline-flex;
}
.view-flamechart .flamechart .root-content .zoom-timings::before {
    content: '›';
    color: #888;
}
.view-flamechart .flamechart .root-content .zoom-timings .view-duration {
    margin-left: 1ex;
}
.view-flamechart .flamechart .root-content .zoom-timings .view-duration::before {
    content: 'zoom:';
    color: #888;
}

.view-flamechart__details {
    position: sticky;
    bottom: 0;
    box-sizing: border-box;
    max-height: 0;
    width: 100%;
    overflow: hidden;
    overflow-y: auto;
    padding: 0 12px;
    margin-top: 51px;

    display: flex;
    flex-direction: row;
    gap: 0 20px;
    
    background: rgba(255, 255, 255, .75);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;

    transition: .2s ease-in-out;
    transition-property: padding, max-height, opacity;

    font-size: 11px;
}
.view-flamechart__details.has-details {
    max-height: 80px;
    padding-top: 5px;
    padding-bottom: 5px;
    opacity: 1;
}
.discovery-root-darkmode .view-flamechart__details {
    background: rgba(36, 36, 36, .8);
}
.view-flamechart__details .view-badge {
    display: inline-block;
    margin: 0 0 3px -5px;
    padding-top: 0;
    padding-bottom: 1px;
    line-height: 19px;
}
.view-flamechart__details .view-badge.function-loc {
    padding-block: .5px;
}
.view-flamechart__details .view-duration {
    align-items: baseline;
}
.view-flamechart__details .view-duration.total::before,
.view-flamechart__details .view-duration.self::before {
    white-space: pre;
    font-size: 80%;
    color: #888;
    min-width: 10ex;
    text-align: right;
}
.view-flamechart__details .view-duration.total::before {
    content: 'Total time: ';
}
.view-flamechart__details .view-duration.self::before {
    content: 'Self time: ';
}
.view-flamechart__details .view-duration > .time {
    flex: 0;
}
.view-flamechart__details .view-duration > .fraction {
    width: auto;
}

.view-flamechart.fully-visible .view-flamechart__enable-scrolling-button {
    position: absolute;
    bottom: calc(var(--details-height, 0px) + 4px);
    z-index: 10;
    background: var(--discovery-background-color);
    left: 50%;
    transform: translate(-50%);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    opacity: .75;
    cursor: pointer;
    transition: opacity .2s ease-in-out;
    contain: style layout paint;
}
.view-flamechart.fully-visible .view-flamechart__enable-scrolling-button:hover {
    opacity: .95;
}
.view-flamechart:not(.fully-visible.lock-scrolling.disable-scrolling) .view-flamechart__enable-scrolling-button,
.view-flamechart:not(.has-scroll) .view-flamechart__enable-scrolling-button {
    opacity: 0;
    pointer-events: none;
}

.discovery-root-darkmode .flamechart .frame:hover {
    --fill-opacity: .3;
}

.flamechart-tooltip {
    padding: 5px 10px;
    min-width: 250px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    background: rgba(255, 255, 255, .75);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.discovery-root-darkmode .flamechart-tooltip {
    background: rgba(36, 36, 36, .8);
}
.flamechart-tooltip .view-badge {
    display: inline-block;
    margin: 0 0 3px -5px;
    padding-top: 0;
    padding-bottom: 1px;
    line-height: 19px;
}
.flamechart-tooltip .view-badge.function-loc {
    padding-block: .5px;
}
.flamechart-tooltip .view-duration {
    align-items: baseline;
}
.flamechart-tooltip .view-duration.total::before {
    content: 'Total time: ';
    white-space: pre;
    font-size: 80%;
    color: #888;
}
.flamechart-tooltip .view-duration.self::before {
    content: 'Self time: ';
    white-space: pre;
    font-size: 80%;
    color: #888;
}
.flamechart-tooltip .view-duration > .time {
    flex: 0;
}
.flamechart-tooltip .view-duration > .fraction {
    width: auto;
}
