/* Tabs bar  */

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

:root {
	--space-above-tabbar: 0 !important;
}

#TabsToolbar:not([inFullscreen]) > .toolbar-items {
	margin-bottom: -1px !important;
}

/* Fix tabs bar icon sizes */
#TabsToolbar {
    --toolbarbutton-inner-padding: var(--toolbarbutton-inner-padding) !important;
}
/* Tabs bar height */
#tabbrowser-tabs,
#tabbrowser-tabs arrowscrollbox {
	height: auto !important;
	min-height: auto !important;
}
tab > stack {
	height: 36px !important;
	min-height: 36px !important;
}

/* Remove hover effects on tab bar buttons */
#TabsToolbar {
	--toolbarbutton-active-background: transparent !important;
	--toolbarbutton-hover-background: transparent !important;
	padding: 0 3px !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=true]) {
	margin: 0 !important;
}
.tabbrowser-tab {
	border: 0 !important;
	padding-inline: 0 !important;
}
#TabsToolbar {
	padding: 0 !important;
}
#TabsToolbar .toolbarbutton-1:last-child {
	margin-right: 4px !important;
}

/* Tabs borders */
.tabbrowser-tab {
	border-right: 1px solid var(--nordic-toolbar-border-color) !important;
}
#TabsToolbar {
	margin-right: -1px !important;
}
#tabbrowser-tabs[overflow=true] .tabbrowser-tab[first-visible-unpinned-tab] {
	border-left: 1px solid var(--nordic-toolbar-border-color) !important;
}

/* Tab labels */
tab {
	color: var(--nordic-tabbar-tab-color) !important;
	font-family: Cantarell, inherit;
	font-weight: bold;
	font-size: 1em;
}
tab:hover {
	color: var(--nordic-tabbar-tab-hover-color) !important;
}
.tab-content[selected],
tab[selected] {
	color: var(--nordic-tabbar-tab-active-color) !important;
}
tab:-moz-window-inactive {
	color: var(--nordic-inactive-tabbar-tab-color) !important;
}
tab[selected]:-moz-window-inactive {
	color: var(--nordic-inactive-tabbar-tab-active-color) !important;
}

/* Reset tab background */
.tab-background {
	border-radius: 0 !important;
	box-shadow: none !important;
	margin-block: 0 !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 */
.tabbrowser-tab .tab-close-button {
	margin-left: auto !important;
}

/* Force tab favicon to the center */
.tabbrowser-tab:not([class*="identity-color-"]) .tab-icon-stack {
	margin-left: auto !important;
}

/* Tab icon margin */
.tabbrowser-tab:not([pinned]) .tab-icon-stack {
	margin-right: 2px;
}


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

/* Tab buttons */
.tab-icon-overlay,
.tab-close-button {
	-moz-appearance: none !important;
	border: 0px solid transparent;
	box-sizing: content-box; /* Avoid deformation on flexbox */
	border-radius: 99px !important;
	padding: 4px !important;
	background-size: 24px;
}
:root:not(:-moz-window-inactive) .tab-icon-overlay:hover,
:root:not(:-moz-window-inactive) .tab-close-button:hover {
	background-image: var(--gnome-tabbar-close-hover);
}

.tab-icon-stack:is([soundplaying], [muted], [activemedia-blocked]) image {
	 margin: auto !important;
}


/* Close tab button */
:root {	
	--nordic-fill-icon: red !important;
}
.tab-close-button {
	list-style-image: url("../icons/window-close-symbolic.svg") !important;
	fill: var(--nordic-toolbar-color) !important;
	fill-opacity: 1 !important;
	-moz-context-properties: fill, fill-opacity !important;
	height: 16px !important;
	opacity: 1 !important;
	width: 16px !important;
}

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

:root:not(:-moz-window-inactive) .tab-close-button:active {
	background-image: var(--nordic-button-active-background) !important;
	box-shadow: var(--nordic-button-active-box-shadow) !important;
	border-color: var(--nordic-button-active-border-color) !important;
	border-bottom-color: var(--nordic-button-active-border-color) !important;
	border-top-color: var(--nordic-button-active-border-accent-color) !important;
}

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

/* Autohide*/

.tabbrowser-tab:not([selected]) .tab-close-button {
	visibility: hidden;
}
.tabbrowser-tab:hover .tab-close-button {
	visibility: visible;
}

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

.tab-background, #TabsToolbar .toolbar-items {
	background: var(--nordic-toolbar-background) !important;
}
/* Active tab */
.tab-background[selected] {
	background: var(--nordic-tabbar-tab-active-background) !important;
	border-bottom: 2px solid var(--nordic-tabbar-tab-active-border-bottom-color) !important;
}
.tab-background[selected]:-moz-window-inactive {
	background-color: var(--nordic-inactive-tabbar-tab-active-background) !important;
	border-bottom-color: var(--nordic-inactive-tabbar-tab-active-border-bottom-color) !important;
}

/* Tab hover */
:root:not(:-moz-window-inactive) .tabbrowser-tab:hover > .tab-stack > .tab-background[selected] {
	background-color: var(--nordic-tabbar-tab-active-hover-background) !important;
}
.tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected]),
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected]),
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-tab:hover > .tab-stack > .tab-background > .tab-line:not([selected]) {
	background-color: transparent !important;
}
:root:not(:-moz-window-inactive) .tabbrowser-tab:hover > .tab-stack > .tab-background:not([selected]) {
	background-color: var(--nordic-tabbar-tab-hover-background) !important;
	border-image: none !important;
	border-bottom: 3px solid var(--nordic-tabbar-tab-hover-border-bottom-color) !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-context-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;
}
