@import "../../globals.md";
@import "./tabs";

// Material Design Tabs
// --------------------------------------------------

$tabbar-md-background:               $toolbar-md-background !default;
$tabbar-md-item-padding:             12px 10px 5px 10px !default;
$tabbar-md-item-font-size:           1.4rem !default;
$tabbar-md-item-font-weight:         500 !default;
$tabbar-md-item-icon-size:           2.4rem !default;
$tabbar-md-item-height:              4.8rem !default;

$tab-button-md-active-color:         $toolbar-md-active-color !default;
$tab-button-md-inactive-color:       $toolbar-md-inactive-color !default;


tabbar {
  background: $tabbar-md-background;
}


.tab-button {
  padding: $tabbar-md-item-padding;
  min-height: $tabbar-md-item-height;
  font-size: $tabbar-md-item-font-size;
  font-weight: $tabbar-md-item-font-weight;
  opacity: 0.7;

  box-shadow: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  color: $tab-button-md-inactive-color;

  &[aria-selected=true] {
    opacity: 1.0;
    color: $tab-button-md-active-color;
  }
}

.tab-button-text {
  margin-top: 5px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.tab-button-icon {
  font-size: $tabbar-md-item-icon-size;
  min-width: $tabbar-md-item-icon-size + 5;
}

[tabbarLayout=icon-bottom] .tab-button {
  padding-top: 8px;
  padding-bottom: 8px;
}

[tabbarLayout=icon-right] .tab-button,
[tabbarLayout=icon-left] .tab-button {
  padding-bottom: 10px;

  ion-icon {
    min-width: 24px;
  }
}

[tabbarLayout=icon-hide] .tab-button,
[tabbarLayout=title-hide] .tab-button,
.tab-button.icon-only,
.tab-button.has-title-only {
  padding: 6px 10px 6px 10px;
}

tab-highlight {
  position: absolute;
  display: block;
  height: 2px;
  width: 1px;
  bottom: 0;
  left: 0;
  background: $tab-button-md-active-color;
  transform-origin: 0 0;
  transform: translateZ(0);

  &.animate {
    transition-duration: 300ms;
  }
}

[tabbarPlacement=bottom] tab-highlight {
  top: 0;
}


// Material Design  Tabbar Color Mixin
// --------------------------------------------------

@mixin tabbar-md($color-name, $color-value) {

  ion-tabs[#{$color-name}] tabbar {
    background-color: $color-value;

    .tab-button {
      color: color-inverse($color-value);
    }

    .tab-button:hover:not(.disable-hover),
    .tab-button[aria-selected=true] {
      color: color-inverse($color-value);
    }

    tab-highlight {
      background: color-inverse($color-value);
    }
  }

}


// Material Design Tabbar Color Generation
// --------------------------------------------------

@each $color-name, $color-value in $colors-md {
  @include tabbar-md($color-name, $color-value);
}
