/* Tabs bar  */

@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

/* Tabs bar height */
#tabbrowser-tabs,
#tabbrowser-tabs arrowscrollbox {
	height: initial !important;
	min-height: initial !important;
}

/* Fix pinned tabs height where tabs amount activates scrollbox*/
.tabbrowser-tab {
	min-height: var(--tab-min-height);
	padding-inline: 2px !important;
}


tab>stack {
	height: 32px !important;
}

/* Extra margin for the first and last tabs */
.tabbrowser-tab[first-tab]:not([pinned]) {
	margin-left: 8px !important;
}

.tabbrowser-tab[last-tab]:not([pinned]) {
	margin-right: 8px !important;
}

#TabsToolbar .toolbar-items {
	margin-bottom: -1px !important;
}

:root[tabsintitlebar][inFullscreen] #TabsToolbar .toolbar-items {
	margin-bottom: 0 !important;
}

/* Remove hover effects on tab bar buttons */
#TabsToolbar {
	--toolbarbutton-active-background: transparent !important;
	--toolbarbutton-hover-background: transparent !important;
	padding: 0 0 !important;
}

/* New hover effect */
#TabsToolbar toolbarbutton {
	fill-opacity: .6 !important;
}

#TabsToolbar toolbarbutton:not([disabled]):hover,
#TabsToolbar toolbarbutton[open=true] {
	fill-opacity: 1 !important;
}

/* Remove shadow next to tab scroll buttons */
.arrowscrollbox-overflow-start-indicator,
.arrowscrollbox-overflow-end-indicator {
	display: none;
}

/* Remove tab separators */
.tabbrowser-tab::after,
.tabbrowser-tab::before {
	border-color: transparent !important;
	border-image: none !important;
}

/* Space between tabs */
.tabbrowser-tab:not([pinned]) {
	margin: 0 0 !important;
}

/* Tab labels */
tab {
	color: var(--gnome-tabbar-tab-color) !important;
	font-family: SF Pro, inherit;
	font-size: 1em;
}

tab:hover {
	color: var(--gnome-tabbar-tab-hover-color) !important;
}

tab[selected] {
	color: var(--gnome-tabbar-tab-active-color) !important;
}

tab:-moz-window-inactive {
	color: var(--gnome-inactive-tabbar-tab-color) !important;
}

tab[selected]:-moz-window-inactive {
	color: var(--gnome-inactive-tabbar-tab-active-color) !important;
}

/* Center all inside tab */
.tab-content {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: -1px;
	min-width: 100% !important;
	padding: 0 10px !important;
}

/* Prevent tab icons size breaking */
.tab-icon-image,
.tab-icon-sound,
.tab-throbber,
.tab-throbber-fallback,
.tab-close-button {
	min-width: 16px;
}

/* Adjust tab label width */
.tab-label-container {
	min-width: 0 !important;
}

/* Put tab close button and icon sound to the right */
.tab-icon-sound[soundplaying="true"],
.tab-icon-sound[activemedia-blocked="true"] {
	margin-left: auto !important;
}
/* In case firefox changes, muted icon fix can be changed here */
.tabbrowser-tab:not([soundplaying]):not([muted]):not([activemedia-blocked]) .tab-close-button,
.tabbrowser-tab[soundplaying-scheduledremoval="true"] .tab-icon-stack,
.tabbrowser-tab .tab-icon-stack[muted]:not([soundplaying-scheduledremoval="true"]) {
	margin-left: auto !important;
}

.tab-icon-sound {
	margin-right: 6px;
}

/* Force tab favicon to the center */
.tab-throbber,
.tab-throbber-fallback,
.tabbrowser-tab:not([busy]) .tab-icon-image,
.tabbrowser-tab:not([class*="identity-color-"]) .tab-icon-stack {
	margin-left: auto !important;
}
/* separate class for multi-tab alignment*/
.tabbrowser-tab[class*="identity-color-"]>.tab-stack>.tab-content>.tab-icon-stack {
	margin-left:auto !important;
}
/* add ellipsis similar to safari*/
.tab-label{
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

/* If tab favicon is not present, force tab label to the center - magic sauce for v113 centre favicon in tabs*/
.tabbrowser-tab .tab-label-container {
	margin-left: 0 !important;
	max-width: fit-content;
	flex-direction: column;
	display: flex;
	justify-content: center;
	mask-image: none !important;
}

.tabbrowser-tab:not([image]):not([busy]):not([progress]) .tab-label-container {
	margin-left: auto !important;
}

/* If tab close button is not present, don't force favicon to the center */
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]) .tab-throbber,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]) .tab-throbber-fallback,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]):not([busy]) .tab-icon-image,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]):not([image]) .tab-label-container,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]) .tab-icon-stack
{
	margin-left: 0 !important;
}

/* Remove tab icons */
/* tab:not([pinned=true]) .tab-icon-image {
	display: none;
} */

