/*
 * Copyright (c) 2019 dunnhumby Germany GmbH.
 * All rights reserved.
 *
 * This source code is licensed under the MIT license found in the LICENSE file
 * in the root directory of this source tree.
 *
 */

@import "../proto/base.css";

:root {
  --inputHeight: 40px;
  --borderWidth: 1px;
}
.default {
  .container {
    display: flex;
    flex-direction: row;

    margin: 0;

    border-radius: 2px;

    & > * {
      margin: 0;
    }
  }

  .input {
    flex: 1 1 auto;
    min-width: 0;

    box-shadow: none;
  }

  .valueLabel {
    display: block;
    position: relative;

    flex: 0 0 auto;
    width: auto;

    border: var(--borderWidth) solid var(--PC-GREY--L70);

    padding: 0 var(--spacing-2);

    background: var(--PC-WHITE);

    @extend %Nessie-Regular;
    color: var(--PC-GREY--D5);
    font-size: var(--typo-1);

    line-height: calc(var(--inputHeight) - (2 * var(--borderWidth)));
    vertical-align: middle;
    white-space: nowrap;

    cursor: pointer;

    &::before,
    &::after {
      content: "";

      display: block;
      position: absolute;
      top: 11px;

      width: 1px;
      height: var(--spacing-2);

      background: var(--PC-GREY--L70);
    }

    &::before {
      left: 0;
    }

    &::after {
      right: 0;
    }
  }
}

.position__left {
  .container {
    flex-direction: row-reverse;
  }

  .input {
    padding-left: var(--spacing-2);
  }

  .valueLabel {
    margin-right: -1px;
    border-right: none;
    border-bottom-left-radius: 2px;
    border-top-left-radius: 2px;
    &::before {
      display: none;
    }
  }
}

.position__right {
  .input {
    padding-right: var(--spacing-2);
  }

  .valueLabel {
    margin-left: -3px;
    border-left: none;
    border-bottom-right-radius: 2px;
    border-top-right-radius: 2px;

    &::after {
      display: none;
    }
  }
}

.fakeHovered {
  .container {
    box-shadow: 0 0 0 2px color(var(--PC-BLUE) a(30%));
  }

  .input {
    border-color: var(--PC-BLUE);
  }

  .valueLabel {
    border-color: var(--PC-BLUE);
  }
}

.error {
  .valueLabel {
    border-color: var(--PC-RED);
    color: var(--PC-RED);

    &::before,
    &::after {
      background: var(--PC-RED);
    }
  }

  .input {
    box-shadow: none !important;
  }

  &.fakeHovered .container {
    box-shadow: 0 0 0 2px color(var(--PC-RED) a(30%));
  }
}

.disabled,
.disabled:hover {
  .valueLabel,
  .input {
    background: var(--PC-GREY--L90);
    border-color: var(--PC-GREY--L70);
    pointer-events: none;
  }
}
