.botiga-metabox {
	display: flex;
}

.botiga-metabox-tabs {
	display: flex;
	flex-direction: column;
	width: 225px;
	background-color: #f7f7f7;
	border: 1px solid #ddd;

	a {
		position: relative;
		display: flex;
		color: #1a1a1a;
		padding: 15px 20px;
		text-decoration: none;
		transition: all .1s;
		border-bottom: 1px solid #ddd;

		&:last-child {
			border-bottom: 0;
		}

		&.active:after {
			content: "";
			position: absolute;
			z-index: 1;
			top: calc(50% - 8px);
			right: -1px;
			pointer-events: none;
			border: solid transparent;
			border-right-color: #fff;
			border-width: 8px;
		}

		&:focus,
		&:active {
			box-shadow: none;
			outline: none;
		}

		&:hover {
			background-color: #eee;
		}

		&.active {
			color: #fff;
			background-color: #007cba;
		}
	}
}

.botiga-metabox-contents {
	flex: 1;
	display: flex;
	flex-direction: column;
	border: 1px solid #ddd;
}

.botiga-metabox-tabs {

	+ .botiga-metabox-contents {
		border-left: 0;
	}
}

.botiga-metabox-content {
	display: flex;
	flex-direction: column;

	&:not(.active) {
		display: none;
	}
}

.botiga-metabox-content-title {
	display: none;
	margin: 0;
	padding: 10px 15px;
	color: #1e1e1e;
	background-color: #eee;
}

.botiga-metabox-field {
	display: flex;
	flex-wrap: wrap;
	grid-gap: 20px;
	padding: 20px;

	&:first-child {
		border-top: none;
	}

	&:last-child {
		border-bottom: none;
	}
}

.botiga-metabox-field-hidden{
	display: none;
}

.botiga-metabox-field-separator-before {
	border-top: 1px solid #eee;
}

.botiga-metabox-field-separator-after {
	border-bottom: 1px solid #eee;
}

.botiga-metabox-field-inline {
	flex-direction: column;
}

.botiga-metabox-field-title {
	width: 30%;
	max-width: 275px;
	display: flex;
	flex-wrap: wrap;
	grid-gap: 5px;
	flex-direction: column;

	h4 {
		margin: 0;
		color: #1e1e1e;
	}

	small {
		opacity: 0.75;

		code{
			font-size: 1em;
		}
	}
}

.botiga-metabox-field-content {
	flex: 1
}

.botiga-metabox-field-description {
	font-size: 80%;
	opacity: 0.75;
	margin-top: 10px;

	code{
		font-size: 1em;
	}
}

.botiga-metabox-field-text {

	input {
		width: 50%;
		max-width: 100%;
	}
}

.botiga-metabox-field-number {

	input {
		width: 100px;
		max-width: 100%;
	}
}

.botiga-metabox-field-textarea {

	textarea {
		width: 100%;
		max-width: 100%;
		min-height: 100px;
		vertical-align: top;
	}
}

.botiga-metabox-field-checkbox {

	label {
		display: flex;
		grid-gap: 6px;
		align-items: center;
		user-select: none;

		input {
			margin: 0;
		}
	}
}

.botiga-metabox-field-switcher {

	label {
		display: inline-flex;
		grid-gap: 6px;
		align-items: center;
		user-select: none;
	}

	i {
		position: relative;
		overflow: hidden;
		display: flex;
		width: 45px;
		height: 22px;
		background-color: #c8c8c8;
		border-radius: 20px;
		transition: all 0.2s;

		&:before {
			content: "";
			position: absolute;
			display: block;
			width: 14px;
			height: 14px;
			top: 4px;
			left: 6px;
			background-color: #fff;
			border-radius: 20px;
			transition: all 0.1s;
		}
	}

	input {
		display: none;

		&:checked {

			+i {
				background-color: #2271b1;

				&:before {
					left: 26px;
				}
			}
		}
	}
}

.botiga-metabox-field-choices-images {
	display: flex;
	flex-wrap: wrap;
	grid-gap: 2px;

	label {
		display: flex;
		user-select: none;
	}

	figure {
		padding: 4px;
		margin: 0;
		border: 2px solid transparent;
		border-radius: 4px;
		transition: all .2s;
		max-width: 80px;
		max-height: 80px;

		img {
			width: 100%;
			vertical-align: top;
		}
	}

	input {
		display: none;

		&:checked {

			+figure {
				border-color: #1e1e1e;

				&:before {
					left: 26px;
				}
			}
		}
	}
}

