/* components/cabinet-exam.css — модалка прохождения мини-теста/итогового
 * экзамена, patterns/cabinet/js/exam/panel.js. Общая для «Аудитории» и
 * «Лекций» — вмонтирована ВНУТРЬ .reclaim-audience/.reclaim-lectures
 * (см. докстринг panel.js), поэтому наследует --settings-accent и другие
 * токены оттуда же, здесь их заново не объявляем.
 */

.cbx-hidden {
	display: none !important;
}

.cbx-overlay {
	position: fixed;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: color-mix( in srgb, var( --ink ) 45%, transparent );
}

.cbx-overlay--dock {
	position: relative;
	inset: auto;
	z-index: 1;
	flex: 1 1 auto;
	min-height: 0;
	padding: 0;
	background: none;
	align-items: stretch;
	justify-content: stretch;
}

.cbx-modal {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min( 100%, 34rem );
	max-height: min( 100%, 42rem );
	overflow: hidden;
	border: 1px solid var( --line );
	border-radius: 10px;
	background: var( --surface );
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.25 );
}

.cbx-modal::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 1;
	height: 3px;
	background: var( --primary-bg, #e85e1a );
}

.cbx-overlay--dock .cbx-modal {
	width: 100%;
	max-height: none;
	height: 100%;
	border-radius: 0;
	box-shadow: none;
}

.cbx-overlay--dock .cbx-modal::before {
	display: none;
}

.cbx-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1rem 1.15rem;
	border-bottom: 1px solid var( --line );
}

.cbx-modal__title {
	flex: 1 1 auto;
	margin: 0;
	min-width: 0;
	font-family: var( --font-display );
	font-size: 1.05rem;
	font-weight: 800;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.cbx-icon {
	display: block;
	flex: 0 0 auto;
}

.cbx-modal__close {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 1.42rem;
	height: 1.42rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	color: var( --muted );
	cursor: pointer;
	line-height: 1;
}

.cbx-modal__close .cbx-icon {
	width: 1.05rem;
	height: 1.05rem;
}

.cbx-modal__close:hover,
.cbx-modal__close:focus-visible {
	background: color-mix( in srgb, var( --ink ) 6%, transparent );
	color: var( --ink );
	outline: none;
}

.cbx-modal__body {
	overflow-y: auto;
	padding: 1.1rem 1.15rem 1.35rem;
}

.cbx-modal__body > p {
	margin: 0 0 0.6rem;
	line-height: 1.5;
}

.cbx-modal__body hr {
	margin: 1rem 0;
	border: 0;
	border-top: 1px solid var( --line );
}

.cbx-muted {
	color: var( --muted );
	font-size: 0.88rem;
}

/* —— Правила теста —— */
.cbx-facts {
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
	margin: 0 0 1.05rem;
	padding: 0;
	list-style: none;
}

.cbx-fact {
	display: flex;
	align-items: flex-start;
	gap: 0.7rem;
	padding: 0.7rem 0.8rem;
	border: 1px solid var( --line );
	border-radius: 12px;
	background: color-mix( in srgb, var( --ink ) 3%, var( --surface ) );
}

.cbx-fact__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 2.05rem;
	height: 2.05rem;
	border-radius: 9px;
	background: color-mix( in srgb, var( --settings-accent ) 14%, transparent );
	color: var( --settings-accent-strong );
}

.cbx-fact__text {
	margin: 0;
	font-size: 0.92rem;
	font-weight: 400;
	line-height: 1.4;
}

/* —— Мои попытки —— */
.cbx-history-block {
	margin-top: 1.25rem;
	padding-top: 1.1rem;
	border-top: 1px solid var( --line );
}

.cbx-history-head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0.65rem;
	color: var( --ink );
}

.cbx-history-head__icon {
	display: inline-flex;
	color: var( --settings-accent-strong );
}

.cbx-step {
	margin: 0;
	color: var( --ink );
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.cbx-history {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}

.cbx-history__row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.65rem 0.8rem;
	border: 1px solid var( --line );
	border-radius: 12px;
	background: var( --surface );
	cursor: pointer;
	font: inherit;
	text-align: left;
}

