/* Admin-UI – gemeinsame Basis (Design-Tokens + Komponenten)
 * Referenz: admin_ui_rules.md · Maßstab: Umfrageeditor
 * Einbindung: AddCSS("/p/css/adm-ui.css"); Root: class="adm-ui-app"
 */

.adm-ui-app {
	--adm-bg: #f4f6fb;
	--adm-card: #fff;
	--adm-border: #dce3f2;
	--adm-text: #1e2a44;
	--adm-muted: #5c6b88;
	--adm-accent: #2f5fd4;
	--adm-accent-hover: #244ba8;
	--adm-green: #0b7a2a;
	--adm-green-hover: #096423;
	--adm-green-soft: #e8f7ec;
	--adm-green-border: #7bc995;
	--adm-shadow: 0 8px 28px rgba(30, 42, 68, 0.08);
	--adm-radius: 14px;
	--adm-radius-sm: 10px;
	max-width: 1100px;
	margin: 20px auto 40px;
	color: var(--adm-text);
	font-size: 15px;
	line-height: 1.45;
}

/* Volle Breite des Admin-Inhaltsbereichs (z. B. Filemanager, Logo-Verwaltung) */
.adm-ui-app.adm-ui-app--full {
	max-width: none;
	width: 100%;
	box-sizing: border-box;
}

/* Header */
.adm-ui-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
	padding: 20px 22px;
	background: linear-gradient(135deg, #eef2ff 0%, #f8faff 55%, #fff 100%);
	border: 1px solid var(--adm-border);
	border-radius: var(--adm-radius);
	box-shadow: var(--adm-shadow);
}

.adm-ui-header h2 {
	margin: 0 0 6px;
	font-size: 1.45rem;
	font-weight: 800;
}

.adm-ui-header p {
	margin: 0;
	color: var(--adm-muted);
	font-size: 0.92rem;
}

/* Buttons */
.adm-ui-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 1px solid var(--adm-border);
	border-radius: var(--adm-radius-sm);
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	background: #fff;
	color: var(--adm-text);
	transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.adm-ui-btn:hover {
	border-color: #b8c5e4;
	background: #f7f9ff;
}

.adm-ui-btn:active {
	transform: scale(0.98);
}

.adm-ui-btn-primary {
	background: var(--adm-green);
	border-color: #075e20;
	color: #fff;
}

.adm-ui-btn-primary:hover {
	background: var(--adm-green-hover);
	border-color: #064d1b;
	color: #fff;
}

.adm-ui-btn-secondary {
	background: var(--adm-accent);
	border-color: var(--adm-accent);
	color: #fff;
}

.adm-ui-btn-secondary:hover {
	background: var(--adm-accent-hover);
	border-color: var(--adm-accent-hover);
	color: #fff;
}

.adm-ui-btn-ghost {
	background: transparent;
	border-style: dashed;
	color: var(--adm-accent);
}

.adm-ui-btn-danger {
	background: #fff;
	border-color: #e8b4b4;
	color: #b00000;
}

.adm-ui-btn-danger:hover {
	background: #fff0f0;
	border-color: #d88;
	color: #8b0000;
}

.adm-ui-icon-btn {
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	color: var(--adm-muted);
	cursor: pointer;
	border-radius: 8px;
}

.adm-ui-icon-btn:hover {
	background: rgba(0, 0, 0, 0.06);
	color: var(--adm-text);
}

/* List + cards */
.adm-ui-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 16px;
}

.adm-ui-card {
	background: var(--adm-card);
	border: 1px solid var(--adm-border);
	border-radius: var(--adm-radius);
	padding: 18px;
	box-shadow: var(--adm-shadow);
	display: flex;
	flex-direction: column;
	gap: 12px;
	transition: box-shadow 0.2s, border-color 0.2s;
}

.adm-ui-card:hover {
	border-color: #b8c5e4;
	box-shadow: 0 12px 32px rgba(30, 42, 68, 0.12);
}

.adm-ui-card.is-active {
	border-color: var(--adm-green-border);
	box-shadow: 0 0 0 1px var(--adm-green-border), var(--adm-shadow);
}

