/**
 * Helmut CF7 Single Shop — frontend styles.
 *
 * Every rule is scoped to a .hcfss- class. Page builders such as Nicepage emit
 * broad element selectors and inline styles, so nothing here targets bare
 * elements, and colours are inherited from the theme wherever possible.
 */

/*
 * Hides a label visually while leaving it for screen readers. Compact forms
 * often drop labels entirely; this keeps the form small without doing that.
 */
.hcfss-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

.hcfss-picker {
	margin: 0 0 1em;
}

.hcfss-picker[hidden] {
	display: none;
}

.hcfss-picker__button {
	box-sizing: border-box;
	display: inline-block;
	padding: 0.6em 1.2em;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.3;
	cursor: pointer;
}

.hcfss-picker__button:hover,
.hcfss-picker__button:focus-visible {
	opacity: 0.8;
}

/* Never remove the focus ring; keyboard users need to see where they are. */
.hcfss-picker__button:focus-visible,
.hcfss-dialog__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.hcfss-picker__button[disabled] {
	opacity: 0.55;
	cursor: default;
}

.hcfss-picker__summary {
	margin: 0.6em 0 0;
	font-size: 0.95em;
	line-height: 1.4;
}

.hcfss-picker__summary--empty {
	opacity: 0.75;
}

.hcfss-total {
	/* Sits in the normal field flow so it lines up with the inputs above it. */
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 1em;
	padding: 0;
	color: var( --hcfss-text-color, inherit );
	font-size: var( --hcfss-font-size, inherit );
	font-weight: 600;
	line-height: 1.4;
	text-align: left;
}

/* Nothing chosen yet: quieter, and never shown as a finished total. */
.hcfss-total--pending {
	font-weight: 400;
	opacity: 0.8;
}

/*
 * Disabled submit button.
 *
 * Contact Form 7 disables the button until a required acceptance checkbox is
 * ticked, and says nothing about why. Left unstyled, the button looks ready and
 * simply ignores every click, which reads as a broken form rather than a
 * missing tick. Dimming it makes the cause obvious at a glance.
 */
.hcfss-shop-form input[type="submit"]:disabled,
.hcfss-shop-form .wpcf7-submit:disabled {
	opacity: 0.5 !important;
	cursor: not-allowed !important;
}

/* Draw the eye to the checkbox that is holding the order up. */
.hcfss-shop-form:has( input[type="submit"]:disabled ) .wpcf7-acceptance .wpcf7-list-item-label::after {
	content: " *";
	color: #b32d2e;
	font-weight: 700;
}

/*
 * Invalid fields.
 *
 * Contact Form 7 marks a rejected field with .wpcf7-not-valid and prints the
 * reason in .wpcf7-not-valid-tip. Page builders routinely hide or collapse the
 * tip, leaving the visitor with only the generic "one or more fields have an
 * error" banner and no idea which field to fix. These rules put both back.
 */
.hcfss-shop-form .wpcf7-not-valid,
.hcfss-shop-form select.wpcf7-not-valid,
.hcfss-shop-form textarea.wpcf7-not-valid {
	border: 2px solid #b32d2e !important;
	outline: none;
	background-color: #fdf3f3 !important;
}

/*
 * !important is deliberate. Contact Form 7 refuses to submit while a field is
 * invalid, so if the page builder hides this message the visitor is left with a
 * button that appears to do nothing at all. Losing the styling battle here
 * costs far more than the specificity is worth.
 */
.hcfss-shop-form .wpcf7-not-valid-tip {
	display: block !important;
	margin: 0.35em 0 0 !important;
	visibility: visible !important;
	max-width: none !important;
	max-height: none !important;
	height: auto !important;
	overflow: visible !important;
	position: static !important;
	clip: auto !important;
	opacity: 1 !important;
	color: #b32d2e !important;
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.4;
	text-indent: 0;
	white-space: normal;
}

/* The checkbox itself cannot carry a border convincingly; mark its row. */
.hcfss-shop-form .wpcf7-acceptance .wpcf7-list-item:has( .wpcf7-not-valid ),
.hcfss-shop-form .wpcf7-checkbox .wpcf7-list-item:has( .wpcf7-not-valid ) {
	padding-left: 0.5em;
	border-left: 3px solid #b32d2e;
}

/*
 * Page builders frequently collapse the label that Contact Form 7 renders next
 * to an acceptance checkbox. Restoring display here keeps the consent wording
 * visible, which it has to be for the consent to mean anything.
 */
.hcfss-shop-form .wpcf7-acceptance .wpcf7-list-item {
	display: block;
	margin: 0;
}

