/* =========================================
   TESPI Live Search Extra
   Custom dropdown for Elementor Search widget
   Widget custom class: .header-search
========================================= */

/* Search widget wrapper */
.header-search {
	position: relative;
}

/* Hide native Elementor live results container to avoid conflicts */
.header-search .e-search-results-container {
	display: none !important;
}

/* Custom independent live results dropdown */
.header-search .tespi-live-search-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 99999;
	width: 100%;
	max-height: 75vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
	padding: 0;
	display: none;
	visibility: hidden;
	opacity: 0;
    font-family: "Google Sans", sans-serif;
}

.header-search .tespi-live-search-dropdown.is-active {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

/* Main live results wrapper */
.tespi-live-results {
	padding: 22px 24px 24px;
	background: #fff;
}

/* Sections */
.tespi-live-results__section {
	padding-bottom: 22px;
	margin-bottom: 22px;
	border-bottom: 1px solid #eee;
}

.tespi-live-results__section:last-of-type {
	margin-bottom: 0;
}

.tespi-live-results__title {
	margin: 0 0 16px;
	font-size: 16px;
	line-height: 24px;
	font-weight: 700;
	color: #222;
}

/* Popular queries */
.tespi-live-results__popular-list,
.tespi-live-results__category-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.tespi-live-results__popular-item a,
.tespi-live-results__category-item a {
	display: flex;
	align-items: center;
	width: 100%;
	text-decoration: none;
	color: #222;
}

.tespi-live-results__popular-item a {
	gap: 16px;
	padding: 4px 0;
	font-size: 14px;
	line-height: 20px;
}

.tespi-live-results__popular-item a:hover,
.tespi-live-results__category-item a:hover {
	color: #222;
}

/* Search icon */
.tespi-live-results__search-icon {
	position: relative;
	display: inline-block;
	width: 28px;
	height: 28px;
	flex: 0 0 28px;
	color: #1e1e1e;
}

.tespi-live-results__search-icon::before {
	content: "";
	position: absolute;
	width: 19px;
	height: 19px;
	border: 2px solid currentColor;
	border-radius: 50%;
	left: 0;
	top: 0;
}

.tespi-live-results__search-icon::after {
	content: "";
	position: absolute;
	width: 12px;
	height: 2px;
	background: currentColor;
	border-radius: 10px;
	transform: rotate(45deg);
	left: 14px;
	top: 19px;
}

/* Categories */
.tespi-live-results__category-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.tespi-live-results__category-item a {
	gap: 16px;
	padding: 0;
	font-size: 18px;
	line-height: 1.35;
}

.tespi-live-results__category-image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	flex: 0 0 64px;
	border-radius: 10px;
	background: #f5f5f5;
	overflow: hidden;
}

.tespi-live-results__category-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tespi-live-results__category-name {
	flex: 1;
	font-weight: 500;
	color: #222;
}

.tespi-live-results__category-arrow {
	margin-left: auto;
	font-size: 42px;
	line-height: 1;
	color: #999;
	font-weight: 300;
}

/* Products */
.tespi-live-results__product-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
}

.tespi-live-results__product-item {
	min-width: 0;
}
.tespi-live-results__product-item .custom-card-cart-plus, .tespi-live-results__product-item .custom-card-cart-minus{
	padding: 0;
}
.tespi-live-results__product-item img{
    height: auto !important;
}

/* Elementor template inside product item */
.tespi-live-results__product-item .elementor {
	width: 100%;
}

.tespi-live-results__product-item .woocommerce-product-attributes-item__value{
    white-space: nowrap;
}

/* Footer / Show all */
.tespi-live-results__footer {
	position: sticky;
	bottom: 0;
	z-index: 3;
	padding-top: 14px;
    padding-bottom: 16px;
	background: #fff;
}

.tespi-live-results__show-all {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 66px;
	border-radius: 10px;
	background: #f5f5f5;
	color: #222;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.2s ease;
}

.tespi-live-results__show-all:hover {
	background: #eeeeee;
	color: #222;
}

/* Loading */
.tespi-live-results__loading {
	padding: 24px;
	text-align: center;
	color: #777;
	font-size: 16px;
}

/* =========================================
   Tablet
========================================= */

@media (max-width: 1024px) {
	.tespi-live-results__product-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 18px;
	}
}

/* =========================================
   Mobile
========================================= */

@media (max-width: 767px) {
	.header-search .tespi-live-search-dropdown {
		position: fixed;
		top: 170px;
		left: 12px;
		right: 12px;
		width: auto;
		max-height: calc(100vh - 200px);
		border-radius: 16px;
	}

	.tespi-live-results {
		padding: 18px 16px 20px;
	}

	.tespi-live-results__section {
		padding-bottom: 18px;
		margin-bottom: 18px;
	}

	.tespi-live-results__title {
		font-size: 18px;
		margin-bottom: 14px;
	}

	.tespi-live-results__popular-item a {
		font-size: 16px;
		gap: 16px;
	}

	.tespi-live-results__search-icon {
		width: 24px;
		height: 24px;
		flex-basis: 24px;
	}

	.tespi-live-results__search-icon::before {
		width: 15px;
		height: 15px;
		border-width: 2px;
	}

	.tespi-live-results__search-icon::after {
		width: 10px;
		height: 2px;
		left: 15px;
		top: 17px;
	}

	.tespi-live-results__category-list {
		gap: 10px;
	}

	.tespi-live-results__category-item a {
		font-size: 16px;
		gap: 16px;
	}

	.tespi-live-results__category-image {
		width: 52px;
		height: 52px;
		flex-basis: 52px;
	}

	.tespi-live-results__category-arrow {
		font-size: 34px;
	}

	.tespi-live-results__product-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px;
	}

	/* Mobile: show only 4 products = 2 rows x 2 columns */
	.tespi-live-results__product-item:nth-child(n + 5) {
		display: none;
	}

	.tespi-live-results__show-all {
		min-height: 56px;
		font-size: 16px;
	}

	.tespi-live-results__loading {
		padding: 20px;
		font-size: 15px;
	}
}