@import "../decoration/animate_common";

#navigator-toolbox {
  --uc-toolbar-hide-height: calc(-1 * var(--uc-toolbar-height, 0));
  margin-bottom: var(--uc-toolbar-hide-height) !important;

  @include Animate {
    @include Option("userChrome.decoration.animate") {
      will-change: margin-top, margin-bottom, background-color !important;
      transition: $toolbox-transition-margin-top,
                  $toolbox-transition-margin-bottom,
                  $toolbox-transition-background-color !important;
      &:-moz-window-inactive {
        transition: $toolbox-transition-margin-top,
                    $toolbox-transition-margin-bottom,
                    $toolbox-transition-background-color-inactive !important;
      }
      &:is(:hover, :focus-within) {
        transition-delay: 0s, 0s, 0.2s !important;
      }

      &[inFullscreen="true"] {
        transition: $toolbox-transition-margin-top-fullscreen,
                    $toolbox-transition-margin-bottom,
                    $toolbox-transition-background-color !important;
        &:-moz-window-inactive {
          transition: $toolbox-transition-margin-top-fullscreen,
                      $toolbox-transition-margin-bottom,
                      $toolbox-transition-background-color-inactive !important;
        }
      }
    }
    @include NotOption("userChrome.decoration.animate") {
      transition: $toolbox-transition-margin-bottom,
                  $toolbox-transition-background-color !important;

      &:is(:hover, :focus-within) {
        transition-delay: 0s !important;
      }
    }
  }

  &:is(:hover, :focus-within) {
    @include Option("userChrome.autohide.tabbar", "userChrome.autohide.navbar") {
      @include Option("userChrome.autohide.tabbar", "userChrome.tabbar.one_liner") {
        --uc-toolbar-height: var(--uc-tabbar-height);

        @include NotOption("userChrome.autohide.navbar") {
          @include Option("userChrome.autohide.bookmarkbar") {
            --uc-toolbar-height: calc(var(--uc-tabbar-height) + var(--uc-bm-height));
          }
        }

        @include OneLinerNavbar {
          @include NotOption("userChrome.autohide.bookmarkbar") {
            --uc-toolbar-height: calc(var(--uc-tabbar-height) + var(--uc-navbar-height));
          }
          @include Option("userChrome.autohide.bookmarkbar") {
            --uc-toolbar-height: calc(var(--uc-tabbar-height) + var(--uc-navbar-height) + var(--uc-bm-height));
          }
        }
      }
    }
    @include NotOption("userChrome.autohide.tabbar") {
      @include NotOption("userChrome.autohide.navbar") {
        @include Option("userChrome.autohide.bookmarkbar") {
          --uc-toolbar-height: var(--uc-bm-height);
        }
      }

      @include Option("userChrome.autohide.navbar", "userChrome.tabbar.one_liner") {
        @include OneLinerNavbar {
          @include NotOption("userChrome.autohide.bookmarkbar") {
            --uc-toolbar-height: var(--uc-navbar-height);
          }
          @include Option("userChrome.autohide.bookmarkbar") {
            --uc-toolbar-height: calc(var(--uc-navbar-height) + var(--uc-bm-height));
          }
        }
      }
    }
  }
}
