@import '~@/themes/scss/mixin.scss';
@import '~bootstrap/scss/bootstrap-grid';

body {
  overflow-x: auto;
}

.column-area {
  max-width: 25%;
  width: 25%;
  background-color: var(--secondary);
  height: 100vh;
  padding-right: 20px;
  @include media-breakpoint-down(lg) {
    padding-right: 10px;
    max-width: 25%;
    width: 25%;
  }
}

.main-area {
  max-width: 45vw;
  min-width: 55%;
  min-height: 100vh;
  max-height: 100vh;
  @include media-breakpoint-down(lg) {
    max-width: 44vw;
    width: 44vw;
  }
}

.top-selectbar {
  height: 76px;

  .dropdown {
    float: right;
    margin-top: 24px;
    //margin: 30px 0;
    background-color: var(--secondary);
    border-radius: 4px;
    color: var(--text-color);
    width: 108px;
    border: solid 1px rgba(#9799ab, 0.5);

    button {
      padding: 0 4px !important;

      div {
        height: 24px !important;
        margin-left: 6px !important;

        span {
          height: 24px !important;
        }
      }

      span {
        padding-right: 4px !important;
        @include regular-text;
        font-size: 14px;
        font-weight: normal;
        font-stretch: normal;
        font-style: normal;
        letter-spacing: 0.2px;
      }
    }

    .select-popover {
      margin: 8px auto !important;
      box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.16), 0 4px 4px 0 rgba(0, 0, 0, 0.16);

      li {
        div {
          padding: 0;

          span {
            padding: 0;
          }
        }

        span {
          margin-right: 8px;
        }
      }
    }
  }
}

option {
  margin: 40px;
  background: var(--primary);
  color: var(--text-color);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: 4px;
}

.context > div {
  padding: 8px;
}

