/**
 * Infobric Form Widget Styles
 * Modern, clean design using Infobric theme colors
 */

/* Form Header */
.infobric-form-title {
	margin: 0 0 16px;
	padding: 0;
	color: #272726;
	font-weight: 600;
	line-height: 1.2;
}

.infobric-form-description {
	margin: 0 0 24px;
	padding: 0;
	color: #919191;
	line-height: 1.6;
}

.infobric-form-description p {
	margin: 0 0 12px;
}

.infobric-form-description p:last-child {
	margin-bottom: 0;
}

/* Form Container */
.infobric-form-container {
	width: 100%;
	max-width: 100%;
	padding: 28px 24px;
	border-radius: 16px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
	background: #ffffff;
}

.infobric-form {
	width: 100%;
}

/* Form Fields Layout */
.infobric-form-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 20px;
}

.infobric-form-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.infobric-form-field-help {
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 13px;
	line-height: 1.5;
	color: #595959;
	white-space: pre-line;
	overflow-wrap: anywhere;
}

.infobric-form-information {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 14px;
	line-height: 1.6;
	color: #272726;
}

.infobric-form-information-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 20px;
	width: 20px;
	height: 22px;
	color: #272726;
}

.infobric-form-information-icon svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.infobric-form-information-text {
	min-width: 0;
	white-space: pre-line;
	overflow-wrap: anywhere;
}

/* Field Width Classes */
.infobric-field-width-100 {
	width: 100%;
}

.infobric-field-width-50 {
	width: calc(50% - 10px);
}

.infobric-field-width-33 {
	width: calc(33.333% - 14px);
}

.infobric-field-width-25 {
	width: calc(25% - 15px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.infobric-field-width-50,
	.infobric-field-width-33,
	.infobric-field-width-25 {
		width: 100%;
	}
}

@media (min-width: 769px) and (max-width: 1024px) {
	.infobric-field-width-33,
	.infobric-field-width-25 {
		width: calc(50% - 10px);
	}
}

/* Labels */
.infobric-form-field label,
.infobric-form-container .infobric-old-upsales-form .infobric-form-field label {
	font-family: 'SuisseIntl-Medium-WebS', sans-serif;
	font-size: 14px;
	font-weight: 500;
	color: #1a2e3d;
	line-height: 1.4;
	margin-bottom: 0;
}

.infobric-form-field .required-asterisk {
	color: #E57D3E;
	margin-left: 2px;
}

/* Input Fields */
.infobric-form-field input[type="text"],
.infobric-form-field input[type="email"],
.infobric-form-field input[type="tel"],
.infobric-form-field input[type="number"],
.infobric-form-field input[type="url"],
.infobric-form-field textarea,
.infobric-form-field select,
.infobric-form-container .infobric-old-upsales-form :is(input[type="text"], input[type="email"], textarea) {
	width: 100%;
	padding: 12px 16px;
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: #1a2e3d;
	background-color: #ffffff;
	border: 1px solid #d4d8db;
	border-radius: 8px;
	transition: all 0.3s ease;
	outline: none;
}

.infobric-form-field input[type="text"]:focus,
.infobric-form-field input[type="email"]:focus,
.infobric-form-field input[type="tel"]:focus,
.infobric-form-field input[type="number"]:focus,
.infobric-form-field input[type="url"]:focus,
.infobric-form-field textarea:focus,
.infobric-form-field select:focus,
.infobric-form-container .infobric-old-upsales-form :is(input[type="text"], input[type="email"], textarea):focus {
	border-color: #73C095;
	box-shadow: 0 0 0 3px rgba(115, 192, 149, 0.1);
}

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

/* Placeholder styling */
.infobric-form-field input::placeholder,
.infobric-form-field textarea::placeholder {
	color: #919191;
	opacity: 1;
}

/* Select Dropdown */
.infobric-form-field select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23272726' d='M6 8L0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	padding-right: 40px;
	cursor: pointer;
}