.botiga-metabox-field-uploads-content,
.botiga-metabox-field-repeater-content{
	display: flex;
	flex-direction: column;
	align-items: flex-start;

	ul{
		margin: 0;
		padding: 0;
		list-style: none;
		width: 100%;

		li{
			margin: 0;
			padding: 0;
			display: flex;
			align-items: center;
			justify-content: flex-start;
			margin-bottom: 10px;

			&.hidden{
				display: none;
			}

			span{
				cursor: pointer;
				font-size: 20px;
				padding: 5px;
				width: auto;
				height: auto;
				user-select: none;
				color: #1e1e1e;
				opacity: 0.5;
				transition: all .2s;

				&:hover{
					opacity: 1;
				}

				&.dashicons-trash{
					color: #a00;
					font-size: 18px;
				}
			}
		}
	}

	input{
		width: 50%;
		max-width: 100%;
		max-width: 100%;
		margin-right: 5px;
	}
}

.botiga-metabox-field-size-chart{

	ul{
		margin: 0;
		padding: 0;
		list-style: none;

		li{
			margin-bottom: 20px;

			&.hidden{
				display: none;
			}
		}
	}

	table{
		width: 100%;
    border-spacing: 0;
		border-collapse: collapse;
		background-color: #fff;

		th,
		td{
			padding: 15px;
			border: 1px solid rgba(0,0,0,0.1);

			&:last-child{
				width: 1%;
				min-width: 75px;
			}
		}

		thead{
			text-align: center;

			label{
				display: inline-flex;
				grid-gap: 5px;
				justify-content: center;
				align-items: center;
			}
		}

		tbody{

			input{
				width: 100%;
				max-width: 100%;
				text-align: center;
			}

			tr{

				&:nth-child(2){

					td:not(:last-child){
						background-color: #eee;
					}
				}
			}
		}

		tfoot{
			text-align: right;
		}
	}

	.botiga-buttons{
		display: flex;
		grid-gap: 10px;
		justify-content: center;
		align-items: center;

		a{
			display: flex;
			justify-content: center;
			align-items: center;
			width: 16px;
			height: 16px;
			font-size: 14px;
			line-height: 1em;
			font-weight: bold;
			padding: 2px;
			border-radius: 4px;
			user-select: none;
			box-shadow: none;
			text-decoration: none;

			&:active{
				opacity: 0.5;
			}
		}
	}

	.botiga-add-col,
	.botiga-add-row{
		color: #27ae60;
		background-color: #d5f5e3;
	}

	.botiga-del-col,
	.botiga-del-row{
		color: #e74c3c;
		background-color: #f2d7d5;
	}

	.botiga-remove{
	  color: #fff;
	  border-color: #d50204;
	  background: #d50204;

	  &:hover,
	  &:focus{
	    border-color: #b32d2e;
	    background: #b32d2e;
	  }

	  &:focus{
	    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #b32d2e;
	  }

	  &:active{
	    border-color: #b32d2e;
	    background: #b32d2e;
	  }
	}

	.botiga-duplicate{
		display: flex;
		justify-content: center;
		align-items: center;
		user-select: none;
		box-shadow: none;
		text-decoration: none;

		&:active{
			opacity: 0.5;
		}

		svg{
			width: 16px;
			height: 16px;
			fill: #000;
		}
	}
}

.botiga-metabox-field-media{

	figure{
	  display: flex;
	  justify-content: center;
	  align-items: center;
	  margin: 0;
	  padding: 5px;
	  width: 75px;
	  height: 75px;
	  border: 1px solid #e5e5e5;
	  background-color: #fff;
	  box-sizing: border-box;

	  img{
	    max-width: 100%;
	    height: auto;
	  }
  }

	input{
		display: none;
	}

	.botiga-button-remove{
	  color: #b32d2e;
	  border-color: #b32d2e;
	  background: #fff8f8;

	  &:hover,
	  &:focus,
	  &:active{
		  color: #b32d2e;
	    border-color: #b32d2e;
	    background: #fff0f0;
	  }

	  &:focus{
	    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #b32d2e;
	  }
	}
}

