/**
 * IIHF Surveys — public front-end styles.
 *
 * All colours, spacing and radius come from CSS custom properties so the
 * survey can be re-branded without touching this file. Override
 * `.iihf-survey` (or a more specific selector) from theme CSS.
 */

:root {
	--iihf-survey-primary: #1f5f3b;
	--iihf-survey-secondary: #d8efe0;
	--iihf-survey-text: #1f2933;
	--iihf-survey-muted: #62717c;
	--iihf-survey-border: #d7dde3;
	--iihf-survey-error: #b42318;
	--iihf-survey-radius: 8px;
	--iihf-survey-max-width: 860px;
	--iihf-survey-font: inherit;

	/* Options (radio/checkbox) layout — overridden per-install from Settings. */
	--iihf-options-direction: column;
	--iihf-options-gap: 10px;

	/* Button styling — overridden per-install from Settings; fall back to
	   the primary brand colour so an un-configured install still looks right. */
	--iihf-button-bg: var( --iihf-survey-primary );
	--iihf-button-text: #ffffff;
	--iihf-button-hover-bg: var( --iihf-button-bg );
	--iihf-button-font-family: inherit;
	--iihf-button-font-size: 16px;
	--iihf-button-font-weight: 600;

	/* Previous/Next/Submit row layout — overridden per-install from Settings. */
	--iihf-nav-direction: row;
	--iihf-nav-justify: space-between;
	--iihf-nav-gap: 12px;
	--iihf-button-width: auto;

	/* Question spacing/typography — overridden per-install from Settings. */
	--iihf-field-spacing: 24px;
	--iihf-question-font-family: inherit;
	--iihf-question-font-size: 16px;
	--iihf-question-font-weight: 600;
	--iihf-question-answer-gap: 14px;
}

.iihf-survey {
	max-width: var( --iihf-survey-max-width );
	margin: 0 auto;
	color: var( --iihf-survey-text );
	font-family: var( --iihf-survey-font );
	box-sizing: border-box;
}

.iihf-survey *,
.iihf-survey *::before,
.iihf-survey *::after {
	box-sizing: inherit;
}

/* The browser's own [hidden]{display:none} rule has very low specificity,
   so a theme that styles buttons/divs broadly (e.g. "button { display:
   inline-flex }" from a page builder's global styles) can easily override
   it and make Previous/Next/Submit all appear at once regardless of what
   the JS set. Reassert it explicitly, scoped to the survey only. */
.iihf-survey [hidden] {
	display: none !important;
}

.iihf-survey-title {
	margin-bottom: 0.5em;
}

.iihf-survey-intro {
	margin-bottom: 1.5em;
	color: var( --iihf-survey-muted );
}

.iihf-survey-message p {
	background: var( --iihf-survey-secondary );
	border-radius: var( --iihf-survey-radius );
	padding: 1em 1.25em;
}

.iihf-survey-thankyou {
	background: var( --iihf-survey-secondary );
	border-radius: var( --iihf-survey-radius );
	padding: 1.5em;
}

.iihf-errors {
	background: #fdecea;
	border: 1px solid var( --iihf-survey-error );
	color: var( --iihf-survey-error );
	border-radius: var( --iihf-survey-radius );
	padding: 0.75em 1em;
	margin-bottom: 1em;
}

.iihf-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.iihf-progress {
	margin-bottom: 1.5em;
}

.iihf-progress-track {
	background: var( --iihf-survey-border );
	border-radius: 999px;
	height: 8px;
	overflow: hidden;
}

.iihf-progress-fill {
	background: var( --iihf-survey-primary );
	height: 100%;
	transition: width 0.2s ease;
}

.iihf-progress-label {
	margin: 0.4em 0 0;
	font-size: 0.85em;
	color: var( --iihf-survey-muted );
}

.iihf-field {
	margin-bottom: var( --iihf-field-spacing );
}

.iihf-field label,
.iihf-field legend {
	display: block;
}

/* Scoped to the question's own label/legend — not the answer options inside
   it — so typography and spacing settings never bump the weight/gap of
   individual answers like "Yes"/"No". */
.iihf-question-label {
	font-family: var( --iihf-question-font-family );
	font-size: var( --iihf-question-font-size );
	font-weight: var( --iihf-question-font-weight );
	margin-bottom: var( --iihf-question-answer-gap );
}

