/* ==========================================================================
   Katalog: raspored sa filterima, traka, kartice (mreža i lista), promo i „Učitaj još“.
   Referentna slika 01, u modernijem izvođenju. Mobile-first.
   ========================================================================== */

.tb-shop {
	padding-bottom: var(--wp--preset--spacing--60);
}

.tb-shop__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
	align-items: start;
}

/* Razmak između kolona daje grid, ne WordPress razmak između blokova. */
.tb-shop .tb-shop__layout > * {
	margin-block: 0;
}

@media (min-width: 1024px) {
	.tb-shop__layout:has(> .tb-filters) {
		grid-template-columns: 280px minmax(0, 1fr);
		gap: 2.25rem;
	}

	/* Bočna kolona prati skrol (kartica kao na slici 01); pomera se ispod zaglavlja kada je vidljivo. */
	.tb-shop .tb-filters {
		position: sticky;
		top: calc(var(--tb-header-h) + 1.25rem);
		max-height: calc(100vh - var(--tb-header-h) - 2.5rem);
		max-height: calc(100dvh - var(--tb-header-h) - 2.5rem);
		padding: 1.1rem 1.25rem 0.5rem;
		overflow-y: auto;
		overscroll-behavior: contain;
		border: 1px solid var(--tb-line);
		border-radius: 14px;
		background: #fff;
		scrollbar-width: thin;
		transition: top 260ms ease, max-height 260ms ease;
	}

	body:has(.tb-site-header.is-hidden) .tb-shop .tb-filters {
		top: 1.25rem;
		max-height: calc(100vh - 2.5rem);
		max-height: calc(100dvh - 2.5rem);
	}

	.tb-shop .tb-filters .tb-facet:last-of-type {
		border-bottom: 0;
	}
}

.tb-catalog {
	min-width: 0;
}

/* --------------------------------------------------------------------------
   Traka iznad proizvoda
   -------------------------------------------------------------------------- */
.tb-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1.25rem;
	margin-bottom: 1rem;
}

.tb-toolbar__count {
	margin: 0;
	color: var(--tb-muted);
	font-size: 0.875rem;
}

.tb-toolbar__count strong {
	color: var(--tb-ink);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.tb-toolbar__actions {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.tb-sort {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
}

.tb-sort__label {
	margin: 0;
	color: var(--tb-muted);
	font-size: 0.8125rem;
	white-space: nowrap;
}

.tb-sort__control {
	position: relative;
	display: inline-flex;
}

.tb-sort__control::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 0.85rem;
	width: 0.75rem;
	height: 0.75rem;
	background: currentColor;
	-webkit-mask: url("../../assets/icons/chevron-down.svg") center / contain no-repeat;
	mask: url("../../assets/icons/chevron-down.svg") center / contain no-repeat;
	pointer-events: none;
	transform: translateY(-50%);
}

.tb-sort select {
	min-height: 42px;
	padding: 0 2.25rem 0 1rem;
	border: 1px solid var(--tb-line);
	border-radius: 999px;
	background: #fff;
	color: var(--tb-ink);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

.tb-sort select:hover {
	border-color: var(--tb-forest);
}

/* Ekran na dodir: 16 px, da iOS ne zumira stranicu pri otvaranju izbora (WooCommerce „.woocommerce-page select“ daje 13 px). */
@media (pointer: coarse) {
	.tb-sort .tb-sort__control select {
		min-height: 44px;
		font-size: 1rem;
	}
}

.tb-view {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--tb-line);
	border-radius: 999px;
	background: #fff;
}

.tb-view__btn {
	display: grid;
	place-items: center;
	width: 36px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--tb-muted);
	cursor: pointer;
	transition: background-color var(--tb-ease), color var(--tb-ease);
}

.tb-view__btn[aria-pressed="true"] {
	background: var(--tb-forest);
	color: #fff;
}

.tb-view__btn .tb-ico::before {
	width: 1.05rem;
	height: 1.05rem;
}

.tb-catalog > .tb-chips:not([hidden]) {
	margin: -0.25rem 0 1rem;
}

.tb-results {
	transition: opacity 180ms ease;
}