.cbx-history__row:hover,
.cbx-history__row:focus-visible {
	border-color: color-mix( in srgb, var( --settings-accent ) 40%, var( --line ) );
	background: color-mix( in srgb, var( --settings-accent ) 8%, var( --surface ) );
	outline: none;
}

.cbx-history__mark {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 2.05rem;
	height: 2.05rem;
	border-radius: 999px;
	background: color-mix( in srgb, var( --ink ) 6%, transparent );
}

.cbx-history__info {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.12rem;
	min-width: 0;
}

.cbx-history__date {
	color: var( --muted );
	font-size: 0.82rem;
}

.cbx-history__status {
	font-size: 0.9rem;
	font-weight: 700;
}

.cbx-history__status--pass {
	color: #1a7f37;
}

.cbx-history__mark.cbx-history__status--pass {
	color: #1a7f37;
	background: color-mix( in srgb, #1a7f37 12%, transparent );
}

.cbx-history__status--fail {
	color: #b00020;
}

.cbx-history__mark.cbx-history__status--fail {
	color: #b00020;
	background: color-mix( in srgb, #b00020 10%, transparent );
}

.cbx-history__status--pending {
	color: var( --muted );
}

.cbx-history__mark.cbx-history__status--pending {
	color: var( --muted );
	background: color-mix( in srgb, var( --ink ) 6%, transparent );
}

.cbx-alert {
	margin: 0 0 0.85rem;
	padding: 0.55rem 0.75rem;
	border: 1px solid rgba( 176, 0, 32, 0.35 );
	border-radius: 8px;
	background: rgba( 176, 0, 32, 0.08 );
	color: #b00020;
	font-size: 0.88rem;
}

.cbx-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: 0.9rem;
}

.cbx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.35rem;
	padding: 0.45rem 1.05rem;
	border: 1px solid var( --line );
	border-radius: 10px;
	background: var( --surface );
	color: var( --ink );
	cursor: pointer;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 650;
}

.cbx-btn:hover,
.cbx-btn:focus-visible {
	border-color: color-mix( in srgb, var( --ink ) 24%, var( --line ) );
	outline: none;
}

.cbx-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.cbx-btn--primary {
	border-color: color-mix( in srgb, var( --settings-accent ) 40%, transparent );
	background: var( --settings-accent );
	color: #fff;
}

.cbx-btn--primary:hover,
.cbx-btn--primary:focus-visible {
	border-color: var( --settings-accent-strong );
	background: var( --settings-accent-strong );
	color: #fff;
}

.cbx-btn--danger {
	border-color: rgba( 176, 0, 32, 0.35 );
	color: #b00020;
}

/* —— Страница попытки —— */
.cabinet-exam-view {
	max-width: 40rem;
}

.cbx-page,
.cbx-modal {
	--settings-accent: var( --primary-bg );
	--settings-accent-strong: color-mix( in srgb, var( --primary-bg ) 78%, #1b1430 );
}

@media ( prefers-color-scheme: dark ) {
	:root:not( [data-theme="light"] ) .cbx-page,
	:root:not( [data-theme="light"] ) .cbx-modal {
		--settings-accent: #ff7a33;
		--settings-accent-strong: #ff944d;
	}
}

:root[data-theme="dark"] .cbx-page,
:root[data-theme="dark"] .cbx-modal {
	--settings-accent: #ff7a33;
	--settings-accent-strong: #ff944d;
}

.cbx-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.4rem 1rem;
	margin: 0 0 1.35rem;
	padding: 0 0 0.85rem;
	border-bottom: 1px solid color-mix( in srgb, var( --ink ) 8%, transparent );
}

.cbx-toolbar__count {
	margin: 0;
	color: var( --muted );
	font-size: 0.9rem;
	font-weight: 500;
}

.cbx-timer {
	margin: 0;
	color: var( --ink );
	font-size: 0.95rem;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
}

