/**
 * OpenFields Relational Fields Styles.
 *
 * Styles for post object, taxonomy, and user fields.
 *
 * @package OpenFields
 * @since   1.0.0
 */

/* Base containers */
.cofld-post-object-field,
.cofld-user-field {
	position: relative;
}

/* Selected items container */
.cofld-selected-items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 8px;
}

.cofld-selected-items:empty {
	margin-bottom: 0;
}

/* Individual selected item */
.cofld-selected-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: #f0f0f1;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 13px;
	line-height: 1.4;
}

.cofld-selected-item:hover {
	border-color: #8c8f94;
}

.cofld-item-title {
	font-weight: 500;
	color: #1d2327;
}

.cofld-item-type {
	color: #646970;
	font-size: 12px;
}

.cofld-remove-item {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	padding: 0;
	border: none;
	background: none;
	color: #8c8f94;
	cursor: pointer;
	border-radius: 50%;
	transition: all 0.15s ease;
}

.cofld-remove-item:hover {
	color: #d63638;
	background: rgba(214, 54, 56, 0.1);
}

.cofld-remove-item .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* User avatar in selected items */
.cofld-selected-item .cofld-user-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
}

/* Search container */
.cofld-search-container {
	position: relative;
}

.cofld-search-input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 14px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cofld-search-input:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

/* Search results dropdown */
.cofld-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	max-height: 300px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-top: none;
	border-radius: 0 0 4px 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 100;
	display: none;
}

.cofld-search-results.active {
	display: block;
}

/* Loading and empty states */
.cofld-search-loading,
.cofld-search-empty,
.cofld-search-error {
	padding: 12px 16px;
	color: #646970;
	font-size: 13px;
	text-align: center;
}

.cofld-search-error {
	color: #d63638;
}

/* Individual search result */
.cofld-search-result {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f1;
	transition: background-color 0.1s ease;
}

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

.cofld-search-result:hover {
	background: #f6f7f7;
}

.cofld-result-title {
	flex: 1;
	font-weight: 500;
	color: #1d2327;
}

.cofld-result-type {
	color: #646970;
	font-size: 12px;
	background: #f0f0f1;
	padding: 2px 8px;
	border-radius: 10px;
}

.cofld-result-email {
	color: #646970;
	font-size: 12px;
}

/* User avatar in search results */
.cofld-search-result .cofld-user-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex-shrink: 0;
}

/* Taxonomy field styles */
.cofld-taxonomy-field {
	width: 100%;
}

.cofld-taxonomy-checkbox,
.cofld-taxonomy-radio {
	max-height: 200px;
	overflow-y: auto;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 8px;
	background: #fff;
}

.cofld-checkbox-label,
.cofld-radio-label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	cursor: pointer;
	border-radius: 4px;
	transition: background-color 0.1s ease;
}

.cofld-checkbox-label:hover,
.cofld-radio-label:hover {
	background: #f6f7f7;
}

.cofld-term-count {
	color: #646970;
	font-size: 12px;
	margin-left: auto;
}

/* Searchable select enhancement */
.cofld-searchable-select {
	min-height: 38px;
}

/* Multiple select styling */
.cofld-searchable-select[multiple] {
	min-height: 150px;
}

/* Error state */
.cofld-error {
	color: #d63638;
	background: #fcf0f1;
	padding: 8px 12px;
	border-radius: 4px;
	border: 1px solid #d63638;
}

/* ============================================================================
   Link Field Styles
   ============================================================================ */

.cofld-link-field {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cofld-link-row {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cofld-link-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 500;
	color: #1d2327;
}

.cofld-link-label .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	color: #646970;
}

.cofld-link-url,
.cofld-link-title {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 14px;
}

.cofld-link-url:focus,
.cofld-link-title:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

.cofld-link-target-row {
	flex-direction: row;
	align-items: center;
}

.cofld-checkbox-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 13px;
	color: #1d2327;
}

.cofld-checkbox-inline input[type="checkbox"] {
	margin: 0;
}
