/**
 * Byggherrevyn Form Widget v2 - Enhanced Styles
 * Matches Infobric Equipment Savings Calculator Design System
 */

:root {
	--bbhv-primary: #243746;
	--bbhv-accent: #FF6C0E;
	--bbhv-background: #F4F5F6;
	--bbhv-white: #FFFFFF;
	--bbhv-text-dark: #243746;
	--bbhv-text-light: #919191;
	--bbhv-border: #E5E7EB;
	--bbhv-success: #73C095;
	--bbhv-error: #EF4444;
	--bbhv-border-radius: 12px;
}

/**
 * MAIN WRAPPER
 */
.bbhv-form-wrapper-v2 {
	font-family: 'SuisseIntl-Light-WebS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	max-width: 1000px;
	margin: 0 auto;
	padding: 100px 100px;
	background: linear-gradient(135deg, var(--bbhv-background) 0%, #FFFFFF 100%);
	border-radius: 24px;
	box-shadow: 0 4px 20px rgba(36, 55, 70, 0.08);
	color: var(--bbhv-text-dark);
	line-height: 1.6;
}

/**
 * TITLES & SUBTITLES
 */
.bbhv-form-title-v2 {
	font-size: 2.5rem;
	font-weight: 700;
	margin: 0 0 1rem 0;
	color: var(--bbhv-primary);
	font-family: 'SuisseIntl-Bold-WebS', sans-serif;
}

.bbhv-form-subtitle-v2 {
	font-size: 1.1rem;
	color: var(--bbhv-text-light);
	margin: 0 0 2rem 0;
	line-height: 1.6;
}

/**
 * INSTRUCTIONS TEXT
 */
.bbhv-form-instructions {
	background: linear-gradient(135deg, var(--bbhv-primary, #243746) 0%, #1a2a38 100%);
	border-left: 4px solid var(--bbhv-accent);
	border-radius: var(--bbhv-border-radius);
	padding: 20px 24px;
	margin: 0 0 24px 0;
	box-shadow: 0 4px 12px rgba(36, 55, 70, 0.15);
	font-size: 1rem;
	line-height: 1.8;
	color: #FFFFFF;
}

.bbhv-form-instructions p {
	margin: 0 0 1em 0;
	color: #FFFFFF;
}

.bbhv-form-instructions p:last-child {
	margin-bottom: 0;
}

.bbhv-form-instructions strong,
.bbhv-form-instructions b {
	color: #FFFFFF;
	font-weight: 600;
}

.bbhv-form-instructions ul,
.bbhv-form-instructions ol {
	margin: 0 0 1em 0;
	padding-left: 24px;
	color: #FFFFFF;
}

.bbhv-form-instructions li {
	margin-bottom: 0.5em;
	color: #FFFFFF;
}

.bbhv-form-instructions a {
	color: var(--bbhv-accent);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease;
	font-weight: 500;
}

.bbhv-form-instructions a:hover {
	border-bottom-color: var(--bbhv-accent);
}

/**
 * FORM CONTAINER
 */
.bbhv-form-v2 {
	display: flex;
	flex-direction: column;
	gap: 30px;
	--bbhv-primary: #243746;
	--bbhv-accent: #FF6C0E;
	--bbhv-background: #F4F5F6;
	--bbhv-border-radius: 12px;
}

/**
 * PROGRESS BAR
 */
.bbhv-progress-bar-v2 {
	background: var(--bbhv-white);
	border-radius: var(--bbhv-border-radius);
	padding: 30px;
	box-shadow: 0 2px 8px rgba(36, 55, 70, 0.08);
	margin-bottom: 10px;
}

.bbhv-progress-track {
	width: 100%;
	height: 8px;
	background: var(--bbhv-background);
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 30px;
	position: relative;
}

.bbhv-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--bbhv-accent) 0%, #E55F0A 100%);
	border-radius: 4px;
	transition: width 0.4s ease;
}

.bbhv-progress-steps {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

.bbhv-step-indicator {
	display: flex;
	align-items: center;
	gap: 12px;
	opacity: 0.5;
	transition: all 0.3s ease;
	cursor: pointer;
}

.bbhv-step-indicator.bbhv-step-active {
	opacity: 1;
}

.bbhv-step-indicator.bbhv-step-completed {
	opacity: 0.75;
}

.bbhv-step-number {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--bbhv-background);
	font-weight: 600;
	font-family: 'SuisseIntl-SemiBold-WebS', sans-serif;
	color: var(--bbhv-text-dark);
	font-size: 16px;
	transition: all 0.3s ease;
}

.bbhv-step-indicator.bbhv-step-active .bbhv-step-number {
	background: var(--bbhv-accent);
	color: var(--bbhv-white);
	box-shadow: 0 2px 8px rgba(255, 108, 14, 0.3);
	transform: scale(1.1);
}

.bbhv-step-indicator.bbhv-step-completed .bbhv-step-number {
	background: var(--bbhv-success);
	color: var(--bbhv-white);
}

.bbhv-step-label {
	font-size: 14px;
	font-weight: 500;
	font-family: 'SuisseIntl-Medium-WebS', sans-serif;
	color: var(--bbhv-text-dark);
}

/**
 * STEP INSTRUCTION BOX
 */
.bbhv-step-instruction {
	background: linear-gradient(135deg, #FFF5E6 0%, #FFE8CC 100%);
	border-left: 4px solid var(--bbhv-accent);
	border-radius: 8px;
	padding: 20px 24px;
	margin: 0 0 24px 0;
}

.bbhv-instruction-title {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--bbhv-primary);
	margin: 0 0 8px 0;
	font-family: 'SuisseIntl-Bold-WebS', sans-serif;
}

.bbhv-instruction-text {
	font-size: 0.95rem;
	color: var(--bbhv-text-dark);
	margin: 0;
	line-height: 1.6;
}

@media (max-width: 640px) {
	.bbhv-form-wrapper-v2 {
		padding: 30px 20px;
		border-radius: 16px;
	}

	.bbhv-progress-steps {
		grid-template-columns: repeat(3, 1fr);
		gap: 10px;
	}

	.bbhv-step-label {
		font-size: 11px;
		display: none;
	}

	.bbhv-step-number {
		width: 32px;
		height: 32px;
		font-size: 14px;
	}

	.bbhv-progress-bar-v2 {
		padding: 20px;
	}
	
	.bbhv-step-instruction {
		padding: 16px 18px;
		margin-bottom: 20px;
	}
	
	.bbhv-instruction-title {
		font-size: 1rem;
	}
	
	.bbhv-instruction-text {
		font-size: 0.9rem;
	}
}

/**
 * STEP CONTAINERS
 */
.bbhv-step-container {
	animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/**
 * CARD STYLING
 */
.bbhv-card-v2 {
	background: var(--bbhv-white);
	border-radius: var(--bbhv-border-radius);
	padding: 40px;
	box-shadow: 0 2px 8px rgba(36, 55, 70, 0.08);
	transition: all 0.3s ease;
}

.bbhv-card-v2:hover {
	box-shadow: 0 4px 16px rgba(36, 55, 70, 0.12);
}

.bbhv-card-title-v2 {
	font-size: 22px;
	font-weight: 600;
	font-family: 'SuisseIntl-SemiBold-WebS', sans-serif;
	color: var(--bbhv-primary);
	margin: 0 0 24px 0;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--bbhv-background);
	display: flex;
	align-items: center;
	gap: 12px;
}

/**
 * FORM GRID
 */
.bbhv-form-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 24px;
	margin-bottom: 24px;
}

