/*
 * TablePress Frontend Uploader – Styles
 * Passe die Variablen unten an dein Corporate Design an (z. B. Vereinsfarben).
 */

/*
 * Wichtig: [hidden] wird hier gezielt mit !important erzwungen, weil einige
 * Elemente unten eigene "display"-Werte (z. B. flex) bekommen. Ohne diese
 * Regel gewinnt die Autoren-CSS gegen das native [hidden]-Attribut, und die
 * Elemente (u. a. das Bestätigungs-Modal) wären fälschlich immer sichtbar.
 */
.tfu-modal-overlay[hidden],
.tfu-preview[hidden],
.tfu-dropzone-file[hidden] {
	display: none !important;
}

.tfu-wrapper {
	--tfu-primary: #2563eb;
	--tfu-primary-dark: #1d4ed8;
	--tfu-primary-light: #eff4ff;
	--tfu-success: #15803d;
	--tfu-success-bg: #f0fdf4;
	--tfu-error: #b91c1c;
	--tfu-error-bg: #fef2f2;
	--tfu-bg: #f6f7fb;
	--tfu-card-bg: #ffffff;
	--tfu-border: #e2e5eb;
	--tfu-text: #1f2430;
	--tfu-text-muted: #6b7280;
	--tfu-radius: 14px;
	--tfu-radius-sm: 10px;
	--tfu-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.08);

	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--tfu-text);
	max-width: 640px;
	margin: 2rem auto;
	padding: 0 1rem;
}

.tfu-wrapper *,
.tfu-wrapper *::before,
.tfu-wrapper *::after {
	box-sizing: inherit;
}

.tfu-card {
	background: var(--tfu-card-bg);
	border: 1px solid var(--tfu-border);
	border-radius: var(--tfu-radius);
	box-shadow: var(--tfu-shadow);
	padding: 2rem;
}

.tfu-card--narrow {
	max-width: 440px;
	margin: 0 auto;
}

.tfu-header {
	text-align: center;
	margin-bottom: 1.75rem;
}

.tfu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--tfu-primary-light);
	color: var(--tfu-primary);
	margin-bottom: 0.75rem;
}

.tfu-icon svg {
	width: 26px;
	height: 26px;
}

.tfu-header h2 {
	margin: 0 0 0.4rem;
	font-size: 1.4rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.tfu-subtitle {
	margin: 0;
	color: var(--tfu-text-muted);
	font-size: 0.95rem;
	line-height: 1.5;
}

.tfu-step {
	display: flex;
	gap: 0.85rem;
	margin-bottom: 1.5rem;
}

.tfu-step-number {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--tfu-primary);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	margin-top: 1.9rem;
}

.tfu-field {
	flex: 1 1 auto;
	min-width: 0;
}

.tfu-field label {
	display: block;
	font-weight: 600;
	font-size: 0.92rem;
	margin-bottom: 0.5rem;
}

#tfu-table-select {
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: 1.5px solid var(--tfu-border);
	border-radius: var(--tfu-radius-sm);
	font-size: 0.95rem;
	background: #fff;
	color: var(--tfu-text);
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.19l3.71-3.96a.75.75 0 111.1 1.02l-4.25 4.5a.75.75 0 01-1.1 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 16px;
	padding-right: 2.25rem;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#tfu-table-select:focus {
	outline: none;
	border-color: var(--tfu-primary);
	box-shadow: 0 0 0 3px var(--tfu-primary-light);
}

.tfu-dropzone {
	position: relative;
	border: 1.5px dashed var(--tfu-border);
	border-radius: var(--tfu-radius-sm);
	padding: 1.75rem 1rem;
	text-align: center;
	cursor: pointer;
	background: var(--tfu-bg);
	transition: border-color 0.15s ease, background 0.15s ease;
}

.tfu-dropzone:hover,
.tfu-dropzone:focus-visible {
	border-color: var(--tfu-primary);
	background: var(--tfu-primary-light);
	outline: none;
}

.tfu-dropzone.tfu-dropzone--active {
	border-color: var(--tfu-primary);
	background: var(--tfu-primary-light);
}

.tfu-dropzone-icon {
	width: 28px;
	height: 28px;
	color: var(--tfu-primary);
	margin-bottom: 0.5rem;
}

.tfu-dropzone-empty p {
	margin: 0.15rem 0;
	font-size: 0.92rem;
}

.tfu-dropzone-hint {
	color: var(--tfu-text-muted);
	font-size: 0.82rem !important;
}

