/* Tabs bar  */

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

#tabbrowser-tabs,
#tabbrowser-tabs:-moz-window-inactive {
	background: none !important;
}

/* Tabs bar height */
#tabbrowser-tabs,
#tabbrowser-tabs arrowscrollbox {
	height: initial !important;
	min-height: initial !important;
	margin: 0 2px !important;
	padding-top: 2px !important;
}
tab > stack {
	height: 24px !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;
	box-shadow: inset 0 -2px 3px rgba(0,0,0, 0.05), inset 0 -1px 1px rgba(0,0,0, 0.05);
}

#TabsToolbar:-moz-window-inactive {
	box-shadow: inset 0 -2px 3px rgba(0,0,0, 0.05), inset 0 -1px 1px rgba(0,0,0, 0.05);
}

/* 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;
}

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

/* Add tab separators */
.tabbrowser-tab:not([selected=true]):not(:hover) {
	border-image: linear-gradient(to bottom, transparent 25%, var(--gnome-button-border-color) 25%, var(--gnome-button-border-color) 85%, transparent 84%) 0 1 0 0 / 0 1px 0 0 stretch !important;
}

.tabbrowser-tab + .tabbrowser-tab:hover,
.tabbrowser-tab + .tabbrowser-tab[selected=true] {
	box-shadow: -4px 0 0 -3px var(--gnome-tabstoolbar-background) !important;
}

.tabbrowser-tab:-moz-window-inactive + .tabbrowser-tab:-moz-window-inactive:hover,
.tabbrowser-tab:-moz-window-inactive + .tabbrowser-tab:-moz-window-inactive[selected=true] {
	box-shadow: -4px 0 0 -3px var(--gnome-inactive-tabstoolbar-background) !important;
}

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

/* Tab labels */
tab {
	color: var(--gnome-tabbar-tab-color) !important;
	font-family: Cantarell, inherit;
	font-weight: normal;
	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 {
	min-width: 100% !important;
	padding: 0 12px 0 16px !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[muted="true"],
.tab-icon-sound[activemedia-blocked="true"] {
	margin-left: auto !important;
}
.tabbrowser-tab:not([soundplaying]):not([muted]):not([activemedia-blocked]) .tab-close-button {
	margin-left: auto !important;
}
.tab-icon-sound {
	margin-right: 6px;
}

/* If tab close button is not present, don't force favicon to the center */
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]) .tab-throbber,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]) .tab-throbber-fallback,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]):not([busy]) .tab-icon-image,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]):not([image]) .tab-label-container {
	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 !important;
	list-style-image: url("../icons/window-close-symbolic.svg") !important;
	height: 16px !important;
	opacity: 0.75;
	padding: 0 !important;
	width: 16px !important;
	transition: all 200ms cubic-bezier(0.0, 0.0, 0.2, 1) !important;
}

@media (prefers-color-scheme: dark) {
	.tab-close-button {
		list-style-image: url("../icons/window-close-symbolic-dark.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;
} */

.tabbrowser-tab[usercontextid] > .tab-stack > .tab-background > .tab-bottom-line {
	display: none;
}

.tab-background {
	background-color: var(--gnome-tabbar-tab-background) !important;
	box-shadow: none !important;
	margin: 0 !important;
	padding: 0 !important;
	transition: all 200ms cubic-bezier(0.0, 0.0, 0.2, 1),
	            background-color 0,
	            box-shadow 0 !important; 
}

/* Active tab */
.tab-background[selected=true] {
	background-color: var(--gnome-tabbar-tab-active-background) !important;
	background-image: none !important;
	border-radius: 0 0 0 0;
	border: none !important;
	border-image: url("../icons/tab-active-background.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
}
.tab-background[selected=true]:-moz-window-inactive {
	background-color: var(--gnome-inactive-tabbar-tab-active-background) !important;
	border-radius: 0 0 0 0;
	border: none !important;
	border-image: url("../icons/tab-inactive-active-background.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
	border-top: none !important;
}

/* Tab hover */
:root:not(:-moz-window-inactive) .tabbrowser-tab:hover > .tab-stack > .tab-background[selected=true] {
	background-color: var(--gnome-tabbar-tab-active-background) !important;
	border-radius: 0 0 0 0;
	border: none !important;
	border-image: url("../icons/tab-active-background.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
	border-top: none !important;
}
.tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]),
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]),
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background > .tab-line:not([selected=true]) {
	background-color: var(--gnome-tabbar-tab-hover-background) !important;
	border-radius: 5px 5px 0 0;
	border: none !important;
	border-image: url("../icons/tab-hover-background.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
}
.tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]):-moz-window-inactive,
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]):-moz-window-inactive,
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background > .tab-line:not([selected=true]):-moz-window-inactive {
	background-color: var(--gnome-tabbar-tab-hover-background) !important;
	border-radius: 5px 5px 0 0;
	border: none !important;
	border-image: url("../icons/tab-inactive-hover-background.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
}

@media (prefers-color-scheme: dark) {
	/* Active tab */
	.tab-background[selected=true] {
		border-image: url("../icons/tab-active-background-dark.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
	}
	.tab-background[selected=true]:-moz-window-inactive {
		border-image: url("../icons/tab-inactive-active-background-dark.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
	}

	/* Tab hover */
	:root:not(:-moz-window-inactive) .tabbrowser-tab:hover > .tab-stack > .tab-background[selected=true] {
		border-image: url("../icons/tab-active-background-dark.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
	}
	.tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]),
	#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]),
	#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background > .tab-line:not([selected=true]) {
		border-image: url("../icons/tab-hover-background-dark.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !important;
	}
	.tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]):-moz-window-inactive,
	#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected=true]):-moz-window-inactive,
	#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background > .tab-line:not([selected=true]):-moz-window-inactive {
		border-image: url("../icons/tab-inactive-hover-background-dark.svg") 8 12 8 12 / 8px 12px 8px 12px stretch !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;
}

/* 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: var( --identity-tab-color);
	-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: auto !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;
}
