/**
 * Glossary Search Autocomplete Styles
 * World-class search UI with smooth animations and modern design
 */

/* Search Input Container */
.dt-glossary-search-wrapper {
	position: relative;
	width: 100%;
	max-width: 600px;
	margin: 0 auto 2rem;
}

.dt-glossary-search-input {
	width: 100%;
	padding: 12px 16px;
	padding-left: 40px;
	font-size: 16px;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	transition: all 0.3s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
}

.dt-glossary-search-input:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dt-glossary-search-input::placeholder {
	color: #9ca3af;
}

/* Search Icon */
.dt-glossary-search-wrapper::before {
	content: '🔍';
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 18px;
	pointer-events: none;
}

/* Autocomplete Results Container */
.dt-glossary-autocomplete-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: white;
	border: 1px solid #e5e7eb;
	border-top: none;
	border-radius: 0 0 8px 8px;
	max-height: 500px;
	overflow-y: auto;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	display: none;
	margin-top: -1px;
}

.dt-glossary-autocomplete-results.dt-visible {
	display: block;
}

/* Results Content */
.dt-autocomplete-content {
	padding: 8px 0;
}

/* Section */
.dt-autocomplete-section {
	padding: 8px 0;
}

.dt-autocomplete-section:not(:last-child) {
	border-bottom: 1px solid #f3f4f6;
}

.dt-autocomplete-section-title {
	padding: 8px 16px;
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: #f9fafb;
}

/* Individual Item */
.dt-autocomplete-item {
	display: flex;
	align-items: center;
	padding: 10px 12px;
	margin: 0 4px;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
	transition: all 0.2s ease;
	cursor: pointer;
}

.dt-autocomplete-item:hover,
.dt-autocomplete-item.dt-active {
	background: #f3f4f6;
}

.dt-autocomplete-item.dt-active {
	background: #eff6ff;
	border-left: 3px solid #3b82f6;
	padding-left: 9px;
}

/* Item Image */
.dt-autocomplete-item-image {
	width: 40px;
	height: 40px;
	margin-right: 12px;
	flex-shrink: 0;
	border-radius: 6px;
	overflow: hidden;
	background: #f3f4f6;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
}

.dt-autocomplete-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dt-placeholder-image {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
}

/* Item Content */
.dt-autocomplete-item-content {
	flex: 1;
	min-width: 0;
}

