/* Hash Category Popup — styles */

:root {
	--hcp-width:       1100px;
	--hcp-img-size:    56px;
	--hcp-radius:      12px;
	--hcp-accent:      var(--wd-primary-color, #2d7d46);
	--hcp-bg-opacity:        1;   /* set inline by JS from Settings > Category Popup */
	--hcp-header-bg-opacity: 1;   /* set inline by JS from Settings > Category Popup */
	--hcp-overlay-opacity:   0.5; /* set inline by JS from Settings > Category Popup */
}

/* ── Overlay ── */
.hcp-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, var(--hcp-overlay-opacity));
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.22s ease;
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

.hcp-overlay.hcp-open {
	opacity: 1;
	pointer-events: auto;
}

/* ── Modal card ── */
.hcp-modal {
	background: rgba(255, 255, 255, var(--hcp-bg-opacity));
	backdrop-filter: blur(20px) saturate(180%);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	border-radius: var(--hcp-radius);
	/* Fades out together with the body opacity slider — otherwise a dark
	   halo/shadow stays visible even when the card itself is fully transparent. */
	box-shadow: 0 24px 64px rgba(0, 0, 0, calc(var(--hcp-bg-opacity) * 0.22));
	width: 100%;
	max-width: var(--hcp-width);
	max-height: 82vh;
	overflow-y: auto;
	transform: translateY(18px) scale(0.97);
	transition: transform 0.22s ease, background 0.15s ease, box-shadow 0.15s ease;
	position: relative;
	scrollbar-width: thin;
}

.hcp-overlay.hcp-open .hcp-modal {
	transform: translateY(0) scale(1);
}

/* ── Header ── */
.hcp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px 16px;
	border-bottom: 1px solid rgba(240, 240, 240, var(--hcp-header-bg-opacity));
	position: sticky;
	top: 0;
	background: rgba(255, 255, 255, var(--hcp-header-bg-opacity));
	z-index: 1;
	border-radius: var(--hcp-radius) var(--hcp-radius) 0 0;
}

.hcp-title {
	font-size: 15px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	margin: 0;
	color: #222;
}

/* ── Title badge (toggle in Settings > Category Popup) ──
   Wraps the category name in a rounded pill background instead of plain text. */
.hcp-title-badge .hcp-title {
	display: inline-block;
	background: var(--hcp-accent);
	color: #fff;
	padding: 6px 16px;
	border-radius: 20px;
}

.hcp-header-right {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
}

.hcp-view-all {
	font-size: 12px;
	font-weight: 600;
	color: var(--hcp-accent);
	text-decoration: none;
	border: 1.5px solid var(--hcp-accent);
	border-radius: 20px;
	padding: 4px 12px;
	transition: background 0.15s, color 0.15s;
	white-space: nowrap;
}

.hcp-view-all:hover {
	background: var(--hcp-accent);
	color: #fff;
}

.hcp-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	color: #aaa;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s;
	line-height: 1;
	border-radius: 50%;
}

.hcp-close:hover {
	color: #333;
}

.hcp-close svg {
	width: 20px;
	height: 20px;
	display: block;
}

/* ── Category grid ── */
.hcp-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 4px;
	padding: 14px 12px 20px;
}

/* ── Single category item ── */
a.hcp-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: #222;
	transition: background 0.14s;
}

a.hcp-item:hover {
	background: #e2e2e2;
}

.hcp-item-img {
	width: var(--hcp-img-size);
	height: var(--hcp-img-size);
	min-width: var(--hcp-img-size);
	object-fit: contain;
	background: #fafafa;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	padding: 4px;
}

.hcp-item-placeholder {
	width: var(--hcp-img-size);
	height: var(--hcp-img-size);
	min-width: var(--hcp-img-size);
	background: #f0f0f0;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ccc;
}

.hcp-item-placeholder svg {
	width: 22px;
	height: 22px;
}

.hcp-item-info {
	min-width: 0;
}

.hcp-item-name {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	line-height: 1.3;
	color: #222;
}

.hcp-item-count {
	font-size: 11px;
	color: #aaa;
	margin-top: 2px;
}

