/**
 * Choice components + product-page sticky CTA.
 *
 * ADR-004: products have no prices, so quantity tiers and the price summary
 * were removed. Option groups/cards/chips remain for choice UIs such as the
 * general quote page (/teklif/). The sticky bar jumps to the product quote
 * form. Loaded on product pages and the quote page.
 *
 * Components: option-group · option-select · option-chip · option-card ·
 * option-reason (incompatible) · file-upload · sticky-mobile-bar
 *
 * All choices are native radios/checkboxes inside fieldset+legend.
 * Incompatible values use aria-disabled (stays focusable, reason is read).
 */

/* ── option-group ─────────────────────────────────────────────────── */
.tr-option-group {
	margin: 0;
	padding: 0 0 var(--tr-space-5);
	border: 0;
	border-bottom: 1px solid var(--tr-color-border);
	min-width: 0;
}

.tr-option-group + .tr-option-group {
	padding-top: var(--tr-space-5);
}

.tr-option-group__label {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--tr-space-1) var(--tr-space-2);
	padding: 0;
	margin-bottom: var(--tr-space-3);
	font-size: var(--tr-text-small);
	font-weight: var(--tr-weight-bold);
}

.tr-option-group__value {
	font-weight: var(--tr-weight-regular);
	color: var(--tr-color-text-muted);
}

.tr-option-group__help {
	margin-top: var(--tr-space-3);
	font-size: var(--tr-text-caption);
	color: var(--tr-color-text-muted);
}

.tr-option-group__help summary {
	display: inline-flex;
	min-height: 32px;
	align-items: center;
	font-weight: var(--tr-weight-semibold);
	color: var(--tr-color-ink);
	text-decoration: underline;
	text-underline-offset: 0.2em;
	cursor: pointer;
}

.tr-option-group__help p {
	padding-top: var(--tr-space-2);
	max-width: 52ch;
}

/* ── option-select ────────────────────────────────────────────────── */
.tr-option-select {
	/* uses .tr-select from components.css */
	max-width: 420px;
}

/* ── option-chip (wrapper around .tr-chip items) ──────────────────── */
.tr-option-chip {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tr-space-2);
}

.tr-chip input[aria-disabled="true"] + span {
	border-style: dashed;
	border-color: var(--tr-color-border-strong);
	background: var(--tr-color-surface-soft);
	color: var(--tr-color-text-muted);
	cursor: not-allowed;
}

.tr-chip input[aria-disabled="true"] + span::before {
	content: "";
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 6px;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	background: linear-gradient(45deg, transparent 43%, currentColor 43% 57%, transparent 57%);
	vertical-align: -1px;
}

/* ── option-card (visual choices: paper, lamination, delivery) ────── */
.tr-option-card {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
	gap: var(--tr-space-2);
}

