/*
 * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
 * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

.timeline-toolbar-container {
  display: flex;
  align-items: flex-start;
  flex: none;
  background-color: var(--sys-color-cdt-base-container);
  border-bottom: 1px solid var(--sys-color-divider);

  & > :first-child {
    flex: 1 1 auto;
  }
}

.timeline-settings-pane {
  display: grid;
  grid-template-columns: 50% 50%;
  padding-top: var(--sys-size-3);
  row-gap: var(--sys-size-3);
  flex: none;
  background-color: var(--sys-color-cdt-base-container);
  border-bottom: 1px solid var(--sys-color-divider);

  & > div {
    margin-left: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
  }
}

#timeline-overview-panel {
  flex: none;
  position: relative;
  border-bottom: 1px solid var(--sys-color-divider);
}

#timeline-overview-grid {
  background-color: var(--sys-color-cdt-base-container);
}

#timeline-overview-grid .timeline-grid-header {
  height: 12px;
}

#timeline-overview-grid .resources-dividers-label-bar {
  pointer-events: auto;
  height: 12px;
}

#timeline-overview-grid .resources-divider-label {
  top: 1px;
}

.timeline-details-split {
  flex: auto;
}

.timeline.panel .status-pane-container {
  z-index: 1000;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.timeline.panel .status-pane-container.opaque {
  background-color: var(--sys-color-cdt-base-container);
  pointer-events: auto;
}

.timeline.panel .status-pane-container.tinted {
  /* stylelint-disable-next-line plugin/use_theme_colors */
  background-color: #0005;
  background-blend-mode: multiply;
  pointer-events: auto;
}

.timeline-landing-page.legacy > div > p {
  flex: none;
  white-space: pre-line;
  line-height: 18px;
}

.popover ul {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

#memory-graphs-canvas-container {
  overflow: hidden;
  flex: auto;
  position: relative;

  .no-events-found {
    position: absolute;
    font: var(--sys-typescale-body4-regular);
    left: var(--sys-size-5);
    bottom: var(--sys-size-5);

    p {
      margin: 0;
    }
  }
}

#memory-counters-graph {
  flex: auto;
}

#memory-graphs-canvas-container .memory-counter-marker {
  position: absolute;
  border-radius: 3px;
  width: 5px;
  height: 5px;
  margin-left: -3px;
  margin-top: -2px;
}

#memory-graphs-container .timeline-memory-header {
  flex: 0 0 26px;
  background-color: var(--sys-color-surface2);
  border-bottom: 1px solid var(--sys-color-divider);
  justify-content: space-between;
}

#memory-graphs-container .timeline-memory-header::after {
  content: "";
  /* stylelint-disable-next-line custom-property-pattern */
  background-image: var(--image-file-toolbarResizerVertical);
  background-repeat: no-repeat;
  background-position: right center, center;
  flex: 20px 0 0;
  margin: 0 4px;
}

.timeline-memory-toolbar {
  flex-shrink: 1;
}

.memory-counter-value {
  margin: 8px;
}

#counter-values-bar {
  flex: 0 0 20px;
  border-top: solid 1px var(--sys-color-divider);
  width: 100%;
  overflow: hidden;
  line-height: 18px;
}

.timeline-flamechart {
  overflow: hidden;
}

.brick-game {
  background-color: var(--sys-color-neutral-container);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999; /* A high value to ensure it's on top */
}

.game-close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  position: absolute;
  right: 15px;
  top: 15px;
  border-radius: 50%;
  cursor: pointer;
}

.scorePanel {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  white-space: pre-line;
  padding: 15px;
  position: absolute;
  left: 15px;
  bottom: 15px;
  border: double 7px transparent;
  border-radius: 20px;
  background-origin: border-box;
  background-clip: content-box, border-box;
  font-weight: 200;
}

