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

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

#main-window {
	-moz-appearance: -moz-window-titlebar !important;
}

/* Headerbar top border corners rounded */
:root[tabsintitlebar]:not([inFullscreen]):not([sizemode="maximized"]) #nav-bar {
	border-radius: 12px 12px 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[tabsintitlebar]:not([inFullscreen]) #nav-bar {
		padding-right: 60px !important;
	}
}
/* 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[tabsintitlebar]:not([inFullscreen]) #nav-bar {
		padding-right: 70px !important;
	}
}
/* Window buttons: 3 buttons */
@media (-moz-gtk-csd-minimize-button) and (-moz-gtk-csd-maximize-button) and (-moz-gtk-csd-close-button) {
	:root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
		padding-right: 90px !important;
	}
}

/* Fullscreen headerbar padding for 1 button */
:root[tabsintitlebar][inFullscreen] #nav-bar {
	padding-right: 40px !important;
}

/* Window buttons box */
:root[tabsintitlebar] #titlebar .titlebar-buttonbox-container,
:root[tabsintitlebar] #titlebar-buttonbox-container,
:root[tabsintitlebar][inFullscreen] #window-controls {
	-moz-appearance: none !important;
	padding: 0 3px 0 4px;
	position: absolute !important;
	right: 8px;
	top: 0;
	display: block !important;
}
:root[tabsintitlebar] #titlebar .titlebar-buttonbox {
	-moz-appearance: none !important;
}

/* Window buttons style */
:root[tabsintitlebar] #titlebar .titlebar-button,
:root[tabsintitlebar][inFullscreen] #window-controls toolbarbutton {
	-moz-appearance: none !important;
	border: none !important;
	border-radius: 100px !important;
	height: 16px;
	margin: 16px 4px !important;
	padding: 2px 0 !important;
	width: 16px;
}
:root[tabsintitlebar] #titlebar .titlebar-button .toolbarbutton-icon,
:root[tabsintitlebar][inFullscreen] #window-controls toolbarbutton .toolbarbutton-icon {
	opacity: 0 !important;
}
:root[tabsintitlebar] #titlebar:-moz-window-inactive .titlebar-button .toolbarbutton-icon,
:root[tabsintitlebar][inFullscreen] #window-controls:-moz-window-inactive toolbarbutton .toolbarbutton-icon {
	opacity: 0 !important;
}

/* Remove close and minimize buttons from fullscreen buttons */
:root[tabsintitlebar][inFullscreen] #window-controls #close-button,
:root[tabsintitlebar][inFullscreen] #window-controls #minimize-button,
:root[tabsintitlebar][inFullscreen] #titlebar .titlebar-buttonbox-container,
:root[tabsintitlebar][inFullscreen] #titlebar .titlebar-buttonbox .titlebar-close,
:root[tabsintitlebar][inFullscreen] #titlebar .titlebar-buttonbox .titlebar-min {
	display: none !important;
}

/* Left window buttons */
@media (-moz-gtk-csd-reversed-placement) {
	:root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
		padding-right: 3px !important;
	}

	/* Window buttons box */
	:root[tabsintitlebar] #titlebar .titlebar-buttonbox-container {
		padding: 0 3px 0 4px;
		left: 8px;
		right: auto;
	}

	/* Window controls: at least 1 button */
	@media (-moz-gtk-csd-minimize-button), (-moz-gtk-csd-maximize-button), (-moz-gtk-csd-close-button) {
		:root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
			padding-left: 60px !important;
		}
	}
	/* Window controls: 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[tabsintitlebar]:not([inFullscreen]) #nav-bar {
			padding-left: 70px !important;
		}
	}
	/* Window controls: 3 buttons */
	@media (-moz-gtk-csd-minimize-button) and (-moz-gtk-csd-maximize-button) and (-moz-gtk-csd-close-button) {
		:root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
			padding-left: 90px !important;
		}
	}
}

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