@use "../../themes/ionic/ionic.globals.scss" as globals;
@use "./tab-bar.common";

:host {
  --background: #{globals.$tabbar-ionic-background};
  --background-activated: #{globals.$tabbar-ionic-background-activated};
  --background-focused: #{globals.$tabbar-ionic-background-focused};
  --border: #{globals.$ion-border-size-0} #{globals.$ion-border-style-solid} #{globals.$tabbar-ionic-border-color};
  --color: #{globals.$tabbar-ionic-color};
  --color-selected: #{globals.$tabbar-ionic-color-selected};

  /*
   * In case there's scrolling, justify the content to the start.
   */
  justify-content: unset;

  /*
   * Ensure the tab bar does not grow larger than the viewport width.
   * Useful for when the tab buttons have large labels, allowing the space
   * to be evenly divided among the buttons.
   */
  max-width: 100%;

  /**
   * Tab bar has a box sizing of content-box to ensure the padding
   * is not included in the height. This is important for the
   * component to adjust to the safe area bottom.
   *
   * In order for the height to be calculated correctly, the padding
   * top and bottom must be excluded from the height calculation.
   */
  min-height: calc(globals.$ion-scale-1400 - calc(globals.$ion-space-100 * 2));

  gap: globals.$ion-space-300;

  box-shadow: #{globals.$ion-elevation-2};

  /*
   * In case there are more tab buttons than can fit in the tab bar, enable
   * horizontal scrolling.
   */
  overflow: auto hidden;

  // TODO(ROU-10853): replace this value with a layer token
  z-index: 10;
}

// Tab Bar Expand
// --------------------------------------------------

/* Full */
:host(.tab-bar-full) {
  /* stylelint-disable */
  padding-top: globals.$ion-space-100;
  padding-bottom: calc(globals.$ion-space-100 + var(--ion-safe-area-bottom, 0));

  padding-right: calc(globals.$ion-space-400 + var(--ion-safe-area-right, 0));
  padding-left: calc(globals.$ion-space-400 + var(--ion-safe-area-left, 0));
  /* stylelint-enable */
}

:host([slot="top"].tab-bar-full) {
  padding-top: calc(globals.$ion-space-100 + var(--ion-safe-area-top, 0));
  padding-bottom: globals.$ion-space-100;
}

/* Compact */
:host(.tab-bar-compact) {
  @include globals.padding(globals.$ion-space-100, globals.$ion-space-400);

  position: absolute;

  align-self: center;

  width: fit-content;

  contain: content;
}

:host([slot="top"].tab-bar-compact) {
  top: calc(globals.$ion-space-100 + var(--ion-safe-area-top, 0));
}

:host([slot="bottom"].tab-bar-compact) {
  bottom: calc(globals.$ion-space-400 + var(--ion-safe-area-bottom, 0));
}

// Tab Bar Shapes
// --------------------------------------------------

/* Soft */
:host(.tab-bar-soft) {
  @include globals.border-radius(globals.$ion-border-radius-400);
}

/* Round */
:host(.tab-bar-round) {
  @include globals.border-radius(globals.$ion-border-radius-full);
}

/* Rectangular */
:host(.tab-bar-rectangular) {
  @include globals.border-radius(globals.$ion-border-radius-0);
}
