@import "mixins";
@import "icons";
@import "job-listings";

$primary: 			#999; 									/* Primary colour for buttons (alt) */
$primarytext: 		desaturate(lighten($primary, 50%), 18%);		/* Text on primary colour bg */

$secondary: 		desaturate(lighten($primary, 40%), 18%);		/* Secondary buttons */
$secondarytext:	 	desaturate(darken($secondary, 60%), 18%);		/* Text on secondary colour bg */

$highlight: 		adjust-hue($primary, 150); 						/* Prices, In stock labels, sales flash */
$highlightext:		desaturate(lighten($highlight, 50%), 18%);	/* Text on highlight colour bg */

$contentbg: 		#fff; 										/* Content BG - Tabs (active state) */
$subtext: 			#777; 										/* small, breadcrumbs etc */

@mixin display-icon() {
	display: inline-block;
	width: 16px;
	height: 16px;
	-webkit-font-smoothing: antialiased;
	font-size: 16px;
	font-family: "job-manager" !important;
	text-decoration: none;
	font-weight: normal;
	font-style: normal;
	vertical-align: top;
	font-size: 16px;
	margin: 0 2px 0 0;

	*overflow: auto;
	*zoom: 1;
	*display: inline;
}

.display-icon {

	@include display-icon();
}

/* =Global styles/layout
-------------------------------------------------------------- */
.job-manager-message,
.job-manager-error,
.job-manager-info {
	padding: 1em 2em 1em 3.5em !important;
	margin-bottom: 2em;
	position: relative;
	background-color: lighten($secondary, 5%);
	color: $secondarytext;
	border-top: 3px solid $primary;
	list-style: none outside !important;
	width: auto;

	@include clearfix();
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

	&::before {
		content: "";
		font-family: sans-serif;
		display: inline-block;
		position: absolute;
		top: 1em;
		left: 1.5em;
	}

	li {
		list-style: none outside !important;
		padding-left: 0 !important;
		margin-left: 0 !important;
	}

	&.job-manager-message {
		border-top-color: #8fae1b;

		&::before {
			color: #8fae1b;
			content: "\2713";
		}
	}

	&.job-manager-info {
		border-top-color: #1e85be;

		&::before {
			color: #1e85be;
			content: "i";
			font-family: Times, Georgia, serif;
			font-style: italic;
		}
	}

	&.job-manager-error {
		border-top-color: #b81c23;

		&::before {
			color: #b81c23;
			content: "\00d7";
			font-weight: 700;
		}
	}
}

.job-manager-form {

	fieldset {
		margin: 0 0 1em 0;
		padding: 0 0 1em 0;
		line-height: 2em;
		border: 0;
		border-bottom: 1px solid #eee;

		@include clearfix();

		label:not(.full-line-checkbox-field label) {
			display: block;
			margin: 0;
			width: 29%;
			float: left;
			vertical-align: middle;

			small {
				opacity: 0.75;
				font-size: 0.83em;
			}
		}
		.full-line-checkbox-field label {
			display: inline-block;
		}

		div.field:not(.full-line-checkbox-field) {
			width: 70%;
			float: right;
			vertical-align: middle;
		}

		.wp-editor-container {
			border: 1px solid #ccc;
			-webkit-border-radius: 3px;
			-moz-border-radius: 3px;
			border-radius: 3px;
		}

		.account-sign-in {

			.button {
				margin-right: 0.5em;

				&::before {

					@include display-icon();
					content: "\e808";
				}
			}
		}

		abbr.required {
			color: red;
			font-weight: bold;
			border: 0;
		}

		input.input-text,
		input.input-date,
		textarea,
		select {
			margin: 0;
			vertical-align: middle;
			width: 100%;
			-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
			-moz-box-sizing: border-box;    /* Firefox, other Gecko */
			box-sizing: border-box;         /* Opera/IE 8+ */
		}

		small.description {
			opacity: 0.75;
			font-size: 0.83em;
			margin: 1.2em 0 0 0;
			display: block;
			line-height: 1.2em;
		}

		.job-manager-uploaded-files {
			display: table;

			.job-manager-uploaded-file {
				line-height: 2em;
				font-style: italic;
				margin-bottom: 1em;
				display: block;

				.job-manager-uploaded-file-preview {

					img {
						height: 64px;
						margin: 0;
						vertical-align: top;
					}

					a {
						line-height: 64px;
						display: inline-block;
						padding: 0 0 0 1em;
					}
				}

				.job-manager-uploaded-file-name {
					display: block;
				}
			}
		}
	}

	.submit-job {
		padding: 1em 0;
	}

	.job-manager-term-checklist {
		list-style: none outside;
		max-height: 200px;
		overflow: auto;
		margin: 0;

		li {
			list-style: none outside;
			margin: 0;
			display: block;
			float: none;

			label {
				width: auto;
				float: none;
			}

			li {
				margin: 0 0 0 2em;
			}
		}
	}

	input[type=submit]:disabled,
	input[type=submit].disabled {
		opacity: 0.5;
		filter: alpha(opacity=50);
		cursor: not-allowed;
	}

	.spinner {
		background-repeat: no-repeat;
		background-size: 20px 20px;
		display: inline-block;
		visibility: hidden;
		width: 20px;
		height: 20px;
		margin: 0;
		vertical-align: middle;
	}

	.spinner.is-active {
		visibility: visible;
	}

	.select2-container
	{
		font-size: 1rem;

		input.select2-search__field {
			width: 100% !important;
			height: unset;
		}
		.select2-selection--multiple .select2-selection__rendered {
			display: block;
			padding: 0;

			li {
				margin: 5px;
			}

			input {
				padding: 0 5px;
			}
		}
	}
}