.tb-is-loading .tb-results {
	opacity: 0.45;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Promo kartica u mreži (promo iz mega menija)
   -------------------------------------------------------------------------- */
.tb-promo-tile {
	position: relative;
	isolation: isolate;
	display: flex;
	align-items: flex-end;
	height: 100%;
	min-height: 320px;
	overflow: hidden;
	border-radius: 14px;
	background: var(--tb-forest);
	color: #fff;
	text-decoration: none;
}

.tb-promo-tile:hover {
	color: #fff;
	text-decoration: none;
}

.tb-promo-tile__img {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	transition: transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tb-promo-tile:hover .tb-promo-tile__img {
	transform: scale(1.05);
}

.tb-promo-tile::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(180deg, rgba(10, 43, 36, 0) 10%, rgba(10, 43, 36, 0.55) 45%, rgba(10, 43, 36, 0.94) 100%);
}

.tb-promo-tile__body {
	display: grid;
	gap: 0.45rem;
	padding: 1.25rem;
}

.tb-promo-tile__eyebrow {
	color: var(--wp--preset--color--sand);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.tb-promo-tile__title {
	font-size: 1.25rem;
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.2;
}

.tb-promo-tile__text {
	font-size: 0.875rem;
	line-height: 1.45;
	opacity: 0.86;
}

.tb-promo-tile__cta {
	justify-self: start;
	margin-top: 0.35rem;
	padding: 0.55rem 0.95rem;
	border-radius: 999px;
	background: #fff;
	color: var(--tb-forest);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   „Učitaj još“ sa trakom napretka
   -------------------------------------------------------------------------- */
.tb-more {
	display: grid;
	justify-items: center;
	gap: 0.75rem;
	margin-top: clamp(1.75rem, 4vw, 2.75rem);
	text-align: center;
}

.tb-more__text {
	margin: 0;
	color: var(--tb-muted);
	font-size: 0.875rem;
}

.tb-more__bar {
	display: block;
	width: min(240px, 70%);
	height: 4px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--tb-line);
}

.tb-more__bar > span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--tb-forest);
	transition: width 400ms ease;
}

.tb-more__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 240px;
	min-height: 50px;
	margin-top: 0.25rem;
	padding: 0 1.75rem;
	border: 1.5px solid var(--tb-forest);
	border-radius: 999px;
	color: var(--tb-forest);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color var(--tb-ease), color var(--tb-ease);
}

.tb-more__btn:hover {
	background: var(--tb-forest);
	color: #fff;
	text-decoration: none;
}

.tb-more__btn.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/*
 * Chrome drži ekran na dugmetu „Učitaj još“ (sidro skrola je dugme u fokusu), pa bi kosturi i kartice otišli iznad
 * ekrana, a opis kategorije i footer bi se pomerali (CLS). Bez sidra u ovom delu ekran ostaje na poslednjim
 * karticama, kosturi se pojavljuju ispod njih i potiskuju dugme (u 500 ms posle dodira, ne računa se).
 */
.tb-more {
	overflow-anchor: none;
}

.tb-more__first {
	color: var(--tb-muted);
	font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Prazan rezultat, dugmad, obaveštenje
   -------------------------------------------------------------------------- */
.tb-empty {
	display: grid;
	justify-items: center;
	gap: 0.5rem;
	padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
	border: 1px dashed var(--tb-line);
	border-radius: 14px;
	background: var(--tb-paper);
	text-align: center;
}

.tb-empty__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.tb-empty__text {
	max-width: 42ch;
	margin: 0;
	color: var(--tb-muted);
}

.tb-empty__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6rem;
	margin: 0.75rem 0 0;
}

/* Prazna kategorija: srodne kategorije kao dugmići */
.tb-empty__label {
	margin: 1.25rem 0 0;
	color: var(--tb-muted);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.tb-empty__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tb-empty__links a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0.5rem 1rem;
	border: 1px solid var(--tb-line);
	border-radius: var(--tb-radius-pill);
	background: var(--tb-white);
	color: var(--tb-ink);
	font-size: 0.9375rem;
	text-decoration: none;
}

