/**
 * Podcast List Styles
 * 
 * Custom styles for the [ssp_podcasts] shortcode
 * Extracted from podcast-list.php template
 * 
 * @package SeriouslySimplePodcasting
 * @since 3.13.0
 */

.ssp-podcasts {
	display: grid;
	gap: 20px;
	max-width: 100%;
}

/* Single column layout (default) */
.ssp-podcasts-columns-1 {
	grid-template-columns: 1fr;
}

/* Two column layout */
.ssp-podcasts-columns-2 {
	grid-template-columns: repeat(2, 1fr);
}

/* Three column layout */
.ssp-podcasts-columns-3 {
	grid-template-columns: repeat(3, 1fr);
}

.ssp-podcast-card {
	display: flex;
	background: var(--ssp-podcast-card-bg, #f8f9fa);
	border-radius: 8px;
	padding: 16px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	transition: box-shadow 0.3s ease, background-color 0.3s ease;
	position: relative;
}

.ssp-podcast-card:hover {
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
	background: var(--ssp-podcast-card-hover-bg, #e9ecef);
}

.ssp-podcast-image {
	flex-shrink: 0;
	width: 120px;
	aspect-ratio: 1 / 1;
	margin-right: 20px;
	border-radius: 8px;
	overflow: hidden;
	background: #e9ecef;
	display: flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
}

.ssp-podcast-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ssp-podcast-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #6c5ce7, #a29bfe);
	color: white;
	text-align: center;
	padding: 10px;
}

.ssp-podcast-placeholder-text {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	word-break: break-word;
}

.ssp-podcast-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}

.ssp-podcast-header {
	margin-bottom: 8px;
}

.ssp-podcast-title {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	color: var(--ssp-title-color, #6c5ce7);
	line-height: 1.2;
}

.ssp-listen-now-button-content {
	background: var(--ssp-button-bg, #343a40);
	color: var(--ssp-button-text, #ffffff);
	text-decoration: none;
	padding: 8px 16px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	display: inline-block;
	margin-top: auto;
	margin-left: auto;
	width: fit-content;
	box-sizing: border-box;
	transition: 0.3s ease;
}

/* When wrapped in <a> tag, the <a> tag should get the auto margins */
a.ssp-listen-now-button {
	margin-top: auto;
	margin-left: auto;
	width: fit-content;
	text-decoration: none;
}

/* Hover animations only apply when there's a wrapper <a> tag */
a.ssp-listen-now-button:hover .ssp-listen-now-button-content,
a.ssp-listen-now-button:focus .ssp-listen-now-button-content {
	background: var(--ssp-button-hover-bg, #495057);
	color: var(--ssp-button-text, #ffffff);
	text-decoration: none;
	outline: 1px solid var(--ssp-button-hover-bg, #495057);
	outline-offset: 0px;
}

a.ssp-listen-now-button:focus-visible .ssp-listen-now-button-content {
	outline: 1px solid var(--ssp-title-color, #6c5ce7);
	outline-offset: 2px;
}

.ssp-podcast-episode-count {
	font-size: 16px;
	color: var(--ssp-episode-count-color, #6c757d);
	margin-bottom: 8px;
	font-weight: 500;
}

.ssp-podcast-description {
	font-size: 16px;
	color: var(--ssp-description-color, #6c757d);
	line-height: 1.5;
	margin: 0 0 16px 0;
	text-align: justify;
}

/* Responsive design */
@media (max-width: 768px) {
	/* Force single column layout on mobile for all column configurations */
	.ssp-podcasts-columns-2,
	.ssp-podcasts-columns-3 {
		grid-template-columns: 1fr;
	}
	
	.ssp-podcast-card {
		flex-direction: column;
		text-align: center;
	}
	
	.ssp-podcast-image {
		width: 100%;
		max-width: 300px;
		aspect-ratio: 1 / 1;
		margin: 0 auto 15px auto;
	}
	
	.ssp-podcast-title {
		font-size: 20px;
		text-align: center;
	}
	
	.ssp-listen-now-button-content {
		font-size: 12px;
		padding: 12px 12px;
		width: 100%;
		max-width: 300px;
		display: block;
		margin: auto auto 12px auto;
		text-align: center;
	}
	
	/* When wrapped in <a> tag on mobile */
	a.ssp-listen-now-button {
		width: 100%;
		max-width: 300px;
		display: block;
		margin: auto auto 12px auto;
		text-align: center;
	}
	
	.ssp-podcast-episode-count {
		font-size: 14px;
	}
	
	.ssp-podcast-description {
		font-size: 14px;
	}
}

/* Tablet responsive design */
@media (max-width: 1024px) and (min-width: 769px) {
	/* Reduce 3 columns to 2 columns on tablet */
	.ssp-podcasts-columns-3 {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Middle screen range - force mobile layout for better image handling */
@media (max-width: 900px) {
	.ssp-podcast-card {
		flex-direction: column;
		text-align: center;
	}
	
	.ssp-podcast-image {
		width: 100%;
		max-width: 300px;
		aspect-ratio: 1 / 1;
		margin: 0 auto 15px auto;
	}
}

/* Clickability styles */
.ssp-podcast-card-clickable {
	position: relative;
}

.ssp-podcast-card-link {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	text-decoration: none;
	color: transparent;
}

.ssp-podcast-card-link:hover,
.ssp-podcast-card-link:focus {
	text-decoration: none;
	color: transparent;
	outline: 2px solid #6c5ce7;
	outline-offset: 2px;
}

/* Ensure focus is visible for keyboard navigation */
.ssp-podcast-card-link:focus-visible {
	outline: 2px solid #6c5ce7;
	outline-offset: 2px;
}

.ssp-podcast-card-clickable:hover {
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ssp-podcast-title-link {
	text-decoration: none;
	color: inherit;
}

.ssp-podcast-title-link:hover,
.ssp-podcast-title-link:focus {
	text-decoration: none;
	color: #495057;
	outline: 2px solid #6c5ce7;
	outline-offset: 2px;
	border-radius: 2px;
}

.ssp-podcast-title-link:focus-visible {
	outline: 2px solid #6c5ce7;
	outline-offset: 2px;
}

.ssp-podcast-title-link .ssp-podcast-title {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	color: var(--ssp-title-color, #6c5ce7);
	line-height: 1.2;
	transition: color 0.3s ease;
}

.ssp-podcast-title-link:hover .ssp-podcast-title {
	color: #495057;
}

/* Screen reader only text */
.ssp-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}