@import url(https://fonts.googleapis.com/css?family=Montserrat:400);

$focusedOutlineColor: #4c9ffe;

.root {
  display: flex;
  height: 100%;
  box-sizing: border-box;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

// Base styles
.list {
  width: 400px;
  height: 600px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #999;
}

.item {
  position: relative;
  border-bottom: 1px solid #999;

  cursor: grab;
  touch-action: manipulation;

  &.sorting {
    pointer-events: none;
  }
}

.containsDragHandle {
  cursor: default;
}

// Stylized
.stylizedList {
  position: relative;
  z-index: 0;
  background-color: #f3f3f3;
  border: 1px solid #efefef;
  border-radius: 3px;
  outline: none;
}

.stylizedItem {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  background-color: #fff;
  border-bottom: 1px solid #efefef;
  box-sizing: border-box;
  user-select: none;
  outline: none;

  color: #333;
  font-weight: 400;

  &:focus:not(.containsDragHandle) {
    text-indent: -2px;
    border: 2px solid $focusedOutlineColor;
  }
}

.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

// Drag handle
.handleWrapper {
  width: 18px;
  height: 18px;
  outline: none;
}

.handle {
  display: block;
  width: 18px;
  height: 18px;
  margin-right: 20px;
  overflow: hidden;

  > svg {
    opacity: 0.3;
  }

  cursor: grab;
}

// Horizontal list
.horizontalList {
  display: flex;
  width: 600px;
  height: 300px;
  white-space: nowrap;
}

.horizontalItem {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 200px;
  border-right: 1px solid #efefef;
  border-bottom: 0;
}

// Grid
.grid {
  display: grid;
  height: 130 * 3px + 20px;
  grid-gap: 10px;
  grid-template-columns: auto auto auto auto;
  width: auto;
  white-space: nowrap;
  border: 0;
  background-color: transparent;
}

.gridItem {
  width: 130px;
  height: 130px;
  padding: 0;
  border: none;
  background-color: transparent;

  .wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #fff;
    transform: scale(1);
    font-size: 28px;

    span {
      display: none;
    }
  }
}

.gridVariableSized {
  .gridItem {
    &[data-index='0'] {
      width: auto !important;
      height: auto !important;
      grid-column-end: span 2;
      grid-row-end: span 2;
    }

    &.sorting {
      .wrapper {
        transition: transform 150ms ease-in-out;
      }
    }
  }
}

.gridItemVariableSized {
  &[data-index='0'] {
    .wrapper {
      font-size: 56px;
    }
  }
}

// Nested
.category {
  height: auto;

  .categoryHeader {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    padding: 10px 14px;
    background: #f9f9f9;
    border-bottom: 1px solid #efefef;
    user-select: none;
  }

  .categoryList {
    height: auto;
  }
}

// Divider
.divider {
  padding: 10px 20px;
  background: #f9f9f9;
  border-bottom: 1px solid #efefef;
  text-transform: uppercase;
  font-size: 14px;
  color: #333;
}

// Helper styles
.helper {
  box-shadow: 0 5px 5px -5px rgba(0, 0, 0, 0.2),
    0 -5px 5px -5px rgba(0, 0, 0, 0.2);

  cursor: grabbing;
}

.stylizedHelper {
  &:not(.gridItem),
  &.gridItem .wrapper {
    border: 1px solid #efefef;
    box-shadow: 0 5px 5px -5px rgba(0, 0, 0, 0.2);
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 3px;

    &.horizontalItem {
      cursor: col-resize;
    }

    &:focus {
      box-shadow: 0 0px 5px 1px $focusedOutlineColor;
    }
  }

  &.gridItem .wrapper {
    transition: transform 150ms ease-in-out;
  }
}

.shrinkedHelper {
  height: 20px !important;
}

:global {
  body {
    font-family: 'Montserrat', 'Helvetica Neue', 'Helvetica', arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: rgba(#f4f5f9, 0.7);
  }
  html,
  body,
  #root {
    height: 100%;
    margin: 0;
  }
}
