@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;

  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: $tabbar-md-item-font-size;
  font-weight: $tabbar-md-item-font-weight;
  color: $tab-button-md-inactive-color;
  box-shadow: none;
  opacity: .7;

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

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

  text-transform: uppercase;
}

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

  font-size: $tabbar-md-item-icon-size;
}

[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;
}

tab-highlight {
  position: absolute;
  bottom: 0;
  left: 0;
  display: block;

  width: 1px;
  height: 2px;

  background: $tab-button-md-active-color;
  transform: translateZ(0);
  transform-origin: 0 0;

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

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


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

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

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

    .tab-button {
      color: $color-contrast;
    }

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

    tab-highlight {
      background: $color-contrast;
    }
  }

}


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

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