/**
 * Search functionality styles for Equine Streaming plugin.
 */

/* Hide elements behind modal when open */
body.equine-search-modal-open .equine-streaming-video-duration,
body.equine-search-modal-open .equine-streaming-video-card,
body.equine-search-modal-open .equine-streaming-video-lock-icon,
body.equine-search-modal-open .equine-streaming-video-free-badge {
	z-index: 1 !important;
	position: relative;
}

/* Search Icon */
.equine-search-icon {
	background: none !important;
	border: none !important;
	cursor: pointer;
	padding: 0 !important;
	margin: 0 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease;
	color: #ffffff !important;
	vertical-align: middle;
}

.equine-search-icon:hover {
	opacity: 0.8;
	color: #ffffff !important;
}

.equine-search-icon:focus {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
	color: #ffffff !important;
}

.equine-search-icon svg {
	stroke: #ffffff !important;
	fill: none !important;
}

/* Search Modal */
.equine-search-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99999999 !important;
	display: none;
	isolation: isolate; /* Create new stacking context */
}

.equine-search-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.75) !important;
	backdrop-filter: blur(4px);
	opacity: 1 !important;
	z-index: 99999998 !important;
}

.equine-search-modal-content {
	position: relative;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	max-width: 600px;
	width: 90%;
	max-height: 80vh;
	margin: 10vh auto;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 99999999 !important;
	opacity: 1 !important;
}

/* Close Button */
.equine-search-modal-close {
	position: absolute;
	top: 0;
	right: 15px;
	background: none !important;
	border: none !important;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0;
	z-index: 10;
	transition: color 0.2s ease;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 300;
	/* Center vertically: input has 20px top padding, so center is at 20px + (line-height / 2) */
	/* Input line-height is 18px * 1.5 = 27px, so center of text is at 20px + 13.5px = 33.5px */
	/* Button center should be at 33.5px, so top should be 33.5px - 15px = 18.5px */
	top: 18.5px;
	transform: translateY(0);
}

.equine-search-modal-close:hover {
	color: #000;
	transform: translateY(0) !important;
}

.equine-search-modal-close:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	transform: translateY(0);
}

/* Search Input */
.equine-search-input {
	width: 100%;
	padding: 20px 50px 20px 20px;
	border: none;
	border-bottom: 2px solid #e0e0e0;
	font-size: 18px;
	line-height: 1.5;
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.2s ease;
	position: relative;
}

.equine-search-input:focus {
	border-bottom-color: #2271b1;
}

.equine-search-input::placeholder {
	color: #999;
}

/* Results Container */
.equine-search-results {
	flex: 1;
	overflow-y: auto;
	padding: 0;
	min-height: 200px;
	max-height: calc(80vh - 80px);
}

/* Results List */
.equine-search-results-list {
	padding: 0;
	margin: 0;
	list-style: none;
}

/* Result Item */
.equine-search-result-item {
	display: grid;
	grid-template-columns: 180px 1fr;
	gap: 20px;
	padding: 15px 20px;
	border-bottom: 1px solid #e0e0e0;
	cursor: pointer;
	transition: background-color 0.2s ease;
	text-decoration: none;
	color: inherit;
	align-items: start;
}

.equine-search-result-item:hover {
	background-color: #f5f5f5;
}

.equine-search-result-item:last-child {
	border-bottom: none;
}

/* Result Thumbnail */
.equine-search-result-thumbnail {
	width: 100%;
	height: 0;
	padding-bottom: 56.25%; /* 16:9 aspect ratio fallback */
	position: relative;
	background-color: #f0f0f0;
	border-radius: 4px;
	overflow: hidden;
	aspect-ratio: 16 / 9; /* Modern browsers */
}

@supports (aspect-ratio: 16 / 9) {
	.equine-search-result-thumbnail {
		padding-bottom: 0;
		height: auto;
	}
}

.equine-search-result-thumbnail img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.equine-search-thumbnail-placeholder {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #e0e0e0;
	color: #999;
	font-size: 32px;
}

.equine-search-result-duration {
	position: absolute;
	bottom: 4px;
	right: 4px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	padding: 2px 6px;
	border-radius: 2px;
	font-size: 11px;
	font-weight: 600;
}

/* Result Content */
.equine-search-result-content {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.equine-search-result-title {
	margin: 0 0 8px 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: #333;
	word-wrap: break-word;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	max-height: 2.6em;
}

.equine-search-result-taxonomies {
	margin: 0;
	font-size: 12px;
	line-height: 1.4;
	color: #666;
	word-wrap: break-word;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	max-height: 2.8em;
}

/* Loading State */
.equine-search-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	color: #666;
}

.equine-search-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #e0e0e0;
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: equine-search-spin 0.8s linear infinite;
	margin-bottom: 15px;
}

@keyframes equine-search-spin {
	to {
		transform: rotate(360deg);
	}
}

.equine-search-loading p {
	margin: 0;
	font-size: 14px;
}

/* No Results */
.equine-search-no-results {
	padding: 40px 20px;
	text-align: center;
	color: #666;
}

.equine-search-no-results p {
	margin: 0;
	font-size: 16px;
}

/* Error State */
.equine-search-error {
	padding: 40px 20px;
	text-align: center;
	color: #d63638;
}

.equine-search-error p {
	margin: 0;
	font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
	.equine-search-modal-content {
		width: 95%;
		margin: 5vh auto;
		max-height: 90vh;
	}

	.equine-search-input {
		font-size: 16px;
		padding: 15px 45px 15px 15px;
	}

	.equine-search-result-item {
		grid-template-columns: 120px 1fr;
		padding: 12px 15px;
		gap: 12px;
	}

	.equine-search-result-title {
		font-size: 13px;
	}

	.equine-search-result-taxonomies {
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.equine-search-result-item {
		grid-template-columns: 1fr;
		gap: 10px;
	}
}