.adm-ui-card-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 8px;
}

.adm-ui-card-title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 800;
}

.adm-ui-card-excerpt {
	margin: 0;
	color: var(--adm-muted);
	font-size: 0.9rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.adm-ui-card-meta {
	font-size: 0.82rem;
	color: var(--adm-muted);
}

.adm-ui-card-foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
	padding-top: 4px;
}

/* Badges */
.adm-ui-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.adm-ui-badge-live {
	background: var(--adm-green-soft);
	color: var(--adm-green);
}

.adm-ui-badge-off {
	background: #eef1f6;
	color: var(--adm-muted);
}

.adm-ui-badge-warn {
	background: #fff4e5;
	color: #9a5b00;
}

/* Stat blocks (3-col in card) */
.adm-ui-card-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.adm-ui-stat {
	text-align: center;
	padding: 8px 4px;
	background: var(--adm-bg);
	border-radius: var(--adm-radius-sm);
}

.adm-ui-stat strong {
	display: block;
	font-size: 1.2rem;
	color: var(--adm-text);
}

.adm-ui-stat span {
	font-size: 0.72rem;
	color: var(--adm-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* Progress bars */
.adm-ui-mini-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.adm-ui-mini-bar label {
	flex: 0 0 38%;
	font-size: 0.8rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.adm-ui-mini-bar-track {
	flex: 1;
	height: 8px;
	background: #e8edf7;
	border-radius: 4px;
	overflow: hidden;
}

.adm-ui-mini-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--adm-accent), #6b8fe8);
	border-radius: 4px;
	transition: width 0.4s ease;
}

.adm-ui-mini-bar em {
	flex: 0 0 36px;
	font-style: normal;
	font-size: 0.78rem;
	color: var(--adm-muted);
	text-align: right;
}

.adm-ui-result-bar {
	margin-bottom: 10px;
}

.adm-ui-result-bar-header {
	display: flex;
	justify-content: space-between;
	font-size: 0.85rem;
	margin-bottom: 4px;
}

.adm-ui-result-bar-track {
	height: 10px;
	background: #e8edf7;
	border-radius: 5px;
	overflow: hidden;
}

.adm-ui-result-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--adm-green), #3cb85a);
	border-radius: 5px;
}

/* Links */
.adm-ui-link-row {
	display: inline-flex;
	align-items: flex-start;
	gap: 6px;
	max-width: 100%;
}

.adm-ui-card-link {
	font-size: 0.85rem;
	word-break: break-all;
}

.adm-ui-copy-link {
	flex-shrink: 0;
	margin-top: 1px;
	border: none;
	background: transparent;
	color: var(--adm-muted);
	cursor: pointer;
	padding: 2px 6px;
	border-radius: 6px;
	font-size: 0.95rem;
	line-height: 1.2;
}

.adm-ui-copy-link:hover,
.adm-ui-copy-link:focus-visible {
	color: var(--adm-accent);
	background: rgba(37, 99, 235, 0.08);
	outline: none;
}

/* Empty state */
.adm-ui-empty {
	text-align: center;
	padding: 48px 24px;
	background: var(--adm-card);
	border: 2px dashed var(--adm-border);
	border-radius: var(--adm-radius);
	color: var(--adm-muted);
}

/* Toast */
.adm-ui-toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 100100;
	max-width: 360px;
	padding: 14px 18px;
	border-radius: 12px;
	font-weight: 700;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	transform: translateY(120%);
	opacity: 0;
	transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.35s;
	pointer-events: none;
}

.adm-ui-toast.is-visible {
	transform: translateY(0);
	opacity: 1;
}

.adm-ui-toast.ok {
	background: var(--adm-green);
	color: #fff;
}

.adm-ui-toast.err {
	background: #c62828;
	color: #fff;
}

/* Drawer */
.adm-ui-drawer {
	position: fixed;
	inset: 0;
	z-index: 100090;
	pointer-events: none;
}

.adm-ui-drawer.is-open {
	pointer-events: auto;
}

