/* =========================================
   BSS Form Widget - BSS-Plus
   ========================================= */

/* Form Container */
.bss-form {
	position: relative;
}

.bss-form__form {
	position: relative;
}

/* Fields Row - Flex layout */
.bss-form__fields-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

/* Field widths */
.bss-form__field { box-sizing: border-box; }
.bss-form__field--w100 { width: 100%; }
.bss-form__field--w75  { width: calc(75% - 8px); }
.bss-form__field--w66  { width: calc(66.666% - 8px); }
.bss-form__field--w50  { width: calc(50% - 8px); }
.bss-form__field--w33  { width: calc(33.333% - 11px); }
.bss-form__field--w25  { width: calc(25% - 12px); }

/* Labels */
.bss-form__label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 0.9rem;
}

.bss-form__label--inline {
	display: inline-block;
	margin-bottom: 0;
	margin-right: 12px;
	vertical-align: middle;
}

.bss-form--labels-inline .bss-form__field {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
}

.bss-form--labels-inline .bss-form__label {
	margin-bottom: 0;
	margin-right: 12px;
	white-space: nowrap;
}

.bss-form--labels-inline .bss-form__input-wrap {
	flex: 1;
	min-width: 0;
}

.bss-form--labels-inline .bss-form__field-error {
	width: 100%;
}

