@import 'adminVariables';

/*
TYPOGRAPHIES
*/
@mixin titleModule {
  font-size: $module_title;
  font-weight: bold;
  letter-spacing: 0.6px;
}

@mixin subtitleModule {
  font-size: $module_subtitle;
  font-weight: bold;
  letter-spacing: 0.3px;
}

/*
ADMIN MIXINS
*/
@mixin infoBorder {
  border-left: 1px solid $color_dark;
}

@mixin status {
  position: relative;

  &:before {
    content: '';
    @include absolute-fill;
    z-index: 0;
    background-color: rgba(255, 255, 255, 0.1);
  }

  > * {
    z-index: 1;
  }

  &.color1,
  &.info1 {
    border: 1px solid $status_color1;
    background-color: $status_color1;

    &.label {
      padding: 2px 5px;
      border-radius: 4px;
      color: $status_color1;
      background-color: rgba($color: $status_color1, $alpha: 0.2);
    }
  }

  &.color2,
  &.info2 {
    border: 1px solid $status_color2;
    background-color: $status_color2;

    &.label {
      padding: 2px 5px;
      border-radius: 4px;
      color: $status_color2;
      background-color: rgba($color: $status_color2, $alpha: 0.2);
    }
  }

  &.color3,
  &.info3 {
    border: 1px solid $status_color3;
    background-color: $status_color3;

    &.label {
      padding: 2px 5px;
      border-radius: 4px;
      color: $status_color3;
      background-color: rgba($color: $status_color3, $alpha: 0.2);
    }
  }

  &.color4,
  &.info4 {
    border: 1px solid $status_color4;
    background-color: $status_color4;

    &.label {
      padding: 2px 5px;
      border-radius: 4px;
      color: $status_color4;
      background-color: rgba($color: $status_color4, $alpha: 0.2);
    }
  }

  &.color5,
  &.info5 {
    border: 1px solid $status_color5;
    background-color: $status_color5;

    &.label {
      padding: 2px 5px;
      border-radius: 4px;
      color: $status_color5;
      background-color: rgba($color: $status_color5, $alpha: 0.2);
    }
  }
}

@mixin legend {
  display: flex;
  align-items: center;

  .title {
    font-weight: bold;
    font-size: 16px;
    margin-right: 12px;
  }

  .item {
    margin: 4px 0;
    font-size: 12px;
    font-weight: 600;
    @include middle;
    margin-right: 5px;
    @include status;
    padding: 1px 6px;
    border-radius: $border_radius;
    color: white;

    &:before {
      border-radius: $border_radius;
    }
  }
}

@mixin fixedStructure {
  position: absolute;
  left: 0;

  width: 100%;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: $default_spacing_v $default_spacing_h;

  .actions {
    text-align: right;
    display: flex;

    button {
      flex-shrink: 0;
      margin-left: 10px;
    }
  }
}

@mixin dropdownActions {
  button {
    margin-left: 0;
  }

  .actions-items {
    min-width: 120px;
    text-align: left;
  }

  .item {
    white-space: nowrap;
    font-size: 14px;
    padding: 6px 12px;

    &.separator{
      padding: 6px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.5);
      margin: 4px 7px;
    }

    &:not(.separator){
      &:hover {
        background-color: rgba($color: $color-grey, $alpha: 0.2);
        cursor: pointer;
      }
    }
    &.red {
      color: $color-red;
    }
  }
}

@mixin fixedHeader {
  @include fixedStructure;
  border-bottom: 1px solid $color_border;
  background-color: white;
  height: $height_page_header;
  top: 0;

  h1,
  .title {
    @include titleModule;
    margin: 0;
    color: $color_resource_header;
  }

  .id {
    font-size: 13px;
    font-weight: bold;
    display: inline-block;
    margin-left: 8px;
  }
  .dropdown {
    margin-left: 10px;
    @include dropdownActions;
  }
}

@mixin fixedFooter {
  height: $height_page_footer;
  @include fixedStructure;
  bottom: 0; //border-top: 1px solid $color_border;
  background-color: white;
  @include box-shadow(0, -2px);

  .left,
  .right {
    display: flex;
    align-items: center;
  }

  .stats {
    font-size: 12px;
    color: $color-grey-font;
    margin-right: 25px;
  }
}

/*
Table sizing
*/

@mixin cellStyle {
  &.empty,
  &.indication,
  &.status {
    width: 80px;
  }

  &.small {
    width: $with_table_small;
  }

  &.large {
    width: $with_table_large;
  }

  &.edit {
    width: $with_table_edit;
  }

  &.action,
  &.button {
    width: $with_table_action;
    text-align: center;
  }

  &.index {
    text-align: center;
    width: $with_table_index;
  }
}

@mixin separator {
  margin-top: 25px;
  font-weight: bold;
  letter-spacing: 1.4px;
  padding: 5px 0;
  border-bottom: 1px solid $color_border;

  h3 {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
  }

  &.no-margin {
    margin-top: 0;
  }

  &.intermediary {
    h3 {
      font-size: 14px;
      opacity: 0.7;
    }
  }
}