.adm-ui-drawer-overlay {
	position: absolute;
	inset: 0;
	background: rgba(12, 18, 36, 0.45);
	opacity: 0;
	transition: opacity 0.3s;
}

.adm-ui-drawer.is-open .adm-ui-drawer-overlay {
	opacity: 1;
}

/* Zentrierte Modals (z. B. VidText) hängen oft an document.body – eigene Tokens */
.adm-ui-drawer.adm-ui-drawer--center {
	--adm-bg: #f4f6fb;
	--adm-card: #fff;
	--adm-border: #dce3f2;
	--adm-text: #1e2a44;
	--adm-muted: #5c6b88;
	--adm-accent: #2f5fd4;
	--adm-accent-hover: #244ba8;
	--adm-green: #0b7a2a;
	--adm-green-hover: #096423;
	--adm-green-soft: #e8f7ec;
	--adm-green-border: #7bc995;
	--adm-shadow: 0 8px 28px rgba(30, 42, 68, 0.08);
	--adm-radius: 14px;
	--adm-radius-sm: 10px;
	color: var(--adm-text);
}

.adm-ui-drawer-panel {
	position: absolute;
	top: 0;
	right: 0;
	width: min(520px, 100%);
	height: 100%;
	background: #fff;
	box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.adm-ui-drawer.is-open .adm-ui-drawer-panel {
	transform: translateX(0);
}

.adm-ui-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	border-bottom: 1px solid var(--adm-border);
	background: linear-gradient(135deg, #f3f6ff, #fff);
}

.adm-ui-drawer-head h3 {
	margin: 0;
	font-size: 1.15rem;
}

.adm-ui-drawer-body {
	flex: 1;
	overflow: auto;
	padding: 18px;
}

.adm-ui-drawer-foot {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 14px 18px;
	border-top: 1px solid var(--adm-border);
	background: #fafbfd;
}

/* Modal (zentriert) */
.adm-ui-modal {
	position: fixed;
	inset: 0;
	z-index: 100095;
	display: none;
	pointer-events: none;
}

.adm-ui-modal[hidden] {
	display: none !important;
}

.adm-ui-modal.is-open {
	display: block;
	pointer-events: auto;
}

.adm-ui-modal-overlay {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: rgba(12, 18, 36, 0.48);
	opacity: 0;
	transition: opacity 0.28s ease;
}

.adm-ui-modal.is-open .adm-ui-modal-overlay {
	opacity: 1;
}

.adm-ui-modal-panel {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 1;
	width: min(560px, calc(100% - 24px));
	max-height: calc(100vh - 32px);
	transform: translate(-50%, -48%) scale(0.98);
	background: var(--adm-card, #fff);
	border-radius: var(--adm-radius, 14px);
	box-shadow: var(--adm-shadow, 0 8px 28px rgba(30, 42, 68, 0.08)), 0 24px 64px rgba(12, 18, 36, 0.18);
	display: flex;
	flex-direction: column;
	opacity: 0;
	transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.28s ease;
	overflow: hidden;
}

.adm-ui-modal.is-open .adm-ui-modal-panel {
	transform: translate(-50%, -50%) scale(1);
	opacity: 1;
}

.adm-ui-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	padding: 16px 18px;
	border-bottom: 1px solid var(--adm-border, #dce3f2);
	background: linear-gradient(135deg, #f3f6ff, #fff);
	border-radius: var(--adm-radius, 14px) var(--adm-radius, 14px) 0 0;
}

.adm-ui-modal-head h3 {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--adm-text, #1e2a44);
}

.adm-ui-modal-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 18px;
}

.adm-ui-modal-foot {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	flex-shrink: 0;
	gap: 10px;
	padding: 14px 18px;
	border-top: 1px solid var(--adm-border, #dce3f2);
	background: #fafbfd;
	border-radius: 0 0 var(--adm-radius, 14px) var(--adm-radius, 14px);
}

/* Form fields */
.adm-ui-field {
	margin-bottom: 16px;
}

.adm-ui-field label,
.adm-ui-field-label {
	display: block;
	margin-bottom: 6px;
	font-weight: 700;
	font-size: 0.88rem;
	color: #33415f;
}

/* Einheitliche Controls in allen adm-ui-app-Modulen */
.adm-ui-app input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="file"]),
.adm-ui-app select,
.adm-ui-app textarea,
.adm-ui-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="file"]),
.adm-ui-field select,
.adm-ui-field textarea {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid var(--adm-border);
	border-radius: var(--adm-radius-sm);
	padding: 11px 12px;
	font: inherit;
	font-size: 15px;
	line-height: 1.35;
	color: var(--adm-text);
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.adm-ui-app input::placeholder,
.adm-ui-field input::placeholder,
.adm-ui-app textarea::placeholder,
.adm-ui-field textarea::placeholder {
	color: #8a97b0;
	opacity: 1;
}

.adm-ui-app input:hover:not(:disabled):not(:read-only),
.adm-ui-app textarea:hover:not(:disabled):not(:read-only),
.adm-ui-field input:hover:not(:disabled):not(:read-only),
.adm-ui-field textarea:hover:not(:disabled):not(:read-only) {
	border-color: #b8c5e4;
	background-color: #fcfdff;
}

.adm-ui-app select:hover:not(:disabled),
.adm-ui-field select:hover:not(:disabled) {
	border-color: #b8c5e4;
	background-color: #fcfdff;
}

.adm-ui-app input:focus,
.adm-ui-app textarea:focus,
.adm-ui-field input:focus,
.adm-ui-field textarea:focus {
	outline: none;
	border-color: var(--adm-accent);
	box-shadow: 0 0 0 3px rgba(47, 95, 212, 0.18);
	background-color: #fff;
}

.adm-ui-app select:focus,
.adm-ui-field select:focus {
	outline: none;
	border-color: var(--adm-accent);
	box-shadow: 0 0 0 3px rgba(47, 95, 212, 0.18);
	background-color: #fff;
}

.adm-ui-app input:disabled,
.adm-ui-app select:disabled,
.adm-ui-app textarea:disabled,
.adm-ui-app input:read-only,
.adm-ui-field input:disabled,
.adm-ui-field select:disabled,
.adm-ui-field textarea:disabled,
.adm-ui-field input:read-only,
.adm-ui-field textarea:read-only {
	background: var(--adm-bg);
	color: var(--adm-muted);
	cursor: not-allowed;
}

.adm-ui-app select,
.adm-ui-field select {
	appearance: none;
	background-color: #fff;
	background-image: linear-gradient(45deg, transparent 50%, var(--adm-muted) 50%),
		linear-gradient(135deg, var(--adm-muted) 50%, transparent 50%);
	background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	padding-right: 36px;
}

.adm-ui-check,
.adm-ui-field--check {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
	cursor: pointer;
	user-select: none;
}

.adm-ui-check input[type="checkbox"],
.adm-ui-field--check input[type="checkbox"] {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--adm-green);
	flex-shrink: 0;
	cursor: pointer;
}

