/*
  Resizable Container with 3 divisions
  ------------------------------------------------------------------------------
*/

$threesizer-handle: 30px;

.threesizer {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;

  &.dragging .threesizer--division {
    @include no-user-select();
    pointer-events: none;
  }

  &.vertical {
    flex-direction: row;
  }

  &.horizontal {
    flex-direction: column;
  }
}

.threesizer--division {
  overflow: hidden;
  display: flex;
  align-items: stretch;

  transition: height 0.25s ease-in-out, width 0.25s ease-in-out;

  &.dragging {
    transition: none;
  }

  &.vertical {
    flex-direction: row;
  }

  &.horizontal {
    flex-direction: column;
  }
}

/* Draggable Handle With Title */
.threesizer--handle {
  @include no-user-select();
  background-color: $g4-onyx;
  transition: background-color 0.25s ease, color 0.25s ease;

  &.vertical {
    border-right: solid 2px $g3-castle;

    &:hover,
    &.dragging {
      cursor: col-resize;
    }
  }

  &.horizontal {
    border-bottom: solid 2px $g3-castle;

    &:hover,
    &.dragging {
      cursor: row-resize;
    }
  }

  &:hover {
    &.disabled {
      cursor: pointer;
    }

    color: $g16-pearl;
    background-color: $g5-pepper;
  }

  &.dragging {
    color: $c-laser;
    background-color: $g5-pepper;
  }
}

.threesizer--title {
  padding-left: 14px;
  position: relative;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  color: $g11-sidewalk;
  z-index: 1;
  transition: transform 0.25s ease;

  &.vertical {
    transform: translate(28px, 14px);

    &.threesizer--collapsed {
      transform: translate(0, 3px) rotate(90deg);
    }
  }
}

$threesizer-shadow-size: 9px;
$threesizer-z-index: 2;
$threesizer-shadow-start: fade-out($g0-obsidian, 0.82);
$threesizer-shadow-stop: fade-out($g0-obsidian, 1);

.threesizer--contents {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  position: relative;

  &.horizontal {
    flex-direction: row;
  }

  &.vertical {
    flex-direction: column;
  }

  // Bottom Shadow
  &.horizontal:after,
  &.vertical:after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: $threesizer-z-index;
  }

  &.horizontal:after {
    width: 100%;
    height: $threesizer-shadow-size;
    @include gradient-v($threesizer-shadow-stop, $threesizer-shadow-start);
  }

  &.vertical:after {
    height: 100%;
    width: $threesizer-shadow-size;
    @include gradient-h($threesizer-shadow-stop, $threesizer-shadow-start);
  }
}

// Hide bottom shadow on last division
.threesizer--contents.no-shadows:before,
.threesizer--contents.no-shadows:after,
.threesizer--division:last-child .threesizer--contents:after {
  content: none;
  display: none;
}

// Header
.threesizer--header {
  background-color: $g2-kevlar;
  
  .horizontal > & {
    width: 50px;
    border-right: 2px solid $g4-onyx;
  }

  .vertical > & {
    height: 50px;
    border-bottom: 2px solid $g4-onyx;
  }
}

.threesizer--body {
  .horizontal > &:only-child {
    width: 100%;
  }

  .vertical > &:only-child {
    height: 100%;
  }
  
  .threesizer--header + & {
    flex: 1 0 0;
  }
}
