/* Izbor udžbenika v2 — frontend */

.iuzs2 {
	--iuzs2-brand: #924280;
	--iuzs2-brand-dark: #78356a;
	--iuzs2-brand-soft: #f7eef5;
	--iuzs2-ink: #1f2430;
	--iuzs2-muted: #6b7280;
	--iuzs2-line: #e5e7ef;
	--iuzs2-radius: 14px;

	position: relative;
	box-sizing: border-box;
	/* Centrirano i ograničene širine — bez velikog praznog prostora desno. */
	max-width: 820px;
	margin: 0 auto 2rem;
	padding: clamp( 16px, 4vw, 28px );
	border: 1px solid var( --iuzs2-line );
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 1px 2px rgba( 20, 20, 43, .04 ), 0 12px 32px -18px rgba( 20, 20, 43, .25 );
	color: var( --iuzs2-ink );
	font-size: 15px;
	line-height: 1.45;
}

.iuzs2 *,
.iuzs2 *::before,
.iuzs2 *::after {
	box-sizing: border-box;
}

/* ---------- Zaglavlje ---------- */

.iuzs2-head {
	margin-bottom: 22px;
	text-align: center;
}

.iuzs2-title {
	margin: 0 0 6px;
	font-size: clamp( 18px, 3vw, 22px );
	line-height: 1.3;
	font-weight: 700;
	color: var( --iuzs2-ink );
	text-align: center;
}

.iuzs2-desc {
	margin: 0;
	color: var( --iuzs2-muted );
	font-size: 14.5px;
}

/* ---------- Koraci ---------- */

/* Koraci su centrirani blok — tekst unutar njih ostaje levo poravnat
   jer marker sa brojem stoji sa strane. */
.iuzs2-steps {
	max-width: 540px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

/* Svaki korak je zaseban red: marker levo, sadržaj desno. */
.iuzs2-step {
	position: relative;
	display: grid;
	grid-template-columns: 38px minmax( 0, 1fr );
	gap: 0 14px;
	margin: 0;
	padding: 0 0 22px;
	list-style: none;
}

.iuzs2-step::before,
.iuzs2-step::marker {
	content: none;
}

.iuzs2-step:last-child {
	padding-bottom: 4px;
}

/* Marker sa brojem + vertikalna linija ka sledećem koraku. */
.iuzs2-marker {
	position: relative;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	grid-row: 1 / -1;
}

.iuzs2-step:not( :last-child ) .iuzs2-marker::after {
	content: '';
	position: absolute;
	top: 42px;
	bottom: -22px;
	left: 50%;
	width: 2px;
	background: var( --iuzs2-line );
	transform: translateX( -50% );
	transition: background-color .25s;
}

/* Poslednji korak ionako nema liniju (nema `content`), pa `:not()` nije potreban. */
.iuzs2-step.is-done .iuzs2-marker::after {
	background-color: var( --iuzs2-brand );
}

.iuzs2-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 2px solid var( --iuzs2-line );
	border-radius: 50%;
	background: #fff;
	color: #9aa1ae;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	transition: all .2s;
}

.iuzs2-step.is-active .iuzs2-num {
	border-color: var( --iuzs2-brand );
	background: var( --iuzs2-brand-soft );
	color: var( --iuzs2-brand );
	box-shadow: 0 0 0 4px rgba( 146, 66, 128, .12 );
}

.iuzs2-step.is-done .iuzs2-num {
	border-color: var( --iuzs2-brand );
	background: var( --iuzs2-brand );
	color: #fff;
	font-size: 0;
}

.iuzs2-step.is-done .iuzs2-num::after {
	content: '✓';
	font-size: 18px;
	font-weight: 700;
}

.iuzs2-step-body {
	position: relative; /* sidro za panel sa pretragom */
	min-width: 0;
	padding-top: 2px;
}

