/* =====================================================================
   Course search panel (catalogue toolbar). Markup is built by assets/js/course-search.js, data comes from
   the REST route in inc/course-search.php. The bar itself (`.s247-search--bar`) is styled in study247.css.
   The panel sits OVER the page under the bar: absolute, below the sticky header (header is z-index 50).
   ===================================================================== */

.s247-search--bar .e-search { position: relative; }

/*
 * Elementor's "×" (clear) icon shows as soon as there is text. study247.css pins every direct svg of the input
 * wrapper to the left, for the magnifier, so the × landed on top of it. Put it at the right end of the field.
 */
.s247-search.s247-search--bar .e-search-input-wrapper > .e-fas-times { left: auto; right: 14px; width: 14px !important; height: 14px !important; fill: #8b93a1; cursor: pointer; }
.s247-search.s247-search--bar .e-search-input-wrapper > .e-fas-times:hover { fill: var(--s247-ink, #08090d); }
.s247-search.s247-search--bar .e-search-input { padding-right: 40px !important; }

.s247-ls {
	position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: 100%;
	min-width: min(460px, calc(100vw - 2 * var(--s247-gutter, 28px)));
	background: #fff; border: 1px solid var(--s247-line, #e3e6ec); border-radius: 12px; overflow: hidden;
	box-shadow: 0 18px 44px rgba(14, 22, 40, .18), 0 2px 6px rgba(14, 22, 40, .06);
	font: 400 14px/1.5 Arial, Helvetica, sans-serif; color: var(--s247-ink, #08090d); text-align: left;
	animation: s247-ls-in .14s ease-out;
}
.s247-ls[hidden] { display: none; }
@keyframes s247-ls-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* thin progress line while a new query is loading over old results */
.s247-ls.is-loading::before {
	content: ""; position: absolute; z-index: 2; left: 0; top: 0; height: 2px; width: 40%; background: var(--s247-orange, #ff6500);
	animation: s247-ls-bar 1s ease-in-out infinite;
}
@keyframes s247-ls-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.s247-ls.is-loading .s247-ls__row { opacity: .55; }

.s247-ls__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- result rows ---- */
.s247-ls .s247-ls__list { list-style: none; margin: 0; padding: 6px; max-height: min(520px, 70vh); overflow-y: auto; overscroll-behavior: contain; }
.s247-ls .s247-ls__list:empty { display: none; }
.s247-ls .s247-ls__row { margin: 0; padding: 0; list-style: none; }
.s247-ls a.s247-ls__item {
	display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 9px;
	color: inherit; text-decoration: none; transition: background-color .12s;
}
.s247-ls .s247-ls__row[aria-selected="true"] a.s247-ls__item,
.s247-ls a.s247-ls__item:hover { background: #f2f4f8; color: inherit; }
.s247-ls .s247-ls__row[aria-selected="true"] a.s247-ls__item { box-shadow: inset 3px 0 0 var(--s247-blue, #075bef); }

.s247-ls .s247-ls__thumb { flex: none; display: block; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: #e9ecf2; }
.s247-ls .s247-ls__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0; margin: 0; }

.s247-ls .s247-ls__body { flex: 1 1 auto; min-width: 0; display: block; }
.s247-ls .s247-ls__title {
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--s247-ink, #08090d);
}
.s247-ls .s247-ls__row[aria-selected="true"] .s247-ls__title,
.s247-ls a.s247-ls__item:hover .s247-ls__title { color: var(--s247-blue, #075bef); }
.s247-ls mark { background: rgba(255, 101, 0, .16); color: inherit; font-weight: 800; padding: 0 1px; margin: 0 -1px; border-radius: 3px; }
.s247-ls .s247-ls__cat { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: #5d6676; }

.s247-ls .s247-ls__price { flex: none; display: flex; align-items: baseline; gap: 5px; margin-left: auto; padding-left: 4px; white-space: nowrap; }
.s247-ls .s247-ls__price small { font-size: 12px; font-weight: 700; color: #5d6676; }
.s247-ls .s247-ls__price del { font-size: 12px; font-weight: 400; color: #8b93a1; }
.s247-ls .s247-ls__price strong { font-size: 14px; font-weight: 700; color: var(--s247-ink, #08090d); }

/* ---- loading skeleton ---- */
.s247-ls .s247-ls__sk { display: flex; align-items: center; gap: 14px; margin: 0; padding: 10px 16px; list-style: none; }
.s247-ls .s247-ls__sk-thumb { flex: none; width: 56px; height: 56px; border-radius: 8px; }
.s247-ls .s247-ls__sk-lines { flex: 1; display: block; }
.s247-ls .s247-ls__sk-lines span { display: block; height: 11px; border-radius: 6px; }
.s247-ls .s247-ls__sk-lines span + span { width: 45%; height: 9px; margin-top: 9px; }
.s247-ls .s247-ls__sk-thumb, .s247-ls .s247-ls__sk-lines span {
	background: linear-gradient(90deg, #eceff4 25%, #f6f7fa 45%, #eceff4 65%); background-size: 300% 100%; animation: s247-ls-shimmer 1.2s linear infinite;
}
@keyframes s247-ls-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- empty / error ---- */
.s247-ls .s247-ls__note { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 22px 20px; }
.s247-ls .s247-ls__note[hidden] { display: none; }
.s247-ls .s247-ls__note-title { font-size: 15px; font-weight: 800; line-height: 1.4; color: var(--s247-ink, #08090d); }
.s247-ls .s247-ls__note-hint { font-size: 13px; color: #5d6676; }
.s247-ls a.s247-ls__note-link { margin-top: 8px; font-size: 14px; font-weight: 800; color: var(--s247-blue, #075bef); }
.s247-ls a.s247-ls__note-link:hover { text-decoration: underline; }

/* ---- footer: all results ---- */
.s247-ls a.s247-ls__all {
	display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px;
	border-top: 1px solid var(--s247-line, #e3e6ec); background: #f7f8fa; font-size: 14px; font-weight: 800; line-height: 1.4; color: var(--s247-blue, #075bef);
}
.s247-ls a.s247-ls__all[hidden] { display: none; }
.s247-ls a.s247-ls__all:hover { background: #eef2fb; }
.s247-ls a.s247-ls__all span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s247-ls a.s247-ls__all::after {
	content: ""; flex: none; width: 13px; height: 13px; background: currentColor;
	-webkit-mask: var(--s247-icon-chev-r) center / contain no-repeat; mask: var(--s247-icon-chev-r) center / contain no-repeat;
}

/* ---- small screens: the bar is full width, so the panel is too ---- */
@media (max-width: 767px) {
	.s247-ls { min-width: 0; border-radius: 10px; }
	.s247-ls a.s247-ls__item { gap: 11px; padding: 9px 8px; }
	.s247-ls .s247-ls__thumb, .s247-ls .s247-ls__sk-thumb { width: 48px; height: 48px; }
	.s247-ls .s247-ls__price { flex-direction: column; align-items: flex-end; gap: 0; }
	.s247-ls .s247-ls__price small { display: none; }
	.s247-ls .s247-ls__price del { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
	.s247-ls, .s247-ls.is-loading::before, .s247-ls .s247-ls__sk-thumb, .s247-ls .s247-ls__sk-lines span { animation: none; }
}