.select2-container .select2-dropdown {
	font-size: 1rem;
}


@media screen and (max-width: 782px) {

	.job-manager-form fieldset label:not(.full-line-checkbox-field label) {
		width: 100%;
		float: none;
	}

	.job-manager-form fieldset div.field:not(.full-line-checkbox-field) {
		width: 100%;
		float: none;
	}
}

div.job_listings {
	margin-bottom: 1em;

	ul.job_listings {
		margin: 0;
	}
}

.single_job_listing {

	.company {
		position: relative;
		border: 1px solid #eee;
		padding: 1em;
		margin: 0 0 2em;
		display: block;
		clear: both;
		min-height: 3em;
		box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
		box-sizing: content-box;

		img {
			width: 3em;
			height: 3em;
			position: absolute;
			left: 1em;
			float: left;
			vertical-align: middle;
			box-shadow: none;
		}

		.name {
			margin: 0 0 0 3em;
			padding: 0 0 0 1em;
			line-height: 1.5em;

			a {
				float: right;
				margin-left: 1em;
			}
		}

		.tagline {
			display: block;
			margin: 0 0 0 3em;
			padding: 0 0 0 1em;
			line-height: 1.5em;
			font-style: italic;
			color: #999;
		}

		.website::before {

			@include display-icon();
			content: "\e809";
		}

		.company_twitter::before {

			@include display-icon();
			content: "\e80a";
		}

		.company_header {
			margin: 0 0 1em;
			min-height: 60px;
		}

		.company_video {
			border-top: 1px solid #eee;
			padding: 1em 0 0;
			position: relative;
			padding-bottom: 56.25%;
			padding-top: 30px;
			height: 0;
			overflow: hidden;

			iframe,
			object,
			embed {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				margin: 0;
				display: block;
			}
		}
	}

	.meta {
		list-style: none outside;
		padding: 0;
		margin: 0 0 1.5em;
		overflow: hidden;
		zoom: 1;
		clear: both;

		li {
			margin: 0 1em 0 0;
			padding: 0.5em;
			float: left;
			line-height: 1em;
			color: #999;
		}

		.job-type {
			color: #fff;
			background-color: $part-time;
		}

		.full-time {
			background-color: $full-time;
		}

		.part-time {
			background-color: $part-time;
		}

		.temporary {
			background-color: $temporary;
		}

		.freelance {
			background-color: $freelance;
		}

		.internship {
			background-color: $internship;
		}

		.position-filled,
		.listing-expired {
			color: #b81c23;
		}

		.location::before {

			@include display-icon();
			content: "\e81d";
		}

		.date-posted::before {

			@include display-icon();
			content: "\e80f";
		}

		.position-filled::before,
		.listing-expired::before {

			@include display-icon();
			content: "\e80e";
		}

		.salary:before {
			@include display-icon();
			content: '\e800';
		}
	}

	.job_description {
		margin: 0 0 1.5em;
	}
}