/* Checkbox and Radio Groups */
.infobric-form-field .iti {
	width: 100%;
	min-width: 0;
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

.infobric-form-field .iti__dropdown-content {
	max-width: min(360px, calc(100vw - 32px));
	white-space: normal;
}

.infobric-form-container .iti button.iti__selected-country {
	display: flex;
	align-items: center;
	height: 100%;
	white-space: nowrap;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	box-shadow: none;
	transform: none;
}

.infobric-checkbox-group,
.infobric-radio-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.infobric-checkbox-label,
.infobric-radio-label {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 15px;
	color: #272726;
	cursor: pointer;
	transition: color 0.2s ease;
}

.infobric-checkbox-label:hover,
.infobric-radio-label:hover {
	color: #73C095;
}

.infobric-checkbox-label input[type="checkbox"],
.infobric-radio-label input[type="radio"] {
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
	accent-color: #73C095;
}

/* Submit Button */
.infobric-form-button-wrapper {
	margin-top: 8px;
}

.infobric-form-submit,
.infobric-form-container .infobric-old-upsales-form .infobric-form-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 32px;
	font-family: 'SuisseIntl-SemiBold-WebS', sans-serif;
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
	background-color: #e95c10;
	border: none;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.3s ease;
	outline: none;
	min-width: 160px;
}

.infobric-form-submit:hover,
.infobric-form-container .infobric-old-upsales-form .infobric-form-submit:hover {
	background-color: #d45410;
	transform: translateY(-1px);
	box-shadow: 0 1px 4px rgba(233, 92, 16, 0.4);
}

.infobric-form-submit:active,
.infobric-form-container .infobric-old-upsales-form .infobric-form-submit:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(115, 192, 149, 0.3);
}

.infobric-form-submit:disabled,
.infobric-form-container .infobric-old-upsales-form .infobric-form-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.infobric-form-submit .button-loader {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
}

.infobric-form-submit.loading .button-text {
	display: none;
}

.infobric-form-submit.loading .button-loader {
	display: inline-flex !important;
}

.infobric-old-upsales-form .infobric-form-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.infobric-old-upsales-form .infobric-form-field {
	width: auto;
	min-width: 0;
	grid-column: span 2;
}

.infobric-old-upsales-form .infobric-field-width-50 {
	grid-column: span 1;
}

.infobric-form-container .infobric-old-upsales-form :is(input[type="text"], input[type="email"], textarea) {
	box-sizing: border-box;
	margin: 0;
	height: auto;
}

.infobric-form-container .infobric-old-upsales-form .infobric-form-submit {
	margin: 0;
}

@media (max-width: 768px) {
	.infobric-old-upsales-form .infobric-field-width-50 {
		grid-column: span 2;
	}
}

/* Form Messages */
.infobric-form-message {
	margin-top: 20px;
	padding: 16px 20px;
	border-radius: 4px;
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 15px;
	line-height: 1.5;
	animation: slideDown 0.3s ease;
}

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

.infobric-form-message.success {
	color: #155724;
	background-color: #C0FFDC;
	border: 1px solid #73C095;
}

.infobric-form-message.error {
	color: #721c24;
	background-color: #f8d7da;
	border: 1px solid #f5c6cb;
}

/* Validation States */
.infobric-form-field input.error,
.infobric-form-field textarea.error,
.infobric-form-field select.error {
	border-color: #E57D3E;
}

.infobric-form-field input.error:focus,
.infobric-form-field textarea.error:focus,
.infobric-form-field select.error:focus {
	border-color: #E57D3E;
	box-shadow: 0 0 0 3px rgba(229, 125, 62, 0.1);
}

.infobric-form-field .field-error-message {
	font-size: 13px;
	color: #E57D3E;
	margin-top: 4px;
	display: none;
}

.infobric-form-field.has-error .field-error-message {
	display: block;
	animation: slideDown 0.2s ease;
}

/* Validation Error Messages */
.infobric-field-error {
	display: block;
	font-size: 13px;
	color: #E57D3E;
	margin-top: 5px;
	line-height: 1.4;
	animation: slideDown 0.2s ease;
}

/* Acceptance Field */
.infobric-acceptance-wrapper {
	margin: 15px 0;
}

.infobric-acceptance-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.6;
	color: #272726;
	margin: 0;
	padding: 0;
}

