/* ==========================================================================
  Component: Toolbar
  ---
  Component for aligning multiple sub components on a horizontal axis
   ========================================================================== */

/* Variables
   ========================================================================== */

$c-toolbar-item-spacing: 1.6rem !default;
$c-toolbar-main-border-color: #DDD !default;
$c-toolbar-bar-size-regular: 4.8rem;
$c-toolbar-z: 2;
$c-toolbar-middle-z: 1;
$c-toolbar-title-heading-font-weight: 600;

/* Component
   ========================================================================== */

.c-toolbar {
  width: 100%;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-around;
  height: $c-toolbar-bar-size-regular;
}

.c-toolbar--spaced {
  padding: 0 2.4rem;
}

.c-toolbar--auto {
  height: auto;
}

.c-toolbar__left {
  z-index: $c-toolbar-z; // Left and right should have higher z-index than center; if the elements overlap, there is a bigger chance we can still tap the action most likely contained on the left or right end
  justify-content: flex-start;
  .c-toolbar__item {
    margin-right: $c-toolbar-item-spacing;
    &:only-child {
      margin: 0;
    }
  }
}

.c-toolbar__right {
  z-index: $c-toolbar-z; // Left and right should have higher z-index than center; if the elements overlap, there is a bigger chance we can still tap the action most likely contained on the left or right end
  justify-content: flex-end;
  .c-toolbar__item {
    margin-left: $c-toolbar-item-spacing;
    &:only-child {
      margin: 0;
    }
  }
}

.c-toolbar__left,
.c-toolbar__right {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
}

.c-toolbar__item {
  position: relative;
}

.c-toolbar__center {
  position: absolute;
  margin-left: 50%;
  left: 0;
}

.c-toolbar__center-inner {
  margin-left: -50%;
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  .c-toolbar__item {
    margin: 0 $c-toolbar-item-spacing/2;
    &:only-child {
      margin: 0;
    }
  }
}

.c-toolbar__center--interactive {
  z-index: $c-toolbar-middle-z; // If our middle element is interactive (rare) we can specifiy this
}

// For some cases you need to set -100% to actually center the item
.c-toolbar__center-inner--alt {
  margin-left: -100%;
}

/* Specific children
   ========================================================================== */

.c-toolbar__title {
  font-weight: $c-toolbar-title-heading-font-weight;
  font-size: 1.8rem;
}

/* Justified toolbar
   ========================================================================== */

.c-toolbar__justified {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  .c-toolbar__item {
    margin-right: $c-toolbar-item-spacing;
  }
}

.c-toolbar__item--stretch {
  flex: 1;
}

.c-toolbar__justified {
  .c-toolbar__item:last-child {
    margin: 0;
  }
}