/*
 * NASEPKAVAC VYHLADAVANIA (assets/js/main.js - nasepkavac, ajax/naseptavac.php)
 *
 * Samostatny subor (nie v main.css), aby presiel aj do redizajnu, kde main.css
 * nahradilo mc.css. Nacitava ho template/main.php.
 * Farby su z premennych redizajnu (mc.css), s fallbackom pre povodny vzhlad.
 */

.search-form.nsp-form {
	position: relative;
}

/* tociace koliesko namiesto lupy pocas nacitavania (velkost nastavi JS podla lupy) */
.nsp-spinner {
	display: none;
	flex: none;
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(225, 183, 98, 0.3);
	border-top-color: var(--gold-500, #e1b762);
	border-radius: 50%;
	animation: nsp-spin 0.65s linear infinite;
}

.nsp-form.nsp-nacitava .nsp-spinner {
	display: inline-block;
}

.nsp-form.nsp-nacitava .search-icon > :not(.nsp-spinner),
.nsp-form.nsp-nacitava .mc-search__field > svg {
	display: none;
}

@keyframes nsp-spin {
	to { transform: rotate(360deg); }
}

.nsp {
	--nsp-gold: var(--gold-500, #e1b762);
	--nsp-gold-dark: var(--gold-700, #8c6420);
	--nsp-gold-bg: var(--gold-50, #fcf7ee);
	--nsp-ink: var(--ink, #16161a);
	--nsp-muted: var(--muted, #6b6e75);
	--nsp-subtle: var(--subtle, #8a8d94);
	--nsp-line: var(--line, #ececee);
	--nsp-surface: var(--surface, #ffffff);
	--nsp-surface-muted: var(--surface-muted, #f6f6f6);

	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 1000;
	width: 100%;
	max-height: min(640px, calc(100vh - 140px));
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--nsp-surface);
	color: var(--nsp-ink);
	border-radius: 14px;
	box-shadow: 0 0 0 1px rgba(22, 22, 26, 0.06), 0 24px 64px rgba(22, 22, 26, 0.16);
	font-size: 14px;
	line-height: 1.35;
	text-align: left;
	animation: nsp-in 0.14s ease-out;
}

.nsp[hidden] {
	display: none;
}

@keyframes nsp-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: none; }
}

/* tenky pruh pocas nacitavania */
.nsp__loading {
	position: sticky;
	top: 0;
	height: 2px;
	overflow: hidden;
	opacity: 0;
	transition: opacity 0.15s;
}

.nsp.is-loading .nsp__loading {
	opacity: 1;
}

.nsp__loading::after {
	content: "";
	position: absolute;
	top: 0;
	left: -40%;
	width: 40%;
	height: 100%;
	background: var(--nsp-gold);
	animation: nsp-loading 0.9s ease-in-out infinite;
}

@keyframes nsp-loading {
	to { left: 100%; }
}

.nsp__oprava {
	margin: 10px 12px 0;
	padding: 8px 12px;
	border-radius: 8px;
	background: var(--nsp-gold-bg);
	font-size: 13px;
	color: var(--nsp-muted);
}

.nsp__oprava strong {
	color: var(--nsp-ink);
	font-weight: 600;
}

.nsp__nadpis {
	padding: 14px 16px 6px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--nsp-subtle);
}

/* kategorie ako stitky */
.nsp__kategorie {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 2px 16px 6px;
}

.nsp__kategoria {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	max-width: 100%;
	padding: 6px 12px;
	border: 1px solid var(--nsp-line);
	border-radius: 999px;
	color: var(--nsp-ink);
	font-size: 13px;
	text-decoration: none;
	transition: border-color 0.12s, background 0.12s;
}

.nsp__kategoria span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nsp__kategoria small {
	flex-shrink: 0;
	color: var(--nsp-subtle);
	font-size: 11px;
}

.nsp__kategoria:hover,
.nsp__kategoria.is-active {
	border-color: var(--nsp-gold);
	background: var(--nsp-gold-bg);
	color: var(--nsp-ink);
	text-decoration: none;
}

/* produkty */
.nsp__produkty {
	padding: 0 6px 6px;
}

.nsp__produkt {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	border-radius: 10px;
	color: var(--nsp-ink);
	text-decoration: none;
	transition: background 0.12s;
}

.nsp__produkt:hover,
.nsp__produkt.is-active {
	background: var(--nsp-gold-bg);
	color: var(--nsp-ink);
	text-decoration: none;
}

.nsp__obrazok {
	width: 56px;
	height: 56px;
	border-radius: 8px;
	background: var(--nsp-surface-muted);
	overflow: hidden;
}

.nsp__obrazok img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.nsp__text {
	min-width: 0;
}

.nsp__znacka {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--nsp-gold-dark);
}

.nsp__nazov {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 500;
}

.nsp__popis {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 12.5px;
	color: var(--nsp-muted);
}

.nsp mark {
	padding: 0;
	background: none;
	color: inherit;
	font-weight: 700;
	box-shadow: inset 0 -0.35em 0 rgba(225, 183, 98, 0.35);
}

.nsp__cena {
	text-align: right;
	white-space: nowrap;
	font-weight: 600;
}

.nsp__cena s {
	display: block;
	font-size: 12px;
	font-weight: 400;
	color: var(--nsp-subtle);
}

.nsp__cena--nedostupne {
	max-width: 120px;
	white-space: normal;
	font-size: 12px;
	font-weight: 500;
	color: var(--nsp-muted);
}

.nsp__ziadne {
	padding: 20px 16px;
	color: var(--nsp-muted);
}

.nsp__vsetky {
	position: sticky;
	bottom: 0;
	display: block;
	padding: 13px 16px;
	border-top: 1px solid var(--nsp-line);
	background: var(--nsp-surface);
	color: var(--nsp-ink);
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background 0.12s;
}

.nsp__vsetky:hover,
.nsp__vsetky.is-active {
	background: var(--nsp-gold-bg);
	color: var(--nsp-ink);
	text-decoration: none;
}

.nsp__vsetky span {
	color: var(--nsp-subtle);
	font-weight: 400;
}

@media (max-width: 600px) {
	.nsp {
		border-radius: 12px;
		max-height: calc(100vh - 120px);
	}

	.nsp__produkt {
		grid-template-columns: 44px minmax(0, 1fr) auto;
		gap: 10px;
		padding: 8px;
	}

	.nsp__obrazok {
		width: 44px;
		height: 44px;
	}

	.nsp__kategoria small {
		display: none;
	}
}