.infobric-acceptance-checkbox {
	margin: 4px 0 0 0;
	width: 18px;
	height: 18px;
	min-width: 18px;
	cursor: pointer;
	flex-shrink: 0;
	accent-color: #1D2C38;
}

.infobric-acceptance-text {
	flex: 1;
	color: #272726;
	font-size: 14px;
	line-height: 1.6;
}

.infobric-acceptance-text a {
	color: #1D2C38;
	text-decoration: underline;
	font-weight: 500;
}

.infobric-acceptance-text a:hover {
	color: #2d4456;
	text-decoration: none;
}

.infobric-acceptance-wrapper.error {
	color: #E57D3E;
}

.infobric-acceptance-wrapper.error .infobric-acceptance-label {
	color: #E57D3E;
}

.infobric-acceptance-wrapper.error .infobric-acceptance-text {
	color: #E57D3E;
}

.infobric-acceptance-wrapper.error .infobric-acceptance-checkbox {
	outline: 2px solid #E57D3E;
	outline-offset: 2px;
}

.infobric-acceptance-wrapper.error .infobric-field-error {
	margin-top: 8px;
}

/* Loading State */
.infobric-form.loading {
	opacity: 0.7;
	pointer-events: none;
}

/* Elementor Editor Fixes */
.elementor-editor-active .infobric-form-submit {
	pointer-events: none;
}

/* File Upload - Drag and Drop */
.infobric-file-upload-wrapper {
	width: 100%;
}

.infobric-file-drop-zone {
	position: relative;
	border: 2px dashed #e0e0e0;
	border-radius: 8px;
	padding: 40px 20px;
	text-align: center;
	background-color: #fafafa;
	transition: all 0.3s ease;
	cursor: pointer;
}

.infobric-file-drop-zone:hover {
	border-color: #73C095;
	background-color: #f0f9f4;
}

.infobric-file-drop-zone.drag-over {
	border-color: #73C095;
	background-color: #e8f5ee;
	border-style: solid;
}

.infobric-file-drop-zone.has-error {
	border-color: #E57D3E;
	background-color: #fff5f2;
}

.infobric-drop-zone-content svg {
	display: block;
	margin: 0 auto 16px;
}

.infobric-drop-text {
	font-family: 'SuisseIntl-Medium-WebS', sans-serif;
	font-size: 16px;
	color: #272726;
	margin: 0 0 12px;
}

.infobric-file-browse-btn {
	display: inline-block;
	padding: 10px 24px;
	background-color: #1D2C38;
	color: #ffffff;
	border: none;
	border-radius: 4px;
	font-family: 'SuisseIntl-Medium-WebS', sans-serif;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: 12px;
}

.infobric-file-browse-btn:hover {
	background-color: #2d4456;
	transform: translateY(-1px);
}

.infobric-file-info {
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 12px;
	color: #919191;
	margin: 0;
}

.infobric-file-list {
	margin-top: 16px;
}

.infobric-file-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background-color: #f6f6f6;
	border-radius: 4px;
	margin-bottom: 8px;
	transition: background-color 0.2s ease;
}

.infobric-file-item:hover {
	background-color: #ececec;
}

.infobric-file-item-info {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
}

.infobric-file-icon {
	width: 32px;
	height: 32px;
	background-color: #73C095;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	font-family: 'SuisseIntl-Bold-WebS', sans-serif;
	font-size: 10px;
	text-transform: uppercase;
	flex-shrink: 0;
}

.infobric-file-details {
	flex: 1;
}

.infobric-file-name {
	font-family: 'SuisseIntl-Medium-WebS', sans-serif;
	font-size: 14px;
	color: #272726;
	margin: 0 0 4px;
	word-break: break-word;
}

.infobric-file-size {
	font-family: 'SuisseIntl-Regular-WebS', sans-serif;
	font-size: 12px;
	color: #919191;
	margin: 0;
}

.infobric-file-remove {
	background: none;
	border: none;
	color: #E57D3E;
	cursor: pointer;
	padding: 8px;
	font-size: 18px;
	line-height: 1;
	transition: color 0.2s ease;
	flex-shrink: 0;
}

