/* ===========================================================================
 * AAPS Blogs page (3389) — category tabs filter, sort dropdown & pagination.
 * The tabs/sort/grid are styled in Elementor; this file adds the interactive
 * chrome (sort menu, numbered pagination) + hides the now-unused native panels.
 * ======================================================================== */

/* The loop grid was pulled out of the tabs into #aapsBlogsGrid, so the tab
 * content panels are empty — collapse them. The tab headings remain. */
#aapsBlogsFilter .e-n-tabs-content { display: none !important; }

/* The tab strip is rebuilt from the live category list (can be many), so keep
 * it on a single horizontally-scrollable row. */
#aapsBlogsFilter .e-n-tabs-heading {
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none;          /* Firefox */
	-ms-overflow-style: none;       /* IE/Edge */
}
#aapsBlogsFilter .e-n-tabs-heading::-webkit-scrollbar { height: 0; display: none; }
#aapsBlogsFilter .e-n-tab-title { flex: 0 0 auto; white-space: nowrap; }

/* The custom AJAX pagination replaces the widget's native load-more / pagination. */
#aapsBlogsGrid .e-load-more-anchor,
#aapsBlogsGrid .elementor-button-wrapper,
#aapsBlogsGrid .e-load-more-spinner,
#aapsBlogsGrid nav.elementor-pagination { display: none !important; }

/* ── our results grid (replaces the native loop grid once JS renders) ───── */
.aaps-blogs-results {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: 32px;
	row-gap: 48px;
	transition: opacity .15s ease;
}
@media (max-width: 1024px) { .aaps-blogs-results { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .aaps-blogs-results { grid-template-columns: 1fr; } }

#aapsBlogsGrid.aaps-blogs-loading .aaps-blogs-results {
	opacity: .45;
	pointer-events: none;
}

.aaps-blogs-empty {
	grid-column: 1 / -1;
	margin: 0;
	padding: 56px 16px;
	text-align: center;
	color: #535862;
	font-size: 16px;
}

/* ── sort dropdown ──────────────────────────────────────────────────────── */
#aapsBlogsFilterSort.aaps-sort-ready { position: relative; cursor: pointer; }
#aapsBlogsFilterSort.aaps-sort-ready:focus-visible { outline: 2px solid #104C94; outline-offset: 2px; }
#aapsBlogsFilterSort img { transition: transform .2s ease; }
#aapsBlogsFilterSort.is-open img { transform: rotate(180deg); }

#aapsBlogsFilterSort .aaps-sort-menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	left: 0;
	min-width: 210px;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #fff;
	border: 1px solid #E9EAEB;
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(10, 13, 18, .12);
	z-index: 60;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
#aapsBlogsFilterSort.is-open .aaps-sort-menu {
	opacity: 1;
	visibility: visible;
	transform: none;
}
.aaps-sort-opt {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.3;
	color: #414651;
	white-space: nowrap;
}
.aaps-sort-opt:hover { background: #F5F5F5; }
.aaps-sort-opt.is-active { color: #181D27; font-weight: 600; }
.aaps-sort-opt.is-active::after {
	content: "";
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	background: #104C94;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M16.67 5 7.5 14.17 3.33 10' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M16.67 5 7.5 14.17 3.33 10' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ── numbered pagination (Untitled-UI style, matching the design) ───────── */
.aaps-blogs-pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	margin-top: 48px;
	padding-top: 20px;
	border-top: 1px solid #E9EAEB;
}
.aaps-blogs-pagination[hidden] { display: none; }

/* Neutralise the site's global button / kit styling that leaks onto bare
 * <button> elements (accent border + background). */
.aaps-blogs-pagination button {
	margin: 0;
	background: none !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 8px !important;
	box-shadow: none !important;
	text-shadow: none !important;
	font-family: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	        appearance: none;
}

.aaps-pg-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	padding: 8px 6px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	color: #535862 !important;
}
.aaps-pg-btn svg { display: block; flex: 0 0 auto; }
.aaps-pg-btn:hover:not([disabled]) { color: #181D27 !important; }
.aaps-pg-btn[disabled] { opacity: .4; cursor: default; }

.aaps-pg-list {
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.aaps-pg-list li { display: flex; }
.aaps-pg-num {
	min-width: 40px;
	height: 40px;
	padding: 0 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	color: #717680 !important;
}
.aaps-pg-num:hover { background: #FAFAFA !important; color: #181D27 !important; }
.aaps-pg-num.is-active { background: #FAFAFA !important; color: #252B37 !important; font-weight: 600; }
.aaps-pg-dots {
	min-width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #717680;
	font-size: 14px;
}

@media (max-width: 767px) {
	.aaps-blogs-pagination { gap: 8px; }
	.aaps-pg-btn span { display: none; }     /* arrows only on small screens */
	.aaps-pg-num { min-width: 36px; height: 36px; }
}

/* Clickable featured-image container (overlay anchor injected per card by JS).
   The image container carries the post link the same way the card title/arrow do. */
.aaps-blogs-results .e-loop-item .elementor-element-34a1018 { position: relative; }
.aaps-blogs-results .aaps-card-img-link {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
	text-indent: -9999px;
	overflow: hidden;
}
