// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

.settings-bar {
  background-color: $color-gray-50;
  border-left: 1px solid $color-gray-60;
  position: relative;

  &.settings-bar-left {
    border-left: none;
    border-right: 1px solid $color-gray-60;

    & .tab-container-tabs {
      padding-left: 1.5rem;
    }
  }

  .settings-bar-inside {
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: 100%;
    height: calc(100% - 2px);

    .tool-window,
    .sitemap {
      position: relative;
      border-bottom: 1px solid $color-gray-60;
      display: flex;
      flex-direction: column;
      flex: 1;
      width: 100%;
      height: 100%;

      .tool-window-bar {
        align-items: center;
        display: flex;
        flex-shrink: 0;
        padding: $size-2;
        overflow: hidden;
        margin: 0;

        svg {
          fill: $color-gray-20;
          height: 12px;
          width: 12px;
        }

        button,
        div {
          border: none;
          background-color: transparent;
          color: $color-gray-10;
          font-size: $fs14;
          max-width: 100%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        span.pages-title {
          color: #e3e3e3;
          font-size: 0.875rem;
          max-width: 100%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        span.tool-badge {
          border: 1px solid $color-primary;
          border-radius: $br2;
          font-size: $fs10;
          color: $color-primary;
          padding: 2px 4px;
          margin-left: auto;
        }

        span.tool-link,
        span.shared-library {
          margin-left: auto;
          padding-left: 17px;
          display: flex;

          svg {
            fill: $color-gray-30;
            height: 20px;
            width: 20px;
          }
        }

        span.tool-link:hover svg {
          fill: $color-primary;
        }

        span.library-title {
          color: $color-gray-10;
          font-size: $fs14;
          max-width: 100%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          &:first-letter {
            text-transform: uppercase;
          }
        }

        .tool-window-bar-icon {
          height: 21px;
          display: flex;
          align-items: center;
          justify-content: center;

          svg {
            width: 15px;
            height: 15px;
          }
        }

        &.big {
          height: 3rem;
          padding-bottom: 1rem;
        }

        .tool-window-bar-title {
          font-size: $fs14;
          margin-left: 0.5rem;
        }

        .tool-window-icon {
          margin-right: $size-2;
          display: none;
        }

        .tool-window-close {
          cursor: pointer;
          margin-left: auto;
          transform: rotate(45deg);

          &:hover {
            svg {
              fill: $color-danger;
            }
          }
        }

        & .view-only-mode {
          color: $color-primary;
          border: 1px solid $color-primary;
          border-radius: $br3;
          font-size: $fs10;
          text-transform: uppercase;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-left: auto;
          padding: 0.25rem;
        }
      }
    }

    .assets-bar .tool-window {
      flex: none;
      height: auto;
    }
  }

  .empty {
    color: $color-gray-20;
    font-size: $fs12;
    line-height: $lh-150;
    text-align: center;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 12px;

    .tool-window-bar-icon {
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 16px;
    }

    svg {
      width: 32px;
      height: 32px;
      fill: $color-gray-30;
    }

    .btn-primary {
      margin-top: 10px;
      background-color: $color-gray-60;
      color: $color-gray-10;
      &:hover {
        background-color: $color-primary;
        color: $color-black;
      }
    }
  }

  & > .resize-area {
    position: absolute;
    width: 8px;
    height: 100%;
    z-index: 10;
    cursor: ew-resize;
  }

  &.settings-bar-left > .resize-area {
    right: -8px;
  }

  &.settings-bar-right > .resize-area {
    left: -4px;
  }
}

.tool-window-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  &.inspect {
    .tab-container-tabs {
      padding-bottom: 0.5rem;
      background-color: $color-gray-50;
      border-bottom: 1px solid $color-gray-60;
      height: 3rem;
    }

    .tab-container-tab-title {
      border-radius: $br4;

      &.current {
        background-color: $color-primary;
        color: black;
      }
    }
  }
}

.element-list {
  margin: 0;
  width: 100%;

  ul {
    border-left: 9px solid $color-gray-50;
    margin: 0 0 0 0.4rem;

    li {
      border-left: 1px solid $color-gray-40;
    }
  }

  li {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-top: 1px;
    padding-bottom: 1px;

    &.open {
      ul {
        li {
          .element-list-body {
            border-style: dashed;
          }
        }
      }
    }
  }
}

.element-list.pages-list {
  max-height: 10rem;

  .context-menu {
    position: fixed;
  }

  .context-menu-items {
    border: none;
    margin: none;
  }

  .context-menu-action {
    width: 100%;
  }
}

button.collapse-sidebar {
  background: none;
  border: none;
  cursor: pointer;
  height: 2.5rem;
  padding-top: 0.75rem;
  position: absolute;
  width: 1rem;

  & svg {
    width: 12px;
    height: 12px;
    fill: $color-gray-20;
    transform: rotate(180deg);
  }

  &.collapsed {
    background: $color-gray-60;
    left: 48px;
    top: 48px;
    width: 28px;
    height: 48px;
    padding: 0;
    border-radius: 0 $br4 $br4 0;
    border-left: 1px solid $color-gray-50;

    & svg {
      transform: rotate(0deg);
    }
  }
}

#layers.tool-window {
  overflow: auto;
}

