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

// deprecated
$tabs-ios-tab-padding:              null !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 - Size of the tab button icon
$tabs-ios-tab-icon-size:            30px !default;


.tabs-ios .tabbar {
  justify-content: center;

  border-top: $tabs-ios-border;
  background: $tabs-ios-background;
}

.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;
  color: $tabs-ios-tab-text-color;

  @include deprecated-variable(padding, $tabs-ios-tab-padding) {
    @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[aria-selected=true] {
  color: $tabs-ios-tab-text-color-active;
}

.tabs-ios .tab-button[aria-selected=true] .tab-button-icon {
  color: $tabs-ios-tab-icon-color-active;
}

.tabs-ios .tab-button-text {
  @include margin(0, null, 1px, null);

  min-height: $tabs-ios-tab-font-size + 1;
}

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

.tabs-ios .tab-button-icon {
  @include margin(4px, null, 1px, null);

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

.tabs-ios .tab-button-icon::before {
  vertical-align: top;
}

.tabs-ios[tabsLayout=icon-right] .tab-button .tab-button-text, // deprecated
.tabs-ios[tabsLayout=icon-left] .tab-button .tab-button-text, // deprecated
.tabs-ios[tabsLayout=icon-end] .tab-button .tab-button-text,
.tabs-ios[tabsLayout=icon-start] .tab-button .tab-button-text {
  font-size: 1.4rem;
  line-height: 1.1;
}

.tabs-ios[tabsLayout=icon-right] .tab-button ion-icon, // deprecated
.tabs-ios[tabsLayout=icon-left] .tab-button ion-icon, // deprecated
.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 {
  @include margin(2px, 0);

  font-size: 1.4rem;
  line-height: 1.1;
}

.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 {
    border-color: darken($color-base, 10%);
    background-color: $color-base;
  }

  .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, .7);
  }

  .tabs-ios-#{$color-name} .tab-button[aria-selected=true],
  .tabs-ios-#{$color-name} .tab-button[aria-selected=true] .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);
}
