/*
 * Job Portal CSS - Modern, Optimized, Accessible
 * Featuring CSS variables and nesting
 */

:root {
	/* Primary Brand Colors */
	--primary-color: #88b800;
	--primary-hover: #749c00;
	--primary-focus: #5c7b00;
	--primary-light: rgba(136, 184, 0, 0.1);

	/* Text Colors */
	--text-color: #555555;
	--text-color-secondary: #6c757d;
	--text-color-light: #767676;
	--heading-color: #444444;

	/* Background Colors */
	--background-color: #ffffff;
	--background-alt: #f8f8f8;

	/* Borders & Focus */
	--border-color: #dddddd;
	--focus-outline: 3px solid rgba(136, 184, 0, 0.5);

	/* Shadows */
	--card-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
	--card-shadow-hover: 0 5px 15px rgba(0, 0, 0, 0.15);

	/* Transitions */
	--transition-default: all 0.3s ease;
}

/* Global Styles */
.tx-jobapplications {
	color: var(--text-color);
	line-height: 1.5;
	background-color: var(--background-color);

	/* Container layout */
	& .container {
		max-width: 1200px;
		margin: 0 auto;
		padding: 20px 15px;
	}

	/* Section Headings */
	& h2 {
		margin-bottom: 25px;
		font-weight: 600;
		color: var(--heading-color);
		position: relative;
		padding-bottom: 10px;
	}

	.alert.no-entry{
		color: #99cc00;
		background: white;
		border-color: #99cc00;
	}
}

/* Filter Form */
.tx-jobapplications .filter-form {
	background-color: var(--background-alt);
	padding: 20px;
	border-radius: 4px;
	margin-bottom: 30px;
	box-shadow: var(--card-shadow);

	& label {
		font-weight: 600;
		color: var(--text-color);
		margin-bottom: 5px;
		display: block;
	}

	& .filter-container {
		margin-bottom: 15px;
	}
}

/* Selectize Controls */
.tx-jobapplications .selectize-control {
	margin-bottom: 15px;

	& .selectize-input {
		border: 1px solid var(--border-color);
		padding: 8px 12px;
		border-radius: 4px;
		box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);

		&.focus {
			border-color: var(--primary-color);
			box-shadow: 0 0 0 3px rgba(136, 184, 0, 0.25);
			outline: none;
		}

		& input {
			line-height: 20px;
			color: var(--text-color);
		}

		& > div {
			background-color: var(--primary-color);
			color: white;
			border-radius: 3px;
			padding: 2px 8px;
			margin: 2px 5px 2px 0;
			border: none;
		}
	}

	& .selectize-dropdown .option {
		padding: 8px 12px;
		color: var(--text-color);

		&.active {
			background-color: var(--primary-color);
			color: white;
		}
	}

	&.plugin-remove_button [data-value] .remove {
		border-left: 1px solid rgba(255, 255, 255, 0.3);
		padding: 0 6px;
	}
}

/* Job Listings */
.tx-jobapplications .job-listings {
	margin-bottom: 30px;
}

