/* Firefox Compact Mode
 *
 * Copyright (c) 2021 Danny Colin
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

:root {
  /* Tabbar: reduce tab margin */
  --tab-block-margin: 0 !important;
}

/* Reduce minimum window width for Fx74 */
:root:not([chromehidden~="toolbar"]){
  /* Fx74 default is 450px on Windows */
  min-width: 250px !important;
}

//////

#tabbrowser-tabs {
    --user-tab-rounding: 0px;
}

.tab-background {
    border-radius: var(--user-tab-rounding) var(--user-tab-rounding) 0px 0px !important; /* Connected */
    margin-block: 1px 0 !important; /* Connected */
}
#scrollbutton-up, #scrollbutton-down { /* 6/10/2021 */
    border-top-width: 1px !important;
    border-bottom-width: 0 !important;
}

/* 1/16/2022 Tone down the Fx96 tab border with add-on themes in certain fallback situations */
.tab-background:is([selected], [multiselected]):-moz-lwtheme {
    --lwt-tabs-border-color: rgba(0, 0, 0, 0.5) !important;
    border-bottom-color: transparent !important;
}
[brighttext="true"] .tab-background:is([selected], [multiselected]):-moz-lwtheme {
    --lwt-tabs-border-color: rgba(255, 255, 255, 0.5) !important;
    border-bottom-color: transparent !important;
}

/* Container color bar visibility */
.tabbrowser-tab[usercontextid] > .tab-stack > .tab-background > .tab-context-line {
    margin: 0px max(calc(var(--user-tab-rounding) - 3px), 0px) !important;
}

#TabsToolbar, #TabsToolbar > hbox, #TabsToolbar-customization-target, #tabbrowser-arrowscrollbox  {
    max-height: calc(var(--tab-min-height) + 1px) !important;
}

//////

/* Inactive tabs: Separator line style */

.tabbrowser-tab:not([selected=true]):not([multiselected=true]):not([beforeselected-visible="true"]) .tab-background {
    border-right: 1px solid var(--lwt-background-tab-separator-color, rgba(0, 0, 0, .20)) !important;
}
/* For dark backgrounds */
[brighttext="true"] .tabbrowser-tab:not([selected=true]):not([multiselected=true]):not([beforeselected-visible="true"]) .tab-background {
    border-right: 1px solid var(--lwt-background-tab-separator-color, var(--lwt-selected-tab-background-color, rgba(255, 255, 255, .20))) !important;
}
.tabbrowser-tab:not([selected=true]):not([multiselected=true]) .tab-background {
    border-radius: 0 !important;
}
/* Remove padding between tabs */
.tabbrowser-tab {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

//////

/* Tab: Reduce height */
.tabbrowser-tab {
  min-height: 16px !important;
  margin: 0 !important;
}

#TabsToolbar, #tabbrowser-tabs {
    --tab-min-height: 18px !important;
}

#scrollbutton-up,
#scrollbutton-down {
    border-top-width: 0 !important;
    border-bottom-width: 0 !important;
}

/* Tab: Ensure tab height doesn't augment when arrowscrollbox is visible  */ 
#tabbrowser-arrowscrollbox {
  --tab-min-height: 18px !important;
  max-height: var(--tab-min-height);
}

/* Tab: Attention icon */
.tabbrowser-tab:is([image], [pinned]) > .tab-stack > .tab-content[attention]:not([selected="true"]), .tabbrowser-tab > .tab-stack > .tab-content[pinned][titlechanged]:not([selected="true"]) {
  background-position-x: left 2px !important;
  background-position-y: bottom 12.5px !important;
}

/* URLBar: Fix vertical alignment */
#urlbar[breakout=true]:not([open="true"]) {
	--urlbar-height: 16px !important;
	--urlbar-toolbar-height: 18px !important;
}

/* URLBar: Fix URL address vertical aligment when megabar is open */
#urlbar[breakout=true][open="true"] {
	--urlbar-toolbar-height: 16px !important;
}

/* URLBar: Reduce row items padding */
.urlbarView-row-inner {
	padding-inline: var(--urlbarView-item-inline-padding);
	padding-block: 1px !important;
}

/* URLBar: Reduce and realign row bookmark icons */
.urlbarView-type-icon {
	width: 10px !important;
	height: 10px !important;
	margin-bottom: 0 !important;
	margin-inline-start: 10px !important;
}

/* URLBar: Reduce "This time, serach with" padding */
#urlbar .search-one-offs:not([hidden]) {
	padding-block: 4px !important;
}

/* Searchbar: Ensure toolbar height doesn't augment when searchbar is visible */
#urlbar-container, 
#search-container {
	padding-block: 0 !important;
}

/* Searchbar: Make sure the min-height of the input is the same as the popup */
#search-container {
  min-width: 192px !important;
}

/* Toolbar: Reduce spacing */
#urlbar-container {
	--urlbar-container-height: 18px !important;
  margin-top: 0 !important;
}

.urlbar-input-box {
  max-height: 16px !important;
}

/*
 * Make the toolbar extra-compact (similar to v56 with CTR)
 *
 * Applies to Compact density
 *
 * Contributor(s): Alex Vallat
 */

:root[uidensity=compact] #urlbar,
:root[uidensity=compact] .searchbar-textbox {
  min-height: 18px !important;
}

:root[uidensity=compact] #identity-box {
  max-height: 16px;
}

:root[uidensity=compact] #nav-bar .toolbarbutton-1 {
  padding: 0px !important;
}

#nav-bar toolbarbutton > .toolbarbutton-icon { 
	height:14px!important;
	width:14px!important;
	padding: 0 !important;
	margin: 0 2px !important;
}
#personal-bookmarks .bookmark-item > .toolbarbutton-icon { height:16px!important; width:16px!important; }



/* Compatibility with auto-hide.css */
:root[uidensity=compact] #navigator-toolbox {
  --nav-bar-height: 18px !important;
}

#nav-bar {
height: 18px
}


/* Reload Button: Fix vertical alignment */
#reload-button {
	margin-block-start: -2px !important;
}

/* AppMenu: Header */
.panel-header {
	padding: 4px 0 0 4px !important;
}

/* AppMenu: Header button */
.panel-header > .subviewbutton-back {
	padding: 4px !important;
}

/* Windows 10 context menu */
@media (-moz-os-version: windows-win10) {
  /* Context Menu: Reduce vertical space */
  menupopup > menuitem,
  menupopup > menu {
    padding-block: 2px !important;
  }
}