@media (max-width: 768px) {
	.bbhv-form-wrapper-v2 {
		padding: 40px 40px;
		border-radius: 20px;
	}

	.bbhv-form-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}
}

/**
 * FORM GROUPS
 */
.bbhv-form-group {
	display: flex;
	flex-direction: column;
}

.bbhv-form-group-checkbox {
	grid-column: 1 / -1;
	flex-direction: row;
	align-items: flex-start;
	gap: 8px;
}

/**
 * FORM LABELS
 */
.bbhv-form-label {
	font-size: 14px;
	font-weight: 500;
	font-family: 'SuisseIntl-Medium-WebS', sans-serif;
	color: var(--bbhv-text-dark);
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.bbhv-required {
	color: var(--bbhv-accent);
	font-weight: 700;
}

/**
 * FORM INPUTS
 */
.bbhv-form-input,
.bbhv-form-input::-webkit-input-placeholder,
.bbhv-form-input::-moz-placeholder,
.bbhv-form-input:-ms-input-placeholder,
.bbhv-form-input:-moz-placeholder {
	font-family: 'SuisseIntl-Light-WebS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bbhv-form-input {
	padding: 14px 16px;
	border: 2px solid var(--bbhv-border);
	border-radius: 8px;
	font-size: 15px;
	background-color: var(--bbhv-background);
	color: var(--bbhv-text-dark);
	transition: all 0.2s ease;
	box-sizing: border-box;
	width: 100%;
	appearance: none;
}

.bbhv-form-input:focus {
	outline: none;
	border-color: var(--bbhv-accent);
	background-color: var(--bbhv-white);
	box-shadow: 0 0 0 3px rgba(255, 108, 14, 0.1);
}

.bbhv-form-input::placeholder {
	color: var(--bbhv-text-light);
}

.bbhv-form-input:invalid:not(:placeholder-shown) {
	border-color: var(--bbhv-error);
}

/* Select styling */
.bbhv-form-input[type="select"],
select.bbhv-form-input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23243746' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 40px;
}