.cbx-timer--low {
	color: var( --accent-rose, #b00020 );
}

.cbx-questions {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
	margin-bottom: 1.35rem;
}

.cbx-question {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
}

.cbx-question p {
	margin: 0;
}

.cbx-question__head {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin: 0;
}

.cbx-question__index {
	margin: 0;
	color: var( --muted );
	font-size: 0.82rem;
	font-weight: 500;
}

.cbx-question__text {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

.cbx-question__options {
	display: flex;
	flex-direction: column;
	margin: 0;
	border: 1px solid var( --line );
	border-radius: 8px;
	background: var( --surface );
}

.cbx-option {
	position: relative;
	display: block;
	margin: 0;
	padding: 0.8rem 2.7rem 0.8rem 0.95rem;
	overflow: visible;
	border: 0;
	border-top: 1px solid color-mix( in srgb, var( --ink ) 8%, transparent );
	border-radius: 0;
	background: transparent;
	cursor: pointer;
}

.cbx-option:first-child {
	border-top: 0;
	border-radius: 8px 8px 0 0;
}

.cbx-option:last-child {
	border-radius: 0 0 8px 8px;
}

.cbx-option:only-child {
	border-radius: 8px;
}

.cbx-option input {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.cbx-option__dot {
	position: absolute;
	top: 50%;
	right: 0.55rem;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 1.65rem;
	height: 1.65rem;
	margin-top: -0.825rem;
	overflow: hidden;
	border: 1.5px solid color-mix( in srgb, var( --ink ) 16%, var( --line ) );
	border-radius: 999px;
	background: var( --surface );
	opacity: 0;
	pointer-events: none;
}

.cbx-option__dot::after {
	content: "";
	display: block;
	width: 0.34rem;
	height: 0.62rem;
	margin: 0 0 0.12rem 0.02rem;
	border: solid #ff7a33;
	border-width: 0 2.5px 2.5px 0;
	transform: rotate( 45deg );
}

.cbx-option__dot .cbx-icon {
	display: none;
}

.cbx-option__text {
	display: block;
	color: var( --ink );
	font-size: 0.95rem;
	font-weight: 400;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

.cbx-option:hover {
	background: color-mix( in srgb, var( --ink ) 3.5%, var( --surface ) );
}

.cbx-option:focus-within {
	background: transparent;
	outline: none;
}

.cbx-option.is-selected,
.cbx-option:has( input:checked ) {
	background: transparent;
}

.cbx-option input:checked + .cbx-option__dot,
.cbx-option.is-selected .cbx-option__dot,
.cbx-option:has( input:checked ) .cbx-option__dot {
	opacity: 1;
}

.cbx-option--review {
	cursor: default;
}

.cbx-option--review.is-correct {
	background: transparent;
}

.cbx-option--review.is-correct .cbx-option__dot {
	opacity: 1;
}

.cbx-option--review.is-correct .cbx-option__dot::after {
	border-color: #3dcf6a;
}

.cbx-option--review.is-chosen:not( .is-correct ) {
	background: transparent;
}

.cbx-option--review.is-chosen:not( .is-correct ) .cbx-option__dot {
	opacity: 1;
}

.cbx-option--review.is-chosen:not( .is-correct ) .cbx-option__dot::after {
	border-color: var( --accent-rose, #ff6b85 );
}

.cbx-question--review.is-right,
.cbx-question--review.is-wrong,
.cbx-question--review.is-unanswered {
	border: 0;
	background: transparent;
}

.cbx-question__correct {
	margin: 0.3rem 0 0;
	color: #1a7f37;
	font-weight: 650;
}

/* —— Результат —— */
.cbx-result {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15rem;
	margin-bottom: 1.5rem;
	padding: 0 0 1rem;
	border-bottom: 1px solid color-mix( in srgb, var( --ink ) 8%, transparent );
	border-radius: 0;
	background: transparent;
	text-align: left;
}

.cbx-result__icon {
	display: none;
}

.cbx-result--pass,
.cbx-result--fail {
	background: transparent;
}

.cbx-result__title {
	margin: 0 0 0.15rem;
	font-family: inherit;
	font-size: 1.15rem;
	font-weight: 650;
}

.cbx-result--pass .cbx-result__title {
	color: #1a7f37;
}

.cbx-result--fail .cbx-result__title {
	color: #b00020;
}

.cbx-result__score {
	margin: 0;
	color: var( --muted );
}