.hcfss-shop-form .wpcf7-acceptance .wpcf7-list-item-label {
	display: inline;
	visibility: visible;
	max-width: none;
	max-height: none;
	overflow: visible;
	color: var( --hcfss-text-color, inherit );
	font-size: var( --hcfss-font-size, inherit );
	text-indent: 0;
	white-space: normal;
}

.hcfss-shop-form .wpcf7-acceptance input[type="checkbox"] {
	width: auto;
	margin-right: 0.5em;
	vertical-align: baseline;
}

/* ---------------------------------------------------------------------
 * Balíkovna dialog
 * ------------------------------------------------------------------ */

.hcfss-dialog {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba( 0, 0, 0, 0.6 );
}

.hcfss-dialog__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	/* The supplier asks for at least 360x800; below that the map is unusable. */
	max-width: 560px;
	height: 100%;
	max-height: 860px;
	min-height: 480px;
	overflow: hidden;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.35 );
}

.hcfss-dialog__close {
	align-self: flex-end;
	margin: 8px 8px 4px;
	padding: 0.45em 1em;
	border: 1px solid #767676;
	border-radius: 4px;
	background: #fff;
	color: #1d2327;
	font: inherit;
	font-size: 0.9rem;
	cursor: pointer;
}

.hcfss-dialog__frame {
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	border: 0;
}

.hcfss-dialog-open {
	overflow: hidden;
}

@media ( max-width: 480px ) {
	.hcfss-dialog {
		padding: 0;
	}

	.hcfss-dialog__panel {
		max-width: none;
		max-height: none;
		border-radius: 0;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.hcfss-picker__button,
	.hcfss-dialog__close {
		transition: none;
	}
}

/* ---------------------------------------------------------------------
 * Page builder theme
 *
 * Opt-in from the settings screen. Page builders style their own form
 * controls but leave a Contact Form 7 form embedded by shortcode untouched,
 * so the two look unrelated on the same page. These rules give the shop form
 * the same shape, and take their colours from custom properties so a site can
 * match its own palette without editing the plugin.
 * ------------------------------------------------------------------ */

.hcfss-shop-form.hcfss-themed {
	--hcfss-field-border: #d8d8d8;
	--hcfss-field-radius: 0;
	--hcfss-field-padding: 14px 16px;
	--hcfss-field-gap: 12px;
	--hcfss-field-bg: #fff;
	--hcfss-button-bg: #29a8e0;
	--hcfss-button-color: #fff;
}

.hcfss-shop-form.hcfss-themed input[type="text"],
.hcfss-shop-form.hcfss-themed input[type="email"],
.hcfss-shop-form.hcfss-themed input[type="tel"],
.hcfss-shop-form.hcfss-themed input[type="url"],
.hcfss-shop-form.hcfss-themed input[type="number"],
.hcfss-shop-form.hcfss-themed input[type="date"],
.hcfss-shop-form.hcfss-themed select,
.hcfss-shop-form.hcfss-themed textarea {
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 var( --hcfss-field-gap );
	padding: var( --hcfss-field-padding );
	border: 1px solid var( --hcfss-field-border );
	border-radius: var( --hcfss-field-radius );
	background-color: var( --hcfss-field-bg );
	color: var( --hcfss-text-color, inherit );
	font-family: inherit;
	font-size: var( --hcfss-font-size, inherit );
	line-height: 1.4;
}

.hcfss-shop-form.hcfss-themed textarea {
	min-height: 150px;
	resize: vertical;
}

/* Contact Form 7 wraps every control in a <p>; collapse the double spacing. */
.hcfss-shop-form.hcfss-themed p {
	margin: 0;
}

.hcfss-shop-form.hcfss-themed input[type="submit"] {
	display: block;
	width: auto;
	margin: 8px auto 0;
	padding: 14px 44px;
	border: 0;
	border-radius: var( --hcfss-field-radius );
	background-color: var( --hcfss-button-bg );
	color: var( --hcfss-button-color );
	font-family: inherit;
	font-size: var( --hcfss-font-size, inherit );
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
}

.hcfss-shop-form.hcfss-themed input[type="submit"]:hover:not( :disabled ) {
	filter: brightness( 0.92 );
}

.hcfss-shop-form.hcfss-themed .hcfss-picker__button {
	padding: var( --hcfss-field-padding );
	border: 1px solid var( --hcfss-field-border );
	border-radius: var( --hcfss-field-radius );
	background-color: var( --hcfss-field-bg );
}

.hcfss-shop-form.hcfss-themed .wpcf7-acceptance {
	display: block;
	margin: 0 0 var( --hcfss-field-gap );
}
