/* ==========================================================================
   Tags — Pill-style tag input with autocomplete
   ========================================================================== */

/* ── Tag input container ────────────────────────────────────────────────── */

.tag-input {
	position: relative;
}

.tag-input-pills {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sc-space-xs);
	min-height: 2.75rem;
	padding: var(--sc-space-xs) var(--sc-space-sm);
	background-color: var(--sc-bg);
	border: var(--sc-border-width) solid var(--sc-border);
	border-radius: var(--sc-radius-md);
	cursor: text;
	transition: border-color var(--sc-transition-fast) var(--sc-ease-default),
		box-shadow var(--sc-transition-fast) var(--sc-ease-default);
}

.tag-input-pills:focus-within {
	border-color: var(--sc-accent);
	box-shadow: 0 0 0 3px var(--sc-accent-subtle);
}

/* ── Tag pill ───────────────────────────────────────────────────────────── */

.tag-pill {
	display: inline-flex;
	align-items: center;
	gap: var(--sc-space-xs);
	padding: 2px var(--sc-space-md);
	background-color: var(--sc-accent-subtle);
	color: var(--sc-accent-text);
	border-radius: var(--sc-radius-full);
	font-size: var(--sc-text-sm);
	font-weight: var(--sc-weight-medium);
	white-space: nowrap;
	line-height: 1.6;
}

.tag-pill-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1rem;
	height: 1rem;
	border: none;
	background: none;
	color: var(--sc-accent-text);
	cursor: pointer;
	padding: 0;
	font-size: var(--sc-text-xs);
	border-radius: var(--sc-radius-full);
	opacity: 0.6;
	transition: opacity var(--sc-transition-fast) var(--sc-ease-default);
}

.tag-pill-remove:hover {
	opacity: 1;
}

/* ── Tag input field (inline, borderless) ───────────────────────────────── */

.tag-input-field {
	flex: 1;
	min-width: 80px;
	border: none;
	outline: none;
	background: none;
	font-family: var(--sc-font-body);
	font-size: var(--sc-text-sm);
	color: var(--sc-text-primary);
	padding: var(--sc-space-xs) 0;
}

.tag-input-field::placeholder {
	color: var(--sc-text-tertiary);
}

/* ── Autocomplete dropdown ──────────────────────────────────────────────── */

.tag-autocomplete {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: var(--sc-z-dropdown);
	margin-top: var(--sc-space-xs);
	background-color: var(--sc-surface);
	border: var(--sc-border-width) solid var(--sc-border);
	border-radius: var(--sc-radius-md);
	box-shadow: var(--sc-shadow-md);
	max-height: 200px;
	overflow-y: auto;
}

.tag-autocomplete-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--sc-space-sm) var(--sc-space-md);
	font-size: var(--sc-text-sm);
	color: var(--sc-text-primary);
	cursor: pointer;
	transition: background-color var(--sc-transition-fast) var(--sc-ease-default);
}

.tag-autocomplete-item:hover,
.tag-autocomplete-item-active {
	background-color: var(--sc-accent-subtle);
}

.tag-autocomplete-item-count {
	font-size: var(--sc-text-xs);
	color: var(--sc-text-tertiary);
}

.tag-autocomplete-create {
	padding: var(--sc-space-sm) var(--sc-space-md);
	font-size: var(--sc-text-sm);
	color: var(--sc-accent-text);
	cursor: pointer;
	font-weight: var(--sc-weight-medium);
	border-top: var(--sc-border-width) solid var(--sc-border-subtle);
}

.tag-autocomplete-create:hover {
	background-color: var(--sc-accent-subtle);
}

/* ── Read-only tag display (memory detail, archive cards) ───────────────── */

.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sc-space-xs);
}