.infobric-file-remove:hover {
	color: #d45a20;
}

/* Responsive Design */
@media (max-width: 480px) {
	.infobric-form-field input,
	.infobric-form-field textarea,
	.infobric-form-field select {
		font-size: 16px; /* Prevents zoom on iOS */
	}

	.infobric-form-submit {
		width: 100%;
		padding: 16px 24px;
	}
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
	.infobric-form-field input,
	.infobric-form-field textarea,
	.infobric-form-field select {
		background-color: #f6f6f6;
	}
}

/* Accessibility Improvements */
.infobric-form-field input:focus-visible,
.infobric-form-field textarea:focus-visible,
.infobric-form-field select:focus-visible {
	outline: 2px solid #73C095;
	outline-offset: 2px;
}

.infobric-form-submit:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

/**
 * FLOATING LABELS (Field Design V2)
 * Opt-in via .infobric-float-labels on the field wrapper. The label doubles as
 * the placeholder: it sits inside the control while empty and unfocused, then
 * floats onto the top border on focus or once a value exists. State is driven
 * by :placeholder-shown, so every control renders placeholder=" ".
 */
.infobric-float-labels {
	--infobric-float-accent: #F47735;
	--infobric-float-height: 56px;
	--infobric-float-inset: 14px;
}

.infobric-float-labels .infobric-float-field {
	position: relative;
	padding-top: 0;
}

.infobric-float-labels .infobric-float-field > label {
	position: absolute;
	top: 0;
	left: var(--infobric-float-inset);
	z-index: 1;
	height: var(--infobric-float-height);
	max-width: calc(100% - (var(--infobric-float-inset) * 2));
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0 4px;
	color: #595959;
	font-size: 16px !important;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
	transition: transform 160ms ease-out, color 160ms ease-out, font-size 160ms ease-out, height 160ms ease-out;
	transform-origin: left center;
}

/* The label needs an opaque strip behind it once it straddles the border. */
.infobric-float-labels .infobric-float-field > label::before {
	content: "";
	position: absolute;
	inset: 50% 0 auto 0;
	z-index: -1;
	height: 2px;
	background: #ffffff;
	opacity: 0;
	transition: opacity 160ms ease-out;
}

.infobric-float-labels .infobric-float-field > input,
.infobric-float-labels .infobric-float-field > textarea,
.infobric-float-labels .infobric-float-field > select,
.infobric-float-labels .infobric-float-field > .iti > input {
	height: var(--infobric-float-height);
	padding-top: 20px !important;
	padding-bottom: 6px !important;
}

.infobric-float-labels .infobric-float-field > textarea {
	height: auto;
	min-height: calc(var(--infobric-float-height) * 2);
}

/* Floated state: focused, or holding a value. */
.infobric-float-labels .infobric-float-field:focus-within > label,
.infobric-float-labels .infobric-float-field > input:not(:placeholder-shown) ~ label,
.infobric-float-labels .infobric-float-field > textarea:not(:placeholder-shown) ~ label,
.infobric-float-labels .infobric-float-field:has(> input:not(:placeholder-shown)) > label,
.infobric-float-labels .infobric-float-field:has(> textarea:not(:placeholder-shown)) > label,
.infobric-float-labels .infobric-float-field:has(> .iti > input:not(:placeholder-shown)) > label,
.infobric-float-labels .infobric-float-select > label,
.infobric-float-labels .infobric-float-tel > label {
	height: auto;
	transform: translateY(-50%);
	font-size: 12px !important;
	line-height: 1;
}

.infobric-float-labels .infobric-float-field:focus-within > label::before,
.infobric-float-labels .infobric-float-field:has(> input:not(:placeholder-shown)) > label::before,
.infobric-float-labels .infobric-float-field:has(> textarea:not(:placeholder-shown)) > label::before,
.infobric-float-labels .infobric-float-field:has(> .iti > input:not(:placeholder-shown)) > label::before,
.infobric-float-labels .infobric-float-select > label::before,
.infobric-float-labels .infobric-float-tel > label::before {
	opacity: 1;
}

