/**
 * Overlay: szybki kontakt (quick contact).
 * data-opm-view="quick-contact". Token-driven; scoped under .opm.
 * Figma node 1:2950 — centered white modal, black close chip (top-left),
 * title + intro, 5-field grid (message spans full width on the right),
 * stacked GDPR consents with square black-bullet checkboxes, black submit.
 */

.opm.opm-qc {
	position: fixed;
	inset: 0;
	/* Above the offer modal (.opm-modal is z-index 100000). */
	z-index: 100050;
	display: flex;
	align-items: stretch;
	justify-content: flex-end;
	padding: 0;
	font-family: var(--opm-font-sans);
	color: var(--opm-color-ink);
}

.opm.opm-qc[hidden] {
	display: none;
}

/* Backdrop */
.opm-qc__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	cursor: pointer;
}

/* Dialog — right-side slide-in panel (Figma). */
.opm-qc__dialog {
	position: relative;
	width: 612px;
	max-width: 92vw;
	height: 100%;
	max-height: 100vh;
	overflow-y: auto;
	background: #f0f0f1;
	box-shadow: var(--opm-shadow-lg);
	padding: clamp(28px, 4vw, 56px) clamp(24px, 3vw, 48px);
	animation: opm-qc-in var(--opm-duration) var(--opm-ease);
}

@keyframes opm-qc-in {
	from { opacity: 0; transform: translateX(24px); }
	to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
	.opm-qc__dialog { animation: none; }
}

/* Close chip — black square at the panel's top-left (Figma). */
.opm-qc__close {
	position: absolute;
	top: clamp(28px, 4vw, 56px);
	left: clamp(24px, 3vw, 48px);
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	background: var(--opm-color-ink);
	color: var(--opm-color-bg);
	cursor: pointer;
	transition: background var(--opm-duration) var(--opm-ease);
}

.opm-qc__close:hover,
.opm-qc__close:focus-visible {
	background: var(--opm-color-accent);
	outline: none;
}

@media (max-width: 640px) {
	.opm-qc__close {
		top: var(--opm-space-2);
		left: auto;
		right: var(--opm-space-2);
	}
}

/* Head — clears the absolutely-positioned close chip above it. */
.opm-qc__head {
	margin-top: 52px;
	margin-bottom: var(--opm-space-5);
}

.opm-qc__title {
	margin: 0 0 var(--opm-space-2);
	font-size: var(--opm-fs-xl);
	font-weight: var(--opm-fw-bold);
	line-height: 1.2;
	color: var(--opm-color-ink);
}

.opm-qc__intro {
	margin: 0;
	font-size: var(--opm-fs-xs);
	line-height: 1.5;
	color: var(--opm-color-ink-muted);
}

.opm-qc__intro-code {
	display: inline-block;
	margin-left: var(--opm-space-2);
	font-weight: var(--opm-fw-bold);
	color: var(--opm-color-ink);
}

/* Field grid — single stacked column (Figma right panel). */
.opm-qc__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--opm-space-3);
	margin-bottom: var(--opm-space-5);
}

.opm-qc__field {
	display: flex;
	flex-direction: column;
	gap: var(--opm-space-1);
	min-width: 0;
}

.opm-qc__field--message {
	grid-column: 1;
}

.opm-qc__label {
	font-size: var(--opm-fs-xs);
	font-weight: var(--opm-fw-medium);
	color: var(--opm-color-ink);
}

.opm-qc__req {
	color: var(--opm-status-contracted);
	margin-left: 2px;
}

.opm-qc__input {
	width: 100%;
	box-sizing: border-box;
	padding: var(--opm-space-2) var(--opm-space-3);
	font-family: inherit;
	font-size: var(--opm-fs-sm);
	color: var(--opm-color-ink);
	background: var(--opm-color-bg);
	border: 1px solid var(--opm-color-border);
	border-radius: 0;
	transition: border-color var(--opm-duration) var(--opm-ease), box-shadow var(--opm-duration) var(--opm-ease);
}

.opm-qc__input::placeholder {
	color: var(--opm-color-ink-muted);
}

.opm-qc__input:focus {
	outline: none;
	border-color: var(--opm-color-accent);
	box-shadow: 0 0 0 2px rgba(186, 186, 186, 0.25);
}

.opm-qc__textarea {
	resize: vertical;
	min-height: 100%;
	height: 100%;
}

/* Field error state (set by JS) */
.opm-qc__field.is-invalid .opm-qc__input {
	border-color: var(--opm-status-contracted);
}

/* Consents */
.opm-qc__consents {
	margin: 0 0 var(--opm-space-5);
	padding: 0;
	border: none;
	display: flex;
	flex-direction: column;
	gap: var(--opm-space-2);
}