.tr-option-card--wide {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.tr-option-card__item {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-height: 64px;
	padding: var(--tr-space-3) var(--tr-space-3) var(--tr-space-3) var(--tr-space-3);
	border: 1px solid var(--tr-color-border-strong);
	border-radius: var(--tr-radius-sm);
	background: var(--tr-color-paper);
	cursor: pointer;
	transition: border-color var(--tr-transition-fast), box-shadow var(--tr-transition-fast);
}

.tr-option-card__item input {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.tr-option-card__item:hover { border-color: var(--tr-color-ink); }

.tr-option-card__item:has(input:checked) {
	border-color: var(--tr-color-ink);
	box-shadow: inset 0 0 0 1px var(--tr-color-ink);
}

/* check indicator — selection is not colour-only */
.tr-option-card__item::after {
	content: "";
	position: absolute;
	top: var(--tr-space-2);
	right: var(--tr-space-2);
	width: 18px;
	height: 18px;
	border: 1.5px solid var(--tr-color-border-strong);
	border-radius: 50%;
	background: var(--tr-color-paper);
}

.tr-option-card__item:has(input:checked)::after {
	border-color: var(--tr-color-ink);
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat,
		var(--tr-color-ink);
}

.tr-option-card__item:has(input:focus-visible) {
	outline: 2px solid var(--tr-color-focus);
	outline-offset: 2px;
}

.tr-option-card__item:has(input[aria-disabled="true"]) {
	border-style: dashed;
	background: var(--tr-color-surface-soft);
	color: var(--tr-color-text-muted);
	cursor: not-allowed;
}

.tr-option-card__swatch {
	width: 28px;
	height: 28px;
	margin-bottom: var(--tr-space-2);
	border: 1px solid var(--tr-color-border);
	border-radius: var(--tr-radius-sm);
}

.tr-option-card__label {
	padding-right: var(--tr-space-5);
	font-size: var(--tr-text-small);
	font-weight: var(--tr-weight-semibold);
	line-height: 1.3;
}

.tr-option-card__desc {
	font-size: var(--tr-text-caption);
	color: var(--tr-color-text-muted);
	line-height: 1.4;
}

.tr-option-card__meta {
	margin-top: auto;
	padding-top: var(--tr-space-1);
	font-size: var(--tr-text-caption);
	font-weight: var(--tr-weight-semibold);
	font-variant-numeric: tabular-nums;
}

/* ── option-reason (why a value is unavailable) ───────────────────── */
.tr-option-reason {
	display: flex;
	gap: var(--tr-space-2);
	margin-top: var(--tr-space-2);
	font-size: var(--tr-text-caption);
	color: var(--tr-color-text-muted);
}

.tr-option-reason::before {
	content: "i";
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 16px;
	height: 16px;
	border: 1px solid currentColor;
	border-radius: 50%;
	font-size: 0.625rem;
	font-weight: var(--tr-weight-bold);
	font-style: normal;
}

/* ── file-upload ──────────────────────────────────────────────────── */
.tr-file-upload {
	display: grid;
	gap: var(--tr-space-3);
}

.tr-dropzone {
	display: grid;
	justify-items: center;
	gap: var(--tr-space-2);
	padding: var(--tr-space-5) var(--tr-space-4);
	border: 1.5px dashed var(--tr-color-border-strong);
	border-radius: var(--tr-radius-sm);
	background: var(--tr-color-surface-soft);
	text-align: center;
	font-size: var(--tr-text-small);
}

.tr-dropzone .tr-icon { width: 28px; height: 28px; }

.tr-dropzone__specs {
	font-size: var(--tr-text-caption);
	color: var(--tr-color-text-muted);
}


/* ── sticky-mobile-bar ────────────────────────────────────────────── */
.tr-sticky-mobile-bar {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: var(--tr-z-sticky);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tr-space-3);
	min-height: var(--tr-sticky-bar-height);
	padding: var(--tr-space-3) var(--tr-gutter);
	padding-bottom: calc(var(--tr-space-3) + env(safe-area-inset-bottom));
	background: var(--tr-color-paper);
	border-top: 1px solid var(--tr-color-ink);
	box-shadow: 0 -8px 24px -16px rgb(27 28 31 / 0.35);
	transition: transform var(--tr-duration-base) var(--tr-ease);
}

.tr-sticky-mobile-bar[data-hidden="true"] { transform: translateY(110%); }

.tr-sticky-mobile-bar__label {
	display: grid;
	min-width: 0;
	line-height: 1.25;
}

.tr-sticky-mobile-bar__label strong {
	overflow: hidden;
	font-size: 1.0625rem;
	font-weight: var(--tr-weight-bold);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tr-sticky-mobile-bar__label small {
	font-size: var(--tr-text-caption);
	color: var(--tr-color-text-muted);
}

.tr-sticky-mobile-bar__cta { flex: none; }

@media (max-width: 1023px) {
	body.tr-has-sticky-bar {
		padding-bottom: var(--tr-sticky-bar-height);
	}

	/* WCAG 2.4.11: focused fields must not hide behind the bar. */
	html:has(body.tr-has-sticky-bar) {
		scroll-padding-bottom: calc(var(--tr-sticky-bar-height) + var(--tr-space-4));
	}
}

@media (min-width: 1024px) {
	.tr-sticky-mobile-bar { display: none; }
}