.job-manager-application-wrapper {
	clear: both;
	border: 1px solid #eee;
	padding: 0.75em 1em 0;
	margin: 1em 0;
	line-height: 1.5em;
	display: block;
	position: relative;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.single_job_listing,
.job-manager-application-wrapper {

	.application {
		padding: 0;
		margin: 0 0 1em;
		overflow: hidden;

		.application_button,
		.application_details {
			-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
			-moz-box-sizing: border-box;    /* Firefox, other Gecko */
			box-sizing: border-box;         /* Opera/IE 8+ */
		}

		.application_button {
			text-align: center;
			font-size: 1.1em;
			line-height: 1em;
			display: inline-block;
			margin: 0 0.5em 0 0;
			padding: 1em 2em;
			outline: 0;
		}

		.application_details {
			clear: both;
			border: 1px solid #eee;
			padding: 0.75em 1em 0;
			margin: 1em 0;
			line-height: 1.5em;
			display: block;
			position: relative;
			box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);

			p {
				margin: 0 0 0.75em;
			}

			&::before {
				content: "";
				position: absolute;
				margin: -10px 0 0 0;
				top: 0;
				left: 5em;
				width: 0;
				height: 0;
				border-left: 10px solid transparent;
				border-right: 10px solid transparent;
				border-bottom: 10px solid #eee;
			}

			&::after {
				content: "";
				position: absolute;
				margin: -9px 0 0 1px;
				left: 5em;
				top: 0;
				width: 0;
				height: 0;
				border-left: 9px solid transparent;
				border-right: 9px solid transparent;
				border-bottom: 9px solid #fff;
			}
		}
	}
}

.job_filters {
	background: #eee;

	@include clearfix();

	.search_jobs {
		padding: 1em;

		@include clearfix();

		div {
			-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
			-moz-box-sizing: border-box;    /* Firefox, other Gecko */
			box-sizing: border-box;         /* Opera/IE 8+ */

			label {
				display: none;
			}

			&.search_keywords,
			&.filter_first {
				float: left;
				padding-right: 0.5em;
				width: 50%;
			}

			&.search_location,
			&.filter_last {
				float: right;
				padding-left: 0.5em;
				width: 50%;
			}

			&.search_remote_position {

				width: 50%;
				float: right;
				padding-left: 0.5em;
				padding-top: 0.5em;

				input {
					width: auto;
				}

				label#remote_position_label {
					display: inline-block;
				}
			}

			@media(max-width: 480px){
				&.search_keywords,
				&.filter_first {
					width: 100%;
					padding-right: 0;
				}

				&.search_location,
				&.filter_last {
					width: 100%;
					padding-top: 0.5em;
					padding-left: 0;
				}

				&.search_remote_position {
					width: 100%;
				}
			}

			&.search_categories,
			&.filter_wide {
				padding-top: 0.5em;
				clear: both;
				width: 100%;
			}

			&.search_submit {
				padding-top: 0.5em;
			}

			.showing_jobs {

				a {
					padding: 0.25em;
				}

				a.active {
					background: #ddd;
					text-decoration: none;
				}
			}
		}

		input,
		select {
			-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
			-moz-box-sizing: border-box;    /* Firefox, other Gecko */
			box-sizing: border-box;         /* Opera/IE 8+ */
			width: 100%;
		}
	}

	.job_types {
		list-style: none outside;
		margin: 0;
		padding: 0;
		font-size: 0.83em;
		background: #f9f9f9;
		border-top: 1px solid #e5e5e5;

		@include clearfix();

		li {
			margin: 0;
			padding: 0.5em 1em;
			float: left;
			border-right: 1px solid #eee;

			&:last-child {
				border-right: 0;
			}
		}
	}

	.showing_jobs {
		padding: 0.5em 1em;
		display: none;
		font-size: 0.83em;
		background: #f9f9f9;
		border-top: 1px solid #e5e5e5;

		a {
			float: right;
			padding-left: 10px;
			border: 0;
		}
	}
}

div.job_listings {

	.job-manager-pagination {
		text-align: center;
		display: block;
		padding: 1em 0 1em 0;
		border-bottom: 1px solid #eee;
		line-height: 1;
	}

	.load_previous {
		border-top: 1px solid #eee;
	}

	.load_more_jobs + ul.job_listings {
		border-top: 0;
	}

	.load_more_jobs {
		text-align: center;
		display: block;
		padding: 1em 1em 1em 2em;
		border-bottom: 1px solid #eee;
		font-weight: bold;

		&.loading {
			background: url(../images/ajax-loader.gif) no-repeat center;

			strong {
				visibility: hidden;
			}
		}

		&:hover,
		&:focus {
			background-color: #fcfcfc;
			border-bottom: 1px solid #eee;
		}
	}
}

.job_listing_preview {
	padding: 0 1em 1em;
	border: 5px solid #eee;
}

.single-job_listing .entry-header .attachment-post-thumbnail,
.single-job_listing .job_listing.has-post-thumbnail .post-thumbnail {
	display: none;
}

.job_listing_preview_title,
.entry-content .job_listing_preview_title {
	padding: 0.5em 1em;
	vertical-align: middle;
	position: relative;
	background: #eee;

	h2 {
		margin: 0;
		clear: none;
	}

	.button {
		float: right;
		margin-left: 0.25em;
	}
}