/**
 * CHECKBOX STYLING
 */
.bbhv-form-checkbox {
	width: 20px;
	height: 20px;
	cursor: pointer;
	accent-color: var(--bbhv-accent);
	flex-shrink: 0;
	margin-top: 2px;
}

.bbhv-form-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: var(--bbhv-text-dark);
	margin-bottom: 0;
}

.bbhv-form-checkbox-label span {
	flex: 1;
	line-height: 1.4;
}

/**
 * ERROR MESSAGES
 */
.bbhv-error-msg {
	display: none;
	font-size: 12px;
	color: var(--bbhv-error);
	font-weight: 500;
	margin-top: 6px;
}

.bbhv-error-msg.show {
	display: block;
}

/**
 * FORM ACTIONS
 */
.bbhv-form-actions {
	display: flex;
	gap: 12px;
	justify-content: flex-end;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--bbhv-background);
}

@media (max-width: 640px) {
	.bbhv-form-actions {
		flex-direction: column-reverse;
	}
}

/**
 * BUTTONS
 */
.bbhv-btn-prev,
.bbhv-btn-next,
.bbhv-btn-submit {
	padding: 14px 32px;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	font-family: 'SuisseIntl-SemiBold-WebS', sans-serif;
	cursor: pointer;
	transition: all 0.3s ease;
	text-transform: none;
	letter-spacing: normal;
	box-sizing: border-box;
	flex: 1;
}

@media (max-width: 640px) {
	.bbhv-btn-prev,
	.bbhv-btn-next,
	.bbhv-btn-submit {
		flex: 1;
		width: 100%;
	}
}

/* Secondary Button (Previous) */
.bbhv-btn-prev {
	background: var(--bbhv-background);
	color: var(--bbhv-text-dark);
	border: 2px solid var(--bbhv-border);
}

.bbhv-btn-prev:hover {
	background: var(--bbhv-border);
	border-color: var(--bbhv-text-light);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bbhv-btn-prev:active {
	transform: translateY(0);
}

/* Primary Button (Next/Submit) */
.bbhv-btn-next,
.bbhv-btn-submit {
	background: linear-gradient(135deg, var(--bbhv-accent) 0%, #E55F0A 100%);
	color: var(--bbhv-white);
}

.bbhv-btn-next:hover,
.bbhv-btn-submit:hover {
	opacity: 0.9;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(255, 108, 14, 0.3);
}

.bbhv-btn-next:active,
.bbhv-btn-submit:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(255, 108, 14, 0.2);
}

.bbhv-btn-next:disabled,
.bbhv-btn-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* Loading State */
.bbhv-btn-submit.loading {
	position: relative;
	pointer-events: none;
	color: transparent !important;
}

.bbhv-btn-submit.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: bbhv-spin 0.8s linear infinite;
}

@keyframes bbhv-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/**
 * SUCCESS STATE
 */