.tfu-dropzone-file {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	text-align: left;
	padding: 0.15rem 0.25rem;
}

.tfu-file-icon {
	width: 30px;
	height: 30px;
	color: var(--tfu-primary);
	flex: 0 0 auto;
}

.tfu-file-meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.tfu-file-name {
	font-weight: 600;
	font-size: 0.9rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tfu-file-size {
	font-size: 0.8rem;
	color: var(--tfu-text-muted);
}

.tfu-file-remove {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: none;
	background: #fff;
	color: var(--tfu-error);
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

.tfu-file-remove:hover {
	background: var(--tfu-error-bg);
}

.tfu-preview-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--tfu-border);
	border-radius: var(--tfu-radius-sm);
}

#tfu-preview-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

#tfu-preview-table td {
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid var(--tfu-border);
	border-right: 1px solid var(--tfu-border);
	white-space: nowrap;
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
}

#tfu-preview-table tr:first-child td {
	background: var(--tfu-bg);
	font-weight: 600;
}

#tfu-preview-table tr:last-child td {
	border-bottom: none;
}

#tfu-preview-table td:last-child {
	border-right: none;
}

.tfu-preview-hint {
	margin: 0.5rem 0 0;
	font-size: 0.8rem;
	color: var(--tfu-text-muted);
}

.tfu-submit-btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: 0.85rem 1rem;
	border: none;
	border-radius: var(--tfu-radius-sm);
	background: var(--tfu-primary);
	color: #fff;
	font-size: 0.98rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.05s ease;
}

.tfu-submit-btn:hover:not(:disabled) {
	background: var(--tfu-primary-dark);
}

.tfu-submit-btn:active:not(:disabled) {
	transform: scale(0.99);
}

.tfu-submit-btn:disabled {
	background: #c7cad1;
	cursor: not-allowed;
}

.tfu-btn-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: tfu-spin 0.7s linear infinite;
}

.tfu-submit-btn.tfu-is-loading .tfu-btn-spinner {
	display: inline-block;
}

.tfu-submit-btn.tfu-is-loading .tfu-btn-label {
	opacity: 0.85;
}

@keyframes tfu-spin {
	to {
		transform: rotate(360deg);
	}
}

.tfu-message {
	margin-top: 1.25rem;
	padding: 0.85rem 1rem;
	border-radius: var(--tfu-radius-sm);
	font-size: 0.9rem;
	line-height: 1.5;
}

.tfu-message--success {
	background: var(--tfu-success-bg);
	color: var(--tfu-success);
	border: 1px solid rgba(21, 128, 61, 0.25);
}

.tfu-message--error {
	background: var(--tfu-error-bg);
	color: var(--tfu-error);
	border: 1px solid rgba(185, 28, 28, 0.25);
}

.tfu-empty-state {
	text-align: center;
	color: var(--tfu-text-muted);
	font-size: 0.92rem;
}

/* Modal */
.tfu-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 18, 25, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	z-index: 9999;
}

.tfu-modal {
	background: #fff;
	border-radius: var(--tfu-radius);
	box-shadow: var(--tfu-shadow);
	max-width: 420px;
	width: 100%;
	padding: 1.75rem;
	font-family: inherit;
	color: var(--tfu-text);
}

.tfu-modal h3 {
	margin: 0 0 0.6rem;
	font-size: 1.15rem;
}

.tfu-modal p {
	margin: 0 0 1.4rem;
	font-size: 0.92rem;
	color: var(--tfu-text-muted);
	line-height: 1.5;
}

.tfu-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.6rem;
}

.tfu-btn-secondary,
.tfu-btn-primary {
	padding: 0.6rem 1.1rem;
	border-radius: var(--tfu-radius-sm);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	border: 1.5px solid transparent;
}

.tfu-btn-secondary {
	background: #fff;
	border-color: var(--tfu-border);
	color: var(--tfu-text);
}

.tfu-btn-secondary:hover {
	background: var(--tfu-bg);
}

.tfu-btn-primary {
	background: var(--tfu-primary);
	color: #fff;
}

.tfu-btn-primary:hover {
	background: var(--tfu-primary-dark);
}

@media (max-width: 480px) {
	.tfu-card {
		padding: 1.4rem;
	}

	.tfu-step {
		gap: 0.6rem;
	}

	.tfu-step-number {
		margin-top: 1.7rem;
	}
}