.iuzs2-label {
	display: block;
	margin: 0 0 2px;
	color: var( --iuzs2-ink );
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.iuzs2-hint {
	margin: 0 0 10px;
	color: var( --iuzs2-muted );
	font-size: 13px;
	line-height: 1.35;
}

/* ---------- Combobox ---------- */

.iuzs2-combo {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 10px 14px;
	border: 1.5px solid var( --iuzs2-line );
	border-radius: var( --iuzs2-radius );
	background: #fff;
	color: var( --iuzs2-muted );
	font: inherit;
	font-size: 15px;
	text-align: left;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.iuzs2-combo:hover:not( :disabled ) {
	border-color: #c9b0c3;
}

.iuzs2-combo:focus-visible,
.iuzs2-combo.is-open {
	outline: none;
	border-color: var( --iuzs2-brand );
	box-shadow: 0 0 0 3px rgba( 146, 66, 128, .14 );
}

.iuzs2-combo.is-filled {
	color: var( --iuzs2-ink );
	font-weight: 600;
}

.iuzs2-combo:disabled {
	background: #f7f8fa;
	color: #9aa1ae;
	cursor: not-allowed;
}

.iuzs2-combo-val {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.iuzs2-chev {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	color: var( --iuzs2-muted );
	transition: transform .15s;
}

.iuzs2-combo.is-open .iuzs2-chev {
	transform: rotate( 180deg );
}

/* ---------- Panel sa pretragom ---------- */

.iuzs2-panel {
	position: absolute;
	z-index: 30;
	top: calc( 100% + 6px );
	left: 0;
	right: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var( --iuzs2-line );
	border-radius: var( --iuzs2-radius );
	background: #fff;
	box-shadow: 0 18px 44px -12px rgba( 20, 20, 43, .28 );
}

.iuzs2-panel-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px;
	border-bottom: 1px solid var( --iuzs2-line );
	background: #fbfbfd;
}

.iuzs2-search {
	flex: 1 1 auto;
	width: 100%;
	min-height: 42px;
	margin: 0;
	padding: 8px 12px;
	border: 1.5px solid var( --iuzs2-line );
	border-radius: 10px;
	background: #fff;
	font: inherit;
	font-size: 16px; /* sprečava zoom na iOS-u */
	color: var( --iuzs2-ink );
}

.iuzs2-search:focus {
	outline: none;
	border-color: var( --iuzs2-brand );
	box-shadow: 0 0 0 3px rgba( 146, 66, 128, .14 );
}

.iuzs2-panel-close {
	flex: 0 0 auto;
	display: none;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: #eef0f4;
	color: var( --iuzs2-ink );
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.iuzs2-list {
	overflow-y: auto;
	max-height: 46vh;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.iuzs2-opt {
	display: block;
	width: 100%;
	margin: 0;
	padding: 11px 14px;
	border: 0;
	border-bottom: 1px solid #f1f2f6;
	background: none;
	color: var( --iuzs2-ink );
	font: inherit;
	font-size: 15px;
	text-align: left;
	cursor: pointer;
}

.iuzs2-opt:last-child {
	border-bottom: 0;
}

.iuzs2-opt:hover,
.iuzs2-opt.is-active {
	background: var( --iuzs2-brand-soft );
}

.iuzs2-opt-main {
	display: block;
	font-weight: 500;
}

.iuzs2-opt-sub {
	display: block;
	margin-top: 2px;
	color: var( --iuzs2-muted );
	font-size: 12.5px;
}

.iuzs2-list-empty,
.iuzs2-list-more {
	margin: 0;
	padding: 16px 14px;
	color: var( --iuzs2-muted );
	font-size: 13.5px;
	text-align: center;
}

/* ---------- Razredi ---------- */

.iuzs2-grades {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-height: 50px;
	align-items: center;
}

.iuzs2-grades-hint {
	margin: 0;
	color: #9aa1ae;
	font-size: 14px;
}

.iuzs2-pill {
	min-width: 48px;
	min-height: 46px;
	margin: 0;
	padding: 8px 14px;
	border: 1.5px solid var( --iuzs2-line );
	border-radius: 12px;
	background: #fff;
	color: var( --iuzs2-ink );
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all .15s;
}

.iuzs2-pill:hover {
	border-color: #c9b0c3;
}

.iuzs2-pill.is-on {
	border-color: var( --iuzs2-brand );
	background: var( --iuzs2-brand );
	color: #fff;
	box-shadow: 0 4px 12px -4px rgba( 146, 66, 128, .6 );
}

/* Dok se lista učitava. */
.iuzs2-grades.is-busy {
	opacity: .6;
}

.iuzs2-pill:disabled {
	cursor: progress;
}

/* ---------- Dugmad ---------- */

.iuzs2-actions {
	margin-top: 18px;
}

.iuzs2-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 50px;
	padding: 12px 24px;
	border: 0;
	border-radius: var( --iuzs2-radius );
	font: inherit;
	font-size: 15.5px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s, opacity .15s, transform .05s;
}

.iuzs2-btn:active:not( :disabled ) {
	transform: translateY( 1px );
}

.iuzs2-btn-primary {
	background: var( --iuzs2-brand );
	color: #fff;
}

.iuzs2-btn-primary:hover:not( :disabled ) {
	background: var( --iuzs2-brand-dark );
	color: #fff;
}

.iuzs2-btn:disabled {
	background: #e6e8ee;
	color: #9aa1ae;
	cursor: not-allowed;
}

.iuzs2-show {
	width: 100%;
}

.iuzs2-note {
	max-width: 620px;
	margin: 18px auto 0;
	padding-top: 14px;
	border-top: 1px dashed var( --iuzs2-line );
	color: var( --iuzs2-muted );
	font-size: 13px;
	text-align: center;
}

/* ---------- Rezultati ---------- */

.iuzs2-results:empty {
	display: none;
}

.iuzs2-results {
	margin-top: 22px;
}

.iuzs2-loading {
	padding: 30px 0;
	text-align: center;
	color: var( --iuzs2-muted );
}

.iuzs2-spinner {
	display: inline-block;
	width: 34px;
	height: 34px;
	border: 3px solid var( --iuzs2-brand-soft );
	border-top-color: var( --iuzs2-brand );
	border-radius: 50%;
	animation: iuzs2-spin .8s linear infinite;
}

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

@media ( prefers-reduced-motion: reduce ) {
	.iuzs2-spinner { animation-duration: 2s; }
}

.iuzs2-error,
.iuzs2-empty {
	padding: 20px;
	border-radius: var( --iuzs2-radius );
	background: #fdf3f3;
	color: #a12c2c;
	text-align: center;
}

.iuzs2-empty {
	background: #f7f8fa;
	color: var( --iuzs2-muted );
}

.iuzs2-res-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 0 0 12px;
	border-bottom: 2px solid var( --iuzs2-line );
}

.iuzs2-res-title strong {
	display: block;
	font-size: 16px;
	line-height: 1.3;
}

.iuzs2-res-title span {
	display: block;
	margin-top: 2px;
	color: var( --iuzs2-muted );
	font-size: 13px;
}

.iuzs2-checkall {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-radius: 10px;
	background: #f5f6f9;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
}

.iuzs2-books {
	margin: 0;
	padding: 0;
	list-style: none;
}

.iuzs2-book {
	display: grid;
	grid-template-columns: auto 56px minmax( 0, 1fr ) auto;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 12px 4px;
	border-bottom: 1px solid #f1f2f6;
}

.iuzs2-book.is-off {
	opacity: .58;
}

.iuzs2-book-box {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 6px;
	cursor: pointer;
}

.iuzs2-book-check {
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var( --iuzs2-brand );
	cursor: pointer;
}

.iuzs2-book-img {
	width: 56px;
	height: 74px;
	border-radius: 6px;
	background: #f5f6f9;
	object-fit: contain;
}

.iuzs2-book-main {
	min-width: 0;
}

.iuzs2-book-title {
	display: block;
	color: var( --iuzs2-ink );
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
}

.iuzs2-book-title:hover {
	color: var( --iuzs2-brand );
	text-decoration: underline;
}

.iuzs2-book-meta,
.iuzs2-book-sku {
	display: block;
	margin-top: 3px;
	color: var( --iuzs2-muted );
	font-size: 12.5px;
}

.iuzs2-book-sku {
	font-size: 11.5px;
	opacity: .8;
}

.iuzs2-book-side {
	text-align: right;
	white-space: nowrap;
}

.iuzs2-book-price {
	display: block;
	font-size: 15px;
	font-weight: 700;
}

.iuzs2-book-price del {
	display: block;
	color: var( --iuzs2-muted );
	font-size: 12.5px;
	font-weight: 400;
}

.iuzs2-book-price ins {
	text-decoration: none;
}

.iuzs2-badge {
	display: inline-block;
	margin-top: 4px;
	padding: 2px 8px;
	border-radius: 20px;
	background: #fdeeee;
	color: #a12c2c;
	font-size: 11px;
	font-weight: 600;
	white-space: normal;
}

.iuzs2-missing {
	margin: 12px 0 0;
	padding: 10px 14px;
	border-radius: 10px;
	background: #fff8e8;
	color: #7a5a12;
	font-size: 13px;
}

/* ---------- Traka za korpu ---------- */

.iuzs2-bar {
	position: sticky;
	bottom: 0;
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 16px -4px -4px;
	padding: 12px 14px;
	border: 1px solid var( --iuzs2-line );
	border-radius: var( --iuzs2-radius );
	background: rgba( 255, 255, 255, .96 );
	backdrop-filter: blur( 6px );
	box-shadow: 0 -6px 22px -12px rgba( 20, 20, 43, .35 );
}

.iuzs2-bar-info {
	font-size: 14.5px;
	font-weight: 600;
}

.iuzs2-bar.is-empty .iuzs2-bar-info {
	color: var( --iuzs2-muted );
	font-weight: 400;
}

.iuzs2-add {
	flex: 0 0 auto;
}

/* ---------- Toast ---------- */

.iuzs2-toast {
	position: fixed;
	z-index: 100000;
	left: 50%;
	bottom: 24px;
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: min( 92vw, 460px );
	padding: 14px 18px;
	border-radius: 14px;
	background: #1f2430;
	color: #fff;
	font-size: 14.5px;
	box-shadow: 0 18px 40px -14px rgba( 0, 0, 0, .6 );
	transform: translate( -50%, 24px );
	opacity: 0;
	transition: opacity .3s, transform .3s;
}

.iuzs2-toast.is-in {
	transform: translate( -50%, 0 );
	opacity: 1;
}

.iuzs2-toast.is-error {
	background: #8d2222;
}

.iuzs2-toast-link {
	flex: 0 0 auto;
	padding: 7px 14px;
	border-radius: 9px;
	background: #fff;
	color: #1f2430;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.iuzs2-toast-link:hover {
	background: #f0f0f4;
	color: #000;
}

/* ---------- Desktop ---------- */

@media ( min-width: 860px ) {
	.iuzs2-show {
		width: auto;
		min-width: 260px;
	}
}

/* ---------- Mobilni ---------- */

@media ( max-width: 640px ) {
	.iuzs2-panel {
		position: fixed;
		z-index: 100000;
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		max-height: 86vh;
		border: 0;
		border-radius: 18px 18px 0 0;
		animation: iuzs2-sheet .22s ease-out;
	}

	.iuzs2-list {
		max-height: calc( 86vh - 70px );
	}

	.iuzs2-panel-close {
		display: block;
	}

	body.iuzs2-panel-open {
		overflow: hidden;
	}

	body.iuzs2-panel-open::after {
		content: '';
		position: fixed;
		z-index: 99999;
		inset: 0;
		background: rgba( 15, 18, 25, .45 );
	}

	@keyframes iuzs2-sheet {
		from { transform: translateY( 100% ); }
		to { transform: translateY( 0 ); }
	}

	.iuzs2-step {
		grid-template-columns: 34px minmax( 0, 1fr );
		gap: 0 12px;
		padding-bottom: 20px;
	}

	.iuzs2-num {
		width: 34px;
		height: 34px;
		font-size: 15px;
	}

	.iuzs2-step:not( :last-child ) .iuzs2-marker::after {
		top: 38px;
		bottom: -20px;
	}

	.iuzs2-label {
		font-size: 15.5px;
	}

	.iuzs2-book {
		grid-template-columns: auto 48px minmax( 0, 1fr );
		row-gap: 6px;
		padding: 12px 0;
	}

	.iuzs2-book-img {
		width: 48px;
		height: 64px;
	}

	.iuzs2-book-side {
		grid-column: 3;
		text-align: left;
	}

	.iuzs2-book-price {
		font-size: 15.5px;
	}

	.iuzs2-bar {
		margin-left: calc( -1 * clamp( 16px, 4vw, 28px ) );
		margin-right: calc( -1 * clamp( 16px, 4vw, 28px ) );
		margin-bottom: calc( -1 * clamp( 16px, 4vw, 28px ) );
		border-radius: 0 0 17px 17px;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
	}

	.iuzs2-bar-info {
		flex: 1 1 100%;
		font-size: 13.5px;
	}

	.iuzs2-add {
		width: 100%;
	}

	.iuzs2-toast {
		left: 12px;
		right: 12px;
		bottom: 12px;
		max-width: none;
		transform: translateY( 24px );
	}

	.iuzs2-toast.is-in {
		transform: translateY( 0 );
	}
}