.dt-autocomplete-item-title {
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	margin-bottom: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dt-autocomplete-item-title mark {
	background: #fef08a;
	color: inherit;
	font-weight: 600;
	padding: 0 2px;
	border-radius: 2px;
}

.dt-autocomplete-item-excerpt {
	font-size: 13px;
	color: #6b7280;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* View Count Badge */
.dt-view-count {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	background: #f0f9ff;
	color: #0369a1;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
	margin-left: 8px;
	flex-shrink: 0;
}

.dt-view-count .dt-icon {
	font-size: 12px;
}

/* Term Item Styling */
.dt-autocomplete-item.dt-autocomplete-term {
	padding: 10px 16px;
}

.dt-autocomplete-term .dt-autocomplete-item-image {
	display: none;
}

.dt-autocomplete-term .dt-icon {
	font-size: 16px;
	margin-left: 8px;
}

/* Loading State */
.dt-autocomplete-loading {
	padding: 20px;
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: #6b7280;
	font-size: 14px;
}

.dt-loader {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #e5e7eb;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: dt-spin 0.8s linear infinite;
}

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

/* No Results */
.dt-autocomplete-no-results,
.dt-autocomplete-error {
	padding: 30px 20px;
	text-align: center;
	color: #6b7280;
	font-size: 14px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.dt-autocomplete-no-results .dt-icon,
.dt-autocomplete-error .dt-icon {
	font-size: 28px;
	opacity: 0.5;
}

.dt-autocomplete-error {
	color: #dc2626;
}

/* Footer */
.dt-autocomplete-footer {
	padding: 10px 16px;
	font-size: 12px;
	color: #9ca3af;
	background: #f9fafb;
	border-top: 1px solid #e5e7eb;
	text-align: right;
}

.dt-autocomplete-footer kbd {
	display: inline-block;
	padding: 2px 6px;
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
	font-size: 11px;
	color: #374151;
}

/* Scrollbar Styling */
.dt-glossary-autocomplete-results::-webkit-scrollbar {
	width: 8px;
}

.dt-glossary-autocomplete-results::-webkit-scrollbar-track {
	background: transparent;
}

.dt-glossary-autocomplete-results::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 4px;
}

.dt-glossary-autocomplete-results::-webkit-scrollbar-thumb:hover {
	background: #9ca3af;
}

/* Most Searched Terms Sidebar */
.dt-most-searched-terms {
	background: white;
	border-radius: 8px;
	padding: 20px;
	border: 1px solid #e5e7eb;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dt-most-searched-terms h3 {
	font-size: 16px;
	font-weight: 600;
	color: #1f2937;
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.dt-most-searched-terms h3::before {
	content: '🔥';
	font-size: 18px;
}

.dt-searched-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.dt-searched-list li {
	padding: 0;
	margin-bottom: 0;
	border-bottom: 1px solid #f3f4f6;
}

.dt-searched-list li:last-child {
	border-bottom: none;
}

.dt-searched-list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 0;
	color: #3b82f6;
	text-decoration: none;
	font-size: 14px;
	transition: color 0.2s ease;
}

.dt-searched-list a:hover {
	color: #1e40af;
}

.dt-search-item-count {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: #6b7280;
	background: #f3f4f6;
	padding: 2px 8px;
	border-radius: 4px;
}

.dt-empty-message {
	color: #9ca3af;
	text-align: center;
	padding: 20px 0;
	font-size: 14px;
	font-style: italic;
}

.dt-recently-searched-terms {
	background: white;
	border-radius: 8px;
	padding: 20px;
	border: 1px solid #e5e7eb;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	margin-bottom: 20px;
}

.dt-recently-searched-terms h3 {
	font-size: 16px;
	font-weight: 600;
	color: #1f2937;
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.dt-recently-searched-terms h3::before {
	content: '⏱️';
	font-size: 18px;
}

.dt-recent-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.dt-recent-list li {
	padding: 0;
	margin-bottom: 0;
	border-bottom: 1px solid #f3f4f6;
}

.dt-recent-list li:last-child {
	border-bottom: none;
}

.dt-recent-list a {
	display: block;
	padding: 10px 0;
	color: #3b82f6;
	text-decoration: none;
	font-size: 14px;
	transition: color 0.2s ease;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dt-recent-list a:hover {
	color: #1e40af;
}

/* Glossary View Count Display */
.dt-glossary-view-count {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	background: #f0f9ff;
	color: #0369a1;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	margin-top: 12px;
}

.dt-glossary-view-count .dt-icon {
	font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
	.dt-glossary-search-wrapper {
		margin: 0 auto 1.5rem;
	}

	.dt-glossary-search-input {
		font-size: 16px;
		padding: 11px 12px;
		padding-left: 36px;
	}

	.dt-glossary-autocomplete-results {
		max-height: 400px;
	}

	.dt-autocomplete-item {
		padding: 8px 10px;
	}

	.dt-autocomplete-item-image {
		width: 36px;
		height: 36px;
		margin-right: 10px;
	}

	.dt-autocomplete-item-title {
		font-size: 13px;
	}

	.dt-autocomplete-item-excerpt {
		font-size: 12px;
	}

	.dt-view-count {
		padding: 3px 6px;
		font-size: 11px;
	}

	.dt-autocomplete-section-title {
		padding: 6px 12px;
		font-size: 11px;
	}

	.dt-autocomplete-footer {
		padding: 8px 12px;
		font-size: 11px;
	}

	.dt-most-searched-terms,
	.dt-recently-searched-terms {
		padding: 16px;
	}

	.dt-most-searched-terms h3,
	.dt-recently-searched-terms h3 {
		font-size: 15px;
		margin-bottom: 12px;
	}

	.dt-searched-list a,
	.dt-recent-list a {
		padding: 8px 0;
		font-size: 13px;
	}
}

/* Accessibility */
.dt-glossary-search-input:focus-visible,
.dt-autocomplete-item:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: -2px;
}

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