/* Close tab button */
:root {
	--gnome-fill-icon: red !important;
}

.close-icon {
	height: 16px !important;
	padding: 0 !important;
	width: 16px !important;
}

.tab-close-button {
	-moz-appearance: none !important;
	border: none !important;
	box-sizing: content-box;
	/* Avoid deformation on flexbox */
	border-radius: 2px;
	list-style-image: url("../icons/window-close-symbolic.svg") !important;
	height: 16px;
	opacity: .3;
	padding: 0;
	width: 16px;
}

@media (prefers-color-scheme: dark) {
	.tab-close-button {
		list-style-image: url("../icons/window-close-symbolic-light.svg") !important;
	}
}

:root:-moz-window-inactive .tab-close-button:not(#hack) {
	opacity: .18 !important;
}

:root:not(:-moz-window-inactive) .tab-close-button:hover {
	background-color: var(--gnome-button-hover-color) !important;
	border: none !important;
	opacity: 1;
}

:root:not(:-moz-window-inactive) .tab-close-button:active {
	background-color: var(--gnome-button-active-color) !important;
}

.tab-close-button:active:not(:hover) {
	background-image: none !important;
	box-shadow: none !important;
}

/* Tab close button etc. positioning */
.tab-throbber,
.tab-icon-image,
.tab-sharing-icon-overlay,
.tab-icon-sound,
.tab-close-button {
	margin-top: 0 !important;
}

/* Remove blue line above tabs */
.tab-line {
	display: none;
}

/* Move container lines to the top */
.tabbrowser-tab[usercontextid]>.tab-stack>.tab-background {
	border-top: 3px solid var(--identity-tab-color) !important;
}

/* Remove alt colours references for multi tabs*/
.tabbrowser-tab[usercontextid]>.tab-stack>.tab-background>.tab-context-line {
	display: none;
}

.tabbrowser-tab[class*="identity-color-"][pinned] {
	display:flex;
}

/* change background of tabs based on mode to not rely on theme */
.tab-background {
	background-color: var(--gnome-tabbar-tab-background) !important;
	transition: all 200ms;
}
.tabbrowser-tab::after,
.tabbrowser-tab::before {
	border-color: var(--gnome-tabbar-tab-hover-background) !important;
}
#TabsToolbar .toolbarbutton-1 {
	background: var(--gnome-tabbar-tab-background) !important;
	background-color: var(--gnome-tabbar-tab-background) !important;
}
#TabsToolbar .toolbarbutton-1:hover {
	background: var(--gnome-tabbar-tab-hover-background) !important;
	background-color: var(--gnome-tabbar-tab-hover-background) !important;
}
/* Active tab */
.tab-background[selected] {
	background-color: var(--gnome-tabbar-tab-active-background) !important;
	background-image: none !important;
	border: none !important;
	border-image: none !important;
	margin-left: -1px !important;
	margin-right: -1px !important;
	box-shadow: 1px 0 var(--gnome-toolbar-border-color), 1px 0 3px rgba(0, 0, 0, 0.08),
		-1px 0 var(--gnome-toolbar-border-color), -1px 0 3px rgba(0, 0, 0, 0.08),
		inset 0 -1px var(--gnome-toolbar-border-color) !important;
}

.tab-background[selected]:-moz-window-inactive {
	background-color: var(--gnome-inactive-tabbar-tab-active-background) !important;
	border-image: none !important;
}

/* Tab hover */
#TabsToolbar .tabbrowser-tab:hover>.tab-stack>.tab-background:not([selected]) {
	background-color: var(--gnome-tabbar-tab-active-hover-background) !important;
	border-image: none !important;
	box-shadow: inset 0 1px var(--gnome-toolbar-border-color), inset 0 -1px var(--gnome-toolbar-border-color) !important;
}

/* Tabs scroll buttons hover */
#TabsToolbar .scrollbutton-up:not([disabled]):hover,
#TabsToolbar .scrollbutton-down:not([disabled]):hover {
	background-color: var(--gnome-tabbar-tab-active-hover-background) !important;
}

/* Full width tabs */
.tabbrowser-tab:not([style^="max-width"]):not([pinned]),
.tabbrowser-tab[style^="max-width: 100px !important;"]:not([pinned]) {
	max-width: 100% !important;
}

.tabbrowser-tab:not([style^="max-width"]):not([pinned]):not([fadein]),
.tabbrowser-tab[style^="max-width: 100px !important;"]:not([pinned]):not([fadein]) {
	max-width: .1px !important;
}

/* Remove blank spaces on tabs start and end */
#TabsToolbar .titlebar-spacer {
	display: none !important;
}

/* Remove container bottom line indicator */
.tabbrowser-tab[usercontextid]>.tab-stack>.tab-background>.tab-bottom-line {
	display: none;
}