@mixin defaultNavStyle($background: $color_main_nav, $width: $nav_width) {
  width: $width;
  overflow: auto;
  height: 100%;
  background: $background;
  color: black;
  z-index: 4;
  overflow: auto;
  padding: 10px 0;
  border-right: 2px solid #ededed;

  .category {
    padding: 10px 0px;
    margin: 10px 10px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);

    .icon {
      margin-right: 10px;
      min-width: 20px;
    }
  }

  .item {
    text-decoration: none;
    display: block;
    padding: 12px 18px;
    //height: 43px;
    // line-height: 43px;
    font-weight: 400;
    font-size: 15px;
    color: black;
    cursor: pointer;
    border-radius: 2px;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    width: 100%;
    border-left: 2px solid transparent;

    .icon {
      margin-right: 10px;
      min-width: 20px;
    }

    > * {
      @include middle;
    }

    &:hover {
      border-color: #ededed;
    }

    &.state-active {
      font-weight: bold;
      border-left: 2px solid $color_primary;
    }
  }

  .group {
  }

  .items {
    padding-left: 15px;
  }

  .nav-content {
    padding: 10px;
    height: 100%;
    overflow: auto;
  }
}

@mixin navProject {
  // default empty
}

@mixin genericFields {
  .column,
  .group {
    // just a wrapper div
  }

  .section-wrapper {
    margin-bottom: 2 * $mosaic_spacing;
  }

  .section {
    padding: 20px;
    @include card;
    box-shadow: 4px 4px 10px 0 rgba(33, 118, 255, 0.22);
    border-radius: 5px;
  }

  .section-title {
    margin: 0;
    font-weight: bold;
    letter-spacing: 0.3px;
    padding-bottom: 5px;
    font-size: 18px;
    border-bottom: 1px solid $color_border;
  }

  // from generic fields
  .list-value {
    padding: 15px;
    margin-top: 15px;
    border-radius: $border_radius;
    border-radius: $border_radius;
    box-shadow: 0 3px 10px 0 rgba(10, 10, 10, 0.1);
    border: 1px solid $color_border;
  }
  .title-dropdown {
    font-size: 12px;
    font-weight: bold;
  }
}

@mixin navContent($width, $background: $color_main_nav) {
  @include defaultNavStyle($background, $width);
  top: 0; //$height_cms_header;
  position: absolute;
  left: 0;
  bottom: 0;

  $dim_bottom: 38px;
  overflow: auto;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;

  .nav-header {
    flex-shrink: 0;
    height: $height_global_search;
    display: flex;
    padding: 0 10px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-content {
    padding: 0px;
    height: 100%;
    overflow: auto;
  }

  .nav-footer {
    // position: absolute;
    flex-shrink: 0;
  }

  .nav-footer-content {
    height: $dim_bottom;
    background-color: $color_primary;
    cursor: pointer;
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    line-height: $dim_bottom;
    width: 100%;
    position: relative;

    &:hover:before {
      content: '';
      background-color: rgba(255, 255, 255, 0.05);
      @include absolute-fill;
    }

    &.green {
      background-color: $color-green;
    }
  }

  .item-wrapper {
    position: relative;
    text-transform: capitalize;

    .item {
      font-size: 14px;
    }

    &:hover {
      background: rgba(255, 255, 255, 0.1);

      .item {
        background-color: transparent;
      }

      .edit {
        opacity: 1;
      }

      .to-complete,
      .filter-match {
        opacity: 0;
      }
    }

    .to-complete,
    .filter-match {
      @include transition(opacity);
      @include v_align;
      padding: 1px 6px;
      border-radius: 2px;
      background-color: rgba($color: $color_dark_orange, $alpha: 0.3);
      font-size: 10px;
      min-height: 13px;
      letter-spacing: 0px !important;
      font-weight: 900 !important;
      color: $color_dark_orange;
      right: 7px;
    }

    .filter-match {
      background-color: rgba($color: $color_search, $alpha: 0.3);
      color: $color_search;
    }

    .edit {
      position: absolute;
      right: 0;
      color: $color-dark;
      opacity: 0;
      height: 100%;
      @include transition();
      top: 0;
      width: 40px;

      .icon {
        @include center_align;
      }

      //display: none;
      font-size: 10px;
      padding: 7px;
      cursor: pointer;
    }
  }
}

@mixin baseTableStyle {
  table {
    margin: 15px auto;

    tr {
      border-bottom: 1px solid $color_border;

      &:nth-child(2n + 1) {
        background-color: $color-grey-background;
      }

      &:last-child {
        border: none;
      }
    }

    td,
    th {
      padding: 8px 16px;
    }
  }
}

@mixin genericPage {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  .header,
  .footer {
    flex-shrink: 0;
  }

  .header {
    @include fixedHeader;
    position: relative;
    height: auto;
  }

  .footer {
    @include fixedFooter;
    position: relative;
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .content {
    height: 100%;
    // without that it will take all the parent height
    overflow: auto;
  }
}

@mixin buttonShadow($color: $color_primary, $alpha: 0.3) {
  background-color: $color;
  box-shadow: 7px 7px 30px 0 rgba($color: $color, $alpha: 0.3);
}
