/*
 * Copyright (C) 2017-2019 Dremio Corporation
 *
 * 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 "../../styles/constants/index.scss";

$gutter-half: map-get(
  $map: $gutter-sizes,
  $key: half,
);
$gutter: map-get(
  $map: $gutter-sizes,
  $key: full,
);
$gutter-quadruple: map-get(
  $map: $gutter-sizes,
  $key: quadruple,
);

.disable-back-scroll {
  overscroll-behavior-x: none;
}

.textAreaRoot {
  padding: $gutter-half 0px;
  &__container {
    font-size: 14px;
    line-height: 20px;
    display: flex;
    align-items: flex-end;
    position: relative;

    &:hover > .textAreaRoot__icon {
      visibility: visible;
    }

    &:hover > textarea::-webkit-scrollbar-thumb {
      visibility: visible;
    }

    textarea {
      display: inline-flex;
      border: solid 1px var(--border--neutral--solid);
      border-radius: 4px;
      font-size: inherit;
      font-family: inherit;
      font-weight: inherit;
      line-height: inherit;
      padding: $gutter $gutter-quadruple $gutter $gutter;
      resize: vertical;
      width: 100%;
      background-color: var(--fill--primary);
      &:hover {
        border: 1px solid var(--border--hover);
      }

      &:focus {
        border: 1px solid var(--border--focused);
        outline: none;
      }

      &[disabled] {
        background-color: var(--fill--disabled);
        color: var(--text--disabled);
        border: 1px solid var(--border--neutral--solid);
      }

      &.--error {
        border-color: var(--fill--danger--solid) !important;
      }

      &.--noResize {
        resize: none;
      }

      &.--singleLine {
        white-space: nowrap;
        padding-bottom: 22px;
        overflow-x: auto !important;
      }

      &::-webkit-scrollbar {
        width: 12px;
        background-color: transparent;
        &-thumb {
          visibility: hidden;
          min-height: 30px;
          min-width: 10px;
          border-radius: 10px;
          -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
          background-color: #9e9e9e;
        }
      }
    }

    .textAreaRoot__icon {
      display: block;
      position: absolute;
      line-height: 0;
      right: 12px;
      bottom: 6px;
      visibility: hidden;
      &:hover {
        svg {
          path {
            fill: var(--icon--hover);
          }
        }
      }
    }
  }

  &__icon {
    cursor: pointer;
  }

  &__labelContainer {
    display: flex;
    align-items: center;
  }

  &__label {
    flex-grow: 4;
  }
}