.layers-tab {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  .resize-area-horiz {
    position: absolute;
    top: var(--height, 200px);
    left: 0;
    height: 8px;
    width: 100%;
    z-index: 10;
    cursor: ns-resize;
  }
}

.shortcuts,
.debug-panel {
  .shortcuts-header,
  .debug-panel-header {
    display: flex;
    height: 40px;
    background-color: $color-gray-60;

    .shortcuts-title,
    .debug-panel-title {
      color: $color-white;
      font-size: $fs12;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-grow: 1;
      svg {
        height: 18px;
        width: 18px;
        transform: rotate(45deg);
        fill: $color-gray-20;
      }
    }

    .shortcuts-close-button,
    .debug-panel-close-button {
      display: flex;
      justify-content: center;
      background-color: transparent;
      border: none;
      cursor: pointer;
      padding: 2px 0 2px 15px;
      position: absolute;
      top: 8px;
      svg {
        height: 18px;
        width: 18px;
        transform: rotate(45deg);
        fill: $color-gray-20;
      }
    }
  }

  .search-field {
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 10px;

    .search-box {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border: 1px solid $color-gray-30;
      border-radius: $br2;
      width: 100%;
      &:focus-within {
        border: 1px solid $color-primary;
      }
      .input-text {
        margin: 0;
        background: $color-gray-50;
        width: 100%;
        color: $color-white;
        &:focus {
          border-bottom: none;
        }
      }
      .icon-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        border: none;
        background-color: transparent;
        padding: 0;
        .icon {
          display: flex;
          justify-content: center;
          align-items: center;
          &.close {
            transform: rotate(45deg);
          }
        }
      }
      svg {
        width: 16px;
        height: 16px;
        margin: 0 7px;
        cursor: pointer;
        fill: $color-gray-20;
      }
    }
  }

  .shortcut-list {
    border-top: 1px solid $color-gray-60;
    padding: 10px;
    overflow-y: auto;
    height: 90%;
    margin-bottom: 15px;
    .section-title {
      background-color: $color-gray-60;
      padding: 4px 0;
    }
    .section-title,
    .subsection-title {
      display: flex;
      cursor: pointer;
      margin-top: 4px;
      font-size: $fs12;

      .section-name {
        color: $color-white;
      }
      .collapesed-shortcuts {
        padding: 0 10px;
        svg {
          height: 8px;
          width: 8px;
          fill: $color-gray-20;
        }
        &.open {
          svg {
            transform: rotate(90deg);
          }
        }
      }
      .shortcut-count {
        padding-left: 5px;
        color: $color-white;
      }
    }
    .subsection-title {
      padding: 4px 0px;
      .subsection-name {
        color: $color-white;
      }
    }

    .section-title,
    .subsection-title {
      &:hover {
        background-color: $color-primary;
        .subsection-name,
        .section-name {
          color: $color-gray-60;
        }
        svg {
          fill: $color-gray-60;
        }
      }
    }

    .shortcut-name {
      border: 1px solid $color-gray-60;
      border-radius: $br4;
      padding: 7px;
      display: flex;
      justify-content: space-between;
      margin-top: 4px;
      color: $color-white;
      font-size: $fs12;
      .command-name {
        display: flex;
        align-items: center;
      }
      .keys {
        flex-grow: 1;
        display: flex;
        align-items: center;
        justify-content: flex-end;
      }
      .char-box {
        min-width: 15px;
        background-color: $color-white;
        color: $color-black;
        border-radius: $br3;
        padding: 2px 5px;
        font-size: $fs11;
        font-weight: $fw600;
        margin: 0 2px;
        text-transform: capitalize;
        display: inline-block;
        text-align: center;
      }
      .space {
        margin: 0 3px;
      }
    }
  }
  .not-found {
    background-color: $color-gray-60;
    padding: 4px 0;
    color: $color-white;
    display: flex;
    justify-content: center;
    margin-top: 4px;
    font-size: $fs12;
  }
}

.debug-panel {
  .debug-panel-inner {
    padding: 8px;
  }
  .debug-option {
    display: flex;
    gap: 8px;
    margin: 4px 0;
    cursor: pointer;

    label {
      font-size: 80%;
      cursor: pointer;
    }

    svg {
      width: 15px;
      height: 15px;
      background: white;
    }

    &:hover {
      svg {
        stroke: var(--color-primary);
      }
      label {
        color: var(--color-primary);
      }
    }
  }
}
