@import '../../style/index.scss';

$picker-panel: 'cp-ui-picker-panel';
$picker-column: 'cp-ui-picker-column';
$picker: 'cp-ui-picker';

.#{$picker} {
  .picker-modal-mask {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 1;
    display: none;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
  }

  .picker-modal {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 2;
    width: 100%;
    background-color: #efeff4;
    transform: translate(0, 100%);
    backface-visibility: hidden;
    transition: transform 0.3s;

    &.picker-modal-toggle {
      transform: translate(0, 0);
    }

    header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 40px;
      padding: 0 15px;
      background-color: #fbf9fe;

      .title {
        flex: 1 1;
        color: #888;
      }

      a {
        text-decoration: none;
        color: $color-brand-normal;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
      }

      .#{$picker}-header-left {
        color: #9e9e9e;
      }
    }
  }
}

.#{$picker-panel} {
  &.#{$picker-panel}-container {
    z-index: 99;
    width: 100%;

    &,
    *,
    *::before,
    *::after {
      box-sizing: border-box;
      touch-action: none;
    }

    .#{$picker-column} {
      flex: 1 1;
      position: relative;
      max-height: 100%;
      overflow: hidden;
      text-align: center;

      &-scroller {
        transition: 300ms;
        transition-timing-function: ease-out;
      }

      &-item {
        position: relative;
        padding: 0 10px;
        white-space: nowrap;
        color: #999;
        overflow: hidden;
        text-overflow: ellipsis;

        &-selected {
          color: #222;
        }
      }
    }
  }

  &-inner {
    position: relative;
    display: flex;
    justify-content: center;
    height: 100%;
    padding: 0 20px;
    font-size: 1.2em;
    -webkit-mask-box-image:
      linear-gradient(
        to top,
        transparent,
        transparent 5%,
        white 20%,
        white 80%,
        transparent 95%,
        transparent
      );
  }

  &-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    pointer-events: none;

    &::before,
    &::after {
      content: ' ';
      position: absolute;
      left: 0;
      right: auto;
      display: block;
      width: 100%;
      height: 1px;
      background-color: #d9d9d9;
      transform: scaleY(0.5);
    }

    &::before {
      top: 0;
      bottom: auto;
    }

    &::after {
      bottom: 0;
      top: auto;
    }
  }
}
