/* ==========================================================================
   Existing Desktop Styles (Unchanged)
   ========================================================================== */
.angie-applications-directory {
	font-family: inherit;
	max-width: 1200px;
	margin: 2rem auto;
	background: #fff;
}

.angie-app-layout {
	display: flex;
	flex-wrap: wrap;
	gap: 30px;
}

.angie-app-sidebar {
	flex: 0 0 24%;
}

.angie-app-sidebar-title {
	font-size: 1.2rem;
	margin-bottom: 1rem;
	border-bottom: 2px solid #283C8F;
	padding-bottom: 0.5rem;
}

.angie-app-search-form {
	display: flex;
	gap: 5px;
	margin-bottom: 1rem;
}

.angie-app-search-input {
	flex: 1;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
	min-width: 0;
}

.angie-app-search-button {
	padding: 8px 12px;
	background-color: #283C8F;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.angie-app-cat-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.angie-app-cat-list li {
	margin-bottom: 0.5rem;
}

.angie-app-cat-list a {
	text-decoration: none;
	color: #555;
	display: block;
	padding: 8px 12px;
	border-radius: 4px;
	background: #f9f9f9;
	transition: all 0.2s;
}

.angie-app-cat-list a:hover,
.angie-app-cat-list a.active {
	background: #283C8F;
	color: #fff;
}

.angie-app-content {
	flex: 0 0 calc(76% - 30px);
	min-width: 0;
}

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

.angie-app-card {
	border: 1px solid #eaeaea;
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: #fff;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	opacity: 0;
	transform: translateY(20px);
}

@media (prefers-reduced-motion: reduce) {
	.angie-app-card {
		transition: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
}

.angie-app-card.angie-fade-in-up {
	transition: transform 0.6s ease-out, opacity 0.6s ease-out, box-shadow 0.3s ease;
	opacity: 1;
	transform: translateY(0);
}

.angie-app-card:hover {
	transform: translateY(-5px);
	box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.angie-app-card-img {
	overflow: hidden;
}

.angie-app-card-img img {
	width: 100%;
	height: 200px;
	object-fit: contain;
	display: block;
	transition: transform 0.4s ease;
	background: #fdfdfd;
}

.angie-app-card-img:hover img {
	transform: scale(1.04);
}

.angie-app-card-content {
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.angie-app-card-title {
	margin: 0 0 10px;
	font-size: 1.1rem;
}

.angie-app-card-title a {
	color: #333;
	text-decoration: none;
}

.angie-app-card-title a:hover {
	color: #283C8F;
}

.angie-app-card-excerpt {
	color: #666;
	font-size: 0.9rem;
	margin-bottom: 1.5rem;
	flex: 1;
}

.angie-app-card-more {
	display: inline-block;
	color: #283C8F;
	font-weight: bold;
	text-decoration: none;
	font-size: 0.9rem;
	text-transform: uppercase;
	transition: color 0.25s ease;
}

.angie-app-card-more:hover {
	color: #FFC011;
	text-decoration: underline;
}

.angie-app-pagination ul {
	display: flex;
	list-style: none;
	padding: 0;
	margin: 2rem 0 0;
	justify-content: center;
	gap: 5px;
}

.angie-app-pagination a,
.angie-app-pagination span {
	display: block;
	padding: 8px 12px;
	border: 1px solid #ddd;
	background: #fff;
	color: #333;
	text-decoration: none;
	border-radius: 4px;
}

.angie-app-pagination .current {
	background: #283C8F;
	color: #fff;
	border-color: #283C8F;
}

.angie-app-pagination a:hover {
	background: #f0f0f0;
}

/* ==========================================================================
   Responsive Layout Overrides
   ========================================================================== */

@media (max-width: 1024px) {
	.angie-app-sidebar {
		flex: 0 0 30%;
	}
	.angie-app-content {
		flex: 0 0 calc(70% - 30px);
	}
	.angie-app-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ==========================================================================
   Mobile Filter Drawer Styles (Scoped)
   ========================================================================== */

.infinity-mobile-filter-btn {
	display: none;
}

.infinity-mobile-filter-backdrop {
	display: none;
}

.infinity-mobile-filter-drawer {
	display: none;
}

@media (max-width: 767px) {
	/* Hide desktop sidebar title in mobile */
	.desktop-only-title {
		display: none;
	}

	/* Adjust layout to remove sidebar gap */
	.angie-app-sidebar {
		display: none; /* Hidden by default until moved into drawer */
	}
	.angie-app-content {
		flex: 100%;
		/* Add bottom padding so fixed button doesn't hide content */
		padding-bottom: 70px;
	}
	.angie-app-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Fixed Bottom Button */
	.infinity-mobile-filter-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: env(safe-area-inset-bottom, 12px);
		left: 15px;
		right: 15px;
		width: calc(100% - 30px);
		height: 48px;
		background: #283C8F;
		color: #ffffff;
		border: none;
		border-radius: 6px;
		font-size: 16px;
		font-weight: 600;
		z-index: 999;
		cursor: pointer;
		box-shadow: 0 4px 12px rgba(0,0,0,0.2);
	}

	/* Mobile Drawer Backdrop */
	.infinity-mobile-filter-backdrop {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0,0,0,0.5);
		z-index: 9999;
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s ease;
	}
	.infinity-mobile-filter-backdrop.is-open {
		opacity: 1;
		visibility: visible;
	}

	/* Mobile Drawer */
	.infinity-mobile-filter-drawer {
		display: flex;
		flex-direction: column;
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		max-height: 85dvh;
		background: #ffffff;
		border-radius: 16px 16px 0 0;
		z-index: 10000;
		transform: translateY(100%);
		transition: transform 0.3s ease;
		box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
	}
	.infinity-mobile-filter-drawer.is-open {
		transform: translateY(0);
	}

	.infinity-mobile-drawer-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 15px 20px;
		border-bottom: 1px solid #eaeaea;
	}
	.infinity-mobile-drawer-title {
		margin: 0;
		font-size: 1.2rem;
		color: #333;
	}
	.infinity-mobile-drawer-close {
		background: transparent;
		border: none;
		font-size: 20px;
		color: #666;
		cursor: pointer;
		padding: 5px;
	}

	.infinity-mobile-drawer-body {
		padding: 20px;
		overflow-y: auto;
		flex: 1;
		-webkit-overflow-scrolling: touch;
	}
	
	/* When sidebar is inside drawer */
	.infinity-mobile-drawer-body .angie-app-sidebar {
		display: block;
		flex: none;
		width: 100%;
	}
	.infinity-mobile-drawer-body .angie-app-search-form {
		flex-direction: column;
		gap: 10px;
	}
	.infinity-mobile-drawer-body .angie-app-search-button {
		width: 100%;
	}

	.infinity-mobile-drawer-footer {
		display: flex;
		gap: 15px;
		padding: 15px 20px;
		border-top: 1px solid #eaeaea;
		background: #fafafa;
	}
	.infinity-mobile-btn-reset,
	.infinity-mobile-btn-show {
		flex: 1;
		padding: 12px;
		text-align: center;
		border-radius: 4px;
		font-weight: 600;
		cursor: pointer;
		text-decoration: none;
		font-size: 14px;
	}
	.infinity-mobile-btn-reset {
		background: #f0f0f0;
		color: #333;
		border: 1px solid #ddd;
	}
	.infinity-mobile-btn-show {
		background: #283C8F;
		color: #fff;
		border: 1px solid #283C8F;
	}
}

@media (max-width: 480px) {
	.angie-app-grid {
		grid-template-columns: 1fr;
	}
}
