@import "../../globals.core";

// Tabs
// --------------------------------------------------


ion-tabs {
  display: flex;
  flex-direction: column;

  overflow: hidden;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
}

ion-tab {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  flex-direction: column;

  display: none;
  &.show-tab {
    display: flex;
  }
}

ion-tabs > ion-navbar-section {
  order: $flex-order-tabbar-navbar;
}

ion-tabbar-section {
  position: relative;
  order: $flex-order-tabbar-bottom;
}

[tabbarPlacement=top] ion-tabbar-section {
  order: $flex-order-tabbar-top;
}

tabbar {
  position: relative;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.tab-button {
  position: relative;
  z-index: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  align-self: center;
  align-items: center;

  margin: 0;

  text-align: center;
  cursor: pointer;
  @include user-select-none();

  border: 0;
  border-radius: 0;
  background: none;
}

.tab-button-text {
  margin-top: 3px;
  margin-bottom: 2px;
}

.tab-button-text,
.tab-button-icon {
  align-self: center;

  min-width: 26px;
  max-width: 100%;

  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  display: none;
}

.has-icon .tab-button-icon,
.has-title .tab-button-text {
  display: block;
}

.has-title-only .tab-button-text {
  white-space: normal;
}

tab-highlight {
  display: none;
}

[tabbarLayout=icon-bottom] .tab-button {
  .tab-button-icon {
    order: 10;
  }
}

[tabbarLayout=icon-left] .tab-button {
  flex-direction: row;

  .tab-button-icon {
    text-align: right;
    padding-right: 8px;
  }
}

[tabbarLayout=icon-right] .tab-button {
  flex-direction: row;

  .tab-button-icon {
    order: 10;
    text-align: left;
    padding-left: 8px;
  }
}

[tabbarLayout=icon-hide] .tab-button-icon {
  display: none;
}

[tabbarLayout=title-hide] .tab-button-text {
  display: none;
}

// Tab Badges
// --------------------------------------------------

.tab-badge {
  position: absolute;
  top: 4%;
  right: 4%;
  right: calc(50% - 50px);
  padding: 1px 6px;
  height: auto;
  font-size: 12px;
  line-height: 16px;
}

.has-icon .tab-badge {
  right: calc(50% - 30px);
}

[tabbarLayout=icon-hide] .tab-badge,
[tabbarLayout=icon-bottom] .tab-badge,
[tabbarLayout=icon-left] .tab-badge,
[tabbarLayout=icon-right] .tab-badge {
  right: calc(50% - 50px);
}