/* ── Staggered entrance animation (toggle + style in Settings > Category Popup) ──
   Items stay hidden (opacity: 0) as soon as they're inserted, but the animation
   itself only starts once JS adds .hcp-stagger-run — timed so items don't move
   until the popup card is fully visible. See setContent() in hcp-popup.js. ── */
.hcp-grid.hcp-stagger .hcp-item {
	opacity: 0;
}

/* Style 1 — Slide Up: fades in while sliding up slightly */
@keyframes hcp-anim-slide {
	from { opacity: 0; transform: translateY(14px) scale(0.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hcp-grid.hcp-stagger-run.hcp-anim-slide .hcp-item {
	animation: hcp-anim-slide 0.4s cubic-bezier(0.21, 0.9, 0.4, 1) forwards;
}

/* Style 2 — Zoom Pop: scales up from small with a soft bounce overshoot */
@keyframes hcp-anim-zoom {
	0%   { opacity: 0; transform: scale(0.4); }
	65%  { opacity: 1; transform: scale(1.07); }
	100% { opacity: 1; transform: scale(1); }
}

.hcp-grid.hcp-stagger-run.hcp-anim-zoom .hcp-item {
	animation: hcp-anim-zoom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Style 3 — Blur Fade: sharpens into focus from a soft blur */
@keyframes hcp-anim-blur {
	from { opacity: 0; filter: blur(10px); transform: scale(1.04); }
	to   { opacity: 1; filter: blur(0); transform: scale(1); }
}

.hcp-grid.hcp-stagger-run.hcp-anim-blur .hcp-item {
	animation: hcp-anim-blur 0.5s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
	.hcp-grid.hcp-stagger .hcp-item {
		animation: none;
		opacity: 1;
	}
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT 2 — "Cards": bigger image, name centered below, white card
   ══════════════════════════════════════════════════════════════ */
.hcp-layout-cards .hcp-grid {
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 16px;
	padding: 20px;
}

.hcp-layout-cards a.hcp-item {
	flex-direction: column;
	text-align: center;
	gap: 12px;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 14px;
	padding: 20px 12px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.hcp-layout-cards a.hcp-item:hover {
	background: #fff;
	transform: translateY(-4px);
	box-shadow: 0 14px 28px rgba(0, 0, 0, 0.10);
}

.hcp-layout-cards .hcp-item-img,
.hcp-layout-cards .hcp-item-placeholder {
	width: 92px;
	height: 92px;
	min-width: 92px;
}

.hcp-layout-cards .hcp-item-info {
	width: 100%;
}

.hcp-layout-cards .hcp-item-name {
	font-size: 12.5px;
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT 3 — "Glass": frosted, transparent popup background
   ══════════════════════════════════════════════════════════════ */
.hcp-layout-glass {
	/* Fades out together with the body opacity slider instead of staying
	   fixed — otherwise a visible outline remains even at 0% opacity. */
	border: 1px solid rgba(255, 255, 255, calc(var(--hcp-bg-opacity) * 0.5));
}

.hcp-layout-glass .hcp-header {
	border-bottom: 1px solid rgba(0, 0, 0, calc(var(--hcp-header-bg-opacity) * 0.06));
}

.hcp-layout-glass .hcp-grid {
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 16px;
	padding: 20px;
}

.hcp-layout-glass a.hcp-item {
	flex-direction: column;
	text-align: center;
	gap: 12px;
	background: rgba(255, 255, 255, 0.45);
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 14px;
	padding: 20px 12px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.hcp-layout-glass a.hcp-item:hover {
	background: rgba(255, 255, 255, 0.75);
	transform: translateY(-4px);
	box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

.hcp-layout-glass .hcp-item-img,
.hcp-layout-glass .hcp-item-placeholder {
	width: 92px;
	height: 92px;
	min-width: 92px;
}

.hcp-layout-glass .hcp-item-info {
	width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT 4 — "Photo": big edge-to-edge photo thumbnails, name +
   arrow in a bar underneath (shop collections grid style)
   ══════════════════════════════════════════════════════════════ */
.hcp-layout-photo .hcp-grid {
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 14px;
	padding: 16px;
}

.hcp-layout-photo a.hcp-item {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	padding: 0;
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
	border: 1px solid #eee;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hcp-layout-photo a.hcp-item:hover {
	background: #fff;
	transform: translateY(-3px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.10);
}

.hcp-layout-photo .hcp-item-img,
.hcp-layout-photo .hcp-item-placeholder {
	width: 100%;
	height: auto;
	min-width: 0;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #fff;
	border: none;
	border-radius: 0;
	padding: 0;
}

.hcp-layout-photo .hcp-item-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 12px 14px;
	background: #f7f7f7;
}

.hcp-layout-photo .hcp-item-name {
	text-transform: none;
	font-weight: 500;
	font-size: 14px;
	letter-spacing: 0;
}

.hcp-layout-photo .hcp-item-info::after {
	content: "→";
	font-size: 15px;
	color: #444;
	flex-shrink: 0;
	margin-left: 8px;
	transition: transform 0.18s ease;
}

.hcp-layout-photo a.hcp-item:hover .hcp-item-info::after {
	transform: translateX(3px);
}

/* Extra Large thumbnail size variant (Settings > Category Popup > Photo layout thumbnail size) */
.hcp-layout-photo.hcp-photo-size-xlarge .hcp-grid {
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 18px;
	padding: 20px;
}

.hcp-layout-photo.hcp-photo-size-xlarge .hcp-item-img,
.hcp-layout-photo.hcp-photo-size-xlarge .hcp-item-placeholder {
	aspect-ratio: 1 / 1;
}

.hcp-layout-photo.hcp-photo-size-xlarge .hcp-item-info {
	padding: 16px 18px;
}

.hcp-layout-photo.hcp-photo-size-xlarge .hcp-item-name {
	font-size: 16px;
}

/* Small thumbnail size variant (Settings > Category Popup > Photo layout thumbnail size) */
.hcp-layout-photo.hcp-photo-size-small .hcp-grid {
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 10px;
	padding: 12px;
}

.hcp-layout-photo.hcp-photo-size-small .hcp-item-img,
.hcp-layout-photo.hcp-photo-size-small .hcp-item-placeholder {
	aspect-ratio: 1 / 1;
}

.hcp-layout-photo.hcp-photo-size-small .hcp-item-info {
	padding: 8px 10px;
}

.hcp-layout-photo.hcp-photo-size-small .hcp-item-name {
	font-size: 12px;
}

/* ── Loading spinner ── */
.hcp-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 50px 20px;
	gap: 14px;
	color: #bbb;
	font-size: 13px;
}

.hcp-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid #eee;
	border-top-color: var(--hcp-accent);
	border-radius: 50%;
	animation: hcp-spin 0.65s linear infinite;
}

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

/* ── Empty / error state ── */
.hcp-empty {
	text-align: center;
	padding: 50px 20px;
	color: #bbb;
	font-size: 14px;
}

/* ── Mobile: slide up from bottom ── */
@media (max-width: 640px) {
	.hcp-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.hcp-modal {
		border-radius: var(--hcp-radius) var(--hcp-radius) 0 0;
		max-height: 88vh;
		transform: translateY(100%);
	}

	.hcp-overlay.hcp-open .hcp-modal {
		transform: translateY(0);
	}

	.hcp-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}

	.hcp-layout-cards .hcp-grid,
	.hcp-layout-glass .hcp-grid {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
		gap: 12px;
		padding: 14px;
	}

	.hcp-layout-cards .hcp-item-img,
	.hcp-layout-cards .hcp-item-placeholder,
	.hcp-layout-glass .hcp-item-img,
	.hcp-layout-glass .hcp-item-placeholder {
		width: 72px;
		height: 72px;
		min-width: 72px;
	}

	.hcp-layout-photo .hcp-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 10px;
		padding: 12px;
	}

	.hcp-layout-photo.hcp-photo-size-xlarge .hcp-grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		gap: 12px;
		padding: 14px;
	}

	.hcp-layout-photo.hcp-photo-size-small .hcp-grid {
		grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
		gap: 8px;
	}
}
