/**
 * Unified Catalog — structural stub only.
 * Visual design is a separate follow-up pass; this just keeps the
 * facets/actions/results layout usable before that pass lands.
 */

.academe-catalog {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.academe-catalog__form {
	display: flex;
	flex-direction: row;
	gap: 1rem;
	justify-content: flex-start;
	align-items: center;
}

.academe-catalog__facets-wrapper,
.academe-catalog__facets {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/* Each facet is a dropdown: a trigger button plus a floating panel that
   overlays the page instead of pushing layout, so long option lists
   (subject/subsubject/tag) just scroll inside the panel. */
.academe-catalog__facet {
	position: relative;
}

.academe-catalog__facet-trigger {
	display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    border: none;
    font: inherit;
    cursor: pointer;
    border-radius: 14px;
    padding: 10px 16px 10px 10px;
    min-width: 160px;
	border: 1px solid var(--wp--preset--color--gray-002);
}
.academe-catalog__facet-trigger.active{
	background-color: var(--wp--preset--color--light-blue);
	border: 1px solid var(--wp--preset--color--blue);
}
.academe-catalog__facet-trigger.active:hover{
	background-color: var(--wp--preset--color--dark-blue);
	border: 1px solid var(--wp--preset--color--dark-blue);
}
.academe-catalog__facet-trigger[aria-expanded="true"] {
	border-color: #888;
	background: #f2f2f2;
}
.academe-catalog__facet-trigger-label{
	flex-grow: 1;
}
/* .academe-catalog__facet-trigger-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.25rem;
	height: 1.25rem;
	padding: 0 0.35rem;
	border-radius: 999px;
	background: var(--wp--preset--color--dark-blue);
	color: #fff;
	font-size: 0.75em;
	line-height: 1;
} */
/* .academe-catalog__facet-trigger.active:hover .academe-catalog__facet-trigger-count{
	background: #fff;
	color: var(--wp--preset--color--dark-blue);
} */
/* [hidden] has the same specificity as the class rule above; without this,
   the class rule's `display: inline-flex` wins over the browser's default
   `[hidden] { display: none }` and the badge never actually hides. */
.academe-catalog__facet-trigger-count[hidden] {
	display: none;
}

.academe-catalog__facet-trigger-icon {
	font-size: 0.7em;
	opacity: 0.6;
}
/* .academe-catalog__facet-trigger-icon::after {
	content: "\25BE";
} */

.academe-catalog__facet-panel {
	position: absolute;
	top: calc(100% + 0.35rem);
	left: 0;
	z-index: 100;
	min-width: 14rem;
	max-height: 18rem;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
	padding: 0.5rem;
}

.academe-catalog__facet-panel[hidden] {
	display: none;
}

.academe-catalog__facet-search {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 0.4rem;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--wp--preset--color--gray-002);
	border-radius: 8px;
	font: inherit;
	position: sticky;
	top: 0;
	background: #fff;
}

.academe-catalog__facet-option {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.3rem 0.25rem;
	white-space: nowrap;
}

/* Same [hidden]-vs-unconditional-display specificity tie already fixed for the
   trigger-count/apply-count badges — needed again here for facet search filtering. */
.academe-catalog__facet-option[hidden] {
	display: none;
}

.academe-catalog__facet-count {
	color: #777;
	font-size: 0.85em;
}

.academe-catalog__actions {
	display: flex;
	gap: 0.75rem;
	align-items: center;
}

.academe-catalog__apply{
	background-color: var(--wp--preset--color--primary);
	border: 1px solid var(--wp--preset--color--primary);
	color:#ffffff;
	border-radius: 14px;
    padding:10px 16px;
	cursor: pointer;
	
}
.academe-catalog__clear{
	border: none;
	background-color: transparent;
	color:var(--wp--preset--color--foreground);
	cursor: pointer;

}
.academe-catalog__apply:hover{
border: 1px solid var(--wp--preset--color--foreground);
background-color:var(--wp--preset--color--foreground);
	color:#ffffff;
	}
	.academe-catalog__clear:hover{
		border-bottom: 1px solid var(--wp--preset--color--primary);
	color:var(--wp--preset--color--primary);
	}
.academe-catalog__apply-count {
	display: inline-block;
	margin-inline-start: 0.35rem;
}

.academe-catalog__apply-count[hidden] {
	display: none;
}

.academe-catalog__meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
}

.academe-catalog__summary {
	/* color: var(--wp--preset--color--foreground); */
	font-weight: 700;
}

.academe-catalog__sort {
	display: flex;
}

.academe-catalog__sort-select {
	border: 1px solid var(--wp--preset--color--gray-002);
	background-color: var(--wp--preset--color--gray-002);
	border-radius: 14px;
	padding: 10px 16px;
	font: inherit;
	cursor: pointer;
}

.academe-catalog__results {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

.academe-catalog__group-title {
	margin: 0 0 0.75rem;
}

.academe-catalog__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(312px, 1fr));
	gap: 1.25rem;
}


.academe-catalog__group[data-catalog-group="lectures"] .academe-catalog__grid {
	grid-template-columns: repeat(auto-fit, minmax(540px, 1fr)) !important;
}


/* Loading overlay: toggled via .is-loading on .academe-catalog__results-wrapper
   (the stable node fetchCatalog() attaches to) for the duration of any AJAX
   request — Apply, Clear all, pagination, sort change, and popstate all route
   through the same fetchCatalog(), so this covers all of them consistently. */
.academe-catalog__results-wrapper.is-loading .academe-catalog__grid {
	position: relative;
	min-height: 10rem;
}

.academe-catalog__results-wrapper.is-loading .academe-catalog__grid::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	z-index: 5;
}

.academe-catalog__results-wrapper.is-loading .academe-catalog__grid::after {
	content: "";
	position: absolute;
	top: 5%;
	left: 50%;
	width: 4rem;
	height: 4rem;
	margin: -1rem 0 0 -1rem;
	border: 3px solid var(--wp--preset--color--gray-002, #ddd);
	border-top-color: var(--wp--preset--color--primary, #333);
	border-radius: 50%;
	z-index: 6;
	animation: academe-catalog-spin 0.8s linear infinite;
}

@keyframes academe-catalog-spin {
	to {
		transform: rotate(360deg);
	}
}

.academe-catalog__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding: 3rem 1rem;
	text-align: center;
}

.academe-catalog__pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1.5rem;
}
