/**
 * Exxenpana v23 production refinements.
 * WhatsApp, product suggestions, category flyout and top-level archive heroes.
 */

/* Header WhatsApp: one balanced contact control beside the cart. */
.header-actions .header-action-btn.whatsapp-link {
	width: auto;
	min-width: 190px;
	height: 44px;
	padding: 0.35rem 0.7rem 0.35rem 0.5rem;
	gap: 0.55rem;
	justify-content: flex-start;
	border: 1px solid rgba(39, 180, 62, 0.18);
	border-radius: 999px;
	background: rgba(39, 180, 62, 0.055);
	opacity: 1;
	text-decoration: none;
}

.header-actions .header-action-btn.whatsapp-link img {
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
}

.header-actions .header-action-btn.whatsapp-link:hover,
.header-actions .header-action-btn.whatsapp-link:focus-visible {
	border-color: rgba(39, 180, 62, 0.36);
	background: rgba(39, 180, 62, 0.1);
}

.whatsapp-copy {
	position: relative;
	display: block;
	width: 136px;
	height: 1.25rem;
	overflow: hidden;
	font-size: 0.77rem;
	font-weight: 600;
	line-height: 1.25rem;
	letter-spacing: 0.01em;
	white-space: nowrap;
	color: var(--color-dark);
}

.whatsapp-copy-message {
	position: absolute;
	inset: 0 auto auto 0;
	opacity: 0;
	transform: translateY(7px);
	animation: exxepanna-whatsapp-message 8s ease-in-out infinite;
}

.whatsapp-copy-message--second {
	animation-delay: 4s;
}

@keyframes exxepanna-whatsapp-message {
	0%, 50%, 100% { opacity: 0; transform: translateY(7px); }
	7%, 43% { opacity: 1; transform: translateY(0); }
	47% { opacity: 0; transform: translateY(-7px); }
}

/* Native WooCommerce search with lightweight live product suggestions. */
.woocommerce-product-search[data-product-search] {
	position: relative;
}

.product-search-suggestions {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 120;
	max-height: min(430px, calc(100vh - 180px));
	padding: 0.4rem;
	overflow-y: auto;
	border: 1px solid #dedbd5;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 18px 44px rgba(17, 17, 17, 0.14);
}

.product-search-suggestions[hidden] {
	display: none;
}

.product-search-suggestion {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr);
	gap: 0.75rem;
	align-items: center;
	min-width: 0;
	padding: 0.55rem;
	border-radius: 8px;
	color: var(--color-text);
	text-decoration: none;
	touch-action: manipulation;
	transition: background-color 150ms ease, color 150ms ease;
}

.product-search-suggestion:hover,
.product-search-suggestion:focus-visible,
.product-search-suggestion.is-active {
	background: var(--color-surface-secondary);
	color: var(--color-dark);
}

.product-search-suggestion img {
	display: block;
	width: 56px;
	height: 56px;
	border-radius: 7px;
	background: #f4f3ef;
	object-fit: cover;
}

.product-search-suggestion__copy {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 0.2rem;
}

.product-search-suggestion__copy strong {
	overflow: hidden;
	font-size: 0.88rem;
	font-weight: 600;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.product-search-suggestion__copy small {
	font-size: 0.76rem;
	color: var(--color-text-secondary);
}

.product-search-suggestions__empty {
	margin: 0;
	padding: 0.85rem;
	font-size: 0.84rem;
	color: var(--color-text-secondary);
	text-align: center;
}

.search-modal-content .product-search-suggestions {
	z-index: 1001;
}

/* Category flyout: predictable hover, click and nested-list behavior. */
.hero-revision .hero-category-panel {
	max-height: min(620px, calc(100vh - 150px));
	overflow-x: hidden;
	overflow-y: auto;
}

.hero-revision .hero-category-item,
.hero-revision .hero-category-row {
	min-width: 0;
}

.hero-revision .hero-category-row {
	border-radius: 8px;
	transition: background-color 150ms ease;
}

.hero-revision .hero-category-item.has-children > .hero-category-row:hover,
.hero-revision .hero-category-item.has-children > .hero-category-row:focus-within {
	background: var(--color-surface-secondary);
}

.hero-revision .hero-category-row > a,
.hero-revision .hero-category-branch-toggle {
	position: relative;
	z-index: 2;
	pointer-events: auto;
	touch-action: manipulation;
}

.hero-revision .hero-category-row > a {
	min-width: 0;
}

.hero-revision .hero-category-row > a span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hero-revision .hero-category-children {
	padding: 0.25rem 0 0.4rem 0.65rem;
	border-left: 1px solid #e4e0d9;
}

.hero-revision .hero-category-children.is-open {
	animation: exxepanna-category-children-in 150ms ease-out;
}

@keyframes exxepanna-category-children-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Top-level product-category visual: image first, restrained Bulgarian caption. */
body.tax-product_cat .exxepanna-category-hero.has-image::after {
	position: absolute;
	inset: auto 0 0;
	height: 55%;
	content: "";
	pointer-events: none;
	background: linear-gradient(to top, rgba(12, 14, 13, 0.62), rgba(12, 14, 13, 0));
}

body.tax-product_cat .exxepanna-category-hero__image {
	transition: transform 600ms ease;
}

body.tax-product_cat .exxepanna-category-hero.has-image:hover .exxepanna-category-hero__image {
	transform: scale(1.012);
}

body.tax-product_cat .exxepanna-category-hero__caption {
	position: absolute;
	left: clamp(1rem, 3vw, 2.5rem);
	right: clamp(1rem, 3vw, 2.5rem);
	bottom: clamp(1rem, 2.2vw, 2rem);
	z-index: 2;
	color: #fff;
	text-shadow: 0 2px 16px rgba(0, 0, 0, 0.26);
}

body.tax-product_cat .exxepanna-category-hero__caption strong {
	display: block;
	max-width: 820px;
	font-size: clamp(1.45rem, 3vw, 2.6rem);
	font-weight: 500;
	line-height: 1.12;
}

@media (max-width: 1100px) {
	.header-actions .header-action-btn.whatsapp-link {
		width: 44px;
		min-width: 44px;
		padding: 0;
		justify-content: center;
	}

	.whatsapp-copy {
		display: none;
	}
}

@media (max-width: 768px) {
	.product-search-suggestions {
		top: calc(100% + 6px);
		max-height: min(360px, calc(100vh - 150px));
		border-radius: 10px;
	}

	.hero-revision .hero-category-panel {
		max-height: calc(100dvh - 125px);
	}

	body.tax-product_cat .exxepanna-category-hero__caption strong {
		font-size: clamp(1.25rem, 6vw, 1.75rem);
	}
}

@media (max-width: 360px) {
	.header-actions .header-action-btn.whatsapp-link {
		width: 38px;
		min-width: 38px;
		height: 38px;
	}

	.header-actions .header-action-btn.whatsapp-link img {
		width: 27px;
		height: 27px;
		flex-basis: 27px;
	}

	.product-search-suggestion {
		grid-template-columns: 48px minmax(0, 1fr);
	}

	.product-search-suggestion img {
		width: 48px;
		height: 48px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.whatsapp-copy-message,
	.hero-revision .hero-category-children.is-open,
	body.tax-product_cat .exxepanna-category-hero__image {
		animation: none;
		transition: none;
	}

	.whatsapp-copy-message--first {
		opacity: 1;
		transform: none;
	}

	.whatsapp-copy-message--second {
		display: none;
	}
}
