/**
 * Frontend styles for Zluck Ajax Posts Filter
 *
 * @package Zluck_Ajax_Posts_Filter_Elementor
 */

/* Filter Styles */
.aapf-filter {
	margin-bottom: 30px;
}

/* Vertical Tabs Layout - Side by Side */
.aapf-vertical-layout-wrapper {
	display: flex;
	align-items: flex-start;
	gap: 30px;
	width: 100%;
}

.aapf-filter.aapf-filter-vertical {
	margin-bottom: 0;
	width: 250px;
	flex-shrink: 0;
	max-width: 100%;
	position: sticky;
	top: 20px;
}

.aapf-posts-content-wrapper {
	flex: 1;
	margin-left: 0;
	min-width: 0; /* Prevents flex item from overflowing */
	display: flex;
	flex-direction: column;
}

.aapf-filter.aapf-filter-vertical + .aapf-posts-wrapper,
.aapf-posts-content-wrapper .aapf-posts-wrapper {
	flex: 0 1 auto;
	width: 100%;
}

/* Pagination in vertical layout should be below posts */
.aapf-posts-content-wrapper .aapf-pagination {
	margin-top: 30px;
	width: 100%;
}

/* Horizontal Tabs */
.aapf-filter-tabs-horizontal {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.aapf-filter-tabs-horizontal li {
	margin: 0;
}

/* Vertical Tabs */
.aapf-filter-tabs-vertical {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aapf-filter-tabs-vertical li {
	margin: 0;
	width: 100%;
}

.aapf-filter-tabs-vertical .aapf-filter-item {
	display: block;
	width: 100%;
	text-align: left;
	padding: 12px 20px;
}

.aapf-filter-item {
	display: inline-block;
	padding: 10px 20px;
	text-decoration: none;
	border: 1px solid var(--e-global-color-border, #ddd);
	border-radius: 4px;
	transition: all 0.3s ease;
	cursor: pointer;
	background-color: var(--e-global-color-background, #fff);
	color: var(--e-global-color-text, #333);
}

.aapf-filter-item:hover,
.aapf-filter-item.active {
	background-color: var(--e-global-color-primary, #6EC1E4);
	color: var(--e-global-color-background, #fff);
	border-color: var(--e-global-color-primary, #6EC1E4);
}

/* Responsive Filter Styles */
@media (max-width: 768px) {
	.aapf-filter-tabs-horizontal {
		flex-direction: column;
	}
	
	.aapf-filter-tabs-horizontal li {
		width: 100%;
	}
	
	.aapf-filter-tabs-horizontal .aapf-filter-item {
		display: block;
		width: 100%;
		text-align: left;
	}
	
	/* Vertical tabs layout - stack on mobile */
	.aapf-vertical-layout-wrapper {
		flex-direction: column;
		gap: 20px;
	}
	
	.aapf-filter.aapf-filter-vertical {
		width: 100%;
		position: static; /* Remove sticky on mobile */
	}
	
	.aapf-posts-content-wrapper {
		width: 100%;
		margin-left: 0;
	}
	
	.aapf-filter.aapf-filter-vertical + .aapf-posts-wrapper,
	.aapf-posts-content-wrapper .aapf-posts-wrapper {
		width: 100%;
	}
	
	.aapf-filter-tabs-vertical {
		gap: 6px;
	}
	
	.aapf-filter-tabs-vertical .aapf-filter-item {
		padding: 10px 15px;
	}
}

/* Posts Grid */
.aapf-posts-wrapper {
	width: 100%;
}

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

.aapf-posts-equal-height .aapf-post-card {
	display: flex;
	flex-direction: column;
}

.aapf-posts-equal-height .aapf-post-content {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.aapf-posts-equal-height .aapf-post-read-more {
	margin-top: auto;
}

/* Responsive Columns */
@media (max-width: 768px) {
	.aapf-posts-grid {
		grid-template-columns: repeat(var(--aapf-columns-tablet, 2), 1fr);
	}
}

@media (max-width: 480px) {
	.aapf-posts-grid {
		grid-template-columns: repeat(var(--aapf-columns-mobile, 1), 1fr);
	}
}

/* Post Card */
.aapf-post-card {
	border: 1px solid var(--e-global-color-border, #e0e0e0);
	border-radius: 4px;
	overflow: hidden;
	transition: box-shadow 0.3s ease;
}

.aapf-post-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.aapf-post-thumbnail {
	overflow: hidden;
	position: relative;
	width: 100%;
}

.aapf-post-thumbnail img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.3s ease;
}

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

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

.aapf-post-title {
	margin: 0 0 15px 0;
	font-size: 1.25em;
	line-height: 1.4;
}

.aapf-post-title a {
	text-decoration: none;
	color: inherit;
	transition: color 0.3s ease;
}

.aapf-post-title a:hover {
	color: var(--e-global-color-primary, #6EC1E4);
}

.aapf-post-meta {
	font-size: 0.875em;
	color: var(--e-global-color-text, #7A7A7A);
	margin-bottom: 15px;
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
}

.aapf-post-meta span {
	display: inline-block;
}

.aapf-post-meta a {
	color: inherit;
	text-decoration: none;
}

.aapf-post-meta a:hover {
	text-decoration: underline;
}

.aapf-post-excerpt {
	margin-bottom: 15px;
	line-height: 1.6;
	color: var(--e-global-color-text, #7A7A7A);
}

.aapf-post-read-more {
	margin-top: 15px;
}

.aapf-read-more-link {
	display: inline-block;
	padding: 8px 16px;
	background-color: var(--e-global-color-primary, #6EC1E4);
	color: #fff !important; /* White text for readability on blue background */
	text-decoration: none;
	border-radius: 4px;
	transition: background-color 0.3s ease;
}

.aapf-read-more-link:hover {
	background-color: var(--e-global-color-secondary, #54595F);
	color: #fff !important; /* Maintain white text on hover */
}

/* No Posts */
.aapf-no-posts {
	text-align: center;
	padding: 40px 20px;
	color: var(--e-global-color-text, #7A7A7A);
}

/* Error Message */
.aapf-error {
	text-align: center;
	padding: 20px;
	background-color: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
	margin: 20px 0;
}

/* Pagination */
.aapf-pagination {
	margin-top: 30px;
	text-align: center;
}

.aapf-pagination-numbers .page-numbers {
	display: inline-block;
	padding: 8px 12px;
	margin: 0 4px;
	text-decoration: none;
	border: 1px solid var(--e-global-color-border, #ddd);
	border-radius: 4px;
	transition: all 0.3s ease;
	color: var(--e-global-color-text, #7A7A7A);
}

.aapf-pagination-numbers .page-numbers:hover,
.aapf-pagination-numbers .page-numbers.current {
	background-color: var(--e-global-color-primary, #6EC1E4);
	color: var(--e-global-color-background, #fff);
	border-color: var(--e-global-color-primary, #6EC1E4);
}

/* Pagination Icon Wrapper */
.aapf-pagination-icon-wrapper {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.aapf-pagination-icon-wrapper .aapf-pagination-icon {
	display: inline-block;
	line-height: 1;
}

.aapf-load-more-btn {
	padding: 12px 24px;
	background-color: var(--e-global-color-primary, #6EC1E4);
	color: var(--e-global-color-background, #fff);
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 16px;
	transition: background-color 0.3s ease;
}

.aapf-load-more-btn:hover {
	background-color: var(--e-global-color-secondary, #54595F);
}

.aapf-load-more-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Loading State */
.aapf-loading {
	opacity: 0.6;
	pointer-events: none;
	position: relative;
}

.aapf-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 3px solid var(--e-global-color-border, #f3f3f3);
	border-top: 3px solid var(--e-global-color-primary, #6EC1E4);
	border-radius: 50%;
	animation: aapf-spin 1s linear infinite;
}

@keyframes aapf-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* List Layout */
.aapf-posts-list .aapf-post-card {
	display: flex;
	flex-direction: row;
	margin-bottom: 20px;
}

.aapf-posts-list .aapf-post-thumbnail {
	flex: 0 0 300px;
	max-width: 300px;
}

.aapf-posts-list .aapf-post-content {
	flex: 1;
}

@media (max-width: 768px) {
	.aapf-posts-list .aapf-post-card {
		flex-direction: column;
	}

	.aapf-posts-list .aapf-post-thumbnail {
		flex: 1;
		max-width: 100%;
	}
}

/* Masonry Layout */
.aapf-posts-masonry {
	column-count: var(--aapf-columns, 3);
	column-gap: 20px;
}

.aapf-posts-masonry .aapf-post-card {
	break-inside: avoid;
	margin-bottom: 20px;
}

@media (max-width: 768px) {
	.aapf-posts-masonry {
		column-count: var(--aapf-columns-tablet, 2);
	}
}

@media (max-width: 480px) {
	.aapf-posts-masonry {
		column-count: var(--aapf-columns-mobile, 1);
	}
}

/* Card Layout */
.aapf-card-layout {
	position: relative;
	overflow: hidden;
}

.aapf-card-thumbnail {
	position: relative;
	overflow: hidden;
}

.aapf-card-thumbnail img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.4s ease;
}

.aapf-card-layout:hover .aapf-card-thumbnail img {
	transform: scale(1.1);
}

/* Date Overlay (Top Right) */
.aapf-card-date-overlay {
	position: absolute;
	top: 15px;
	right: 15px;
	background-color: var(--e-global-color-primary, #6EC1E4);
	color: var(--e-global-color-background, #fff);
	border-radius: 50%;
	width: 70px;
	height: 70px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 2;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}


.aapf-card-date-day-month {
	font-size: 14px;
	font-weight: bold;
	line-height: 1.2;
	display: block;
	text-transform: uppercase;
}

.aapf-card-date-year {
	font-size: 12px;
	line-height: 1;
	display: block;
	margin-top: 3px;
	opacity: 0.95;
}

/* Category Overlay (Bottom Left) */
.aapf-card-category-overlay {
	top: -20px;
	position: absolute;
	bottom: 15px;
	    height: fit-content;
	left: 15px;
	background-color: var(--e-global-color-accent, #61CE70);
	color: var(--e-global-color-background, #fff);
	padding: 6px 12px;
	border-radius: 4px;
	z-index: 2;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}


.aapf-card-category-overlay a {
	color: var(--e-global-color-background, #fff);
	text-decoration: none;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	transition: opacity 0.3s ease;
}

.aapf-card-category-overlay a:hover {
	opacity: 0.8;
}

/* Card Content */
.aapf-card-content {
	    position: relative;
	padding: 25px;
	background: var(--e-global-color-background, #fff);
}

.aapf-card-title {
	margin: 0 0 15px 0;
	font-size: 1.3em;
	line-height: 1.4;
}

.aapf-card-title a {
	color: var(--e-global-color-primary, #6EC1E4);
	text-decoration: none;
	transition: color 0.3s ease;
}

.aapf-card-layout:hover .aapf-card-title a {
	color: var(--e-global-color-secondary, #54595F);
}

.aapf-card-excerpt {
	margin-bottom: 20px;
	line-height: 1.7;
	color: var(--e-global-color-text, #7A7A7A);
	font-size: 0.95em;
}

/* Card Read More */
.aapf-card-read-more {
	margin-top: 15px;
}

.aapf-card-read-more-link {
	color: var(--e-global-color-accent, #61CE70);
	text-decoration: none;
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: all 0.3s ease;
}

.aapf-card-read-more-link:hover {
	color: var(--e-global-color-primary, #6EC1E4);
	transform: translateX(5px);
}

.aapf-read-more-arrow {
	transition: transform 0.3s ease;
}

.aapf-card-read-more-link:hover .aapf-read-more-arrow {
	transform: translateX(3px);
}

/* Card Meta (Bottom) */
.aapf-card-meta {
	display: flex;
	align-items: center;
	gap: 15px;
	margin-top: 20px;
	padding-top: 15px;
	border-top: 1px solid var(--e-global-color-border, #f0f0f0);
	font-size: 0.85em;
}

.aapf-card-meta .aapf-meta-icon {
	margin-right: 5px;
	font-size: 14px;
}

.aapf-card-meta a {
	color: var(--e-global-color-accent, #61CE70);
	text-decoration: none;
	transition: color 0.3s ease;
}

.aapf-card-meta a:hover {
	color: var(--e-global-color-primary, #6EC1E4);
}

.aapf-card-meta .aapf-meta-category a {
	color: var(--e-global-color-accent, #61CE70);
}

.aapf-card-meta .aapf-meta-category a:hover {
	color: var(--e-global-color-secondary, #54595F);
}

/* Card Hover Effects */
.aapf-card-layout {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Card Layout in Grid - Uses same grid system */
.aapf-posts-card .aapf-posts-grid {
	display: grid;
	grid-template-columns: repeat(var(--aapf-columns, 3), 1fr);
	gap: 30px;
}

/* Responsive Columns for Card Layout */
@media (max-width: 768px) {
	.aapf-posts-card .aapf-posts-grid {
		grid-template-columns: repeat(var(--aapf-columns-tablet, 2), 1fr);
	}
}

@media (max-width: 480px) {
	.aapf-posts-card .aapf-posts-grid {
		grid-template-columns: repeat(var(--aapf-columns-mobile, 1), 1fr);
	}
}

/* Responsive Card Layout */
@media (max-width: 768px) {
	.aapf-card-date-overlay {
		width: 60px;
		height: 60px;
		top: 10px;
		right: 10px;
	}

	.aapf-card-date-day-month {
		font-size: 12px;
	}

	.aapf-card-date-year {
		font-size: 10px;
	}

	.aapf-card-category-overlay {
		bottom: 10px;
		left: 10px;
		padding: 5px 10px;
		font-size: 11px;
	}

	.aapf-card-content {
		padding: 20px;
	}
}

