/**
 * Pyrum Forms Styles
 * Brand Colors:
 * - Primary: #8CBF94
 * - Primary Dark: #0C6632
 * - Primary Light: #DEEFDF
 * - Black: #000000
 * - White: #ffffff
 */

/* Accessibility */
.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	word-wrap: normal !important;
}

/* Hide URL field from visual users */
.pyrum-form-url {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Form wrapper */
.pyrum-form-wrapper {
	max-width: 900px;
	margin-left: 0 !important;
	margin-right: auto !important;
}

/* Form */
.pyrum-form {
	display: block;
}

.pyrum-form.pyrum-form-hidden {
	display: none;
}

/* Section titles - inherit theme styles */
.pyrum-form-section-title {
	margin: 2rem 0 1.5rem;
}

.pyrum-form-section-title:first-child {
	margin-top: 0;
}

/* Form rows (2-column on desktop) */
.pyrum-form-row {
	display: grid;
	gap: 0;
}

@media (min-width: 768px) {
	.pyrum-form-row {
		grid-template-columns: 1fr 1fr;
		gap: 1.5rem;
	}

	.pyrum-form-wrapper {
		margin-left: auto !important;
		max-width: 1000px;
	}

	.pyrum-form {
		border: 1px solid black;
		padding: 40px;
		border-radius: 12px;
	}

	.pyrum-form h3:first-of-type {
		margin-top: 0;
	}

	.pyrum-form-submit {
		text-align: right;
	}
}

/* Form fields */
.pyrum-form-field {
	display: flex;
	flex-direction: column;
	margin-bottom: 1.5rem;
}

.pyrum-form-field-full {
	grid-column: 1 / -1;
}

.pyrum-form-field label {
	font-weight: 500;
	margin-bottom: 0.5rem;
	display: block;
}

.pyrum-form-field input[type="text"],
.pyrum-form-field input[type="email"],
.pyrum-form-field input[type="tel"],
.pyrum-form-field select,
.pyrum-form-field textarea {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid #8CBF94;
	border-radius: 12px;
	background: #DEEFDF;
	color: #000;
	font-size: 1rem;
	font-family: inherit;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.pyrum-form-field select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 2.5rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230C6632' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 12px 8px;
	/* iOS Safari faerbt Select-Text sonst in System-Blau statt Schwarz */
	color: #000;
	-webkit-text-fill-color: #000;
}

.pyrum-form-field select option {
	color: #000;
}

.pyrum-form-field input[type="text"]:focus,
.pyrum-form-field input[type="email"]:focus,
.pyrum-form-field input[type="tel"]:focus,
.pyrum-form-field select:focus,
.pyrum-form-field textarea:focus {
	outline: none;
	border-color: #0C6632;
}

.pyrum-form-field textarea {
	resize: vertical;
	min-height: 120px;
}

/* File input styling */
.pyrum-form-field input[type="file"] {
	padding: 0.75rem;
	font-size: 1rem;
	border: 1px solid #8CBF94;
	border-radius: 12px;
	background: #DEEFDF;
	cursor: pointer;
	box-sizing: border-box;
}

.pyrum-form-field input[type="file"]:focus {
	outline: none;
	border-color: #0C6632;
}

.pyrum-form-field input[type="file"]::file-selector-button {
	padding: 0.5rem 1rem;
	margin-right: 1rem;
	background: #fff;
	color: #000;
	border: 1px solid #000;
	border-radius: 9999px;
	font-family: inherit;
	font-size: 0.875rem;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pyrum-form-field input[type="file"]::file-selector-button:hover {
	background: #8CBF94;
	border-color: #8CBF94;
}

/* Required indicator */
.required-indicator {
	color: #0C6632;
}

/* Error messages */
.pyrum-form-error {
	display: none;
	color: #d00;
	font-size: 0.875rem;
	margin-top: 0.25rem;
}

.pyrum-form-error:not(:empty) {
	display: block;
}

.pyrum-form-field-error input,
.pyrum-form-field-error select,
.pyrum-form-field-error textarea {
	border-color: #d00;
}

/* Help text */
.pyrum-form-help {
	display: block;
	font-size: 0.875rem;
	color: #666;
	margin-top: 0.25rem;
}

/* Checkbox fields */
.pyrum-form-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.pyrum-form-checkbox input[type="checkbox"] {
	flex-shrink: 0;
	width: 1.25rem;
	height: 1.25rem;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	border: 1px solid #8CBF94;
	border-radius: 4px;
	background: #DEEFDF;
	position: relative;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pyrum-form-checkbox input[type="checkbox"]:checked {
	background: #DEEFDF;
	border-color: #0C6632;
}

.pyrum-form-checkbox input[type="checkbox"]:checked::before {
	content: '✓';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #0C6632;
	font-size: 1rem;
	font-weight: bold;
	line-height: 1;
}

.pyrum-form-checkbox input[type="checkbox"]:focus {
	outline: none;
	border-color: #0C6632;
	box-shadow: 0 0 0 2px rgba(12, 102, 50, 0.1);
}

.pyrum-form-checkbox label {
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}

.pyrum-form-checkbox a {
	text-decoration: underline;
}

/* Checkbox group (for multiple checkboxes) */
.pyrum-form-checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-top: 0.5rem;
}

@media (min-width: 768px) {
	.pyrum-form-checkbox-group {
		flex-direction: row;
		gap: 2rem;
	}
}

fieldset {
	border: none;
	padding: 0;
	margin: 0;
}

fieldset legend {
	font-weight: 500;
	margin-bottom: 0.5rem;
	padding: 0;
}

/* File list */
.pyrum-form-files-list {
	margin-top: 0.75rem;
}

.pyrum-form-files-list:empty {
	display: none;
}

.pyrum-form-file-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem;
	background: #f5f5f5;
	border-radius: 4px;
	margin-bottom: 0.5rem;
}

.pyrum-form-file-name {
	font-size: 0.875rem;
}

.pyrum-form-file-size {
	font-size: 0.75rem;
	color: #666;
	margin-left: 0.5rem;
}

/* Submit button - Theme style */
.pyrum-form-submit {
	margin-top: 2rem;
}

.pyrum-form-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4em 1.2em 0.4em 1.2em;
	background: #fff;
	color: #000;
	border: 1px solid #000;
	border-radius: 9999px;
	font-size: 1rem;
	font-weight: 400;
	font-family: inherit;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pyrum-form-button::after {
	content: '→';
	font-size: 1.2em;
	line-height: 1;
}

.pyrum-form-button:hover {
	background: #8CBF94;
	border-color: #8CBF94;
}

.pyrum-form-button:focus {
	outline: 2px solid #000;
	outline-offset: 2px;
}

.pyrum-form-button:disabled {
	background: #999;
	border-color: #999;
	cursor: not-allowed;
}

.pyrum-form-button-loading {
	display: none;
	width: 1rem;
	height: 1rem;
	border: 2px solid rgba(0, 0, 0, 0.3);
	border-top-color: #000;
	border-radius: 50%;
	animation: pyrum-spin 0.6s linear infinite;
}

.pyrum-form-button.pyrum-form-loading .pyrum-form-button-loading {
	display: block;
}

.pyrum-form-button.pyrum-form-loading::after {
	display: none;
}

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

/* Success message */
.pyrum-form-success {
	padding: 2rem;
	background: #DEEFDF;
	border: 2px solid #8CBF94;
	border-radius: 12px;
	text-align: center;
}

.pyrum-form-success h3 {
	margin: 0 0 0.5rem;
	color: #000;
}

.pyrum-form-success p {
	margin: 0;
	color: #000;
}

/* General error message */
.pyrum-form-general-error {
	padding: 1.5rem;
	background: #ffebee;
	border: 2px solid #f44336;
	border-radius: 12px;
	text-align: center;
}

.pyrum-form-general-error p {
	margin: 0;
	color: #c62828;
}

/* Loading state */
.pyrum-form-loading .pyrum-form-button-text {
	opacity: 0.7;
}
