/* ===========================================================
   Düdofamily – Komponenten
   Je Bedienelement GENAU EINE Definition. Wird NACH style.css
   geladen und ersetzt dort verstreute Einzelregeln.
   Nur Tokens aus tokens.css verwenden.
   =========================================================== */

/* ---------- Basis ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
:where(a) { color: var(--accent-strong); text-underline-offset: 3px; }
:where(a:hover) { color: var(--accent-hover); }
::selection { background: var(--accent-soft); color: var(--heading); }

/* Kaushan Script nur für große Überschriften – kleinere in Open Sans (Lesbarkeit mobil) */
h3, h4, h5, h6,
.wp-block-heading:is(h3, h4, h5, h6) {
	font-family: var(--font-body);
	font-weight: 700;
	letter-spacing: 0;
}
h1, h2 { text-wrap: balance; }

/* Sichtbarer Tastatur-Fokus überall */
:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
	border-radius: 6px;
}

/* Icons (SVG-Sprite aus inc/ui.php) */
.duedo-i {
	width: 1.15em;
	height: 1.15em;
	flex: none;
	display: inline-block;
	vertical-align: -0.2em;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.duedo-i.is-ok { color: var(--ok); }
.duedo-i.is-warn { color: var(--warn); }
.duedo-i.is-danger { color: var(--danger); }

/* ---------- Buttons ---------- */
.wp-element-button,
.wp-block-button__link,
input[type="submit"],
input[type="button"],
.duedo-filter-btn,
.duedo-btn-mini,
.duedo-cal-btn,
.duedo-reject-button,
.duedo-delete-button,
.duedo-action-btn,
.duedo-action-edit,
.duedo-btn {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	min-height: var(--btn-h);
	height: auto;
	padding: 0 1.15rem;
	border-radius: var(--r-pill);
	border: 1px solid transparent;
	font: 600 var(--fs-sm)/1.2 var(--font-body);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	vertical-align: middle;
	transition: background-color .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.wp-element-button:active,
.wp-block-button__link:active,
input[type="submit"]:active,
.duedo-btn:active,
.duedo-filter-btn:active { transform: scale(.97); }

/* Primär (Standard) */
.wp-element-button,
.wp-block-button__link:not(.has-background),
input[type="submit"],
.duedo-filter-btn,
.duedo-action-edit,
.duedo-btn-primary {
	background: var(--accent) !important;
	color: var(--on-accent) !important;
}
.wp-element-button:hover,
.wp-block-button__link:not(.has-background):hover,
input[type="submit"]:hover,
.duedo-filter-btn:hover,
.duedo-action-edit:hover,
.duedo-btn-primary:hover {
	background: var(--accent-hover) !important;
	color: var(--on-accent) !important;
}

/* Sekundär (Rahmen) */
.duedo-btn-mini,
.duedo-cal-btn,
.duedo-btn-secondary,
.duedo-back-to-dash .wp-element-button {
	background: var(--surface) !important;
	color: var(--heading) !important;
	border-color: var(--line-strong) !important;
}
.duedo-btn-mini:hover,
.duedo-cal-btn:hover,
.duedo-btn-secondary:hover,
.duedo-back-to-dash .wp-element-button:hover {
	border-color: var(--accent) !important;
	color: var(--accent-strong) !important;
	background: var(--surface) !important;
}

/* Gefährlich */
.duedo-delete-button,
.duedo-reject-button,
.duedo-btn-danger {
	background: var(--surface) !important;
	color: var(--danger) !important;
	border-color: var(--danger-line) !important;
}
.duedo-delete-button:hover,
.duedo-reject-button:hover,
.duedo-btn-danger:hover {
	background: var(--danger) !important;
	color: #fff !important;
	border-color: var(--danger) !important;
}
.duedo-btn-danger.is-solid { background: var(--danger) !important; color: #fff !important; }

/* Ghost */
.duedo-btn-ghost {
	background: transparent !important;
	color: var(--accent-strong) !important;
	border-color: transparent !important;
}
.duedo-btn-ghost:hover { background: var(--accent-soft) !important; }

.duedo-btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }

/* Reine Symbol-Buttons: rund, gleiche Höhe */
a.duedo-btn-icon,
button.duedo-btn-icon,
.duedo-btn.is-icon {
	width: var(--btn-h);
	min-width: var(--btn-h);
	padding: 0 !important;
	border-radius: 50%;
	font-size: 1.05rem;
}

button:disabled,
input[type="submit"]:disabled,
.wp-element-button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Formularfelder ---------- */
input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
input[type="password"], input[type="number"], input[type="date"], input[type="time"],
input[type="search"], input[type="datetime-local"], select, textarea {
	box-sizing: border-box;
	min-height: var(--tap);
	padding: 10px 14px;
	border: 1.5px solid var(--line-strong);
	border-radius: var(--r-sm);
	background: var(--surface);
	color: var(--heading);
	font: 400 var(--fs-md)/1.4 var(--font-body);  /* 16px verhindert iOS-Zoom */
	transition: border-color .15s, box-shadow .15s;
	max-width: 100%;
}
textarea { min-height: 6.5rem; line-height: var(--lh); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .85; }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Sofort-Rückmeldung erst NACH der Eingabe (nicht beim Laden rot) */
input:user-invalid, select:user-invalid, textarea:user-invalid,
[aria-invalid="true"] {
	border-color: var(--danger) !important;
	box-shadow: 0 0 0 3px var(--danger-soft);
}
.duedo-field-error {
	display: flex; align-items: center; gap: 6px;
	color: var(--danger); font-size: var(--fs-xs); font-weight: 600; margin-top: 4px;
}
input[type="checkbox"], input[type="radio"] {
	width: 1.25rem; height: 1.25rem; accent-color: var(--accent); vertical-align: -0.2em;
}
input[type="file"] { font-size: var(--fs-sm); max-width: 100%; }
input[type="file"]::file-selector-button {
	font: 600 var(--fs-sm) var(--font-body);
	min-height: 40px; padding: 0 var(--sp-4); margin-right: var(--sp-3);
	border-radius: var(--r-pill); border: 1px solid var(--line-strong);
	background: var(--surface-2); color: var(--heading); cursor: pointer;
}
label { color: var(--heading); }
.duedo-req, abbr.required { color: var(--danger); text-decoration: none; }

/* Entwurfs-Hinweis (Auto-Speichern) */
.duedo-draft-note {
	display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
	font-size: var(--fs-xs); color: var(--ok); margin: var(--sp-2) 0;
}
.duedo-draft-note button {
	border: 0; background: none; color: var(--accent-strong); font: 600 var(--fs-xs) var(--font-body);
	text-decoration: underline; cursor: pointer; padding: 4px;
}

/* ---------- Karten ---------- */
.duedo-card-ui {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--shadow-1);
}

/* ---------- Badges ---------- */
.duedo-badge,
.duedo-status {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 10px !important;
	border-radius: var(--r-pill);
	font-size: var(--fs-xs) !important;
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: .02em;
	text-transform: none !important;
	height: auto !important;
	white-space: nowrap;
	background: var(--accent-soft);
	color: var(--accent-strong);
	border: 1px solid transparent;
}
.duedo-status.is-live, .duedo-status.is-erledigt, .duedo-badge.is-ok { background: var(--ok-soft); color: var(--ok); }
.duedo-status.is-pending, .duedo-badge.is-accent { background: var(--accent-soft); color: var(--accent-strong); }
.duedo-status.is-rejected, .duedo-status.is-arbeit, .duedo-badge.is-warn { background: var(--warn-soft); color: var(--warn); }
.duedo-status.is-offen, .duedo-status.is-entfaellt, .duedo-badge.is-muted { background: var(--surface-2); color: var(--text-muted); border-color: var(--line); }

/* Roter Punkt / Zähler */
.duedo-card-dot, .duedo-menu-dot {
	display: inline-block; width: 10px; height: 10px; border-radius: 50%;
	background: var(--dot); box-shadow: 0 0 0 2px var(--surface); vertical-align: middle;
}
.duedo-count {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
	background: var(--dot); color: #fff; font: 700 11px/1 var(--font-body);
}

/* ---------- Chips (Filter) ---------- */
.duedo-chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.duedo-chips::-webkit-scrollbar { display: none; }
.duedo-chip {
	flex: none; display: inline-flex; align-items: center; gap: 6px;
	min-height: 36px; padding: 0 14px; border-radius: var(--r-pill);
	border: 1px solid var(--line-strong); background: var(--surface);
	font: 600 var(--fs-sm) var(--font-body); color: var(--text); text-decoration: none; cursor: pointer;
}
.duedo-chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.duedo-chip[aria-pressed="true"], .duedo-chip.is-active { background: var(--heading); border-color: var(--heading); color: var(--surface); }

/* ---------- Meldungen ---------- */
.duedo-msg {
	display: flex !important;
	align-items: flex-start;
	gap: var(--sp-3);
	padding: var(--sp-3) var(--sp-4) !important;
	border-radius: var(--r-md) !important;
	border: 1px solid var(--line) !important;
	background: var(--surface-2) !important;
	color: var(--heading) !important;
	font-size: var(--fs-sm);
	line-height: 1.5;
	animation: duedo-pop .25s var(--ease);
}
.duedo-msg > .duedo-i { margin-top: 2px; font-size: 1.1rem; }
.duedo-msg.is-ok   { background: var(--ok-soft) !important;     border-color: var(--ok-line) !important;     color: var(--ok) !important; }
.duedo-msg.is-err  { background: var(--danger-soft) !important; border-color: var(--danger-line) !important; color: var(--danger) !important; }
.duedo-msg.is-warn { background: var(--warn-soft) !important;   border-color: var(--warn-line) !important;   color: var(--warn) !important; }
.duedo-msg.is-info { background: var(--info-soft) !important;   border-color: var(--info-line) !important;   color: var(--info) !important; }
.duedo-msg strong { color: inherit; }
.duedo-msg .duedo-msg-body { flex: 1; }
.duedo-msg form { margin: 0 0 0 auto; }
.duedo-msg .duedo-undo {
	display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--sp-3);
	border-radius: var(--r-pill); border: 1px solid currentColor; background: transparent;
	color: inherit; font: 600 var(--fs-xs) var(--font-body); cursor: pointer; white-space: nowrap;
}
.duedo-msg .duedo-undo:hover { background: var(--surface); }

