/* DB Connect live-search dropdown — scoped .ai-ls-* to stay clear of
   Herald's own styles. Matches the Anime Flash suggest dropdown layout
   (poster thumb + highlighted title + view-all footer).

   Dark mode: the site-wide "dark reader" plugin maps every color
   algorithmically (bg -> black, text -> warm), so no separate palette
   is needed here — accent red survives as a readable red. */

.herald-search-form.ai-ls-on {
	position: relative;
}

/* iOS Safari auto-zooms the page when an input with font-size < 16px
   receives focus; Herald ships the search input at ~12px. Bump it to
   16px on phone/tablet widths only — desktop keeps the theme look. */
@media (max-width: 991px) {
	.herald-search-form.ai-ls-on input[name="s"] {
		font-size: 16px;
	}
}

/* Author display values would beat the UA's [hidden] { display:none },
   which would keep a "closed" dropdown visible — restore it. */
.ai-ls-drop[hidden],
.ai-ls-drop a.ai-ls-viewall[hidden],
.ai-ls-clear[hidden] {
	display: none;
}

/* Clear (X) button — revealed by JS once the field holds text. The
   inline right offset comes from JS (measured against the theme's
   submit button, which differs per form). */
.ai-ls-clear {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 6;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #d60902;
	opacity: 0.8;
	line-height: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.ai-ls-clear svg {
    width: 14px;
    height: 14px;
}
.ai-ls-clear:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.ai-ls-clear:focus-visible {
	outline: 2px solid #d60902;
	outline-offset: 1px;
}

/* Loading State: Hides the cross SVG and shows a CSS spinner */
.ai-ls-clear.ai-ls-loading svg {
    display: none;
}
.ai-ls-clear.ai-ls-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(214, 9, 2, 0.2);
    border-top-color: #d60902;
    border-radius: 50%;
    animation: ai-ls-spin 0.6s linear infinite;
}
@keyframes ai-ls-spin {
    to { transform: rotate(360deg); }
}

/* Roomier touch target on phone/tablet widths. */
@media (max-width: 991px) {
	.ai-ls-clear {
		width: 36px;
		height: 36px;
	}
    .ai-ls-clear svg {
        width: 16px;
        height: 16px;
    }
}

.ai-ls-drop {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	max-height: min(70vh, 480px);
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.09);
	border-top: 0;
	border-radius: 0 0 4px 4px;
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
}

.ai-ls-list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.ai-ls-note {
	padding: 12px 14px;
	color: #7c868d;
}

.ai-ls-drop a.ai-ls-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.05);
	color: #1b1f24;
	text-decoration: none;
}

.ai-ls-drop a.ai-ls-item:hover,
.ai-ls-drop a.ai-ls-item.ai-ls-active {
	background: #f5f8fa;
	color: #d60902;
	text-decoration: none;
}

.ai-ls-drop a.ai-ls-item:focus-visible {
	outline: 2px solid #d60902;
	outline-offset: -2px;
	background: #f5f8fa;
	color: #d60902;
}

/* Roomier touch rows on phone/tablet widths. */
@media (max-width: 991px) {
	.ai-ls-drop a.ai-ls-item {
		padding: 10px 12px;
	}
}

.ai-ls-thumb {
	position: relative;
	flex: 0 0 80px;
	width: 80px;
	height: 45px;
	overflow: hidden;
	border-radius: 3px;
	background: #edf1f3;
	color: #b3bec4;
}

/* Poster fallback — sits behind the image, shows when img is
   absent or errors out. Inline SVG (no font dependency): the theme's
   icon font does NOT reliably provide the old FontAwesome glyph —
   document.fonts.check('14px FontAwesome') is false on the live site
   and the glyph rendered as a missing-glyph box on phones. */
.ai-ls-thumb:before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3bec4' stroke-width='1.6' stroke-linecap='round'%3E%3Crect x='3.5' y='2.5' width='17' height='19' rx='2'/%3E%3Cpath d='M3.5 8h17M8.5 2.5V8M15.5 2.5V8'/%3E%3Cpath d='M10.2 12.2l4.4 2.8-4.4 2.8z' fill='%23b3bec4' stroke='none'/%3E%3C/svg%3E") center / 22px no-repeat;
}

.ai-ls-thumb img {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ai-ls-info {
	flex: 1;
	min-width: 0;
}

.ai-ls-title {
	display: block;
	font-weight: 600;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ai-ls-title mark {
	padding: 0;
	background: none;
	color: #d60902;
}

.ai-ls-meta {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: #8a939a;
}

/* Footer stays pinned while long result lists scroll above it, so the
   escape hatch to the full search page is always one tap away. */
.ai-ls-drop a.ai-ls-viewall {
	flex: 0 0 auto;
	display: block;
	padding: 10px 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.05);
	background: #fafbfc;
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: #d60902;
	text-decoration: none;
}

.ai-ls-drop a.ai-ls-viewall:hover,
.ai-ls-drop a.ai-ls-viewall:focus {
	background: #eef4f7;
	color: #b40702;
	text-decoration: none;
}

/* Header nav dropdowns: long dynamic menus (GENRE/LANGUAGES/OTT/CATEGORIES) scroll
   internally instead of extending past the viewport. Scoped to the site header so
   footer + mobile off-canvas menus are untouched. Kicks in only when a dropdown
   exceeds the cap, so short menus behave exactly as before. */
.herald-site-header .herald-menu ul ul.sub-menu {
	max-height: min(70vh, 480px);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}
.herald-site-header .herald-menu ul ul.sub-menu::-webkit-scrollbar {
	width: 8px;
}
.herald-site-header .herald-menu ul ul.sub-menu::-webkit-scrollbar-track {
	background: transparent;
}
.herald-site-header .herald-menu ul ul.sub-menu::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.25);
	border-radius: 4px;
}
.herald-site-header .herald-menu ul ul.sub-menu::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.4);
}
