/* .smart-splitter */
smart-splitter {
  width: var(--smart-splitter-default-width);
  height: var(--smart-splitter-default-height);
  position: relative;
  /* Fixes the issue with the overflow and resize-container */

  &[dragged] {
    cursor: w-resize;
  }

  &[orientation="horizontal"][dragged] {
    cursor: s-resize;
  }
}

smart-splitter-item {
  >.smart-container {
    overflow: hidden;
    position: relative;
    padding: var(--smart-splitter-item-padding);
  }
}

.smart-splitter {
  smart-splitter-bar {
    min-width: 5px;
    width: var(--smart-splitter-bar-size);
    position: relative;
    user-select: none;
    overflow: hidden;
    touch-action: none;

    >.smart-container {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column-reverse;
    }

    &.smart-element {
      background: var(--smart-surface);
      border-color: var(--smart-surface-color);
      color: var(--smart-surface-color);
      border-radius: initial;
    }

    &[focus] {
      .smart-splitter-resize-button {

        >span,
        >span::before,
        >span::after {
          background-color: var(--smart-ui-state-color-active);
          border-color: var(--smart-ui-state-color-active);
          color: var(--smart-ui-state-color-active);
        }
      }

      &.smart-element {
        outline: none;
        background: var(--smart-ui-state-active);
        color: var(--smart-ui-state-color-active);
      }
    }

    &[locked] {
      .smart-splitter-resize-button {
        >span {
          visibility: hidden;

          &:before,
          &:after {
            content: none;
          }
        }
      }

      &[hover] {
        background-color: var(--smart-ui-state-hover);
        color: var(--smart-ui-state-color-hover);
      }

      &[focus] {
        background-color: var(--smart-ui-state-active);
        color: var(--smart-ui-state-color-active);
      }
    }

    &[show-near-button] {
      .smart-splitter-near-collapse-button {
        visibility: inherit;
        width: 100%;
      }
    }

    &[show-far-button] {
      .smart-splitter-far-collapse-button {
        visibility: inherit;
        width: 100%;
      }
    }

    &[item-collapsed] {
      cursor: initial;

      >.smart-container {
        flex-direction: initial;
      }

      .smart-splitter-resize-button {
        display: none;

        >span {

          &:before,
          &:after {
            content: initial;
          }
        }
      }

      .smart-splitter-near-collapse-button,
      .smart-splitter-far-collapse-button {
        >span {
          transform: rotate(270deg);
        }

        &.smart-visibility-hidden {
          width: initial;
        }
      }

      .smart-splitter-near-collapse-button {
        >span {
          transform: translate(-50%, -50%) rotate(270deg);
        }
      }

      .smart-splitter-far-collapse-button {
        >span {
          transform: translate(-50%, -50%) rotate(90deg);
        }
      }
    }
  }

  smart-splitter-item {
    overflow: hidden;

    >.smart-container {
      >.smart-content {
        width: 100%;
        height: 100%;
        overflow: auto;
        padding: var(--smart-splitter-item-content-padding);
      }
    }

    &.smart-element {
      background-color: inherit;
      color: inherit;
      border-radius: initial;
    }

    &[collapsed] {
      overflow: hidden;
      padding: initial;
    }
  }

  .smart-splitter {
    margin: 0;
    width: 100%;
    height: 100%;
    border: none;

    smart-splitter-bar {
      background-color: var(--smart-primary);
      color: var(--smart-primary-color);
    }
  }

  >.smart-container {
    display: flex;
    position: relative;
    overflow: inherit;

    >smart-splitter-item {
      height: 100%;
      flex-shrink: 0;
      width: var(--smart-splitter-item-size);
    }

    >smart-splitter-bar {
      //height: 100%;
      flex-shrink: 0;
      height: var(--smart-splitter-bar-fit-size);

      &[locked] {
        cursor: default;
      }
    }

    >.smart-splitter-bar-feedback {
      height: 100%;
      flex-shrink: 0;
    }
  }

  .smart-splitter-bar-feedback {
    min-width: 5px;
    width: var(--smart-splitter-bar-size);
    //position: relative;
    user-select: none;
    overflow: hidden;
    touch-action: none;
    position: absolute;
    background-color: var(--smart-ui-state-hover);
    color: var(--smart-ui-state-color-hover);
    opacity: 0.5;

    &.limit-reached {
      background-color: var(--smart-error);
    }
  }

  .smart-splitter-resize-button {
    width: 100%;
    //height: 20px;
    position: relative;
    font-family: var(--smart-font-family-icon);
    //cursor: pointer;

    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: inherit;

    >span {
      width: 6px;
      height: 6px;
      border: 1px solid var(--smart-surface-color);
      background-color: var(--smart-surface-color);
      color: var(--smart-surface-color);
      border-radius: 50%;
      cursor: inherit;

      &:before,
      &:after {
        position: absolute;
        transform: translate(-50%, -50%);
        content: '';
        width: 4px;
        height: 4px;
        border-radius: 50%;
        border: 1px solid var(--smart-surface-color);
        background-color: var(--smart-surface-color);
        color: var(--smart-surface-color);
        pointer-events: none;
        font-family: var(--smart-font-family-icon);
      }

      &:before {
        left: 50%;
        top: calc(50% - var(--smart-splitter-bar-size));
      }

      &:after {
        top: calc(50% + var(--smart-splitter-bar-size));
        left: 50%;
      }
    }
  }

  .smart-splitter-near-collapse-button,
  .smart-splitter-far-collapse-button {
    //width: 100%;
    height: 20px;
    position: relative;
    font-family: var(--smart-font-family-icon);
    cursor: pointer;
    visibility: hidden;
    width: 0;

    .smart-arrow {
      position: absolute;
      top: 50%;
      left: 50%;
      width: auto;
      height: auto;

      &:after {
        content: var(--smart-icon-arrow-down);
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        width: 100%;
        height: 100%;
        top: 0;
        line-height: normal;
      }
    }
  }

  .smart-splitter-far-collapse-button {
    >span {
      transform: translate(-50%, -50%) rotate(270deg);
    }
  }

  .smart-splitter-near-collapse-button {
    .smart-arrow {
      transform: translate(-55%, -50%) rotate(90deg);
    }
  }

  &:not([readonly]) {
    >.smart-container {
      >smart-splitter-bar {
        &[hover] {
          cursor: w-resize;
        }
      }
    }
  }

  &:not([dragged]) {
    >.smart-container {
      >smart-splitter-bar:not([focus]) {

        .smart-splitter-near-collapse-button,
        .smart-splitter-far-collapse-button {
          color: inherit;
        }
      }

      >smart-splitter-bar[hover]:not([item-collapsed]):not([focus]) {

        .smart-splitter-near-collapse-button,
        .smart-splitter-far-collapse-button {
          color: var(--smart-ui-state-color-hover);
        }
      }
    }


    smart-splitter-bar {

      &.smart-element,
      &[hover] {
        background-color: var(--smart-ui-state-hover);
        border-color: var(--smart-ui-state-border-hover);
        color: var(--smart-ui-state-color-hover);
      }

      &[hover]:not([item-collapsed]):not([focus]) {
        .smart-splitter-resize-button {

          span,
          span:after,
          span:before {
            background-color: var(--smart-ui-state-color-hover);
            border-color: var(--smart-ui-state-color-hover);
            color: var(--smart-ui-state-color-hover);
          }
        }
      }

      &[focus] {
        background-color: var(--smart-ui-state-active);
        border-color: var(--smart-ui-state-border-active);
        color: var(--smart-ui-state-color-active);
      }

      &[focus]:not([item-collapsed]) {
        .smart-splitter-resize-button {

          span,
          span:after,
          span:before {
            background-color: var(--smart-ui-state-color-active);
            border-color: var(--smart-ui-state-color-active);
            color: var(--smart-ui-state-color-active);
          }
        }
      }


      &:not([item-collapsed]):not([focus]) {

        .smart-splitter-near-collapse-button[hover],
        .smart-splitter-far-collapse-button[hover] {
          color: var(--smart-ui-state-color-hover);
        }
      }
    }
  }

  &[dragged] {
    cursor: w-resize;
    pointer-events: none;
    user-select: none;
    touch-action: none;

    &:not([animation='none']) {
      >.smart-container {
        >smart-splitter-item {
          transition: none;
        }
      }
    }
  }

  &[auto-fit-mode="overflow"] {
    >.smart-container {
      overflow: auto;
    }
  }

  &[orientation="horizontal"] {
    >.smart-container {
      flex-direction: column;

      >smart-splitter-item {
        width: 100%;
        height: var(--smart-splitter-item-size);
      }

      >smart-splitter-bar {
        width: var(--smart-splitter-bar-fit-size);
        min-height: 5px;
        height: var(--smart-splitter-bar-size);

        >.smart-container {
          flex-direction: row;
        }

        .smart-splitter-near-collapse-button,
        .smart-splitter-far-collapse-button {
          width: 0;
          height: 100%;
        }

        .smart-splitter-far-collapse-button {
          >span {
            transform: translate(-50%, -45%) rotate(0deg);
          }
        }

        .smart-splitter-near-collapse-button {
          >span {
            transform: translate(-50%, -50%) rotate(180deg);
          }
        }

        .smart-splitter-resize-button {
          //width: 40px;
          width: 20px;
          height: 100%;

          >span {
            &:before {
              left: calc(50% - var(--smart-splitter-bar-size));
              top: 50%;
            }

            &:after {
              top: 50%;
              left: calc(50% + var(--smart-splitter-bar-size));
            }
          }
        }

        &[item-collapsed] {
          .smart-splitter-far-collapse-button {
            >span {
              transform: translate(-50%, -50%) rotate(180deg);
            }
          }

          .smart-splitter-near-collapse-button {
            >span {
              transform: translate(-50%, -50%) rotate(0deg);
            }
          }
        }

        &[show-near-button] .smart-splitter-near-collapse-button,
        &[show-far-button] .smart-splitter-far-collapse-button {
          width: 20px;
          height: 100%;
        }
      }

      >.smart-splitter-bar-feedback {
        width: 100%;
        min-height: 5px;
        height: var(--smart-splitter-bar-size);
      }
    }

    smart-splitter-item {
      &[collapsed] {
        min-width: 0;
        min-height: 0;
      }
    }

    &:not([resize-mode="none"]):not([readonly]) {
      >.smart-container {
        >smart-splitter-bar[hover]:not([locked]) {
          cursor: s-resize;
        }
      }
    }

    &[dragged] {
      cursor: s-resize;
    }
  }

  &[resize-mode="none"] {
    >.smart-container {
      >smart-splitter-bar {
        cursor: default;
      }
    }
  }

  &[disabled] {
    >.smart-container {
      >smart-splitter-bar {
        cursor: default;
        outline: none;
        border: none;
        box-shadow: none;
      }
    }
  }

  &[orientation][disabled] {
    >.smart-container {
      >smart-splitter-bar {
        cursor: default;
      }
    }
  }

  &[dragging-not-allowed] {
    >.smart-container {

      >smart-splitter-bar,
      >.smart-splitter-bar-feedback {
        cursor: default;
      }
    }
  }

  &:not([animation='none']) {

    .smart-splitter-near-collapse-button,
    .smart-splitter-far-collapse-button {
      .smart-arrow {
        transition: transform 0.2s ease-out;
      }
    }

    >.smart-container {
      >smart-splitter-item {
        &.animate {
          transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
        }
      }
    }
  }

  &[orientation-change] {
    &:not([animation='none']) {
      >.smart-container {
        >smart-splitter-item {
          transition: none;
        }
      }
    }
  }

  &[show-locked-items] {
    >.smart-container {
      >smart-splitter-item {
        &[locked] {
          >.smart-container {
            &:after {
              position: absolute;
              content: var(--smart-icon-lock);
              font-family: var(--smart-font-family-icon);
              opacity: 0.25;
              font-size: calc(2.5 * var(--smart-splitter-font-size));
              top: 50%;
              left: 50%;
              transform: translate(-50%, -50%);
            }
          }
        }
      }
    }
  }
}

@import 'rtl/_splitter';