/**
 * LearnDash Courses Display - Styles
 */

.ldcd-courses-wrapper {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

/* Controls */
.ldcd-courses-controls {
	display: flex;
	gap: 15px;
	margin-bottom: 30px;
	flex-wrap: wrap;
	align-items: center;
}

/* Search Wrapper - Simple */
.ldcd-search-wrapper {
	position: relative;
	flex: 1 1 100%;
	width: 100%;
	min-width: 100%;
	margin-bottom: 10px;
}

@media (min-width: 768px) {
	.ldcd-search-wrapper {
		flex: 1 1 auto;
		min-width: 400px;
		max-width: 600px;
		margin-bottom: 0;
	}
}

@media (min-width: 1024px) {
	.ldcd-search-wrapper {
		min-width: 500px;
		max-width: 700px;
	}
}

.ldcd-search-input {
	width: 100%;
	padding: 12px 45px 12px 15px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 15px;
	background-color: #fff;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 768px) {
	.ldcd-search-input {
		font-size: 16px;
		padding: 12px 50px 12px 18px;
	}
}

.ldcd-search-input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.ldcd-search-input::placeholder {
	color: #999;
}

.ldcd-search-clear {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	font-size: 24px;
	color: #999;
	cursor: pointer;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	padding: 0;
	transition: color 0.3s ease;
}

.ldcd-search-clear:hover {
	color: #333;
}

@media (min-width: 768px) {
	.ldcd-search-wrapper {
		display: flex;
		align-items: flex-start;
		gap: 10px;
	}

	.ldcd-search-clear-all {
		margin-top: 0;
		align-self: center;
	}
}

.ldcd-select {
	padding: 10px 15px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background-color: #fff;
	font-size: 14px;
	cursor: pointer;
	transition: border-color 0.3s ease;
}

.ldcd-select:hover {
	border-color: #999;
}

.ldcd-select:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.ldcd-button {
	padding: 10px 20px;
	background-color: #0073aa;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.3s ease;
}

.ldcd-button:hover {
	background-color: #005177;
}

.ldcd-button:active {
	transform: translateY(1px);
}

/* Courses Grid */
.ldcd-courses-grid {
	display: grid;
	gap: 30px;
	margin-top: 30px;
}

.ldcd-courses-grid[data-columns="1"] {
	grid-template-columns: 1fr;
}

/* Single column layout - show image complete without cropping */
.ldcd-courses-grid[data-columns="1"] .ldcd-course-card {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: auto auto auto;
	grid-template-areas:
		"content"
		"action"
		"image";
	gap: 0;
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-content-wrapper {
	grid-area: content;
	display: block;
	min-height: auto;
	flex-direction: column;
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-image-desktop {
	display: none;
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-image-mobile {
	grid-area: image;
	width: 100%;
	max-width: none;
	height: auto;
	min-height: auto;
	overflow: visible;
	background-color: #f9f9f9;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-image-mobile a {
	display: block;
	width: 100%;
	max-width: none;
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-image-mobile img {
	width: auto;
	max-width: 100%;
	height: auto;
	object-fit: contain;
	object-position: center;
	display: block;
	image-rendering: auto;
	-webkit-backface-visibility: hidden;
	-ms-transform: translateZ(0);
	transform: translateZ(0);
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-action {
	grid-area: action;
	padding: 12px 18px;
	margin: 0;
	background-color: #f9f9f9;
	border-top: 1px solid #e1e1e1;
}

.ldcd-courses-grid[data-columns="2"] {
	grid-template-columns: repeat(2, 1fr);
}

.ldcd-courses-grid[data-columns="3"] {
	grid-template-columns: repeat(3, 1fr);
}

.ldcd-courses-grid[data-columns="4"] {
	grid-template-columns: repeat(4, 1fr);
}

/* Responsive Grid */
@media (max-width: 1024px) {
	.ldcd-courses-grid[data-columns="4"],
	.ldcd-courses-grid[data-columns="3"] {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.ldcd-courses-grid {
		grid-template-columns: 1fr !important;
	}

	.ldcd-courses-controls {
		flex-direction: column;
		align-items: stretch;
	}

	.ldcd-select,
	.ldcd-button {
		width: 100%;
	}

	.ldcd-search-wrapper {
		width: 100%;
		max-width: 100%;
		min-width: 100% !important;
	}

	.ldcd-search-input {
		width: 100%;
	}

	/* Mobile card layout - Grid with image at bottom, full width and complete */
	.ldcd-course-card {
		display: grid;
		grid-template-columns: 1fr;
		grid-template-rows: auto auto auto;
		grid-template-areas:
			"content"
			"action"
			"image";
		gap: 0;
		overflow: visible; /* Allow image to display fully without clipping */
	}

	.ldcd-course-content-wrapper {
		grid-area: content;
		display: block;
		min-height: auto;
		flex-direction: column;
		flex-grow: 0;
	}

	.ldcd-course-image-desktop {
		display: none; /* Hide desktop image on mobile */
	}

	/* Remove width restrictions on mobile image */
	.ldcd-course-image {
		max-width: none !important;
		width: auto !important;
		flex: none !important;
	}

	.ldcd-course-content {
		padding: 18px;
		width: 100%;
		flex-grow: 0;
	}

	.ldcd-course-image-mobile {
		grid-area: image;
		width: 100%;
		max-width: none;
		height: auto;
		min-height: auto;
		flex: none;
		overflow: visible;
		background-color: #f9f9f9;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ldcd-course-image-mobile a {
		display: block;
		width: 100%;
		max-width: none;
	}

	.ldcd-course-image-mobile img {
		width: auto;
		max-width: 100%;
		height: auto;
		object-fit: contain;
		object-position: center;
		display: block;
		image-rendering: auto;
		-webkit-backface-visibility: hidden;
		-ms-transform: translateZ(0);
		transform: translateZ(0);
	}

	.ldcd-course-action {
		grid-area: action;
		padding: 12px 18px;
		margin: 0;
		background-color: #f9f9f9;
		border-top: 1px solid #e1e1e1;
	}

	.ldcd-course-title {
		font-size: 20px;
		margin-bottom: 10px;
		line-height: 1.3;
		font-weight: 600;
	}

	.ldcd-course-excerpt {
		font-size: 14px;
		margin-bottom: 10px;
		line-height: 1.5;
	}

	.ldcd-course-meta {
		font-size: 12px;
		margin-bottom: 12px;
		padding-top: 10px;
	}

	.ldcd-course-link {
		padding: 10px 18px;
		font-size: 14px;
		width: 100%;
	}
}

/* Course Card */
.ldcd-course-card {
	background: #fff;
	border: 1px solid #e1e1e1;
	border-radius: 8px;
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* Single column - allow image to display fully */
.ldcd-courses-grid[data-columns="1"] .ldcd-course-card {
	overflow: visible;
}

.ldcd-course-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Content Wrapper - Horizontal Layout */
.ldcd-course-content-wrapper {
	display: flex;
	flex-direction: row;
	flex-grow: 1;
	min-height: 250px;
	align-items: stretch; /* Make both sides same height */
}

.ldcd-course-content {
	padding: 20px;
	flex: 1 1 auto;
	min-width: 0; /* Prevents flex item overflow */
	display: flex;
	flex-direction: column;
}

/* Course Image - Right Side - Optimized for 1200x628 images (landscape) */
.ldcd-course-image {
	flex: 0 0 33.333%;
	max-width: 33.333%;
	width: 33.333%;
	height: 100%;
	min-height: 250px;
	overflow: hidden;
	background-color: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Reset image constraints on mobile and single column */
@media (max-width: 768px) {
	.ldcd-course-image {
		max-width: none !important;
		width: auto !important;
		flex: none !important;
		min-width: auto !important;
	}
}

.ldcd-courses-grid[data-columns="1"] .ldcd-course-image {
	max-width: none !important;
	width: auto !important;
	flex: none !important;
	min-width: auto !important;
}

/* Hide mobile image on desktop */
.ldcd-course-image-mobile {
	display: none;
}

/* Show mobile image only on mobile */
@media (max-width: 768px) {
	.ldcd-course-image-desktop {
		display: none !important;
	}
	
	.ldcd-course-image-mobile {
		display: block;
	}
}

.ldcd-course-image a {
	display: block;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ldcd-course-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: left center;
	display: block;
	transition: transform 0.3s ease;
}

.ldcd-course-card:hover .ldcd-course-image img {
	transform: scale(1.05);
}

.ldcd-course-title {
	margin: 0 0 15px 0;
	font-size: 20px;
	line-height: 1.4;
}

.ldcd-course-title a {
	color: #333;
	text-decoration: none;
	transition: color 0.3s ease;
}

.ldcd-course-title a:hover {
	color: #0073aa;
}

.ldcd-course-excerpt {
	margin-bottom: 15px;
	color: #666;
	font-size: 14px;
	line-height: 1.6;
	flex-grow: 1;
}

.ldcd-course-meta {
	margin-bottom: 20px;
	padding-top: 15px;
	border-top: 1px solid #e1e1e1;
	font-size: 13px;
	color: #888;
}

.ldcd-meta-label {
	font-weight: 600;
	color: #555;
	margin-right: 5px;
}

.ldcd-course-category {
	margin-bottom: 10px;
}

.ldcd-course-tags {
	margin-bottom: 10px;
}

.ldcd-category-tag {
	display: inline-block;
	background-color: #f0f0f0;
	color: #555;
	padding: 4px 10px;
	border-radius: 3px;
	margin-right: 5px;
	margin-bottom: 5px;
	font-size: 12px;
}

.ldcd-tag-badge {
	display: inline-block;
	background-color: #e3f2fd;
	color: #1976d2;
	padding: 3px 8px;
	border-radius: 12px;
	margin-right: 5px;
	margin-bottom: 5px;
	font-size: 11px;
	font-weight: 500;
	border: 1px solid #90caf9;
}

.ldcd-tag-badge:hover {
	background-color: #bbdefb;
	border-color: #64b5f6;
}

.ldcd-course-date,
.ldcd-course-enrolled {
	margin-top: 5px;
}

.ldcd-course-action {
	margin-top: auto;
}

.ldcd-course-link {
	display: inline-block;
	padding: 10px 20px;
	background-color: #0073aa;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	transition: background-color 0.3s ease;
	width: 100%;
	box-sizing: border-box;
}

.ldcd-course-link:hover {
	background-color: #005177;
}

/* No Courses Message */
.ldcd-no-courses {
	text-align: center;
	padding: 40px 20px;
	color: #666;
	font-size: 16px;
	background-color: #f9f9f9;
	border-radius: 8px;
	border: 1px solid #e1e1e1;
}

/* Loading State */
.ldcd-loading {
	text-align: center;
	padding: 40px 20px;
	color: #666;
	font-size: 16px;
}

.ldcd-loading::after {
	content: '...';
	animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
	0%, 20% {
		content: '.';
	}
	40% {
		content: '..';
	}
	60%, 100% {
		content: '...';
	}
}

/* Loading Indicator */
.ldcd-loading-indicator {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 20px;
	background-color: #f9f9f9;
	border: 1px solid #e1e1e1;
	border-radius: 8px;
	margin-bottom: 20px;
	color: #666;
	font-size: 14px;
	font-weight: 500;
}

.ldcd-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid #e1e1e1;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: ldcd-spin 0.8s linear infinite;
}

@keyframes ldcd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Fade In Animation */
.ldcd-course-card {
	animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