/* Focus accent on both the border and the label. The widget's own label colour
   control and designbox-forms' focus skin both target these, so force it. */
.infobric-float-labels .infobric-float-field:focus-within > label {
	color: var(--infobric-float-accent) !important;
}

.infobric-float-labels .infobric-float-field > input:focus,
.infobric-float-labels .infobric-float-field > textarea:focus,
.infobric-float-labels .infobric-float-field > select:focus,
.infobric-float-labels .infobric-float-field > .iti > input:focus {
	border-color: var(--infobric-float-accent) !important;
	box-shadow: inset 0 0 0 1px var(--infobric-float-accent) !important;
	outline: none;
}

.infobric-float-labels .infobric-float-field > input:focus-visible,
.infobric-float-labels .infobric-float-field > textarea:focus-visible,
.infobric-float-labels .infobric-float-field > select:focus-visible {
	outline: 2px solid var(--infobric-float-accent);
	outline-offset: 2px;
}

/* Error wins over the focus accent. */
.infobric-float-labels .infobric-float-field > input.error,
.infobric-float-labels .infobric-float-field > textarea.error,
.infobric-float-labels .infobric-float-field > select.error {
	border-color: #cc0000 !important;
	box-shadow: inset 0 0 0 1px #cc0000 !important;
}

.infobric-float-labels .infobric-float-field:focus-within > label .required-asterisk,
.infobric-float-labels .infobric-float-field > label .required-asterisk {
	margin-left: 2px;
}

/* The flag button occupies the inline start, so a tel label always floats. */
.infobric-float-labels .infobric-float-tel .iti {
	display: block;
	width: 100%;
}

.infobric-float-labels .infobric-float-field > .infobric-form-field-help {
	margin-top: 4px;
}

@media (prefers-reduced-motion: reduce) {
	.infobric-float-labels .infobric-float-field > label,
	.infobric-float-labels .infobric-float-field > label::before {
		transition: none;
	}
}

/* Print Styles */
@media print {
	.infobric-form-submit {
		display: none;
	}
}

/**
 * LABEL INFO POPUP
 * Reusable: any element may carry .infobric-tip with a button + bubble inside.
 */
.infobric-tip {
	position: relative;
	display: inline-flex;
	margin-inline-start: 4px;
	vertical-align: middle;
}

.infobric-tip__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: none;
	color: #7c868f;
	cursor: pointer;
	transition: color 0.15s ease-out;
}

.infobric-tip__btn svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.infobric-tip__btn:hover,
.infobric-tip--open .infobric-tip__btn {
	color: #FF6C0E;
}

.infobric-tip__btn:focus-visible {
	outline: 2px solid #FF6C0E;
	outline-offset: 2px;
}

.infobric-tip__bubble {
	position: absolute;
	inset-inline-start: 50%;
	bottom: calc(100% + 8px);
	z-index: 20;
	width: max-content;
	max-width: 260px;
	padding: 12px 16px;
	transform: translateX(-50%);
	border-radius: 8px;
	background: #243746;
	box-shadow: 0 6px 18px rgb(0 0 0 / 10%);
	color: #f4f5f6;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	text-align: start;
	white-space: normal;
}

/* Hover and keyboard focus reveal without JS; the [hidden] attribute that the
   script toggles only drives the pinned-open state. */
.infobric-tip:hover .infobric-tip__bubble,
.infobric-tip:focus-within .infobric-tip__bubble {
	display: block;
}

.infobric-tip__bubble::after {
	content: "";
	position: absolute;
	inset-inline-start: 50%;
	top: 100%;
	width: 10px;
	height: 10px;
	margin-inline-start: -5px;
	transform: translateY(-50%) rotate(45deg);
	background: #243746;
}

/* Narrow screens: a centred bubble would overflow, so pin it to the field. */
@media (max-width: 575px) {
	.infobric-tip {
		position: static;
	}

	.infobric-form-field {
		position: relative;
	}

	.infobric-tip__bubble {
		inset-inline: 0;
		bottom: auto;
		top: calc(100% + 8px);
		width: auto;
		max-width: none;
		transform: none;
	}

	.infobric-tip__bubble::after {
		display: none;
	}
}
