/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/tabs_on_bottom.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

/*= Tabbar - Move to bottom ==================================================*/
#titlebar,
#TabsToolbar {
  @include BoxOrder(2) /* When userChrome.fullscreen.overlap */;
  --tabs-navbar-shadow-size: 0px;
}
#tab-notification-deck {
  @include BoxOrder(2);
}

#TabsToolbar .titlebar-spacer {
  display: none;
}

#TabsToolbar-customization-target > .toolbarbutton-1:last-child {
  padding-inline-end: var(--toolbar-start-end-padding, 8px);
}

@include Option("userChrome.tabbar.on_bottom.above_bookmark") {
  #PersonalToolbar {
    @include BoxOrder(2);
  }
}
@include NotOption("userChrome.tabbar.on_bottom.above_bookmark") {
  @include Option("userChrome.tab.connect_to_window") {
    @include Option("userChrome.tab.color_like_toolbar") {
      #navigator-toolbox {
        border-bottom-color: var(--toolbar-bgcolor) !important; /* Original: 1px solid var(--chrome-content-separator-color); */
      }
    }
  }
}

/*= Tabbar - Hidden at single tab ===========================================*/
@include Option("userChrome.tabbar.on_bottom.hidden_single_tab") {
  #tabbrowser-tabs .tabbrowser-tab:only-of-type {
    display: none !important;
  }

  #tabbrowser-tabs,
  #tabbrowser-tabs arrowscrollbox {
    height: auto !important;
    min-height: auto !important;
  }

  @include Animate {
    #tabbrowser-tabs {
      transition: height 0.25s var(--animation-easing-function) var(--uc-autohide-toolbar-delay);
    }
  }
}

/*= Menubar - Always on top ==================================================*/
@include Option("userChrome.tabbar.on_bottom.menubar_on_top") {
  /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/tabs_on_bottom_menubar_on_top_patch.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

  /* Menubar on top patch - use with tabs_on_bottom.css */
  /* Only really useful if menubar is ALWAYS visible */
  :root:not([sizemode="fullscreen"]) {
    --uc-window-control-width: 0px !important;
  }
  /* Since menubar is statically at top, remove fake drag-space that might be set by window_control_placeholder_support.css */
  :root:not([sizemode="fullscreen"]) #nav-bar {
    border-inline-width: 0;
  }

  #navigator-toolbox{
    -moz-window-dragging: drag;
  }
  :root[sizemode="fullscreen"] #navigator-toolbox {
    padding-top: 0px !important;
  }
  #toolbar-menubar {
    position: fixed;
    display: flex;
    top: var(--uc-titlebar-padding);
    height: var(--uc-menubar-height);
    width: 100%;
    overflow: hidden;
  }
  :root:is([tabsintitlebar], [customtitlebar]) #toolbar-menubar[autohide="true"]:not([inactive="true"]) {
    height: var(--uc-menubar-height) !important; /* calc(var(--tab-min-height) + 2 * var(--tab-block-margin)) */
  }

  #toolbar-menubar > .titlebar-buttonbox-container {
    height: 100%;
    order: 100;
  }

  #toolbar-menubar > [flex] {
    flex-grow: 100;
  }
  #toolbar-menubar > spacer[flex] {
    order: 99;
    flex-grow: 1;
    min-width: var(--uc-window-drag-space-post);
  }

  #toolbar-menubar .toolbarbutton-1 {
    --toolbarbutton-inner-padding: 3px;
  }

  :root:not([chromehidden~="menubar"], [sizemode="fullscreen"]) #toolbar-menubar:not([autohide="true"]) + #TabsToolbar > .titlebar-buttonbox-container{
    visibility: collapse !important;
  }
  :root:not([chromehidden~="menubar"]):not([sizemode="fullscreen"]) #toolbar-menubar:not([autohide="true"]) .titlebar-buttonbox-container {
    visibility: visible;
  }
}