.tx-jobapplications .job-listing {
	margin-bottom: 30px;

	& .job-panel {
		transition: var(--transition-default);
		border: none;
		box-shadow: var(--card-shadow);
		height: 100%;
		background-color: var(--background-color);

		&:hover {
			transform: translateY(-5px);
			box-shadow: var(--card-shadow-hover);
		}

		&:focus-within {
			box-shadow: 0 0 0 3px rgba(136, 184, 0, 0.4);
			outline: none;
		}
	}

	& .job-image {
		padding: 0;
		background-color: var(--background-alt);
		border-bottom: 1px solid var(--border-color);
		overflow: hidden;
		height: 250px; /* Fixed height for consistency */
		display: flex;
		align-items: center;
		justify-content: center;

		& img {
			width: 100%;
			object-fit: cover;
			transition: transform 0.3s ease;
		}

		& a:focus {
			outline: none; /* Inner focus handled by panel */
		}
	}

	& .job-panel:hover .job-image img {
		transform: scale(1.05);
	}

	& .panel-body {
		padding: 20px;
		display: flex;
		flex-direction: column;
		height: calc(100% - 250px); /* Match image height */
	}

	& .job-title {
		font-size: 18px;
		font-weight: 600;
		margin-top: 0;
		margin-bottom: 15px;

		& a {
			color: var(--heading-color);
			text-decoration: none;
			transition: color 0.2s ease;

			&:hover {
				color: var(--primary-color);
				text-decoration: underline;
			}

			&:focus {
				outline: var(--focus-outline);
				text-decoration: underline;
				outline-offset: 2px;
				border-radius: 2px;
			}
		}
	}

	& .job-details {
		margin-bottom: 20px;
		font-size: 14px;

		& .detail-row {
			margin-bottom: 8px;
		}

		& .detail-label {
			color: var(--text-color-secondary);
			font-weight: 600;
		}

		& .detail-value {
			color: var(--text-color);
		}
	}

	& .job-action {
		margin-top: auto;

		a{
			background-color: var(--primary-color);
			border-color: var(--primary-hover);
			color: #333;
		}
	}
}

/* Button Styles */
.tx-jobapplications .btn {
	font-weight: 600;
	padding: 8px 16px;
	border-radius: 4px;
	transition: all 0.2s ease-in-out;

	&:focus {
		outline: var(--focus-outline);
		outline-offset: 2px;
	}

	&-primary {
		background-color: var(--primary-color);
		border-color: var(--primary-hover);
		color: white;

		&:hover, &:focus {
			background-color: var(--primary-hover);
			border-color: var(--primary-focus);
			color: white;
		}

		&:active {
			background-color: var(--primary-focus);
			border-color: var(--primary-focus);
		}
	}

	&-default {
		background-color: transparent;
		border-color: var(--border-color);
		color: var(--text-color);

		&:hover {
			background-color: var(--background-alt);
			color: var(--text-color);
		}
	}
}

/* Pagination */
.tx-jobapplications .pagination {
	& > li {
		& > a, & > span {
			color: #666666;
			border-color: var(--border-color);

			&:focus {
				outline: var(--focus-outline);
				outline-offset: -2px;
				z-index: 3;
			}
		}

		& > a:hover, & > span:hover {
			color: var(--primary-hover);
			background-color: var(--background-alt);
			border-color: var(--border-color);
		}

		&.active > a, &.active > span {
			background-color: var(--primary-color);
			border-color: var(--primary-color);
			color: white;

			&:hover, &:focus {
				background-color: var(--primary-hover);
				border-color: var(--primary-hover);
				color: white;
			}
		}
	}
}

/* Helper Classes */
.invisible {
	visibility: hidden;
	height: 20px;
	display: block;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.skip-link {
	position: absolute;
	top: -40px;
	left: 0;
	background: var(--primary-color);
	color: white;
	padding: 8px;
	z-index: 100;

	&:focus {
		top: 0;
	}
}

/* Responsive Adjustments */
@media (max-width: 767px) {
	.tx-jobapplications {
		& .job-panel {
			margin-bottom: 20px;
		}

		& .job-image {
			height: 200px; /* Smaller height on mobile */
		}

		& .panel-body {
			height: auto;
		}

		& .filter-form .btn {
			margin-top: 10px;
		}
	}
}

/* Fallback for browsers that don't support CSS nesting */
@supports not (selector(&)) {
	.tx-jobapplications h2 {
		margin-bottom: 25px;
		font-weight: 600;
		color: var(--heading-color);
		position: relative;
		padding-bottom: 10px;
	}

	.tx-jobapplications .job-panel {
		transition: var(--transition-default);
		border: none;
		box-shadow: var(--card-shadow);
	}

	.tx-jobapplications .job-panel:hover {
		transform: translateY(-5px);
		box-shadow: var(--card-shadow-hover);
	}

	.tx-jobapplications .job-image img {
		width: 100%;
		object-fit: cover;
	}

	.tx-jobapplications .job-panel:hover .job-image img {
		transform: scale(1.05);
	}
}