////////////////////////////////////////////////////////////////////////////////
//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////

=jewel-bg-border($state, $bg-color, $bg-border-radius: 0px)
	@if ($state == "normal")
		@if $flat
			background: $bg-color
			border: 0px solid
		@else
			background: linear-gradient(lighten($bg-color, 5%), darken($bg-color, 5%))
			border: 1px solid darken($bg-color, 15%)
			box-shadow: inset 0 1px 0 lighten($bg-color, 20%)
		border-radius: $bg-border-radius
	
	@else if ($state == "hover")
		@if $flat
			background: darken($bg-color, 5%)
			border: 0px solid
		@else
			background: linear-gradient($bg-color, darken($bg-color, 10%))
			border: 1px solid darken($bg-color, 20%)
	
	@else if ($state == "active") or ($state == "selected")
		@if $flat
			background: darken($bg-color, 15%)
			border: 0px solid
		@else
			background: linear-gradient(darken($bg-color, 10%), darken($bg-color, 20%))
			border: 1px solid darken($bg-color, 30%) 
			box-shadow: inset 0px 1px 3px 0px rgba(50, 50, 50, 0.5)

	@else if ($state == "focus")
		@if $flat
			background: lighten($bg-color, 5%)
			border: 0px solid $bg-color
		@else
			border: 1px solid darken($bg-color, 15%)
			box-shadow: inset 0px 0px 0px 1px rgba(lighten($bg-color, 50%), .5), inset 0 1px 0 rgba(lighten($bg-color, 55%), .6)
	
	@else if ($state == "disabled")
		@if $flat
			background: $disabled-color !important
			border: 0px solid !important
		@else
			background: $disabled-color !important
			border: 1px solid $disabled-border-color !important
		box-shadow: none !important
