/**
 * wap-tasklists — Frontend-Komponenten-Bibliothek.
 *
 * Portiert aus design/extracted-tasklists/aufgabenlisten/aufgaben.css.
 * Verwendet AUSSCHLIESSLICH theme.json-Presets (--wp--preset--*) und die
 * :root-Tokens des Themes (--wap-*). Keine eigenen Farben/Radien/Schatten.
 *
 * Wird von beiden Blocks (my-tasks, instance-view) enqueued.
 */

/* ---------------------------------------------------------- Status-Indikator */
.wap-tl-status {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	flex: none;
	position: relative;
	box-sizing: border-box;
	background: var(--wp--preset--color--surface);
	padding: 0;
}
.wap-tl-status--open {
	border: 2px solid var(--wp--preset--color--border-strong);
}
.wap-tl-status--progress {
	border: 2px solid var(--wp--preset--color--secondary);
	background: linear-gradient(
		90deg,
		var(--wp--preset--color--secondary) 50%,
		var(--wp--preset--color--surface) 50%
	);
}
.wap-tl-status--done {
	background: var(--wp--preset--color--secondary);
	border: 2px solid var(--wp--preset--color--secondary);
}
.wap-tl-status--done::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 3px;
	width: 5px;
	height: 9px;
	border: solid var(--wp--preset--color--surface);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.wap-tl-status--skipped {
	border: 2px solid var(--wp--preset--color--border-strong);
	background: var(--wp--preset--color--surface-muted);
}
.wap-tl-status--skipped::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 2px;
	background: var(--wp--preset--color--text-subtle);
	transform: translate(-50%, -50%) rotate(-45deg);
	border-radius: 2px;
}
button.wap-tl-status {
	cursor: pointer;
	transition: transform var(--wap-dur-fast), box-shadow var(--wap-dur-fast);
	border-style: solid;
}
button.wap-tl-status:hover {
	box-shadow: var(--wap-focus-ring);
}
button.wap-tl-status:focus-visible {
	outline: none;
	box-shadow: var(--wap-focus-ring);
}
button.wap-tl-status[disabled] {
	cursor: default;
}
button.wap-tl-status[disabled]:hover {
	box-shadow: none;
}

/* ----------------------------------------------------------------- Avatare */
.wap-tl-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 10px;
	line-height: 1;
	color: var(--wp--preset--color--surface);
	background: var(--wp--preset--color--primary);
	user-select: none;
}
.wap-tl-avatar--md {
	width: 32px;
	height: 32px;
	font-size: 12px;
}
.wap-tl-avatar--lg {
	width: 40px;
	height: 40px;
	font-size: 14px;
}
.wap-tl-avatar--teal {
	background: var(--wp--preset--color--secondary);
}
.wap-tl-avatar--slate {
	background: var(--wp--preset--color--text-muted);
}
.wap-tl-avatar--blue {
	background: var(--wap-primary-70);
}
.wap-tl-avatar--group {
	background: var(--wap-primary-15);
	color: var(--wp--preset--color--primary);
}
.wap-tl-avatar--more {
	background: var(--wap-primary-15);
	color: var(--wp--preset--color--primary);
	font-size: 9px;
}
.wap-tl-avatar svg {
	width: 56%;
	height: 56%;
}

.wap-tl-avatar-stack {
	display: inline-flex;
	align-items: center;
}
.wap-tl-avatar-stack > * {
	margin-left: -7px;
	box-shadow: 0 0 0 2px var(--wp--preset--color--surface);
}
.wap-tl-avatar-stack > *:first-child {
	margin-left: 0;
}

.wap-tl-assignee {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--text-muted);
	white-space: nowrap;
}

/* ------------------------------------------------------------- Gruppen-Chip */
.wap-tl-group-chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--text-muted);
	white-space: nowrap;
}
.wap-tl-group-chip__tip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	z-index: 20;
	background: var(--wp--preset--color--text);
	color: var(--wp--preset--color--surface);
	font-size: 0.75rem;
	line-height: 1.5;
	padding: 8px 11px;
	border-radius: var(--wap-radius-md);
	box-shadow: var(--wap-shadow-3);
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateY(3px);
	transition: opacity var(--wap-dur-fast), transform var(--wap-dur-fast);
}
.wap-tl-group-chip__tip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 14px;
	border: 5px solid transparent;
	border-top-color: var(--wp--preset--color--text);
}
.wap-tl-group-chip:hover .wap-tl-group-chip__tip {
	opacity: 1;
	transform: translateY(0);
}
.wap-tl-group-chip__tip-title {
	font-weight: 700;
	color: var(--wap-on-dark-2);
	display: block;
	margin-bottom: 3px;
}

/* --------------------------------------------------------------- Pills/Badges */
.wap-tl-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	white-space: nowrap;
	font-family: var(--wp--preset--font-family--body);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	padding: 4px 9px;
	border-radius: var(--wap-radius-pill);
}
.wap-tl-pill svg {
	width: 12px;
	height: 12px;
}
.wap-tl-pill--du {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--surface);
}
.wap-tl-pill--warning {
	background: var(--wp--preset--color--warning-bg);
	color: var(--wp--preset--color--warning);
}
.wap-tl-pill--danger {
	background: var(--wp--preset--color--danger-bg);
	color: var(--wp--preset--color--danger);
}
.wap-tl-pill--success {
	background: var(--wp--preset--color--success-bg);
	color: var(--wp--preset--color--success);
}
.wap-tl-pill--count {
	background: var(--wp--preset--color--secondary-15);
	color: var(--wp--preset--color--secondary);
}
.wap-tl-pill--field {
	background: var(--wp--preset--color--surface-muted);
	color: var(--wp--preset--color--text-muted);
	font-weight: 600;
}
.wap-tl-pill--field strong {
	color: var(--wp--preset--color--text-body);
	font-weight: 700;
}
.wap-tl-req {
	color: var(--wp--preset--color--danger);
	font-size: 14px;
	line-height: 0;
	font-weight: 700;
}

