@import "../../../themes/ionic.globals.ios";

// iOS Tabs
// --------------------------------------------------

/// @prop - Border on the tabbar (border-top when [tabsPlacement=bottom] and border-bottom when [tabsPlacement=top])
$tabs-ios-border: $hairlines-width solid $tabs-ios-border-color !default;

/// @prop - Padding top on the tab button
$tabs-ios-tab-padding-top: 0 !default;

/// @prop - Padding end on the tab button
$tabs-ios-tab-padding-end: 2px !default;

/// @prop - Padding bottom on the tab button
$tabs-ios-tab-padding-bottom: $tabs-ios-tab-padding-top !default;

/// @prop - Padding start on the tab button
$tabs-ios-tab-padding-start: $tabs-ios-tab-padding-end !default;

/// @prop - Max width of the tab button
$tabs-ios-tab-max-width: 240px !default;

/// @prop - Minimum height of the tab button
$tabs-ios-tab-min-height: 49px !default;

/// @prop - Text color of the inactive tab button
$tabs-ios-tab-text-color: $tabs-ios-tab-color-inactive !default;

/// @prop - Text color of the active tab button
$tabs-ios-tab-text-color-active: $tabs-ios-tab-color-active !default;

/// @prop - Icon color of the inactive tab button
$tabs-ios-tab-icon-color: $tabs-ios-tab-color-inactive !default;

/// @prop - Icon color of the active tab button
$tabs-ios-tab-icon-color-active: $tabs-ios-tab-color-active !default;

/// @prop - Font size of the tab button text
$tabs-ios-tab-font-size: 10px !default;

/// @prop - Font weight of the tab button text
$tabs-ios-tab-font-weight: 500 !default;

/// @prop - Size of the tab button icon
$tabs-ios-tab-icon-size: 30px !default;

.tabs-ios .tabbar {
  background: $tabs-ios-background;
  border-top: $tabs-ios-border;
  justify-content: center;
}

.tabs-ios[tabsPlacement=top] .tabbar {
  border-top: 0;
  border-bottom: $tabs-ios-border;
}

.tabs-ios .tab-button {
  max-width: $tabs-ios-tab-max-width;
  min-height: $tabs-ios-tab-min-height;
  font-size: $tabs-ios-tab-font-size;
  font-weight: $tabs-ios-tab-font-weight;
  color: $tabs-ios-tab-text-color;

  @include padding($tabs-ios-tab-padding-top, $tabs-ios-tab-padding-end, $tabs-ios-tab-padding-bottom, $tabs-ios-tab-padding-start);
}

.tabs-ios .tab-button:hover:not(.disable-hover),
.tabs-ios .tab-button.tab-active {
  color: $tabs-ios-tab-text-color-active;
}

.tabs-ios .tab-button.tab-active .tab-button-icon {
  color: $tabs-ios-tab-icon-color-active;
}

.tabs-ios .tab-button-text {
  min-height: $tabs-ios-tab-font-size + 1;

  @include margin(0, null, 1px, null);
}

.tabs-ios .has-title-only .tab-button-text {
  font-size: $tabs-ios-tab-font-size + 2;
}

.tabs-ios .tab-button-icon {
  min-width: $tabs-ios-tab-icon-size + 5;
  height: $tabs-ios-tab-icon-size;
  font-size: $tabs-ios-tab-icon-size;
  color: $tabs-ios-tab-icon-color;

  @include margin(4px, null, 1px, null);
}

.tabs-ios .tab-button-icon::before {
  vertical-align: top;
}

.tabs-ios[tabsLayout=icon-end] .tab-button .tab-button-text,
.tabs-ios[tabsLayout=icon-start] .tab-button .tab-button-text {
  font-size: 14px;
  line-height: 1.1;
}

.tabs-ios[tabsLayout=icon-end] .tab-button .ion-icon,
.tabs-ios[tabsLayout=icon-start] .tab-button .ion-icon {
  min-width: 24px;
  height: 26px;
  font-size: 24px;
}

.tabs-ios[tabsLayout=icon-hide] .tab-button,
.tabs-ios .tab-button.has-title-only {
  min-height: $tabs-ios-tab-min-height - 8;
}

.tabs-ios[tabsLayout=icon-hide] .tab-button .tab-button-text,
.tabs-ios .tab-button.has-title-only .tab-button-text {
  font-size: 14px;
  line-height: 1.1;

  @include margin(2px, 0);
}

.tabs-ios[tabsLayout=title-hide] .tab-button,
.tabs-ios .tab-button.icon-only {
  min-height: $tabs-ios-tab-min-height - 8;
}

// iOS Tabbar Color Mixin
// --------------------------------------------------

@mixin tabbar-ios($color-name, $color-base, $color-contrast) {
  .tabs-ios-#{$color-name} .tabbar {
    background-color: $color-base;
    border-color: darken($color-base, 10%);
  }

  .tabs-ios-#{$color-name} .tab-button,
  .tabs-ios-#{$color-name} .tab-button-icon,
  .tabs-ios-#{$color-name} .tab-button:hover:not(.disable-hover),
  .tabs-ios-#{$color-name} .tab-button:hover:not(.disable-hover) .tab-button-icon {
    color: rgba($color-contrast, 0.7);
  }

  .tabs-ios-#{$color-name} .tab-button.tab-active,
  .tabs-ios-#{$color-name} .tab-button.tab-active .tab-button-icon {
    color: $color-contrast;
  }

}

// iOS Tabbar Color Generation
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
  @include tabbar-ios($color-name, $color-base, $color-contrast);
}