.context {
  padding: 8px 0;
  color: var(--text-color);
  text-align: left;
  font-size: 14px;
  @include regular-text();

  .context-menu-group {
    padding: 8px 0 0 0;
    letter-spacing: 0.2px;
    @include bold-text();
  }

  li {
    a {
      @include regular-text();
      margin-right: 20px;
      color: var(--text-color);
      text-decoration: none;
    }

    span {
      color: var(--accent);
      right: 8px;
      position: absolute;
      text-align: left;
    }
  }

  .active {
    cursor: pointer;

    a {
      color: var(--secondary-text-color);
      font-weight: 400;
    }
  }

  .active:hover {
    a {
      color: var(--text-color);
    }

    background-color: var(--active-color, #393d4e);
  }
}

.select-column-area.drag-over {
  border: 1px solid rgba(#57f, 0.5);
}

.select-column-area {
  border: 1px solid rgba(#5577ff, 0);
  width: 100%;
  height: 50vh;
  background-color: var(--primary);
  border-radius: 4px;
  padding: 0;

  p {
    padding: 15px 15px 0px 15px;
    color: var(--text-color);
    font-weight: bold;
    margin: 0;
    text-align: left;
    @include semi-bold-text();
  }

  .blank-content {
    color: var(--neutral);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    img,
    label {
      display: block;
      margin: auto;
      text-align: center;
    }

    label {
      @include regular-text();
      font-size: 14px;
      opacity: 0.5;
      letter-spacing: 0.2px;
    }
  }

  .select-column-drop {
    //height: calc(50vh - 62px);
    height: 42vh;
    padding: 10px 0 0 0;
    box-sizing: content-box;

    .column-content {
      width: 100%;
      height: 100%;
      overflow: auto;
      @include regular-text();

      .items {
        padding: 16px 0 16px 10px;
        display: flex;

        .item-contents {
          width: 100%;
          display: flex;
          flex-wrap: wrap;
          padding: 0 auto;
          margin: 0 auto;
          text-align: left;

          .select-function {
            text-decoration: underline;
            //margin: 0 0.5em 0.3em 0;
            padding: 0 4px;
          }

          .display-name {
            line-height: 18px;
            font-size: 14px;
            margin: 0 0 0.3em 0;
            cursor: unset;
          }
        }
      }

      label,
      a {
        color: var(--text-color);
        font-size: 14px;
        letter-spacing: 0.2px;
      }

      img {
        width: 20px;
        height: 20px;
        padding: 4px;
        margin-right: 8px;
      }

      .more-icon {
        font-size: 14px;
        cursor: pointer;
        float: right;
      }

      .menu-options {
        width: 80px;
        position: absolute;
        right: 50px;
        background-color: var(--primary);
        padding: 5px 15px;
        color: var(--text-color);
        font-size: 14px;
        letter-spacing: 0.2px;
        border-radius: 5px;
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);

        .menu-item div {
          line-height: 2.5;
        }
      }
    }
  }
}

.filter-area.drag-over {
  border: solid 1px rgba(#5577ff, 0.5);
}

.filter-area {
  border: solid 1px rgba(#5577ff, 0);
  width: 100%;
  height: calc(50vh - 116px);
  background-color: var(--primary);
  border-radius: 4px;
  padding: 15px 15px 0 15px;
  margin: 20px 0;
  text-align: left;
  @include regular-text();

  @include media-breakpoint-down(lg) {
    margin: 10px 0;
    height: calc(50vh - 106px);
  }

  .drop-or {
    height: calc(100% - 35px);
  }

  .blank-content {
    color: var(--neutral);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;

    img,
    label {
      display: block;
      margin: auto;
      text-align: center;
    }

    label {
      @include regular-text();
      font-size: 14px;
      opacity: 0.5;
      letter-spacing: 0.2px;
    }

    img {
      width: 40px;
    }
  }

  p {
    color: var(--text-color);
    font-weight: bold;
  }

  .filter-group:last-child .gap-or {
    display: none;
  }

  .filter-content {
    width: 100%;
    height: 100%;
    padding-bottom: 20px;
    overflow: auto;

    .gap-or {
      margin-right: 20px;
      text-align: center;
      color: var(--secondary-text-color);
      font-size: 14px;
    }

    .items {
      padding: 8px 0;
      margin: 8px 0;

      background-color: var(--secondary);
      border-radius: 4px;
      position: relative;
      border: 1px solid #333646;

      .item {
        padding: 8px;

        &:not(:first-child) {
          margin-top: 8px;
        }

        .more-icon {
          font-size: 14px;
          float: right;
          cursor: pointer;
          //padding: 4px;
          height: 20px;
          width: 20px;
        }

        label {
          margin-bottom: 0px;
        }
      }

      .drop-and-label {
        display: none;
        background-color: var(--accent);
        color: var(--accent-text-color);
        border-radius: 0 4px;
        padding: 6px 8px;
        font-size: 14px;
        font-weight: lighter;
        position: absolute;
        right: 0;
        top: 0;
      }

      .item-name {
        margin-right: 0.5em;
      }
    }

    .over-and {
      border-color: var(--accent);

      .drop-and-label {
        display: block;
      }
    }

    label,
    a {
      color: var(--text-color);
      font-size: 14px;
      letter-spacing: 0.2px;
    }

    .menu-options {
      width: 80px;
      position: absolute;
      right: 50px;
      background-color: var(--primary);
      padding: 5px 15px;
      color: var(--text-color);
      font-size: 14px;
      letter-spacing: 0.2px;
      border-radius: 5px;
      box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);

      .menu-item div {
        line-height: 2.5;
      }
    }

    .item-name {
      font-weight: bold;
    }
  }
}

.right-area {
  display: flex;
}

.medium-area .card {
  height: 100vh;
}

.medium-area {
  @include media-breakpoint-down(lg) {
    padding-right: 5px;
    padding-left: 5px;
  }
}

.preview-area {
  height: 76px;
  margin: 0;
  background: var(--secondary);
}

.table-setting-icon {
  margin-top: 8px;
  margin-right: 8px;
  padding: 4px;
}

.description {
  width: 100%;
  padding-left: 20px;
  font-weight: normal;
  font-size: 14px;

  img {
    width: 16px;
    margin-left: 10px;
  }
}

.card {
  background: var(--primary);
  border: 0;
  position: relative;
  width: 100%;

  label {
    color: rgba($white, 0.6);
  }

  .card-title {
    @include regular-text();
    font-size: 24px;
    line-height: 1.5;
    letter-spacing: 0.2px;
  }

  .card-body {
    margin-top: 16px;
    padding: 0px;
    display: flex;
    flex-direction: column;
    height: 100%;

    @include media-breakpoint-down(lg) {
      margin-top: 5px;
    }

    &.table-full-width {
      padding-left: 0;
      padding-right: 0;
    }

    .card-title {
      color: $white;
      text-transform: inherit;
      font-weight: $font-weight-light;
      margin-bottom: 0.75rem;
    }

    .card-description,
    .card-category {
      color: rgba($white, 0.6);
    }
  }

  .card-header {
    padding: 0;

    &:not([data-background-color]) {
      background-color: transparent;
    }

    border: 0;
    color: rgba($white, 0.8);

    .card-title {
      color: $white;
      font-weight: 300;
    }

    .card-category {
      color: $dark-gray;
      margin-bottom: 5px;
      font-weight: 300;
    }
  }

  .map {
    border-radius: $border-radius-sm;

    &.map-big {
      height: 420px;
    }
  }

  &.card-white {
    background: $white;

    .card-title {
      color: $black;
    }

    .card-category,
    .stats {
      color: $card-stats-gray;
    }

    //style for inputs
    @include form-control-placeholder(rgba($black, 0.4), 1);

    .has-danger {
      .form-control,
      .input-group-prepend .input-group-text {
        border-color: $danger-states;
      }
    }

    .input-group-prepend .input-group-text {
      border-color: rgba($black-states, 0.2);
      color: $black-states;
    }

    .form-control {
      color: $black;
      border-color: rgba($black-states, 0.2);

      &:focus {
        border-color: $primary;
      }
    }

    label:not(.btn) {
      color: $default;
    }

    .form-group.no-border,
    .input-group.no-border {
      .form-control,
      .form-control + .input-group-prepend .input-group-text,
      .form-control + .input-group-append .input-group-text,
      .input-group-prepend .input-group-text,
      .input-group-append .input-group-text {
        background-color: $opacity-gray-3;

        &:focus,
        &:active,
        &:active {
          background-color: $opacity-gray-5;
        }
      }

      .form-control {
        &:focus {
          & + .input-group-prepend .input-group-text,
          & + .input-group-append .input-group-text {
            background-color: $transparent-bg;
          }
        }
      }
    }

    .input-group[disabled] {
      .input-group-prepend .input-group-text,
      .input-group-append .input-group-text {
        background-color: $black;
      }
    }

    .form-control[disabled],
    .form-control[readonly],
    fieldset[disabled] .form-control {
      background: $light-gray;
      border-color: rgba($black-states, 0.3);
    }

    .input-group-focus {
      .input-group-prepend .input-group-text,
      .input-group-append .input-group-text,
      .form-control {
        background-color: $white;
        border-color: $primary;
      }

      &.no-border {
        .input-group-prepend .input-group-text,
        .input-group-append .input-group-text {
          background-color: $opacity-gray-5;
        }
      }
    }

    .input-group-prepend .input-group-text {
      border-right: none;
    }

    .input-group-append .input-group-text {
      border-left: none;
    }

    .has-danger .form-control:focus,
    .has-success.input-group-focus .input-group-append .input-group-text,
    .has-success.input-group-focus .input-group-prepend .input-group-text {
      border-color: $danger-states;
    }

    .has-success .form-control:focus,
    .has-success.input-group-focus .input-group-append .input-group-text,
    .has-success.input-group-focus .input-group-prepend .input-group-text {
      border-color: darken($success, 10%);
    }
  }

  &.card-plain {
    background: transparent;
    box-shadow: none;
  }

  .image {
    overflow: hidden;
    height: 200px;
    position: relative;
  }

  .avatar {
    width: 30px;
    height: 30px;
    overflow: hidden;
    border-radius: 50%;
    margin-bottom: 15px;
  }

  label {
    font-size: $font-size-sm;
    margin-bottom: 5px;
  }

  .database-middle-area {
    float: right;

    label {
      margin: 0 0 0 16px;
      color: var(--text-color);
      @include regular-text();
      font-size: 14px;
      letter-spacing: 0.2px;
      padding: 8px;
      width: 128px;
    }
  }

  .card-footer {
    background-color: transparent;
    border: 0;
    padding: 15px;

    .stats {
      i {
        margin-right: 5px;
        position: relative;
      }
    }

    h6 {
      margin-bottom: 0;
      padding: 7px 0;
    }
  }
}

.card-body {
  padding: $card-spacer-y;
  height: calc(100vh - 157px);
}

@include media-breakpoint-down(sm) {
  .card.card-chart .card-header {
    .btn-group-toggle .tim-icons {
      font-size: 0.875rem;
      top: -1px;
    }
  }
}

select {
  /* Change the px value here to change the distance */
  background: url('~@/assets/icon/ic_down.svg') no-repeat right 16px top 50%;
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  padding: 4px 20px;
}

.top-selectbar > swm-select {
  background-position: right 8px top 50%;
  /* Change the px value here to change the distance */
}

.drag-image {
  display: flex;
  width: 200px;
  border: solid 1px rgba(#5577ff, 0.6);
  background-color: var(--secondary);
  padding: 3px 16px;
  gap: 4px;
  align-items: center;

  span {
    white-space: nowrap;
    align-self: center;
    min-width: 70px;
  }

  svg {
    flex-shrink: 0;
  }

  .drag-move {
    width: 18px;
    height: 18px;
    margin: auto 4px auto 0;
    background-image: url('~@/assets/icon/move.svg');
    background-repeat: no-repeat;
    background-size: contain;
    align-self: center;
    flex-shrink: 0;
  }
}

#listbox-item-0 > div {
  text-align: left;
}

#listbox-item-0 {
  padding: 8px;
}

.no-bottom-border {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.setting-area {
  //background-color: var(--secondary);
  padding-bottom: 10px;
  padding-top: 10px;
  width: 100% !important;

  .title-setting-area {
    @include bold-text();
    font-size: 12px;
  }

  .main-setting-area {
    padding: 15px;
    width: 100% !important;
  }
}

.example-area {
  height: 33vh;
  //
  @include media-breakpoint-down(lg) {
    height: 30.5vh;
  }
}

.display-error {
  padding-bottom: 10px;
}

.error {
  @include regular-text();
  font-size: 14px;
  color: var(--danger);
  margin-top: 5px;
}

.scroll-area {
  overflow-x: hidden;
  overflow-y: auto;
  height: 100% !important;
}

// .toggle-setting {
//   padding: 12px 16px;

//   .toggle-title {
//     @include regular-text();
//   }
// }

// .input-setting {
//   padding: 6px 16px;

//   .input-title {
//     @include regular-text();
//   }

//   .input-setting-form {
//     max-lines: 1;
//   }
// }

.input-title {
  @include regular-text();
  font-size: 12px;
  letter-spacing: 0.2px;
  text-align: left;
}

.toggle-title {
  @include regular-text();
  font-size: 12px;
  letter-spacing: 0.2px;
  text-align: left;
}

.panel-area {
  height: 28vh;
  border-radius: 4px;
  //background-color: var(--secondary);
  padding-left: 1px;
  padding-right: 1px;
  cursor: default;

  // fixme: check css
  //.status-loading {
  //  height: 30vh !important;
  //}

  @include media-breakpoint-down(lg) {
    height: 18vh;
  }

  .secondary-chart-background-color {
    background-color: transparent !important;
  }
}

.chart-preview,
.table-preview {
  height: 100%;

  @include media-breakpoint-down(lg) {
    height: 45vh;
  }
}

.setting-control-panel {
  padding: 5px;
}

.excel-setting-title {
  @include semi-bold-text();
  margin-top: 8px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.2px;
}

.form-control:disabled {
  background-color: var(--input-background-color);
  opacity: 0.6;
}

.visualize-panel {
  margin-top: 16px;
  order: 1;
  //flex-grow: 2;
  //overflow: hidden;
  flex: 0 2 50vh;

  @include media-breakpoint-down(lg) {
    margin-top: 5px;
  }
}