.bss-form--labels-hidden .bss-form__label {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.bss-form__required {
	color: #ef4444;
	margin-left: 2px;
}

/* Input wrapper */
.bss-form__input-wrap {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
}

/* Base input styles */
.bss-form__field-input,
.bss-form__field-textarea,
.bss-form__field-select {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 1rem;
	font-family: inherit;
	background: #fff;
	color: inherit;
	transition: border-color 0.2s, box-shadow 0.2s;
	outline: none;
	box-sizing: border-box;
}

.bss-form__field-input:focus,
.bss-form__field-textarea:focus,
.bss-form__field-select:focus {
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.bss-form__field-textarea {
	resize: vertical;
}

.bss-form__field-select {
	appearance: auto;
	cursor: pointer;
}

/* Icon inside input */
.bss-form__field-icon {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: #9ca3af;
	font-size: 1rem;
	line-height: 1;
	pointer-events: none;
	z-index: 1;
	display: flex;
	align-items: center;
}

.bss-form__field-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.bss-form__field--icon-left .bss-form__field-icon { left: 12px; }
.bss-form__field--icon-left .bss-form__field-input,
.bss-form__field--icon-left .bss-form__field-select { padding-left: 38px; }
.bss-form__field--icon-left .bss-form__field-textarea { padding-left: 38px; }

.bss-form__field--icon-right .bss-form__field-icon { right: 12px; }
.bss-form__field--icon-right .bss-form__field-input,
.bss-form__field--icon-right .bss-form__field-select { padding-right: 38px; }
.bss-form__field--icon-right .bss-form__field-textarea { padding-right: 38px; }

/* Textarea icon vertical alignment */
.bss-form__field--textarea .bss-form__field-icon {
	top: 14px;
	transform: none;
}

/* Error state */
.bss-form__field--error .bss-form__field-input,
.bss-form__field--error .bss-form__field-textarea,
.bss-form__field--error .bss-form__field-select {
	border-color: #ef4444;
}

.bss-form__field-error {
	color: #ef4444;
	font-size: 0.8rem;
	margin-top: 4px;
	display: none;
	min-height: 0;
}

.bss-form__field--text .bss-form__field-error,
.bss-form__field--email .bss-form__field-error,
.bss-form__field--tel .bss-form__field-error,
.bss-form__field--textarea .bss-form__field-error {
	width: var(--field-max);
	margin-left: auto;
	margin-right: auto;
}

/* Radio & Checkbox groups */
.bss-form__radio-group,
.bss-form__checkbox-group {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	width: 100%;
}

.bss-form__radio-label,
.bss-form__checkbox-label,
.bss-form__acceptance-label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	font-size: 0.95rem;
}

.bss-form__field-radio,
.bss-form__field-checkbox {
	margin: 0;
	cursor: pointer;
}

/* =========================================
   Choice Cards (Radio & Checkbox)
   ========================================= */
.bss-form__card-group {
	display: grid;
	gap: 12px;
	width: 100%;
}

.bss-form__card-group.bss-form__card-group--center-last {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

.bss-form__card-group--center-last > .bss-form__card-option {
	flex: none;
}

.bss-form__card-option {
	position: relative;
	display: flex;
	align-items: flex-start;
	border: 2px solid #e5e7eb;
	border-radius: 12px;
	padding: 20px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
}

.bss-form__card-option:hover {
	border-color: #93c5fd;
	background-color: #f8faff;
}

.bss-form__card-input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.bss-form__card-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.bss-form__card-group--icon-left .bss-form__card-content {
	flex-direction: row;
	align-items: center;
	text-align: left;
	gap: 12px;
}

.bss-form__card-icon {
	font-size: 28px;
	line-height: 1;
	color: #9ca3af;
	transition: color 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.bss-form__card-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.bss-form__card-label {
	font-size: 0.95rem;
	font-weight: 500;
	color: #374151;
	transition: color 0.2s;
	line-height: 1.4;
}

.bss-form__card-check {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #3b82f6;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transform: scale(0.5);
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
}

.bss-form__card-check svg {
	width: 12px;
	height: 12px;
}

.bss-form__card-option--selected {
	border-color: #3b82f6;
	background-color: #eff6ff;
	box-shadow: 0 0 0 1px #3b82f6;
}

.bss-form__card-option--selected .bss-form__card-icon {
	color: #3b82f6;
}

.bss-form__card-option--selected .bss-form__card-label {
	color: #1f2937;
}

.bss-form__card-option--selected .bss-form__card-check {
	opacity: 1;
	transform: scale(1);
}

.bss-form__card-option:focus-within {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

.bss-form__field--error .bss-form__card-option {
	border-color: #ef4444;
}

/* HTML Content field */
.bss-form__html-content {
	width: 100%;
}

/* =========================================
   Progress Bar
   ========================================= */
.bss-form__progress-wrap {
	margin-bottom: 32px;
}

.bss-form__progress-bar {
	width: 100%;
	height: 8px;
	background: #EAEAEA;
	border-radius: 39px;
	overflow: hidden;
	position: relative;
}

.bss-form__progress-fill {
	height: 100%;
	background: #3b82f6;
	border-radius: 39px;
	transition: width 0.4s ease;
	position: relative;
	overflow: hidden;
}

.bss-form__progress-fill--striped::after {
	content: '';
	position: absolute;
	inset: 0;
	background-image: linear-gradient(
		45deg,
		rgba(255,255,255,0.2) 25%,
		transparent 25%,
		transparent 50%,
		rgba(255,255,255,0.2) 50%,
		rgba(255,255,255,0.2) 75%,
		transparent 75%,
		transparent
	);
	background-size: 20px 20px;
	animation: bssFormStripes 0.6s linear infinite;
}

@keyframes bssFormStripes {
	from { background-position: 0 0; }
	to { background-position: 20px 0; }
}

.bss-form__progress-text {
	text-align: center;
	font-size: 0.85rem;
	color: #6b7280;
	margin-top: 10px;
	font-weight: 500;
}

/* Steps */
.bss-form__step {
	animation: bssFormFadeIn 0.3s ease;
}

@keyframes bssFormFadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* =========================================
   Navigation Buttons
   ========================================= */
.bss-form__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 24px;
	gap: 12px;
}

.bss-form__prev-btn,
.bss-form__next-btn,
.bss-form__submit-btn {
	padding: 12px 28px;
	border: none;
	border-radius: 9px;
	font-weight: 500;
	font-size: 1rem;
	cursor: pointer;
	transition: all 0.2s;
	font-family: inherit;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	line-height: 1.4;
}

.bss-form__next-btn,
.bss-form__submit-btn {
	background: #3b82f6;
	color: #fff;
}

.bss-form__next-btn:hover,
.bss-form__submit-btn:hover {
	background: #2563eb;
}

.bss-form__prev-btn {
	background: #fff;
	color: #3b82f6;
	border: 1px solid #3b82f6;
}

.bss-form__prev-btn:hover {
	background: #eff6ff;
}

.bss-form__submit-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

/* Submit button content */
.bss-form__submit-content {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.bss-form__submit-icon {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.bss-form__submit-icon i,
.bss-form__submit-icon svg {
	font-size: inherit;
	width: 1em;
	height: 1em;
}

.bss-form__submit-loading {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

/* Submit Spinner */
.bss-form__submit-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: bssFormSpin 0.6s linear infinite;
}

@keyframes bssFormSpin {
	to { transform: rotate(360deg); }
}

/* =========================================
   Success & Error Messages
   ========================================= */
.bss-form__success {
	text-align: center;
	padding: 24px;
	color: #16a34a;
	font-size: 1.1rem;
	background: #f0fdf4;
	border-radius: 6px;
}

.bss-form__global-error {
	text-align: center;
	padding: 12px;
	color: #ef4444;
	font-size: 0.95rem;
	background: #fef2f2;
	border-radius: 6px;
	margin-top: 16px;
}

/* =========================================
   Honeypot (hidden from users)
   ========================================= */
.bss-form__hp {
	position: absolute !important;
	left: -9999px !important;
	height: 0 !important;
	overflow: hidden !important;
	opacity: 0 !important;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 767px) {
	.bss-form__field--w25,
	.bss-form__field--w33,
	.bss-form__field--w50,
	.bss-form__field--w66,
	.bss-form__field--w75 {
		width: 100%;
	}

	.bss-form--labels-inline .bss-form__field {
		flex-direction: column;
		align-items: flex-start;
	}

	.bss-form--labels-inline .bss-form__label {
		margin-right: 0;
		margin-bottom: 6px;
	}

	.bss-form__card-group {
		grid-template-columns: 1fr !important;
	}

	.bss-form__card-group--center-last .bss-form__card-option {
		width: 100% !important;
	}
}