.adm-ui-check span,
.adm-ui-field--check span {
	font-weight: 600;
	font-size: 0.92rem;
	color: var(--adm-text);
}

.adm-ui-form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 8px;
	padding-top: 16px;
	border-top: 1px solid var(--adm-border);
}

.adm-ui-dialog {
	--adm-bg: #f4f6fb;
	--adm-card: #fff;
	--adm-border: #dce3f2;
	--adm-text: #1e2a44;
	--adm-muted: #5c6b88;
	--adm-accent: #2f5fd4;
	--adm-accent-hover: #244ba8;
	--adm-green: #0b7a2a;
	--adm-green-hover: #096423;
	--adm-green-soft: #e8f7ec;
	--adm-green-border: #7bc995;
	--adm-shadow: 0 8px 28px rgba(30, 42, 68, 0.08);
	--adm-radius: 14px;
	--adm-radius-sm: 10px;
	border: none;
	border-radius: var(--adm-radius);
	padding: 0;
	width: fit-content;
	max-width: min(440px, calc(100vw - 32px));
	box-shadow: 0 20px 60px rgba(12, 18, 36, 0.22);
	color: var(--adm-text);
	position: fixed;
	inset: 0;
	height: fit-content;
	max-height: calc(100vh - 32px);
	margin: auto;
	overflow: auto;
}

