/* ============================================================
   IFAD catalog — product category archive (grid + toolbar).
   Rebuild of the old WooCommerce shop design on the plain CPT.
   ============================================================ */

.ifad-catalog {
	--ifad-navy: #0e0e31;
	--ifad-red: #e2401c;
	--ifad-line: #e5e5ea;
	--ifad-muted: #6b6b76;
	--ifad-media-bg: #f1f1f3;
	max-width: 1320px;      /* own container — Bootstrap .container was dropped */
	margin: 0 auto;
	padding: 18px 24px 48px;
	box-sizing: border-box;
	color: var(--ifad-navy);
}

/* --- Breadcrumbs + heading (centered, like prod) --- */
.ifad-crumbs {
	text-align: center;
	font-size: 14px;
	color: var(--ifad-muted);
	margin: 6px 0 30px;
}
.ifad-crumbs a { color: var(--ifad-muted); text-decoration: none; }
.ifad-crumbs a:hover { color: var(--ifad-navy); }
.ifad-crumbs .sep { margin: 0 6px; opacity: .6; }
.ifad-crumbs .current { color: var(--ifad-navy); }

.ifad-catalog__title {
	text-align: center;
	text-transform: uppercase;
	font-size: 30px;
	font-weight: 600;
	letter-spacing: .01em;
	margin: 0 0 12px;
	color: var(--ifad-navy);
}
/* Subcategory chip row — centered, wraps for multiple siblings. */
.ifad-catalog__chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 32px 0 24px;
}
.ifad-catalog__chip {
	display: block;
	padding: 11px 32px;
	background: #fff;
	color: var(--ifad-navy);
	border: 1px solid var(--ifad-navy);
	border-radius: 5px;
	font-size: 15px;
	line-height: 1;
	text-decoration: none;
	transition: background .15s ease, color .15s ease;
}
a.ifad-catalog__chip:hover,
.ifad-catalog__chip.is-active { background: var(--ifad-navy); color: #fff; }

/* --- Toolbar: sort left, count right --- */
.ifad-catalog__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0 0 30px;
	flex-wrap: wrap;
}
.ifad-catalog__sort { display: flex; align-items: center; gap: 8px; margin: 0; }
.ifad-catalog__sort label { font-size: 14px; color: var(--ifad-navy); }
.ifad-catalog__count { font-size: 14px; color: var(--ifad-muted); }

/* --- Custom dropdown (ifad-select): replaces native <select> --- */
.ifad-select { position: relative; display: inline-block; min-width: 196px; }
.ifad-select__native { /* kept for form submit + a11y, visually removed */
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
	clip: rect(0 0 0 0);
}
.ifad-select__toggle {
	display: flex;
	align-items: center;
	justify-content: start;
	gap: 10px;
	width: 100%;
	padding: 9px 0px;
	background: none;
	border: 0;                 /* borderless in every state (incl. open/focus) per design */
	font-size: 14px;
	color: var(--ifad-navy);
	text-align: left;
	cursor: pointer;
}
.ifad-select__toggle:focus,
.ifad-select__toggle:focus-visible { outline: none; }
.ifad-select__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ifad-select__caret {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	margin-top: -3px;
	border-right: 1px solid var(--ifad-navy);
	border-bottom: 1px solid var(--ifad-navy);
	transform: rotate(45deg);
	transition: transform .18s ease, margin-top .18s ease;
}
.ifad-select.is-open .ifad-select__caret { transform: rotate(-135deg); margin-top: 2px; }
.ifad-select__menu {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 40;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #fff;
	border: 1px solid var(--ifad-line);
	border-radius: 5px;
	box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.ifad-select.is-open .ifad-select__menu { opacity: 1; visibility: visible; transform: none; }
.ifad-select__option {
	padding: 9px 12px;
	border-radius: 5px;
	font-size: 14px;
	color: var(--ifad-navy);
	cursor: pointer;
	white-space: nowrap;
}
.ifad-select__option:hover { background: #f2f2f5; }
.ifad-select__option.is-selected { background: var(--ifad-navy); color: #fff; }

/* --- Layout: sidebar + grid --- */
.ifad-catalog__layout {
	display: grid;
	grid-template-columns: 334px 1fr;
	gap: 30px;
	align-items: start;
}
.ifad-catalog__sidebar { min-width: 0; }
.ifad-catalog__main { min-width: 0; }

.ifad-filter-placeholder {
	border: 1px solid var(--ifad-line);
	border-radius: 5px;
	padding: 16px;
	color: var(--ifad-muted);
	font-size: 13px;
}
.ifad-filter-placeholder__title {
	display: block;
	font-size: 16px;
	font-weight: 600;
	color: var(--ifad-navy);
	margin-bottom: 6px;
}

/* --- Product grid --- */
.ifad-catalog__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 26px 22px;
}
/* Search results run full width (no sidebar) → 5 columns. */
.ifad-catalog--search .ifad-catalog__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .ifad-catalog--search .ifad-catalog__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .ifad-catalog--search .ifad-catalog__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .ifad-catalog--search .ifad-catalog__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 360px) { .ifad-catalog--search .ifad-catalog__grid { grid-template-columns: 1fr; } }
.ifad-card { position: relative; display: flex; flex-direction: column; }
.ifad-card__media {
	position: relative;
	background: var(--ifad-media-bg);
	border-radius: 5px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
}
.ifad-card__imglink { display: block; width: 100%; height: 100%; }
.ifad-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}
.ifad-card:hover .ifad-card__img { transform: scale(1.04); }
.ifad-card__img--empty { background: var(--ifad-media-bg); }