.wap-tl-counter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 22px;
	padding: 0 7px;
	border-radius: var(--wap-radius-pill);
	background: var(--wp--preset--color--secondary-15);
	color: var(--wp--preset--color--secondary);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 0.8125rem;
}

/* Listen-Referenz-Chip (Item → Instanz) */
.wap-tl-ref-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--wp--preset--color--text-muted);
	text-decoration: none;
	padding: 2px 0;
	white-space: nowrap;
	transition: color var(--wap-dur-fast);
}
.wap-tl-ref-chip svg {
	width: 13px;
	height: 13px;
	color: var(--wp--preset--color--secondary);
	flex: none;
}
.wap-tl-ref-chip:hover {
	color: var(--wp--preset--color--secondary);
}

/* ------------------------------------------------------------ Fortschritt */
.wap-tl-progress {
	display: flex;
	align-items: center;
	gap: 12px;
}
.wap-tl-progress__track {
	flex: 1;
	height: 4px;
	border-radius: var(--wap-radius-pill);
	background: var(--wp--preset--color--border);
	overflow: hidden;
}
.wap-tl-progress__fill {
	height: 100%;
	background: var(--wp--preset--color--secondary);
	border-radius: inherit;
	transition: width var(--wap-dur-base) var(--wap-ease-standard);
}
.wap-tl-progress__label {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--text-body);
	white-space: nowrap;
}
.wap-tl-progress--done .wap-tl-progress__fill {
	background: var(--wp--preset--color--success);
}
.wap-tl-progress--lg .wap-tl-progress__track {
	height: 8px;
}
.wap-tl-progress--lg .wap-tl-progress__label {
	font-size: 0.9375rem;
}

/* --------------------------------------------------------------- Item-Karte */
.wap-tl-item-list {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wap-radius-lg);
	box-shadow: var(--wap-shadow-1);
	overflow: hidden;
}
.wap-tl-item {
	display: grid;
	grid-template-columns: 28px 1fr auto;
	align-items: start;
	gap: 12px;
	padding: 14px 16px;
	background: var(--wp--preset--color--surface);
	border-bottom: 1px solid var(--wp--preset--color--border);
	position: relative;
	transition: background var(--wap-dur-fast) var(--wap-ease-standard);
}
.wap-tl-item:last-child {
	border-bottom: none;
}
.wap-tl-item:hover {
	background: var(--wp--preset--color--primary-04);
}
.wap-tl-item--own {
	padding-left: 20px;
}
.wap-tl-item--own::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--wp--preset--color--secondary);
}
.wap-tl-item__status {
	display: flex;
	justify-content: center;
	padding-top: 1px;
}
.wap-tl-item__main {
	min-width: 0;
	text-align: left;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	font: inherit;
}
.wap-tl-item__title {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	font-size: 0.9375rem;
	color: var(--wp--preset--color--text);
	display: flex;
	align-items: center;
	gap: 7px;
	line-height: 1.3;
}
.wap-tl-item--done .wap-tl-item__title {
	text-decoration: line-through;
	text-decoration-color: var(--wp--preset--color--border-strong);
	color: var(--wp--preset--color--text-subtle);
}
.wap-tl-item--skipped .wap-tl-item__title {
	color: var(--wp--preset--color--text-subtle);
}
.wap-tl-item__desc {
	font-size: 0.8125rem;
	color: var(--wp--preset--color--text-muted);
	margin-top: 4px;
	line-height: 1.45;
}
.wap-tl-item__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 10px;
	margin-top: 10px;
}
.wap-tl-item__actions {
	display: flex;
	align-items: center;
	gap: 2px;
	opacity: 0;
	transition: opacity var(--wap-dur-fast);
}
.wap-tl-item:hover .wap-tl-item__actions,
.wap-tl-item:focus-within .wap-tl-item__actions {
	opacity: 1;
}

/* Icon-Button (Item-Aktionen) */
.wap-tl-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: var(--wap-radius-md);
	border: none;
	background: none;
	color: var(--wp--preset--color--text-subtle);
	cursor: pointer;
	transition: background var(--wap-dur-fast), color var(--wap-dur-fast);
}
.wap-tl-icon-btn:hover {
	background: var(--wp--preset--color--primary-08);
	color: var(--wp--preset--color--primary);
}
.wap-tl-icon-btn svg {
	width: 18px;
	height: 18px;
}

/* --------------------------------------------------------------- Empty-State */
.wap-tl-empty {
	text-align: center;
	padding: 56px 24px;
	max-width: 440px;
	margin: 0 auto;
}
.wap-tl-empty__icon {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--primary-08);
	color: var(--wap-primary-50);
	margin-bottom: 18px;
}
.wap-tl-empty__icon svg {
	width: 26px;
	height: 26px;
}
.wap-tl-empty__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--wp--preset--color--text-body);
	margin: 0 0 6px;
}
.wap-tl-empty__text {
	font-size: 0.875rem;
	color: var(--wp--preset--color--text-muted);
	margin: 0 0 18px;
}
