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

// iOS Tabs
// --------------------------------------------------

$tabbar-ios-background:               $toolbar-ios-background !default;
$tabbar-ios-item-padding:             0px 10px !default;
$tabbar-ios-item-font-size:           10px !default;
$tabbar-ios-item-icon-size:           32px !default;
$tabbar-ios-height:                   49px !default;

$tab-button-ios-min-width:            80px !default;
$tab-button-ios-max-width:            240px !default;
$tab-button-ios-active-color:         $toolbar-ios-active-color !default;
$tab-button-ios-inactive-color:       $toolbar-ios-inactive-color !default;


tabbar {
  border-top: 1px solid $toolbar-ios-border-color;
  background: $tabbar-ios-background;
}

ion-tabs[tabbarPlacement=top] tabbar {
  border-top: none;
  border-bottom: 1px solid $toolbar-ios-border-color;
}

.tab-button {
  padding: $tabbar-ios-item-padding;
  min-width: $tab-button-ios-min-width;
  max-width: $tab-button-ios-max-width;
  min-height: $tabbar-ios-height;

  color: $tab-button-ios-inactive-color;
}

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

.tab-button-text {
  min-height: $tabbar-ios-item-font-size + 1;
  font-size: $tabbar-ios-item-font-size;
}

.has-title-only .tab-button-text {
  font-size: $tabbar-ios-item-font-size + 2;
}

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

  &:before {
    vertical-align: top;
  }
}

[tabbarLayout=icon-right] .tab-button,
[tabbarLayout=icon-left] .tab-button {

  .tab-button-text {
    font-size: 1.4rem;
    line-height: 1.1;
    margin-top: 0;
    margin-bottom: 0;
  }

  ion-icon {
    min-width: 24px;
    height: 26px;
    font-size: 24px;
  }
}

[tabbarLayout=icon-hide] .tab-button,
.tab-button.has-title-only {
  min-height: $tabbar-ios-height - 8;

  .tab-button-text {
    font-size: 1.4rem;
    line-height: 1.1;
  }
}

[tabbarLayout=title-hide] .tab-button,
.tab-button.icon-only {
  min-height: $tabbar-ios-height - 8;
}

&.hairlines ion-tabs {

  tabbar {
    border-top-width: $hairlines-width;
  }

  &[tabbarPlacement="top"] tabbar {
    border-bottom-width: $hairlines-width;
  }

}


// iOS Tabbar Color Mixin
// --------------------------------------------------

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

  ion-tabs[#{$color-name}] tabbar {
    border-color: darken($color-value, 10%);
    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);
    }
  }

}


// iOS Tabbar Color Generation
// --------------------------------------------------

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