/* Live Product Search for WooCommerce - Main Styles */

/* Reset and box-sizing for overlay scope only */
.lpsw-overlay,
.lpsw-overlay *,
.lpsw-overlay *::before,
.lpsw-overlay *::after {
	box-sizing: border-box;
}

/* Overlay container - hidden by default */
.lpsw-overlay {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-100%);
	transition: transform 0.5s cubic-bezier(0.65, 0.05, 0.36, 1),
	            opacity 0.5s cubic-bezier(0.65, 0.05, 0.36, 1),
	            visibility 0s 0.5s linear;
}

/* Overlay visible state */
.lpsw-overlay.lpsw-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: transform 0.5s cubic-bezier(0.65, 0.05, 0.36, 1),
	            opacity 0.5s cubic-bezier(0.65, 0.05, 0.36, 1),
	            visibility 0s linear;
}

/* Semi-transparent backdrop */
.lpsw-backdrop {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 99;
	background: rgba(0, 0, 0, 0.3);
	cursor: pointer;
}

/* Main panel */
.lpsw-panel {
	position: relative;
	width: 100%;
	background: #ffffff;
	color: #333333;
	padding: 40px 20px;
	z-index: 9999;
	overflow-y: auto;
	max-height: 100vh;
}

@media (min-width: 1024px) {
	.lpsw-panel {
		padding: 75px 0 65px;
	}
}

/* Container for panel content */
.lpsw-container {
	max-width: 750px;
	margin: 0 auto;
}

/* Prevent scroll when overlay is open */
html.lpsw-noscroll {
	overflow: hidden;
}

/* Top section with heading */
.lpsw-top {
	margin-bottom: 30px;
}

.lpsw-top h2 {
	margin: 0;
	font-size: 24px;
	font-weight: 300;
	line-height: 1.2;
	text-align: center;
	color: #333333;
}

/* Close button (X icon) */
.lpsw-close {
	position: absolute;
	top: 15px;
	right: 15px;
	width: 20px;
	height: 20px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lpsw-close::before,
.lpsw-close::after {
	content: '';
	position: absolute;
	width: 20px;
	height: 2px;
	background: #333333;
	transition: transform 0.3s ease-out;
}

.lpsw-close::before {
	transform: rotate(-45deg);
}

.lpsw-close::after {
	transform: rotate(-135deg);
}

.lpsw-close:hover::before,
.lpsw-close:hover::after {
	transform: rotate(0deg);
}

@media (min-width: 1500px) {
	.lpsw-close {
		right: 15px;
	}
}

/* Search form wrapper */
.lpsw-form {
	margin-top: 30px;
}

/* Search input box */
.lpsw-search-box {
	position: relative;
	margin: 0 auto;
}

/* Search input field */
.lpsw-input {
	width: 100%;
	height: 45px;
	padding: 0;
	border: none;
	border-bottom: 1px solid #333333;
	background: transparent;
	color: #333333;
	font-size: 16px;
	font-family: inherit;
	line-height: 45px;
	transition: border-color 0.3s ease-in-out;
	outline: none;
}

.lpsw-input::placeholder {
	color: #999999;
	transition: color 0.3s ease-in-out;
}

.lpsw-input:focus {
	border-bottom-color: #555555;
}

.lpsw-input:focus::placeholder {
	color: transparent;
}

/* Search submit button */
.lpsw-submit {
	position: absolute;
	top: 0;
	right: 0;
	width: 45px;
	height: 45px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333333;
	transition: color 0.3s ease;
	font-size: 16px;
}

.lpsw-submit:hover {
	color: #0066cc;
}

.lpsw-submit svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
}

/* Results wrapper */
.lpsw-results-wrap {
	display: none;
	margin-top: 30px;
}

.lpsw-results-wrap.lpsw-has-results {
	display: block;
}

/* Results list */
.lpsw-results {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
	margin: 0 -15px;
	padding: 0;
	max-height: calc(100vh - 275px);
	overflow-y: auto;
	background: #ffffff;
	position: relative;
}

/* Webkit scrollbar styling */
.lpsw-results::-webkit-scrollbar {
	width: 5px;
	background-color: #f5f5f5;
}

.lpsw-results::-webkit-scrollbar-track {
	background-color: #f5f5f5;
}

.lpsw-results::-webkit-scrollbar-thumb {
	background-color: rgba(51, 51, 51, 0.1);
	border-radius: 3px;
}

.lpsw-results::-webkit-scrollbar-thumb:hover {
	background-color: rgba(51, 51, 51, 0.2);
}

/* Loading state */
.lpsw-results.lpsw-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border: 2px solid #f0f0f0;
	border-top-color: #333333;
	border-radius: 50%;
	animation: lpsw-spin 0.8s linear infinite;
	z-index: 10000;
}

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

/* Individual result item */
.lpsw-item {
	list-style: none;
	padding: 0 15px;
	margin-bottom: 30px;
	width: 100%;
}

/* Mobile: 1 column */
@media (max-width: 575px) {
	.lpsw-item {
		width: 100%;
	}
}

/* Tablet small: 2 columns */
@media (min-width: 576px) and (max-width: 991px) {
	.lpsw-item {
		width: 50%;
	}
}

/* Tablet large: 3 columns */
@media (min-width: 992px) and (max-width: 1279px) {
	.lpsw-item {
		width: 33.333%;
	}
}

/* Desktop: 4 columns */
@media (min-width: 1280px) {
	.lpsw-item {
		width: 25%;
	}
}

/* Result item image */
.lpsw-item-image {
	display: block;
	margin-bottom: 15px;
	text-decoration: none;
	outline: none;
}

.lpsw-item-image img {
	width: 100%;
	height: auto;
	display: block;
	border: 1px solid rgba(51, 51, 51, 0.1);
	transition: border-color 0.3s ease;
}

.lpsw-item-image:hover img {
	border-color: rgba(51, 51, 51, 0.2);
}

/* Result item content */
.lpsw-item-content {
	text-align: center;
}

/* Result item title */
.lpsw-item-title {
	display: inline-block;
	margin: 10px 0;
	font-weight: 500;
	font-size: 14px;
	line-height: 1.4;
	color: #333333;
	text-decoration: none;
	transition: color 0.3s ease;
}

.lpsw-item-title:hover {
	color: #0066cc;
}

/* Price styling */
.lpsw-price {
	font-size: 14px;
	margin-top: 8px;
	color: #666666;
	line-height: 1.4;
}

/* Support WooCommerce price HTML (del for strikethrough, ins for sale price) */
.lpsw-price del {
	color: #999999;
	margin-right: 5px;
}

.lpsw-price ins {
	text-decoration: none;
	font-weight: 600;
	color: #ff0000;
}

/* No results message */
.lpsw-no-result {
	list-style: none;
	padding: 30px 15px;
	text-align: center;
	color: #999999;
	width: 100%;
	font-size: 14px;
}

/* Trigger button (icon in nav bar) */
.lpsw-trigger {
	background: none !important;
	border: none !important;
	cursor: pointer;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: currentColor !important;
	transition: color 0.3s ease;
	outline: none;
	line-height: 1;
	text-decoration: none;
}

.lpsw-trigger:hover {
	color: #0066cc;
}

.lpsw-trigger:focus {
	outline: 2px solid #0066cc;
	outline-offset: 2px;
}

/* Trigger icon */
.lpsw-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.lpsw-icon svg {
	width: 25px;
	height: 25px;
	stroke: currentColor;
	fill: none;
}
