/* GNOME CSD styles for headerbar on Firefox [tabsintitlebar] */

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

:root[tabsintitlebar],
:root[customtitlebar] {
	/* Always show nav bar window buttons*/
	#nav-bar > .titlebar-buttonbox-container {
		display: flex !important;
	}

	#toolbar-menubar, #TabsToolbar {
		/* Always hide menu bar window buttons*/
		& > .titlebar-buttonbox-container {
			display: none !important;
		}
	}
}

/* Headerbar top border corners rounded */
:root[tabsintitlebar][sizemode="normal"]:not([gtktiledwindow="true"]) #nav-bar {
	border-radius: env(-moz-gtk-csd-titlebar-radius, 4px) env(-moz-gtk-csd-titlebar-radius, 4px) 0 0 !important;
}

/* Window buttons: at least 1 button */
@media (-moz-gtk-csd-minimize-button), (-moz-gtk-csd-maximize-button), (-moz-gtk-csd-close-button) {
	:root {
		--navbar-csd-offset: 50px;
	}
}
/* Window buttons: at least 2 buttons */
@media (-moz-gtk-csd-minimize-button) and (-moz-gtk-csd-maximize-button),
       (-moz-gtk-csd-minimize-button) and (-moz-gtk-csd-close-button),
       (-moz-gtk-csd-maximize-button) and (-moz-gtk-csd-close-button) {
	:root {
		--navbar-csd-offset: 90px;
	}
}
/* Window buttons: 3 buttons */
@media (-moz-gtk-csd-minimize-button) and (-moz-gtk-csd-maximize-button) and (-moz-gtk-csd-close-button) {
	:root{
		--navbar-csd-offset: 120px;
	}
}

:root[tabsintitlebar] #titlebar .titlebar-buttonbox {
	-moz-appearance: none !important;
}

/* Window buttons style */
:root[tabsintitlebar] #titlebar .titlebar-button,
:root[tabsintitlebar][inFullscreen] #window-controls toolbarbutton {
	border: 1px solid var(--nordic-button-border-color) !important;
	border-color: transparent !important;
	border-radius: 5px !important;
	height: 30px;
	margin: 7px -2px !important;
	padding: 0 2px !important;
	width: 30px;
}

:root[tabsintitlebar] #titlebar .titlebar-button .toolbarbutton-icon,
:root[tabsintitlebar][inFullscreen] #window-controls toolbarbutton .toolbarbutton-icon {
	width: 16px;
}
:root[tabsintitlebar] #titlebar:-moz-window-inactive .titlebar-button .toolbarbutton-icon,
:root[tabsintitlebar][inFullscreen] #window-controls:-moz-window-inactive toolbarbutton .toolbarbutton-icon {
	opacity: .5 !important;
}

/* Remove close and minimize buttons from fullscreen buttons */
:root[tabsintitlebar][inFullscreen] #window-controls #close-button,
:root[tabsintitlebar][inFullscreen] #window-controls #minimize-button {
	display: none;
}

/* Remove tabsbar titlebar blank spaces */
:root[tabsintitlebar] #TabsToolbar .titlebar-placeholder {
	display: none !important;
}

/* Prevent menubar from breaking */
:root[tabsintitlebar] #toolbar-menubar:not([inactive=true]) {
	height: 30px !important;
	margin-bottom: 8px;
}

/* Remove default style of titlebar */
:root[tabsintitlebar] #titlebar {
	-moz-appearance: none !important;
}

/* Fix the issue when dragging tabs */
:root[tabsintitlebar] #navigator-toolbox[movingtab] #TabsToolbar {
	padding-bottom: 0 !important;
}

/* FF 60 fixes */
:root[tabsintitlebar] #titlebar[style="margin-bottom: -1px;"] {
    margin-bottom: -38px !important;
}
:root[tabsintitlebar] #titlebar-content {
	display: block !important;
	position: absolute;
	height: 38px !important;
	top: 0 !important;
}
:root[tabsintitlebar] #titlebar-buttonbox {
	height: auto !important;
	padding: 0 !important;
	margin: 0 !important;
}
:root[tabsintitlebar] #titlebar-content .titlebar-button {	
	padding: 0 7px !important;
}
