/**
 * All Posts Page Styles
 *
 * Styles for the All Posts template with filters, grid/list toggle,
 * and lazy loading functionality.
 *
 * @package TechStoriesTheme
 * @since 1.2.5
 */

/* ==========================================================================
   Page Layout - Full Width Override
   ========================================================================== */

body.ts-all-posts-page,
body.ts-all-posts-page * {
	box-sizing: border-box;
}

body.ts-all-posts-page {
	background-color: #f8f9fa;
}

/* Override ALL parent theme constraints */
body.ts-all-posts-page .site,
body.ts-all-posts-page .site-content,
body.ts-all-posts-page .site-inner,
body.ts-all-posts-page .content-area,
body.ts-all-posts-page .site-main,
body.ts-all-posts-page #primary,
body.ts-all-posts-page #main,
body.ts-all-posts-page article.page,
body.ts-all-posts-page .entry-content {
	max-width: 100% !important;
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
	background: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

body.ts-all-posts-page .ts-container {
	max-width: 1600px !important;
	width: 100% !important;
	margin: 0 auto !important;
	padding: 40px 60px !important;
	box-sizing: border-box !important;
	background: #f8f9fa;
}

/* ==========================================================================
   Page Header
   ========================================================================== */

.ts-page-header {
	padding: 40px 0 30px;
	text-align: center;
}

.ts-page-title {
	font-size: 2rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0;
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */

.ts-filter-bar {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
	padding: 16px 20px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	margin-bottom: 30px;
}

.ts-filter-left {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.ts-filter-dropdown {
	position: relative;
}

.ts-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding: 10px 40px 10px 16px;
	font-size: 0.9375rem;
	font-family: inherit;
	color: #1a1a1a;
	background-color: #f8f9fa;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	cursor: pointer;
	min-width: 160px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ts-select:hover {
	border-color: #007acc;
}

.ts-select:focus {
	outline: none;
	border-color: #007acc;
	box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.15);
}

/* ==========================================================================
   Posts Grid
   ========================================================================== */

.ts-posts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 28px;
}

.ts-post-card {
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ts-post-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.ts-post-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.ts-post-image {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #e9ecef;
}

.ts-post-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.ts-post-card:hover .ts-post-img {
	transform: scale(1.05);
}

.ts-placeholder-img {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.ts-post-content {
	padding: 28px;
}

.ts-post-category {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #007acc;
	margin-bottom: 12px;
}

.ts-post-title {
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.35;
	color: #1a1a1a;
	margin: 0 0 14px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ts-post-excerpt {
	font-size: 0.95rem;
	line-height: 1.6;
	color: #555;
	margin: 0 0 16px;
	display: -webkit-box;
	-webkit-line-clamp: 6;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ts-post-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	font-size: 0.875rem;
	color: #888;
}

.ts-post-meta span {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* ==========================================================================
   Load More
   ========================================================================== */

.ts-load-more-wrapper {
	text-align: center;
	padding: 40px 0 60px;
}

.ts-load-more-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 32px;
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	color: #fff;
	background: #007acc;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
	min-width: 160px;
}

.ts-load-more-btn:hover {
	background: #005fa3;
	transform: translateY(-2px);
}

.ts-load-more-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
	transform: none;
}

.ts-load-more-btn .ts-btn-loading {
	display: none;
	align-items: center;
	gap: 8px;
}

.ts-load-more-btn.loading .ts-btn-text {
	display: none;
}

.ts-load-more-btn.loading .ts-btn-loading {
	display: inline-flex;
}

.ts-spinner {
	animation: ts-spin 1s linear infinite;
}

@keyframes ts-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* No Posts */
.ts-no-posts {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	color: #666;
	font-size: 1.125rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 1024px) {
	body.ts-all-posts-page .ts-container {
		padding: 30px 40px;
	}

	.ts-posts-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 24px;
	}

	.ts-post-content {
		padding: 24px;
	}

	.ts-post-title {
		font-size: 1.25rem;
	}
}

@media screen and (max-width: 768px) {
	body.ts-all-posts-page .ts-container {
		padding: 20px 24px;
	}

	.ts-page-header {
		padding: 30px 0 20px;
	}

	.ts-page-title {
		font-size: 1.75rem;
	}

	.ts-filter-bar {
		flex-direction: column;
		align-items: stretch;
	}

	.ts-filter-left {
		flex-direction: column;
	}

	.ts-select {
		width: 100%;
	}

	.ts-posts-grid {
		grid-template-columns: 1fr;
		gap: 24px;
	}

	.ts-post-content {
		padding: 20px;
	}

	.ts-post-title {
		font-size: 1.25rem;
	}

	.ts-post-excerpt {
		-webkit-line-clamp: 4;
	}
}

@media screen and (max-width: 480px) {
	.ts-all-posts-page .ts-container {
		padding: 0 16px;
	}

	.ts-posts-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.ts-post-image {
		aspect-ratio: 16 / 9;
	}

	.ts-post-content {
		padding: 16px;
	}

	.ts-post-title {
		font-size: 1.125rem;
	}

	.ts-post-excerpt {
		-webkit-line-clamp: 3;
	}

	.ts-load-more-btn {
		width: 100%;
	}
}