/* Browsers apply a default border + padding to <fieldset> (used for
   single/multiple choice, yes/no, and rating questions); reset it so only
   fields with an actual input box (text, textarea, select) show a border. */
.iihf-field fieldset {
	border: none;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.iihf-field fieldset legend {
	width: 100%;
	padding: 0;
}

.iihf-field-description {
	color: var( --iihf-survey-muted );
	font-size: 0.9em;
	margin: 0 0 0.6em;
}

.iihf-field-hint {
	color: var( --iihf-survey-muted );
	font-size: 0.85em;
	font-style: italic;
	margin: 0 0 0.6em;
}

.iihf-option:has( input:disabled ) {
	opacity: 0.5;
}

.iihf-option input:disabled {
	cursor: not-allowed;
}

.iihf-required {
	color: var( --iihf-survey-error );
	margin-left: 0.15em;
}

.iihf-field input[type="text"],
.iihf-field input[type="email"],
.iihf-field input[type="number"],
.iihf-field textarea,
.iihf-field select {
	width: 100%;
	max-width: 100%;
	padding: 0.65em 0.75em;
	border: 1px solid var( --iihf-survey-border );
	border-radius: var( --iihf-survey-radius );
	font-size: 1em;
	font-family: inherit;
	color: var( --iihf-survey-text );
	background: #fff;
}

.iihf-field input:focus-visible,
.iihf-field textarea:focus-visible,
.iihf-field select:focus-visible,
.iihf-survey button:focus-visible {
	outline: 3px solid var( --iihf-survey-primary );
	outline-offset: 1px;
}

.iihf-field.has-error input,
.iihf-field.has-error textarea,
.iihf-field.has-error select {
	border-color: var( --iihf-survey-error );
}

.iihf-field-error {
	color: var( --iihf-survey-error );
	font-size: 0.85em;
	margin: 0.4em 0 0;
	min-height: 1em;
}

.iihf-options {
	display: flex;
	flex-direction: var( --iihf-options-direction );
	flex-wrap: wrap;
	gap: var( --iihf-options-gap );
}

.iihf-option {
	display: flex;
	align-items: flex-start;
	gap: 0.5em;
	font-weight: 400;
	cursor: pointer;
}

.iihf-option input {
	margin-top: 0.2em;
}

.iihf-option-other-text {
	margin-top: 0.5em;
	width: 100%;
	padding: 0.6em 0.75em;
	border: 1px solid var( --iihf-survey-border );
	border-radius: var( --iihf-survey-radius );
}

.iihf-rating-scale {
	display: flex;
	align-items: center;
	gap: 0.75em;
	flex-wrap: wrap;
}

.iihf-rating-options {
	display: flex;
	gap: 0.5em;
	flex-wrap: wrap;
}

.iihf-rating-option {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3em;
	cursor: pointer;
}

.iihf-rating-label {
	font-size: 0.85em;
	color: var( --iihf-survey-muted );
}

.iihf-char-counter {
	font-size: 0.8em;
	color: var( --iihf-survey-muted );
	text-align: right;
	margin: 0.3em 0 0;
}

.iihf-nav {
	display: flex;
	flex-direction: var( --iihf-nav-direction );
	justify-content: var( --iihf-nav-justify );
	align-items: stretch;
	flex-wrap: wrap;
	gap: var( --iihf-nav-gap );
	margin-top: 2em;
}

.iihf-nav button {
	width: var( --iihf-button-width );
}

.iihf-survey button {
	appearance: none;
	border: none;
	border-radius: var( --iihf-survey-radius );
	padding: 0.75em 1.5em;
	font-family: var( --iihf-button-font-family );
	font-size: var( --iihf-button-font-size );
	font-weight: var( --iihf-button-font-weight );
	cursor: pointer;
}

.iihf-survey .button-primary {
	background: var( --iihf-button-bg );
	color: var( --iihf-button-text );
}

.iihf-survey .button-primary:hover {
	background: var( --iihf-button-hover-bg );
	filter: brightness( 0.92 );
}

.iihf-survey .button-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.iihf-survey .button:not( .button-primary ) {
	background: transparent;
	color: var( --iihf-survey-text );
	border: 1px solid var( --iihf-survey-border );
}

@media ( max-width: 600px ) {
	.iihf-nav {
		flex-direction: column-reverse;
	}

	.iihf-survey button {
		width: 100%;
	}

	.iihf-options {
		flex-direction: column;
		gap: 0.6em;
	}
}
