/* World Graph Studio Search Widget Styles */

.worldgraph-search-widget {
	position: relative;
}

.worldgraph-search-form {
	position: relative;
}

.worldgraph-search-input-wrapper {
	display: flex;
	align-items: center;
	border: 2px solid #c3c4c7;
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
	transition: border-color 0.2s ease;
}

.worldgraph-search-input-wrapper:focus-within {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.worldgraph-search-input {
	flex: 1;
	padding: 8px 12px;
	border: none;
	outline: none;
	font-size: 14px;
	line-height: 1.5;
	background: transparent;
}

.worldgraph-search-input::placeholder {
	color: #8c8f94;
}

.worldgraph-search-button {
	padding: 8px 12px;
	background: #f6f7f7;
	border: none;
	border-left: 1px solid #c3c4c7;
	cursor: pointer;
	color: #2271b1;
	transition: background 0.2s ease;
}

.worldgraph-search-button:hover {
	background: #f0f0f1;
}

.worldgraph-search-button .dashicons {
	vertical-align: middle;
}

/* Entity Type Filters */
.worldgraph-search-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
	padding: 8px;
	background: #f6f7f7;
	border-radius: 4px;
}

.worldgraph-filter-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	cursor: pointer;
	font-size: 13px;
	transition: all 0.2s ease;
	user-select: none;
}

.worldgraph-filter-item:hover {
	border-color: var(--entity-color, #2271b1);
	background: var(--entity-color, #2271b1);
	color: #fff;
}

.worldgraph-filter-item input[type="checkbox"]:checked + .dashicons {
	filter: brightness(0) invert(1);
}

.worldgraph-filter-item input[type="checkbox"]:checked ~ .dashicons {
	filter: brightness(0) invert(1);
}

.worldgraph-filter-item .dashicons {
	font-size: 16px;
	line-height: 1;
}

/* Search Results Dropdown */
.worldgraph-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	max-height: 400px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	z-index: 100000;
}

.worldgraph-search-results-header {
	padding: 8px 12px;
	background: #f6f7f7;
	border-bottom: 1px solid #c3c4c7;
	font-size: 12px;
	font-weight: 600;
	color: #50575e;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.worldgraph-search-result-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid #f0f0f1;
	cursor: pointer;
	transition: background 0.15s ease;
}

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

.worldgraph-search-result-item:hover,
.worldgraph-search-result-item.highlighted {
	background: #f0f0f1;
}

.worldgraph-result-icon {
	width: 32px;
	height: 32px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.worldgraph-result-icon .dashicons {
	color: #fff;
	font-size: 16px;
}

.worldgraph-result-content {
	flex: 1;
	min-width: 0;
}

.worldgraph-result-title {
	font-size: 14px;
	font-weight: 500;
	color: #1d2327;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.worldgraph-result-snippet {
	font-size: 12px;
	color: #646970;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.worldgraph-result-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	flex-shrink: 0;
}

.worldgraph-result-type {
	font-size: 11px;
	padding: 2px 6px;
	border-radius: 3px;
	background: #f0f0f1;
	color: #50575e;
	white-space: nowrap;
}

.worldgraph-result-score {
	font-size: 11px;
	color: #8c8f94;
}

/* Loading State */
.worldgraph-search-loading {
	padding: 20px;
	text-align: center;
	color: #646970;
}

.worldgraph-search-loading .dashicons {
	animation: spin 1s linear infinite;
	vertical-align: middle;
}

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* No Results */
.worldgraph-search-no-results {
	padding: 20px;
	text-align: center;
	color: #646970;
	font-size: 14px;
}

/* Admin Bar Search */
#wpadminbar #worldgraph-search .ab-item {
	color: #c3c4c7;
}

#wpadminbar #worldgraph-search .ab-item:hover,
#wpadminbar .ab-awaiting-action #worldgraph-search .ab-item {
	color: #2271b1;
}

#wpadminbar #worldgraph-search .ab-icon {
	font-size: 18px;
}

/* Responsive */
@media (max-width: 782px) {
	.worldgraph-search-filters {
		flex-direction: column;
	}

	.worldgraph-search-result-item {
		flex-direction: column;
		align-items: flex-start;
	}

	.worldgraph-result-meta {
		flex-direction: row;
		align-items: center;
		gap: 8px;
	}
}

/* Accessibility */
.worldgraph-search-input:focus {
	outline: none;
}

.worldgraph-search-results [role="option"]:focus {
	background: #f0f0f1;
	outline: 2px solid #2271b1;
	outline-offset: -2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	.worldgraph-search-input-wrapper {
		background: #1e1e1e;
		border-color: #3c3c3c;
	}

	.worldgraph-search-input {
		color: #e0e0e0;
	}

	.worldgraph-search-button {
		background: #2a2a2a;
		border-color: #3c3c3c;
	}

	.worldgraph-search-button:hover {
		background: #333;
	}

	.worldgraph-search-filters {
		background: #2a2a2a;
	}

	.worldgraph-filter-item {
		background: #1e1e1e;
		border-color: #3c3c3c;
		color: #e0e0e0;
	}

	.worldgraph-search-results {
		background: #1e1e1e;
		border-color: #3c3c3c;
	}

	.worldgraph-search-results-header {
		background: #2a2a2a;
		border-color: #3c3c3c;
		color: #ccc;
	}

	.worldgraph-search-result-item {
		border-color: #3c3c3c;
	}

	.worldgraph-search-result-item:hover,
	.worldgraph-search-result-item.highlighted {
		background: #2a2a2a;
	}

	.worldgraph-result-title {
		color: #e0e0e0;
	}

	.worldgraph-result-snippet {
		color: #aaa;
	}

	.worldgraph-result-type {
		background: #333;
		color: #ccc;
	}

	.worldgraph-search-no-results {
		color: #aaa;
	}
}
