/**
 * The MIT License (MIT)
 *
 * Copyright (c) Camptocamp SA
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

$layertree-group-box-shadow: 0 0 0.25rem 0.06rem;

gmf-layertree {
  display: block;
  padding: 0 $app-margin;
  position: absolute;
  height: 100%;
  width: 100%;
  ul {
    margin-bottom: 0;
  }
  > :first-child {
    margin-right: $half-app-margin;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

.gmf-layertree-node {
  .gmf-layertree-right-buttons {
    display: none;
    cursor: pointer;
    margin-right: $half-app-margin;

    .gmf-layertree-node-menu-btn {
      display: none;
    }
  }

  &.gmf-layertree-depth-1 {
    //styling first level node for desktop app
    background-color: $nav-bg;
    background-color: var(--nav-bg);
    box-shadow: $layertree-group-box-shadow $input-border-focus;
    box-shadow: $layertree-group-box-shadow var(--input-border-focus);

    > ul {
      // no padding for the first list in first level nodes
      padding-left: 0;
      > li:last-child {
        padding-bottom: $half-app-margin;
      }
    }

    &:hover {
      .gmf-layertree-sortable-handle-icon {
        visibility: visible;
      }
    }
  }

  &.gmf-layertree-dragger {
    * {
      cursor: -webkit-grabbing;
      cursor: grabbing;
    }
  }

  .gmf-layertree-group.gmf-layertree-depth-1 {
    background-color: $main-bg-color;
    background-color: var(--main-bg-color);
    padding: $half-app-margin;
  }

  .gmf-layertree-group,
  .gmf-layertree-leaf {
    &:hover {
      .gmf-layertree-right-buttons {
        display: block;
      }
    }
    &.off {
      .extra-actions {
        display: none;
      }
    }
  }

  .gmf-layertree-leaf {
    padding-right: $half-app-margin;
  }

  .gmf-layertree-legend:hover {
    a {
      cursor: pointer;
      display: inline-block;
    }
  }

  // leave space for the drag handle
  .gmf-layertree-depth-1 a.gmf-layertree-expand-node.fa-solid {
    margin-left: $half-app-margin;
  }

  div.ngeo-sortable-handle {
    cursor: -webkit-grab;
    cursor: grab;
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: $app-margin;
    margin: 0.12rem 0 0;
  }

  .gmf-layertree-sortable-handle-icon {
    color: #555;
    visibility: hidden;
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate(-50%, -50%);
  }
}

.gmf-layertree-curr-drag-item {
  border: 0.06rem dashed black;
  margin: 0 $micro-app-margin $app-margin $micro-app-margin;
  box-shadow: $layertree-group-box-shadow $input-border-focus;
  box-shadow: $layertree-group-box-shadow var(--input-border-focus);
}

.gmf-imported-legend {
  padding-top: 0.8rem;
  .gmf-legend-image {
    overflow-y: auto;
  }
}
