/**
 * Copyright © 2016-2026 The Thingsboard Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@import './rule-node-colors';

:host {

  .fc-node-overlay {
    position: absolute;
    pointer-events: none;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    border-radius: 5px;
    opacity: 0;
  }

  :host-context(.fc-hover) .fc-node-overlay {
    opacity: 0.25;
    transition: opacity .2s;
  }

  :host-context(.fc-selected) .fc-node-overlay {
    opacity: 0.25;
  }

  :host-context(.fc-edit) {
    .fc-nodeedit,
    .fc-nodedelete {
      box-sizing: content-box;
      border: solid 2px #fff;
      background: #f83e05;
      outline: none;
    }
  }

  .tb-rule-node {
    box-sizing: content-box;
    display: flex;
    flex-direction: row;
    min-width: 150px;
    max-width: 150px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 16px;
    color: #333;
    pointer-events: none;
    background-color: #f15b26;
    border: solid 1px #777;
    border-radius: 5px;

    @include rule-node-colors();

    &.tb-rule-node-highlighted:not(.tb-rule-node-invalid) {
      box-shadow: 0 0 10px 6px #51cbee;

      .tb-node-title {
        font-weight: 700;
        text-decoration: underline;
      }
    }

    &.tb-rule-node-invalid {
      box-shadow: 0 0 10px 6px #ff5c50;
    }

    &.tb-input-type {
      user-select: none;
      background-color: #a3eaa9;
    }

    .mat-icon, img {
      margin: auto;
      width: 20px;
      min-width: 20px;
      height: 20px;
      min-height: 20px;
      padding-right: 4px;
      font-size: 20px;
    }

    .tb-node-title {
      font-weight: 500;
    }

    .tb-node-type,
    .tb-node-title {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .fc-leftConnectors,
    .fc-rightConnectors {
      position: absolute;
      top: 0;

      z-index: 0;

      display: flex;
      flex-direction: column;
      height: 100%;

      .fc-magnet {
        align-items: center;
      }
    }

    .fc-leftConnectors {
      left: -20px;
    }

    .fc-rightConnectors {
      right: -20px;
    }

    .fc-magnet {
      display: flex;
      flex-grow: 1;
      justify-content: center;
      height: 60px;
    }

    .fc-connector {
      width: 14px;
      height: 14px;
      margin: 10px;
      pointer-events: all;
      background-color: #ccc;
      border: 1px solid #333;
      border-radius: 5px;
    }

    .fc-connector.fc-hover {
      background-color: #000;
    }
  }
}