/* Create new container tab indicator */
.tabbrowser-tab[class*="identity-color-"] .tab-content::before {
	content: "";
	display: block;
	background-image: var(#userContext-icons:--identity-icon);
	background: transparent !important;
	-moz-context-properties: fill;
	fill: var(--identity-icon-color);
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center center;
	min-width: 10px;
	height: 10px;
	margin-right: 5px;
	margin-left: 0 !important;
	border-radius: 100%;
}

.tabbrowser-tab[class*="identity-color-"][pinned] .tab-content::before,
.tabbrowser-tab[class*="identity-color-"][image] .tab-content::before,
.tabbrowser-tab[class*="identity-color-"][busy] .tab-content::before,
.tabbrowser-tab[class*="identity-color-"][progress] .tab-content::before {
	right: -10px;
	top: -8px;
	position: relative;
	margin-right: -10px;
}

/* fix pip on small displays */
.tab-icon-overlay[pictureinpicture] {
	top: 3px !important;
	inset-inline-end: 13px !important;
	z-index: 1 !important;
	max-width: 10px;
	max-height: 10px;
}
.tab-close-button {
	margin-inline-end: -6px !important;
}

/* fix spacing on too many tabs */

.tab-icon-overlay:not([pinned], [sharing]),
[pictureinpicture] {
	margin-inline-end: 4px !important;
	margin-inline-start: 4px !important;
}

/* Fix too many tabs text align */
.tab-close-button[pinned],
#tabbrowser-tabs[closebuttons="activetab"]>#tabbrowser-arrowscrollbox>.tabbrowser-tab>.tab-stack>.tab-content>.tab-icon-stack:not([selected]){
	margin-left: 0 !important;
}
.tab-close-button[pinned],
#tabbrowser-tabs[closebuttons="activetab"]>#tabbrowser-arrowscrollbox>.tabbrowser-tab>.tab-stack>.tab-content>.tab-icon-stack[selected] {
	margin-left: auto !important;
}
/* Fix too many tabs scrollbox height increasing with pinned tabs #39 */
#tabbrowser-tabs,
#tabbrowser-tabs arrowscrollbox {
	height: 36px !important;
}
/* Fix proton padding with moving tab (dragging) #45 */
#tabbrowser-tabs[movingtab]{
	padding-bottom:0 !important;
	margin-bottom: 0 !important;
}

/* Fix website with no favicon centred text */
.tabbrowser-tab:not([image]) .tab-icon-overlay:not([pinned], [sharing], [crashed]) .tab-icon-stack {
	margin-left: 0 !important
}
.tabbrowser-tab:not([image]) .tab-icon-stack {
	margin-left: 0 !important
}

/* @media (-moz-proton) { */
	/* Firefox v89 beta tab fix */
	.tab-background {
		border-radius: 0 !important;
		margin-block: 0 !important;
		box-shadow: inset 0 1px var(--gnome-toolbar-border-color), inset 0 -1px var(--gnome-toolbar-border-color) !important;
	}
	/*Align personal bookmarks v89 */
	#personal-bookmarks {
		align-content: center !important;
	}
	/* fix misc spacing between tabs */
	.tabbrowser-tab {
		padding-inline: 0px !important;
		
	}
	.tabbrowser-tab[selected]>.tab-stack>.tab-background {
		margin-left: 0px !important;
		margin-right: 0px !important;
	}
	/* centre text when audio is playing & muted*/
	.tabbrowser-tab:is([soundplaying]) .tab-label-container,
	.tabbrowser-tab[muted] .tab-label-container{
		margin-left: 0 !important;
		margin-right: auto !important
	}
	/* Centre text when tab is loading with the throbber*/
	.tabbrowser-tab:is([busy]) .tab-icon-stack {
		margin-left: auto !important;
	}
/* } */
/* transition fade on hover to emulate safari */
.tabbrowser-tab  > .tab-stack > .tab-background:not([selected]) {
	transition: background-color 80ms !important;
}
.tabbrowser-tab:hover  > .tab-stack > .tab-background:not([selected]) {
	transition: background-color 150ms ease-in !important;
}

/* close button display only on hover */
.tabbrowser-tab:not([pinned]) .tab-close-button {
	opacity: 0;
	visibility: hidden !important;
	transition: all 80ms !important;
}

.tabbrowser-tab:not([pinned]):hover .tab-close-button {
opacity: 1;
visibility: visible !important;
transition: all 150ms ease-in !important;
}


/* hide tab view section*/
#alltabs-button.toolbarbutton-1 {
    visibility: collapse !important;
}
/* no icon align label to centre */
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected]):not([image]) .tab-label-container{
	margin-left: auto !important;
}
/* too many tabs still show close button */
.tab-close-button {
  &[pinned], #tabbrowser-tabs[closebuttons="activetab"][orient="horizontal"] &:not([selected]) {
display: flex !important;
	}}