.ifad-card__badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	background: #e74c3c;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 3px;
}
/* "Reserved" flag — replaces the discount badge for a held stone. */
.ifad-card__reserved {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	background: var(--ifad-navy);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: .03em;
	text-transform: uppercase;
	padding: 4px 5px;
	border-radius: 3px;
}
.ifad-card__wish {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ffffff00;
	color: #4e4e62;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
	transition: color .15s ease, background .15s ease;
}
.ifad-card__wish:hover { color: var(--ifad-red); }
.ifad-card__wish.is-active { background: var(--ifad-navy); color: #fff; }
.ifad-card__wish.is-active svg { fill: #fff; }
.ifad-card__wish.is-loading { opacity: .5; pointer-events: none; }

.ifad-card__title {
	display: block;
	margin: 12px 0 8px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	color: var(--ifad-navy);
	text-decoration: none;
	transition: color .15s ease;
}
.ifad-card__title:hover {
	color: #59595d;
	text-decoration: none;
}

.ifad-price { font-size: 16px; font-weight: 500; line-height: 1.2; color: var(--ifad-navy); }
.ifad-price del { color: var(--ifad-navy); opacity: .5; margin-right: 3px; text-decoration: line-through; font-weight: 400; }
.ifad-price ins { text-decoration: none; color: var(--ifad-navy); }
.ifad-price.is-sale ins { color: #3434a7; }   /* sale price — same indigo as the product page */
.ifad-price.is-broker ins { color: #3434a7; } /* broker partner net price — same indigo highlight */

/* --- Pagination --- */
/* Separate square buttons with gaps. */
.ifad-catalog__pagination {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 34px;
}
.ifad-catalog__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--ifad-line);
	border-radius: 5px;
	font-size: 14px;
	color: var(--ifad-navy);
	text-decoration: none;
	background: #fff;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ifad-catalog__pagination .page-numbers.current {
	background: var(--ifad-navy);
	border-color: var(--ifad-navy);
	color: #fff;
}
.ifad-catalog__pagination a.page-numbers:hover { border-color: var(--ifad-navy); }
.ifad-catalog__pagination .page-numbers.dots { border-color: transparent; cursor: default; }

.ifad-catalog__empty { padding: 40px 0; color: var(--ifad-muted); }

/* --- Mobile Filter drawer (button + off-canvas sidebar + overlay) --- */
.ifad-catalog__filter-btn { display: none; } /* shown only on mobile */
.ifad-catalog__filter-btn {
	align-items: center;
	gap: 8px;
	padding: 9px 30px;
	background: var(--ifad-navy);
	color: #fff;
	border: 1px solid var(--ifad-navy);
	border-radius: 5px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.ifad-catalog__sidebar-head { display: none; } /* shown only in the mobile drawer */
.ifad-catalog__filter-overlay { position: fixed; inset: 0; background: rgba(14, 14, 49, .45); z-index: 1099; opacity: 0; transition: opacity .25s ease; }
.ifad-catalog__filter-overlay.is-open { opacity: 1; }
body.ifad-filter-lock { overflow: hidden; }

/* --- Responsive --- */
/* Tablet and below (incl. iPad Pro 12.9" portrait = 1024px): the sidebar becomes
   an off-canvas drawer opened by the Filter button (same as phones), so the
   catalogue uses the full width. */
@media (max-width: 1024px) {
	.ifad-catalog__layout { grid-template-columns: 1fr; }
	.ifad-catalog__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 16px; }
	/* Push the sort label to the far edge, opposite the Filter button. Logical
	   `end` (not physical `right`) so it flips with the language: right in LTR,
	   left in RTL — matching the mirrored Filter button. */
	.ifad-select__toggle { justify-content: end; }

	/* Equal-height cards in a row: push the price to the bottom so the price line
	   is level across neighbouring cards regardless of how many lines the title
	   wraps to. */
	.ifad-card__price { margin-top: auto; }

	/* Filter button visible; the sidebar becomes an off-canvas drawer. */
	.ifad-catalog__filter-btn { display: inline-flex; }
	.ifad-catalog__bar { flex-wrap: wrap; }
	.ifad-catalog__sidebar {
		display: block;
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		right: auto;
		width: min(86vw, 340px);
		background: #fff;
		z-index: 1100;
		padding: 0 18px 24px;
		overflow-y: auto;
		overflow-x: hidden; /* guard: no sideways jitter from slider-handle overhang etc. */
		-webkit-overflow-scrolling: touch;
		transform: translateX(-100%);
		transition: transform .28s ease;
		box-shadow: 0 0 40px rgba(14, 14, 49, .22);
	}
	.ifad-catalog__sidebar.is-open { transform: none; }
	.ifad-catalog__sidebar-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: sticky;
		top: 0;
		margin: 0 -18px 8px;
		padding: 14px 18px;
		background: #fff;
		border-bottom: 1px solid var(--ifad-line);
		z-index: 1;
	}
	.ifad-catalog__sidebar-title { font-size: 17px; font-weight: 700; color: var(--ifad-navy); }
	.ifad-catalog__sidebar-close { display: inline-flex; padding: 4px; background: none; border: 0; color: var(--ifad-navy); cursor: pointer; }
}
@media (max-width: 767px) {
	.ifad-catalog__grid { grid-template-columns: repeat(2, 1fr); }
	.ifad-catalog__title { font-size: 24px; }
}
/* Keep 2 columns on standard phones (iPhone 15 Pro 393, SE 375, …); drop to a
   single column only on very narrow screens (≤360px). */
@media (max-width: 360px) {
	.ifad-catalog__grid { grid-template-columns: 1fr; }
}

/* ---------------- Empty-category placeholder (curating) ---------------- */
.ifad-catalog__curating { max-width: 620px; margin: 30px auto 70px; text-align: center; padding: 0 20px; }
.ifad-catalog__curating-icon { display: inline-flex; width: 66px; height: 66px; align-items: center; justify-content: center; margin: 0 0 22px; border: 1px solid var(--ifad-line); border-radius: 50%; color: var(--ifad-navy); }
.ifad-catalog__curating-icon svg { width: 30px; height: 30px; }
.ifad-catalog__curating-title { margin: 0 0 12px; font-size: 26px; font-weight: 600; color: var(--ifad-navy); line-height: 1.25; }
.ifad-catalog__curating-text { margin: 0 0 28px; font-size: 16px; line-height: 1.6; color: var(--ifad-muted); }
.ifad-catalog__curating-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.ifad-catalog__curating-btn { display: inline-flex; align-items: center; justify-content: center; padding: 13px 26px; border: 1px solid var(--ifad-navy); border-radius: 5px; background: var(--ifad-navy); color: #fff; font-size: 14px; font-weight: 500; text-decoration: none; transition: background .15s ease, color .15s ease; }
.ifad-catalog__curating-btn:hover { background: #1b1b4d; }
.ifad-catalog__curating-btn--ghost { background: #fff; color: var(--ifad-navy); }
.ifad-catalog__curating-btn--ghost:hover { background: var(--ifad-navy); color: #fff; }
