﻿@include export-module('listbox-layout') {
  // sass-lint:disable no-vendor-prefixes
  .e-listbox-wrapper,
  .e-listbox-container {
    -webkit-overflow-scrolling: touch;
    cursor: pointer;
    display: block;
    position: relative;
    user-select: none;
    width: 100%;

    * {
      box-sizing: border-box;
    }

    &:focus {
      outline: none;
    }

    &.e-disabled {
      cursor: default;
      pointer-events: none;
    }

    &:not(.e-list-template) .e-list-item,
    .e-list-nrt,
    .e-selectall-parent {
      height: $listview-item-height;
      line-height: $listview-item-line-height;
      padding: $listview-item-padding;
      position: relative;
    }

    &.e-filter-list {
      overflow: inherit;

      & .e-list-parent {
        overflow: auto;
      }
    }

    .e-list-parent {
      height: 100%;
      min-height: $listview-item-height;
    }

    & .e-list-item {
      border-bottom: $listview-border-size solid;
      outline: none;

      &.e-disabled {
        pointer-events: none;
      }
    }

    .e-disable {
      opacity: .7;
    }

    & .e-list-parent {
      margin: 0;
      padding: 0;
    }

    & .e-list-header .e-text.header {
      display: none;
    }

    & .e-icon-back {
      margin-top: $listview-icon-back-margin;
    }

    & .e-list-header .e-headertemplate-text.nested-header {
      display: none;
    }

    & .e-list-header {
      align-items: center;
      border-bottom: 1px solid;
      display: flex;
      font-weight: $listview-header-font-weight;
      height: $listview-header-height;
      padding: 0 $listview-header-text-padding;
    }

    & .e-has-header > .e-view {
      top: 45px;
    }

    & .e-but-back {
      cursor: pointer;
      padding-right: $listview-back-padding-right;
    }

    & .e-list-group-item:first-child {
      border: 0;
      border-bottom: $listview-group-first-border-bottom solid $listview-border-bottom-color;
    }

    & .e-list-group-item {
      border-bottom: $listview-group-border-bottom solid $listview-border-bottom-color;
      border-top: $listview-group-border-top solid;
      font-weight: 600;
      height: $listview-groupheader-item-height;
      line-height: $listview-groupheader-item-line-height;
      padding: $listview-item-padding;
    }

    & .e-icon-collapsible {
      cursor: pointer;
      font-size: 12px;
      position: absolute;
      right: 0%;
      top: 50%;
      transform: translateY(-50%);
    }

    & .e-text-content {
      height: 100%;
      position: relative;
      vertical-align: middle;
    }

    & .e-text-content * {
      display: inline-block;
      vertical-align: middle;
    }

    & .e-text-content.e-checkbox .e-list-text {
      width: calc(100% - 40px);
    }

    & .e-text-content.e-checkbox.e-checkbox-left .e-list-icon + .e-list-text {
      width: calc(100% - 90px);
    }

    & .e-text-content.e-checkbox.e-checkbox-right .e-list-icon + .e-list-text {
      width: calc(100% - 80px);
    }

    & .e-list-item.e-checklist.e-has-child {
      .e-text-content.e-checkbox.e-checkbox-right {
        .e-list-icon + .e-list-text {
          width: calc(100% - 92px);
        }
      }
    }

    & .e-checkbox .e-checkbox-left {
      margin: $listview-checkbox-left-margin;
    }

    & .e-checkbox .e-checkbox-right {
      margin: $listview-checkbox-right-margin;
    }

    & .e-list-text {
      cursor: pointer;
      display: inline-block;
      overflow: hidden;
      text-overflow: ellipsis;
      vertical-align: top;
      white-space: nowrap;
      width: 100%;
    }

    & .e-list-icon + .e-list-text {
      width: calc(100% - 60px);
    }

    & .e-icon-wrapper .e-list-text {
      width: calc(100% - 60px);
    }

    & .e-icon-wrapper.e-text-content.e-checkbox .e-list-text {
      width: calc(100% - 60px);
    }

    & .e-list-icon {
      height: 30px;
      margin-right: $listview-icon-margin-right;
      width: 30px;
    }

    & .e-content {
      overflow: hidden;
      position: relative;
    }

    & .e-list-header .e-text {
      cursor: pointer;
      text-indent: 0;
    }

    & .e-text .e-headertext {
      display: inline-block;
      line-height: $listview-header-line-height;
    }

    &.e-rtl {
      direction: rtl;

      & .e-list-icon {
        margin-left: 16px;
        margin-right: 0;
      }

      & .e-icon-collapsible {
        left: 0%;
        right: initial;
        top: 50%;
        transform: translateY(-50%) rotate(180deg);
      }

      & .e-list-header .e-text {
        cursor: pointer;
      }

      & .e-but-back {
        transform: rotate(180deg);
      }

      & .e-icon-back {
        margin-top: $listview-rtl-icon-back-margin;
      }

      & .e-checkbox .e-checkbox-left {
        margin: $listview-rtl-checkbox-left-margin;
      }

      & .e-checkbox .e-checkbox-right {
        margin: $listview-rtl-checkbox-right-margin;
      }

      .e-checkbox-wrapper {
        margin: $listview-rtl-checkbox-left-margin;
      }
    }

    .e-checkbox-wrapper {
      margin: $listview-checkbox-left-margin;
      text-indent: 0;
      vertical-align: middle;
    }

    &.e-right {
      .e-checkbox-wrapper {
        position: absolute;
        right: 0;
        top: 30%;
      }
    }

    .e-input-group {
      padding: 4px 8px;
    }

    .e-input-focus {
      padding: 4px 4px 4px 8px;
    }

    .e-hidden-select {
      height: 1px;
      opacity: 0;
      position: absolute;
      width: 100%;
    }

    .e-placeholder {
      background-color: $badge-bgcolor;
      display: block;
      height: 1px;
    }
  }

  ejs-listbox {
    display: block;
  }

  .e-listbox-wrapper:not(.e-listbox-container) {
    overflow: auto;
  }

  .e-listbox-wrapper.e-sortableclone,
  .e-listbox-container.e-sortableclone {
    border-width: 0;
    overflow: visible;

    .e-list-item {
      list-style-type: none;
    }

    .e-ripple {
      overflow: visible;

      .e-ripple-element {
        display: none;
      }
    }

    .e-list-badge {
      align-items: center;
      background-color: $badge-bgcolor;
      border: 1px solid $badge-color;
      border-radius: 50%;
      color: $badge-color;
      display: flex;
      font-size: 12px;
      height: 22px;
      justify-content: center;
      position: absolute;
      right: -10px;
      top: -10px;
      width: 22px;
    }
  }

  .e-listboxtool-wrapper,
  .e-listboxtool-container {
    cursor: pointer;
    display: flex;

    * {
      box-sizing: border-box;
    }

    &.e-disabled {
      cursor: default;
      pointer-events: none;
    }

    .e-listbox-wrapper {
      flex: 1;
    }

    &.e-right {
      .e-listbox-tool {
        margin-left: 15px;
      }
    }

    &.e-left {
      .e-listbox-tool {
        margin-right: 15px;
      }
    }

    .e-listbox-tool {
      border: 1px solid $listbox-border-color;
      overflow: auto;
      padding: 8px;

      .e-btn {
        display: list-item;
        list-style-type: none;
        margin-bottom: 10px;
      }
    }
  }

  .e-rtl.e-listboxtool-wrapper,
  .e-rtl.e-listboxtool-container {
    &.e-right {
      .e-listbox-tool {
        margin-right: 15px;
      }
    }

    &.e-left {
      .e-listbox-tool {
        margin-left: 15px;
      }
    }
  }

  .e-bigger .e-listbox-wrapper,
  .e-listbox-wrapper.e-bigger,
  .e-bigger .e-listbox-container,
  .e-listbox-container.e-bigger {
    @if ($skin-name == 'bootstrap4') {
      font-size: 16px;
    }

    .e-list-item {
      border-bottom: $listview-border-bottom solid $listview-border-bottom-color;
      border-left: $listview-border-left solid $listview-border-left-color;
      border-right: $listview-border-right solid $listview-border-right-color;
      border-top: $listview-border-top solid $listview-border-top-color;
    }

    &:not(.e-list-template) .e-list-item,
    .e-selectall-parent {
      height: $listview-touch-item-height;
      line-height: $listview-touch-item-line-height;
      position: relative;
      @if ($skin-name == 'bootstrap4') {
        padding: 12px 20px;
      }
    }

    .e-list-parent {
      min-height: $listview-touch-item-height;
    }

    .e-text-content {
      font-size: $listview-touch-item-font-size;
    }

    .e-list-group-item {
      height: $listview-touch-groupheader-height;
      line-height: $listview-touch-groupheader-line-height;
      @if ($skin-name == 'bootstrap4') {
        font-size: 16px;
        padding: 12px 20px;
      }
    }

    .e-list-header {
      align-items: center;
      display: flex;
      font-weight: $listview-touch-header-font-weight;
      height: $listview-touch-header-height;
      @if ($skin-name == 'bootstrap4') {
        font-size: 20px;
        line-height: 1.2;
        padding: 0 0 0 20px;
      }
    }

    .e-list-header .e-text.header {
      display: none;
    }

    .e-list-header .e-headertemplate-text.nested-header {
      display: none;
    }

    .e-list-header .e-text {
      font-size: $listview-touch-header-font-size;
    }

    .e-but-back {
      @if ($skin-name == 'bootstrap4') {
        margin-top: -3px;
        padding-right: 12px;
      }
    }

    .e-list-icon {
      @if ($skin-name == 'bootstrap4') {
        margin-right: 12px;
      }
    }

    .e-icon-collapsible {
      @if ($skin-name == 'bootstrap4') {
        font-size: 12px;
      }
    }

    .e-checkbox-wrapper {
      @if ($skin-name == 'bootstrap4') {
        margin: 0 12px 0 0;
      }
    }

    &.e-rtl {
      .e-checkbox-wrapper {
        @if ($skin-name == 'bootstrap4') {
          margin: 0 0 0 12px;
        }
      }
    }
  }
}