.bbhv-success-state {
	text-align: center;
	padding: 60px 40px;
	background: var(--bbhv-white);
	border-radius: var(--bbhv-border-radius);
	box-shadow: 0 2px 8px rgba(36, 55, 70, 0.08);
	animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.bbhv-success-title {
	font-size: 28px;
	font-weight: 700;
	font-family: 'SuisseIntl-Bold-WebS', sans-serif;
	color: var(--bbhv-primary);
	margin: 24px 0 12px 0;
}

.bbhv-success-message {
	font-size: 16px;
	color: var(--bbhv-text-light);
	margin: 0 0 12px 0;
	line-height: 1.6;
}

.bbhv-success-note {
	font-size: 14px;
	color: var(--bbhv-accent);
	font-weight: 500;
	margin: 12px 0 0 0;
}

/* Lottie Player */
lottie-player {
	display: block;
	margin: 0 auto 24px !important;
}

lottie-player[data-primary-color="#FF6C0E"] {
	filter: hue-rotate(350deg) saturate(1.2) brightness(1.1);
}

/**
 * RESPONSIVE DESIGN
 */
@media (max-width: 768px) {
	.bbhv-form-wrapper-v2 {
		padding: 20px 15px;
	}

	.bbhv-form-title-v2 {
		font-size: 2rem;
	}

	.bbhv-card-v2 {
		padding: 24px;
	}

	.bbhv-card-title-v2 {
		font-size: 18px;
	}

	.bbhv-form-grid {
		gap: 16px;
	}

	.bbhv-form-actions {
		gap: 8px;
	}

	.bbhv-success-state {
		padding: 40px 20px;
	}

	.bbhv-success-title {
		font-size: 24px;
	}
}

@media (max-width: 480px) {
	.bbhv-form-wrapper-v2 {
		padding: 15px 10px;
	}

	.bbhv-form-title-v2 {
		font-size: 1.5rem;
	}

	.bbhv-form-subtitle-v2 {
		font-size: 0.95rem;
	}

	.bbhv-card-v2 {
		padding: 16px;
	}

	.bbhv-card-title-v2 {
		font-size: 16px;
		margin-bottom: 16px;
	}

	.bbhv-form-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.bbhv-form-input {
		padding: 12px 14px;
		font-size: 14px;
	}

	.bbhv-btn-prev,
	.bbhv-btn-next,
	.bbhv-btn-submit {
		padding: 12px 20px;
		font-size: 14px;
	}

	.bbhv-progress-bar-v2 {
		padding: 16px;
	}
}

/**
 * HELP TEXT & DESCRIPTIONS
 */
.bbhv-help-text {
	display: block;
	font-size: 12px;
	color: var(--bbhv-text-light);
	margin-top: 6px;
	font-style: italic;
	line-height: 1.4;
}

.bbhv-help-text a {
	color: var(--bbhv-accent);
	text-decoration: none;
	font-weight: 500;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease;
}

.bbhv-help-text a:hover {
	border-bottom-color: var(--bbhv-accent);
}

/**
 * ERROR STATES
 */
.bbhv-field-error {
	position: relative;
}

.bbhv-field-error .bbhv-form-input,
.bbhv-field-error select {
	border-color: var(--bbhv-error) !important;
	background: rgba(239, 68, 68, 0.05);
}

.bbhv-error-msg {
	display: none;
	color: var(--bbhv-error);
	font-size: 12px;
	margin-top: 4px;
	font-weight: 500;
	animation: slideDown 0.2s ease;
}

.bbhv-error-msg.show {
	display: block;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/**
 * REQUIRED INDICATOR
 */
.bbhv-required {
	color: var(--bbhv-error);
	font-weight: bold;
	margin-left: 4px;
}

/**
 * reCAPTCHA CONTAINER
 */
.bbhv-recaptcha-container {
	margin: 20px 0;
	padding: 16px;
	background: var(--bbhv-background);
	border-radius: var(--bbhv-border-radius);
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 80px;
}

.bbhv-recaptcha-container iframe {
	border-radius: 4px;
}

/**
 * FORM GROUP STYLING ENHANCEMENTS
 */
.bbhv-form-group {
	position: relative;
	transition: all 0.2s ease;
}

.bbhv-form-group.bbhv-field-required .bbhv-form-label::after {
	content: '';
	display: inline-block;
	width: 4px;
	height: 4px;
	background: var(--bbhv-error);
	border-radius: 50%;
	margin-left: 4px;
	vertical-align: super;
}

/**
 * CHECKBOX GROUP STYLING
 */
.bbhv-form-group-checkbox {
	padding: 12px;
	background: var(--bbhv-background);
	border-radius: 8px;
	border: 1px solid var(--bbhv-border);
	transition: all 0.2s ease;
}

.bbhv-form-group-checkbox:hover {
	background: rgba(247, 251, 249, 0.8);
	border-color: var(--bbhv-accent);
}

.bbhv-form-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
	user-select: none;
	font-size: 14px;
	line-height: 1.5;
	color: var(--bbhv-text-dark);
}

.bbhv-form-checkbox {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 2px;
	cursor: pointer;
	accent-color: var(--bbhv-accent);
}

.bbhv-form-checkbox:hover {
	accent-color: var(--bbhv-accent);
}

/**
 * RESPONSIVE ADJUSTMENTS FOR reCAPTCHA
 */
@media (max-width: 640px) {
	.bbhv-recaptcha-container {
		margin: 16px 0;
		padding: 12px;
		min-height: 70px;
	}

	.bbhv-help-text {
		font-size: 11px;
		margin-top: 4px;
	}

	.bbhv-error-msg {
		font-size: 11px;
		margin-top: 2px;
	}
}