/* ---------- Leerzustand ---------- */
.duedo-empty {
	text-align: center;
	padding: var(--sp-6) var(--sp-4);
	color: var(--text-muted);
	background: var(--surface);
	border: 1px dashed var(--line-strong);
	border-radius: var(--r-md);
	margin: var(--sp-4) 0;
}
.duedo-empty-ill {
	width: 64px; height: 64px; margin: 0 auto var(--sp-3);
	border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong);
	display: grid; place-items: center; font-size: 1.6rem;
}
.duedo-empty p { margin: 0 auto var(--sp-3); max-width: 38ch; }
.duedo-empty p:last-child { margin-bottom: 0; }
.duedo-empty strong { color: var(--heading); font-size: var(--fs-lg); }

/* ---------- Tabellen ---------- */
table { border-collapse: collapse; }
th { color: var(--heading); }

/* ---------- Animationen ---------- */
@keyframes duedo-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes duedo-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes duedo-up { from { transform: translateY(100%); } to { transform: none; } }

.duedo-sr-only {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}

/* Ansichts-Umschalter (Liste/Monat/Jahr, Liste/Kacheln/Karte) */
.duedo-viewbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-3) 0; }
.duedo-viewbar .duedo-member-count { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.duedo-viewswitch { margin: var(--sp-3) 0; }
.duedo-viewbar .duedo-viewswitch { margin: 0; }

/* Datei-/Foto-Auswahl (ui.js: enhanceFileInputs) */
.duedo-file { margin: var(--sp-2) 0 var(--sp-3); }
.duedo-file-input { position: absolute !important; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.duedo-file-drop {
	display: flex !important; align-items: center; gap: var(--sp-3);
	padding: var(--sp-4); border: 2px dashed var(--line-strong); border-radius: var(--r-md);
	background: var(--surface-2); color: var(--heading); cursor: pointer; font-weight: 400 !important;
	transition: border-color .15s, background .15s;
}
.duedo-file-drop:hover, .duedo-file-input:focus-visible + .duedo-file-list, .duedo-file:focus-within .duedo-file-drop { border-color: var(--accent); background: var(--accent-soft); }
.duedo-file-drop b { display: block; font-size: var(--fs-md); }
.duedo-file-drop small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }
.duedo-file-ico { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.duedo-file-ico .duedo-i { width: 24px; height: 24px; }
.duedo-file-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.duedo-file.has-files .duedo-file-list { margin-top: var(--sp-2); }
.duedo-file-item { width: 64px; height: 64px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; }
.duedo-file-item img { width: 100%; height: 100%; object-fit: cover; }
.duedo-file-item.is-doc { width: auto; max-width: 100%; height: auto; min-height: 44px; padding: 6px 10px; display: flex; gap: 6px; }
.duedo-file-item.is-doc small { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.duedo-file-count { font-size: var(--fs-xs); color: var(--ok); font-weight: 600; }