.tb-empty__links a:hover {
	border-color: var(--tb-forest);
}

/* Dugmad (.tb-btn) i obaveštenje „Dodato u korpu“ (.tb-toast) su zajedničke komponente u theme.css. */

@media (max-width: 767px) {
	/*
	 * Traka je lepljiva ispod zaglavlja (64 px), pa se i ona oduzima od vidljivog dela: element na koji dolazi fokus
	 * (i tasterima Shift+Tab unazad) ne sme da ostane ispod nje. Visinu trake meri view.js (--tb-toolbar-h).
	 */
	html:has(.tb-catalog .tb-toolbar) {
		scroll-padding-top: calc(64px + var(--tb-toolbar-h, 6rem) + var(--tb-s-s, 1rem) + var(--tb-sa-t));
	}

	/* Sigurna zona gore (iPhone bez okvira Safarija): traka staje ispod statusne trake, ne ispod nje. */
	.tb-toolbar {
		position: sticky;
		top: var(--tb-sa-t);
		z-index: 20;
		margin-inline: calc(-1 * var(--tb-gutter));
		padding: 0.6rem var(--tb-gutter);
		border-bottom: 1px solid var(--tb-line);
		/* Puna bela: preko tamnih slika proizvoda providna traka spušta sivi broj proizvoda ispod 4,5:1. */
		background: #fff;
	}

	body:has(.tb-site-header:not(.is-hidden)) .tb-toolbar {
		top: calc(64px + var(--tb-sa-t));
	}

	.tb-toolbar__count {
		flex-basis: 100%;
		order: 2;
		font-size: 0.8125rem;
	}

	.tb-toolbar__actions {
		width: 100%;
	}

	.tb-sort {
		flex: 1;
	}

	/* Sakriven samo na ekranu: čitač ekrana i dalje čuje „Sortiraj:“ uz polje (ne display: none). */
	.tb-sort__label {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.tb-sort,
	.tb-sort__control {
		min-width: 0;
	}

	.tb-sort__control {
		width: 100%;
	}

	.tb-sort select {
		width: 100%;
		min-width: 0;
		padding-left: 0.85rem;
		font-size: 0.8125rem;
		text-overflow: ellipsis;
	}

	.tb-toolbar .tb-filters-open {
		padding: 0 0.85rem;
	}

	.tb-promo-tile {
		min-height: 260px;
	}

	.tb-promo-tile__body {
		padding: 0.9rem;
	}

	.tb-promo-tile__title {
		font-size: 1.0625rem;
	}

	.tb-promo-tile__text {
		display: none;
	}
}

/*
 * Uski telefoni (320-389 px): u jednom redu „Filteri“ i sortiranje preko cele širine, da se vidi ceo naziv
 * („Preporučeno“, „Cena: od najniže“, „Cena: od najviše“); mreža ili lista prelazi u red sa brojem proizvoda.
 */
@media (max-width: 389px) {
	.tb-toolbar {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		gap: 0.5rem;
		align-items: center;
	}

	.tb-toolbar__actions {
		display: contents;
	}

	.tb-toolbar .tb-filters-open {
		grid-row: 1;
		grid-column: 1;
	}

	.tb-sort {
		grid-row: 1;
		grid-column: 2 / 4;
	}

	.tb-toolbar__count {
		grid-row: 2;
		grid-column: 1 / 3;
	}

	.tb-view {
		grid-row: 2;
		grid-column: 3;
	}

	.tb-view__btn {
		height: 30px;
	}
}

@media (max-width: 359px) {
	.tb-toolbar__count {
		font-size: 0.75rem;
	}
}

/*
 * Prst: „Mreža“ i „Lista“ su široki 44 px, a površina za dodir je visoka 44 px (::after preko unutrašnjeg
 * razmaka i ivice okvira), dok krug ostaje iste visine kao na računaru.
 */
@media (pointer: coarse) {
	.tb-view__btn {
		position: relative;
		width: 44px;
		height: 36px;
	}

	.tb-view__btn::after {
		content: "";
		position: absolute;
		inset: -4px 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tb-promo-tile__img {
		transition: none !important;
	}
}