.confetti-100 {
  display: block;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.confetti-100 > .confetti-100-particle {
  opacity: 0%;
  position: fixed;
  animation: confetti-100-animation 1s none ease-out;
  font-size: 30px;
}

@keyframes confetti-100-animation {
  0% {
    opacity: 100%;
    transform: translateY(0%) translateY(0%) rotate(0deg);
  }

  100% {
    opacity: 0%;
    /* stylelint-disable-next-line custom-property-pattern */
    transform: translateY(var(--to-Y)) translateX(var(--to-X)) rotate(var(--rotation));
  }
}

@media (prefers-reduced-motion) {
  .confetti-100 > .confetti-100-particle {
    animation-name: dissolve;
  }
}

.timeline-layers-view-properties table {
  width: 100%;
  border-collapse: collapse;
}

.timeline-layers-view-properties td {
  border: 1px solid var(--sys-color-divider);
  line-height: 22px;
}

.timeline-filmstrip-preview > img {
  max-width: 500px;
  max-height: 300px;
  cursor: pointer;
  border: 1px solid var(--sys-color-divider);
}

.timeline-details .filter-input-field {
  width: 120px;
}

.timeline-stack-view-header {
  height: 27px;
  background-color: var(--sys-color-cdt-base-container);
  padding: 6px 10px;
  color: var(--sys-color-on-surface);
  white-space: nowrap;
  border-bottom: 1px solid var(--sys-color-divider);
}

.timeline-landing-page {
  position: absolute;
  background-color: var(--sys-color-cdt-base-container);
}

.timeline-landing-page.legacy {
  justify-content: center;
  align-items: center;
  overflow: auto;
  font-size: 13px;
  color: var(--sys-color-on-surface-subtle);
}

.timeline-landing-page.legacy > div {
  max-width: 450px;
  margin: 10px;
}

.timeline-paint-profiler-log-split > div:last-child {
  background-color: var(--color-background-elevation-1);
  z-index: 0;
}

.timeline-layers-view > div:last-child,
.timeline-layers-view-properties > div:last-child {
  background-color: var(--color-background-elevation-1);
}

.timeline.panel .status-pane-container > div {
  pointer-events: auto;
}

.timeline-tree-view .data-grid .name-container div {
  flex: none;
}

devtools-toolbar {
  .history-dropdown-button {
    width: var(--sys-size-23);
    height: var(--sys-size-9);
    border-radius: var(--sys-shape-corner-extra-small);
    text-align: left;
    display: flex;
    padding-right: var(--sys-size-5);

    &:hover {
      background-color: var(--sys-color-state-hover-on-subtle);
    }

    &:active {
      background-color: var(--sys-color-state-ripple-neutral-on-subtle);
    }

    &:hover:active {
      background:
        linear-gradient(var(--sys-color-state-hover-on-subtle), var(--sys-color-state-hover-on-subtle)),
        linear-gradient(var(--sys-color-state-ripple-neutral-on-subtle), var(--sys-color-state-ripple-neutral-on-subtle));
    }

    &:focus-visible {
      outline: var(--sys-size-2) solid var(--sys-color-state-focus-ring);
    }

    &[disabled] {
      pointer-events: none;
      color: var(--sys-color-state-disabled);
      background-color: var(--sys-color-state-disabled-container);

      .content::after {
        background-color: var(--sys-color-state-disabled);
      }
    }

    & > .content {
      margin-left: 5px;
      padding-right: 5px;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 1 1;
      min-width: 35px;

      &::after {
        float: right;
        user-select: none;
        mask-image: var(--image-file-triangle-down);
        width: 14px;
        height: 14px;
        content: "";
        position: absolute;
        background-color: var(--icon-default);
        right: var(--sys-size-3);
        top: var(--sys-size-3);
      }
    }
  }

  @media (forced-colors: active) {
    .history-dropdown-button[disabled] {
      opacity: 100%;
    }

    .history-dropdown-button > .content::after {
      background-color: ButtonText;
    }

    .history-dropdown-button[disabled] > .content::after {
      background-color: GrayText;
    }
  }
}
