src/content-script/popup.scss
@import 'src/styles/variables';

// NOTE: naming blockName__elementName_modName_modVal
// this BEM naming scheme can be used in JS without quotes
:host {
  --time-auto-switch-timeout: 500ms;
  --popup-opacity: 1;

  --popup-width: 0;
  --popup-height: 0;
  --popup-border-radius: 0;
  --tab-height: 0;
  --tab-horizontal-padding: 0;
  --tab-text-padding: 0;
  --tab-timeout-indicator-height: 0;
  --font-size: 0;
  --icon-size: 0;
  --title-fading-zone-z-index: 1;

  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  height: 100% !important;
  width: 100% !important;
  z-index: 2147483647 !important;
}

.overlay {
  all: initial; // prevent leaking of inherited styles from the :host
  direction: ltr;
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
  opacity: var(--popup-opacity);
}

.card {
  @include popup-theme-light();

  background: var(--card-background-color);
  border-radius: var(--popup-border-radius);
  border-left: var(--popup-border-radius) solid;
  border-left-color: var(--tab_selected-background);
  padding-right: var(--popup-border-radius);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2), 0 3px 4px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.14);
  color: var(--card-color);
  font-size: var(--font-size);
  height: var(--popup-height);
  max-height: 100%;
  width: var(--popup-width);
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;

  &_dark {
    @include popup-theme-dark();
  }
}

.tab {
  display: flex;
  align-items: center;
  height: var(--tab-height);
  padding-left: var(--tab-horizontal-padding);
  position: relative;
  border-bottom-right-radius: var(--popup-border-radius);
  border-top-right-radius: var(--popup-border-radius);
  outline: none;
  cursor: default;
  overflow: hidden;

  &:hover {
    --text-crop-gradient-color: var(--tab_hover-background);
    background-color: var(--tab_hover-background);
    z-index: 10;

    .tab__cornerIcon {
      fill: var(--tab_hover-background);
    }
  }

  &.tab_selected,
  &.tab_selected:hover {
    --text-crop-gradient-color: var(--tab_selected-background);
    background-color: var(--tab_selected-background);
    z-index: 20;

    .tab__cornerIcon {
      fill: var(--tab_selected-background);
    }
  }
}

.tab__cornerIcon {
  position: absolute;
  width: var(--popup-border-radius);
  height: var(--popup-border-radius);
  fill: var(--card-background-color);
  left: 0;
}

.tab__cornerIcon_bottom {
  bottom: 0;
  transform: translateY(100%) rotate(90deg);
}

.tab__cornerIcon_top {
  top: 0;
  transform: translateY(-100%);
}

.tab__icon {
  height: auto;
  width: var(--icon-size);
  // Prevents jumping of the icon after image finished loading.
  // The width property doesn't apply to the image when it is loading.
  min-width: var(--icon-size);

  &_noFavIcon {
    fill: var(--tab__icon_noFavIcon-fill);
  }
}

.tab__text {
  position: relative;
  display: flex;
  height: 100%;
  width: 100%;
  max-height: var(--tab-height);
  white-space: nowrap;
  overflow: hidden;
  align-items: center;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: var(--tab-text-padding);
    height: 100%;
    background: linear-gradient(to left, transparent, var(--text-crop-gradient-color));
    z-index: var(--title-fading-zone-z-index);
  }

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: var(--tab-text-padding);
    height: 100%;
    background: linear-gradient(to right, transparent, var(--text-crop-gradient-color));
  }
}

.tab__textContent {
  position: absolute;
  padding-left: var(--tab-text-padding);
  padding-right: var(--tab-text-padding);
}

.tab__timeoutIndicator {
  position: absolute;
  width: 95%;
  height: var(--tab-timeout-indicator-height);
  background: var(--tab__timeoutIndicator-background);
  bottom: 0;
  left: var(--popup-border-radius);
  animation-name: shrunk-indicator;
  animation-duration: var(--time-auto-switch-timeout);
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  z-index: calc(var(--title-fading-zone-z-index) + 1);
}

@keyframes shrunk-indicator {
  to {
    width: 0;
  }
}
