@charset "UTF-8";

/**************
 * Scrollbars *
 **************/

scrollbar {

	background-color: gtk("@theme_bg_color");
	border-width: 0px;
	border-color: gtk("@theme_bg_color");
	padding: 5px;

	&.vertical {

		&:dir(rtl) {
			border-right: 1px solid gtk("@borders");
		}

		&:dir(ltr) {
			border-left: 1px solid gtk("@borders");
		}

		&.right {
			&:dir(rtl) {
				border-right: none;
			}
			border-left: 1px solid gtk("@borders");
		}

		&.left {
			&:dir(ltr) {
				border-left: none;
			}
			border-right: 1px solid gtk("@borders");
		}
	}

	&.horizontal {
		border-top: 1px solid gtk("@borders");

		&.bottom {
			border-top: 1px solid gtk("@borders");
		}

		&.top {
			border-top: none;
			border-bottom: 1px solid gtk("@borders");
		}
	}

	button {
		min-width: 14px;
		min-height: 14px;
		margin: 0px;
		padding: 0px 0px;
		border: none;
		border-radius: 0px;
		background-image: none;
		background-color: transparent;
		color: transparent;
		box-shadow: none;
		&:hover {
			border: none;
			background-image: none;
			background-color: gtk("@theme_bg_color");
			color: transparent;
		}
		&:active,
		&:active:hover {
			border: none;
			background-image: none;
			background-color: gtk("@theme_bg_color");
			color: transparent;
		}
		&:disabled {
			border: none;
			background-color: gtk("@theme_bg_color");
			background-image: none;
			color: transparent;
		}
	}

	// Overlay Scrollbars
	&.dragging,                                                             // if this isn't set, the scrollbars don't update their size correctly
  &.hovering {
		opacity: 0.991;
	} // probably a gtk bug
	&.overlay-indicator:not(.dragging):not(.hovering) {
		opacity: 0.999;
	} //

	&.overlay-indicator {
		border: none;

		&.vertical {
			border:none;
		}

		&.horizontal {
			border:none;
		}

		background: none;

		slider {
			background-image: gtkoverlayalpha(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_foreground_normal"), 0.5*0.5*0.7), 0.75);
		}
	}

	trough {
		margin: -1px;
		transition-duration: 0.1s;
		min-width: 6px;
		min-height: 14px;
		border-radius: 8px;
		background-color: transparent;
		border: 1px solid transparent;
	}

	&:hover {
		trough {
			background-color: gtkalpha(gtk("@theme_button_foreground_normal"), 0.2*0.5);
			border: 1px solid gtkalpha(gtk("@theme_button_foreground_normal"), 0.2);

			slider {
				background-image: gtkoverlay(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_foreground_normal"), 0.5*0.5));
				box-shadow: 0 0 0 1px gtkalpha(gtk("@theme_button_foreground_normal"), 0.5*0.9) inset;

				&:hover {
					background-image: gtkoverlay(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_decoration_hover"), 0.5));
					box-shadow: 0 0 0 1px gtkalpha(gtk("@theme_button_decoration_hover"), 0.9) inset;
				}
			}
		}
	}

	&.horizontal trough {
		min-width: 14px;
		min-height: 6px;
	}

	*:focus ~ &,
	& ~ *:focus {

		&:hover {
			slider {
				background-image: gtkoverlay(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_decoration_hover"), 0.5));
				box-shadow: 0 0 0 1px gtkalpha(gtk("@theme_button_decoration_hover"), 0.9) inset;
			}
		}

		&.overlay-indicator {
			slider {
				background-image: gtkoverlayalpha(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_decoration_focus"), 0.5*0.7), 0.75);
			}

			&:hover {
				slider {
					background-image: gtkoverlay(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_decoration_hover"), 0.5));
					box-shadow: 0 0 0 1px gtkalpha(gtk("@theme_button_decoration_hover"), 0.9) inset;
				}
			}
		}
	}

	slider {
		margin: -9px;
		margin-bottom: -6px;
		margin-top: -6px;
		transition-duration: 0.1s;
		min-width: 6px;
		min-height: 30px;
		border-radius: 15px;
		background-clip: padding-box;
		background-image: gtkoverlay(gtk("@theme_bg_color"), gtkalpha(gtk("@theme_button_foreground_normal"), 0.5*0.5*0.7));

		// To keep the ability to drag the slider from the edge of the screen
		border: 5px solid transparent;
		box-shadow: 0 0 0 1px gtkalpha(gtk("@theme_button_foreground_normal"), 0.5*0.7*0.9) inset;

	}

	&.horizontal slider {
		margin: -9px;
		margin-left: -6px;
		margin-right: -6px;
		transition-duration: 0.1s;
		min-width: 30px;
		min-height: 6px;
	}
}