.botiga-metabox-field-select-ajax{

	select{
		display: none;
		width: 100%;
  }

  ul{
  	margin: 0;
  	padding: 0;
  	list-style: none;
  	vertical-align: top;

  	li{
  		margin: 0;
  		padding: 0;
  	}
  }

  .select2-container--default .select2-selection--multiple .select2-selection__rendered{
  	width: auto;
  	display: inline;
  	padding: 0;
  }

  .select2-container .select2-search--inline .select2-search__field{
		margin: 0;
		padding: 0;
  }

  .select2-container--default.select2-container--focus .select2-selection--multiple{
  	border-color: #aaa;
  }

  .select2-container--default .select2-selection--multiple{
  	padding: 0 5px;
  }

  .select2-container--default .select2-selection--multiple .select2-selection__choice{
  	margin-left: 0;
  }

  .botiga-select2-clear{
  	display: block;
  	width: 100%;
  	clear: both;
  }

  .botiga-metabox-field-content{
  	min-height: 32px;
  }
}

.botiga-metabox-field-wc-attributes{

	ul{
		margin: 0;
		padding: 0;
		list-style: none;
		display: flex;
		grid-gap: 5px;
		flex-direction: column;

		li{
			margin: 0;
			padding: 0;
			display: flex;
			max-width: 300px;
			align-items: center;
			border: 1px solid #e5e5e5;
			background-color: #fdfdfd;
			border-radius: 3px;

			&:hover{
				border-color: #ccc;
			}

			label{
				display: flex;
				grid-gap: 5px;
				align-items: center;
				flex: 1;
				padding: 8px;
				user-select: none;

				input{
					margin: 0;
				}
			}

			.botiga-sortable-move{
				cursor: pointer;
				padding: 8px;
			}
		}
	}
}

.botiga-metabox-field-code-editor{

	.CodeMirror-wrap{
		border: 1px solid #eee;
	}
}

.botiga-metabox-field-media-content{
	display: flex;
	grid-gap: 10px;
	align-items: center;
}

.botiga-metabox-field-media-button{
  flex: 1;
  display: flex;
  grid-gap: 5px;
}

.botiga-metabox-field-no-padding{
	padding-top: 0;
	padding-bottom: 0;
}

body:not(.block-editor-page){
	
	#botiga_metabox{

		.inside {
			margin: 0;
			padding: 0;
		}

		.botiga-metabox-tabs{
			border-top: 0;
			border-left: 0;
			border-bottom: 0;
		}

		.botiga-metabox-contents{
			border: 0;
		}
	}
}

#side-sortables {

	.botiga-metabox-tabs {
		display: none;
	}

	.botiga-metabox-content-title,
	.botiga-metabox-content:not(.active) {
		display: block;
	}

	.botiga-metabox-field {
		grid-gap: 8px;
		padding: 10px 15px;
		flex-direction: column;
	}

	.botiga-metabox-field-title {
		width: auto;
		font-size: 12px;

		&:empty{
			display: none;
		}
	}

	.botiga-metabox-contents {
		border-left: none;
		border-right: none;
	}

	#botiga_metabox {

		.postbox-header {
			border-top: none;

			h2 {
				color: #1e1e1e;
				padding: 0 0 0 15px;
				font-size: 13px;
				font-weight: 500;
			}
		}

		.inside {
			padding: 0;
		}
	}

	.botiga-metabox-field-text,
	.botiga-metabox-field-uploads-content,
	.botiga-metabox-field-repeater-content {

		input{
			width: 100%;
		}
	}
}

@media only screen and (max-width: 991px) {

	.botiga-metabox-tabs {
		display: none;
	}

	.botiga-metabox-content-title,
	.botiga-metabox-content:not(.active) {
		display: block;
	}

	.botiga-metabox-field {
		grid-gap: 8px;
		padding: 15px;
		flex-direction: column;
	}

	.botiga-metabox-field-title {
		width: auto;

		&:empty{
			display: none;
		}
	}

	.botiga-metabox-contents {
		border-left: none;
		border-right: none;
	}

	#botiga_metabox {

		.inside {
			padding: 0;
		}
	}

	.botiga-metabox-field-text,
	.botiga-metabox-field-uploads-content,
	.botiga-metabox-field-repeater-content {

		input{
			width: 100%;
		}
	}
}