.job_summary_shortcode {
	border: 1px solid #ccc;
	-moz-border-radius: 4px;
	-webkit-border-radius: 4px;
	border-radius: 4px;
	text-align: center;
	position: relative;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
	-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
	-moz-box-sizing: border-box;    /* Firefox, other Gecko */
	box-sizing: border-box;         /* Opera/IE 8+ */

	&.aligncenter {
		display: block;
		margin: 2em auto 2em;
	}

	&.alignleft {
		float: left;
		margin: 0 2em 2em 0;
	}

	&.alignright {
		float: right;
		margin: 0 0 2em 2em;
	}

	a {
		text-decoration: none;
		color: inherit;
	}

	img {
		margin: 0;
		padding: 0;
		display: block;
		width: 100%;
		-moz-border-radius: 0;
		-webkit-border-radius: 0;
		-moz-border-top-left-radius: 3px;
		-moz-border-top-right-radius: 3px;
		-webkit-border-top-left-radius: 3px;
		-webkit-border-top-right-radius: 3px;
		border-radius: 0;
		border-top-left-radius: 3px;
		border-top-right-radius: 3px;
		box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
	}

	.job_summary_content {
		padding: 0 1em;
	}

	.meta {
		font-style: italic;
		color: #777;
	}

	.job-type {
		-moz-border-radius: 1em;
		-webkit-border-radius: 1em;
		border-radius: 1em;
		color: #fff;
		text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
		position: absolute;
		top: 0;
		right: 0;
		padding: 0.5em;
		height: 1em;
		width: auto;
		min-width: 1em;
		font-size: 1em;
		text-align: center;
		vertical-align: middle;
		line-height: 1em;
		margin: -0.5em -0.5em 0 0;

		&.full-time {
			background-color: $full-time;
		}

		&.part-time {
			background-color: $part-time;
		}

		&.temporary {
			background-color: $temporary;
		}

		&.freelance {
			background-color: $freelance;
		}

		&.internship {
			background-color: $internship;
		}
	}
}

#job-manager-job-dashboard {

	.account-sign-in {

		.button {
			margin-right: 0.5em;

			&::before {

				@include display-icon();
				content: "\e808";
			}
		}
	}

	table {

		ul.job-dashboard-actions {
			margin: 0;
			padding: 0;
			visibility: hidden;
			font-size: 0.92em;

			li {
				float: none;
				display: inline;
				padding: 0;
				margin: 0 0.5em 0 0;
				font-weight: normal;
				list-style: none outside;

				&::after {
					padding: 0 0 0 0.5em;
					content: "\2023";
				}

				&:last-child::after {
					content: "";
				}

				.job-dashboard-action-delete {
					color: red;
				}
			}
		}

		tr:hover,
		tr:focus {

			ul.job-dashboard-actions {
				visibility: visible;
			}
		}

		td,
		th {
			padding: 0.5em 1em 0.5em 0;
		}

		.job_title small {
			color: #999;
		}

		.featured-job-icon {

			&::before {

				@include jm-icon();
				content: "\e803";
			}
		}

		.filled,
		.expires,
		.applications {
			text-align: center;
		}
	}
}

nav.job-manager-pagination,
#content nav.job-manager-pagination {
	text-align: center;

	ul {
		display: inline-block;
		white-space: nowrap;
		padding: 0;
		clear: both;
		border-left: 1px solid #eee;
		margin: 1px;

		li {
			border-right: 1px solid #eee;
			border-top: 1px solid #eee;
			border-bottom: 1px solid #eee;
			padding: 0;
			margin: 0;
			float: left;
			display: inline;
			overflow: hidden;

			a,
			span {
				margin: 0;
				text-decoration: none;
				padding: 0;
				line-height: 1em;
				font-size: 1em;
				font-weight: normal;
				padding: 0.5em;
				min-width: 1em;
				display: block;
				border: 0;
			}

			span.current,
			a:hover,
			a:focus {
				background: #eee;
				color: darken(#eee, 40);
			}
		}
	}
}

// Chosen fixes
.chosen-container {
	width: 100% !important;
}

// Default theme fixes
.twenty-ten {

	.job_types,
	.chosen-choices {
		margin: 0 !important;
	}
}

.rtl {

	.job-manager-form {

		label {
			float: right;
		}

		div.field {
			float: left;
		}
	}

	.job_listing_preview_title,
	.entry-content .job_listing_preview_title {

		.button {
			float: left;
		}
	}

	.single_job_listing {

		.meta {

			li {
				float: right;
				margin: 0 0 0 1em;
			}
		}
	}
}

// Admin Bar Select2 overlap fixes
#wpadminbar ~ span.select2-container, body.admin-bar > span.select2-container {
	padding-top: 32px;
}

@media screen and ( max-width: 782px ) {
	#wpadminbar ~ span.select2-container, body.admin-bar > span.select2-container {
		padding-top: 46px;
	}
}