.adm-ui-dialog::backdrop {
	background: rgba(12, 18, 36, 0.45);
}

.adm-ui-dialog-form {
	padding: 22px;
}

.adm-ui-dialog-form h3 {
	margin: 0 0 18px;
	font-size: 1.15rem;
	font-weight: 800;
}

.adm-ui-row2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

/* Toggle */
.adm-ui-toggle-wrap {
	margin-bottom: 20px;
}

.adm-ui-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	user-select: none;
}

.adm-ui-toggle input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.adm-ui-toggle-ui {
	width: 48px;
	height: 28px;
	background: #c5cede;
	border-radius: 999px;
	position: relative;
	transition: background 0.2s;
	flex-shrink: 0;
}

.adm-ui-toggle-ui::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s;
}

.adm-ui-toggle input:checked + .adm-ui-toggle-ui {
	background: var(--adm-green);
}

.adm-ui-toggle input:checked + .adm-ui-toggle-ui::after {
	transform: translateX(20px);
}

.adm-ui-toggle-label small {
	font-weight: 400;
	color: var(--adm-muted);
}

/* Sections */
.adm-ui-section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.adm-ui-section-head h4 {
	margin: 0;
	font-size: 0.95rem;
}

.adm-ui-inset-panel {
	margin-bottom: 20px;
	padding: 14px;
	background: var(--adm-bg);
	border-radius: 12px;
}

.adm-ui-divider-section {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid var(--adm-border);
}

.adm-ui-divider-section h4 {
	margin: 0 0 12px;
	font-size: 0.95rem;
}

.adm-ui-hint {
	font-size: 0.85rem;
	color: var(--adm-muted);
	margin: 0 0 10px;
}

.adm-ui-pill {
	padding: 6px 12px;
	background: var(--adm-bg);
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 600;
}

.adm-ui-pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

/* Sortable option rows */
.adm-ui-sort-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.adm-ui-sort-grip {
	color: #aab4c8;
	font-size: 14px;
	cursor: grab;
	padding: 4px;
}

.adm-ui-sort-row input {
	flex: 1;
	border: 1px solid var(--adm-border);
	border-radius: var(--adm-radius-sm);
	padding: 10px 12px;
	font: inherit;
}

.adm-ui-row-remove {
	width: 36px;
	height: 36px;
	border: 1px solid #e0e6f2;
	border-radius: var(--adm-radius-sm);
	background: #fff;
	color: #888;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
}

.adm-ui-row-remove:hover {
	background: #fff0f0;
	border-color: #e8b4b4;
	color: #c62828;
}

/* Path / slug row */
.adm-ui-path-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 12px;
}

.adm-ui-path-prefix {
	color: var(--adm-muted);
	font-size: 0.9rem;
}

.adm-ui-path-row input {
	flex: 1;
	min-width: 120px;
	border: 1px solid var(--adm-border);
	border-radius: var(--adm-radius-sm);
	padding: 10px 12px;
	font: inherit;
}

.adm-ui-path-locked {
	word-break: break-all;
	font-weight: 600;
}

.adm-ui-path-locked .adm-ui-link-row {
	display: flex;
	align-items: flex-start;
}

/* Form status */
.adm-ui-form-status {
	display: none;
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-weight: 600;
	font-size: 0.9rem;
}

.adm-ui-form-status.err {
	display: block;
	background: #fff0f0;
	border: 1px solid #e8b4b4;
	color: #b00000;
}

@media (max-width: 640px) {
	.adm-ui-header {
		flex-direction: column;
	}

	.adm-ui-row2 {
		grid-template-columns: 1fr;
	}

	.adm-ui-list {
		grid-template-columns: 1fr;
	}

	.adm-ui-toast {
		left: 16px;
		right: 16px;
		max-width: none;
	}
}
