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

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


ion-tabs {
  display: flex;
  overflow: hidden;

  flex-direction: column;

  margin: 0;
  padding: 0;

  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
}

ion-tab {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  overflow: hidden;

  flex-direction: column;

  width: 100%;
  height: 100%;

  &.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;
  overflow: hidden;

  justify-content: center;
}

.tab-button {
  @include user-select-none();

  position: relative;
  z-index: 0;
  display: flex;
  overflow: hidden;

  flex: 1;
  flex-direction: column;
  align-items: center;
  align-self: center;
  justify-content: center;

  margin: 0;

  border: 0;
  border-radius: 0;

  text-align: center;
  text-decoration: none;
  background: none;
  cursor: pointer;
}

.tab-disabled {
  pointer-events: none;

  ion-badge,
  ion-icon,
  span {
    opacity: .4;
  }
}

.tab-hidden {
  display: none;
}

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

.tab-button-text,
.tab-button-icon {
  display: none;
  overflow: hidden;

  align-self: center;

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

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

.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 {
    padding-right: 8px;

    text-align: right;
  }
}

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

  .tab-button-icon {
    order: 10;

    padding-left: 8px;

    text-align: left;
  }
}

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

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

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

.tab-badge {
  position: absolute;
  top: 6%;
  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-bottom] .tab-badge,
[tabbarLayout=icon-left] .tab-badge,
[tabbarLayout=icon-right] .tab-badge {
  right: calc(50% - 50px);
}