.opm-qc__sr,
.opm-qc__consent .opm-qc__checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.opm-qc__consent {
	position: relative;
	display: grid;
	grid-template-columns: 15px 1fr;
	gap: var(--opm-space-2);
	align-items: start;
	font-size: var(--opm-fs-2xs);
	line-height: 1.5;
	cursor: pointer;
}

/* Square checkbox with centered black bullet when checked */
.opm-qc__consent-box {
	width: 15px;
	height: 15px;
	margin-top: 1px;
	border: 1px solid var(--opm-color-border);
	background: var(--opm-color-bg);
	position: relative;
	flex: none;
	transition: border-color var(--opm-duration) var(--opm-ease);
}

.opm-qc__consent-box::after {
	content: "";
	position: absolute;
	inset: 4px;
	background: var(--opm-color-ink);
	opacity: 0;
	transition: opacity var(--opm-duration) var(--opm-ease);
}

.opm-qc__checkbox:checked + .opm-qc__consent-box::after {
	opacity: 1;
}

.opm-qc__checkbox:focus-visible + .opm-qc__consent-box {
	outline: 2px solid var(--opm-color-accent);
	outline-offset: 1px;
}

.opm-qc__consent.is-invalid .opm-qc__consent-box {
	border-color: var(--opm-status-contracted);
}

.opm-qc__consent-text {
	color: var(--opm-color-ink);
}

.opm-qc__consent-text a {
	color: var(--opm-color-accent);
	text-decoration: underline;
}

/* Footer */
.opm-qc__foot {
	display: flex;
	align-items: center;
	gap: var(--opm-space-4);
	flex-wrap: wrap;
}

.opm-qc__submit {
	display: inline-flex;
	align-items: center;
	gap: var(--opm-space-2);
	min-width: 120px;
	justify-content: center;
	padding: var(--opm-space-2) var(--opm-space-5);
	font-family: inherit;
	font-size: var(--opm-fs-xs);
	font-weight: var(--opm-fw-bold);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--opm-color-bg);
	background: var(--opm-color-ink);
	border: 1px solid var(--opm-color-ink);
	cursor: pointer;
	transition: background var(--opm-duration) var(--opm-ease), color var(--opm-duration) var(--opm-ease);
}

.opm-qc__submit:hover:not([disabled]),
.opm-qc__submit:focus-visible:not([disabled]) {
	background: var(--opm-color-accent);
	border-color: var(--opm-color-accent);
	color: var(--opm-color-on-accent);
	outline: none;
}

.opm-qc__submit[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.opm-qc__spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: var(--opm-radius-full);
	animation: opm-qc-spin 0.6s linear infinite;
}

.opm-qc.is-sending .opm-qc__spinner {
	display: inline-block;
}

@keyframes opm-qc-spin {
	to { transform: rotate(360deg); }
}

.opm-qc__status {
	margin: 0;
	font-size: var(--opm-fs-xs);
	line-height: 1.4;
}

.opm-qc__status[data-state="error"] {
	color: var(--opm-status-contracted);
}

.opm-qc__status[data-state="success"] {
	color: var(--opm-color-accent);
	font-weight: var(--opm-fw-medium);
}

/* Mobile — single column, message back in flow */
@media (max-width: 640px) {
	.opm-qc__dialog {
		padding: var(--opm-space-5) var(--opm-space-4);
	}
	.opm-qc__grid {
		grid-template-columns: 1fr;
	}
	.opm-qc__field--message {
		grid-column: 1;
		grid-row: auto;
	}
	.opm-qc__textarea {
		min-height: 100px;
		height: auto;
	}
}

/* ===== Figma QA: labels-as-placeholders + category accent (fallback) ===== */
.opm-qc__input::placeholder { color: #1d2b32; opacity: 1; }
/* Checkbox checked bullet + close hover + links follow the category accent;
   fallback: default accent / black per spec. */
.opm-qc__checkbox:checked + .opm-qc__consent-box::after { background: var(--opm-color-accent, var(--opm-color-ink, #000)); opacity: 1; }
.opm-qc__close:hover,
.opm-qc__close:focus-visible { background: var(--opm-color-accent, #bababa); }
.opm-qc__consent-text a { color: var(--opm-color-accent, #000); }
/* Collapse each long consent to two lines (expand on focus/hover of the row). */
.opm-qc__consent-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.opm-qc__consent:hover .opm-qc__consent-text,
.opm-qc__consent:focus-within .opm-qc__consent-text { -webkit-line-clamp: unset; overflow: visible; }

/* ===== In-modal mode: slide the form INSIDE the offer modal (Figma) =========
   JS confines the overlay to the modal dialog's box (top/left/width/height),
   so the panel slides from the modal's right edge and the backdrop dims only
   the modal — not the whole page. */
.opm.opm-qc.opm-qc--in-modal { position: fixed; inset: auto; }
.opm-qc--in-modal .opm-qc__dialog { height: 100%; max-width: 100%; }