/* ==========================================================================
   WC Live Search - default theme
   Override any of these variables in your theme's CSS (child theme /
   Customizer "Additional CSS") to match your site's styling.
   ========================================================================== */
:root {
	--wcls-primary: #243978;      /* navy button */
	--wcls-primary-hover: #1a2b5c;
	--wcls-text: #1a1a1a;
	--wcls-muted: #8a8f98;
	--wcls-border: #c9cdd6;
	--wcls-bg: #ffffff;
	--wcls-bg-hover: #f7f8fa;
	--wcls-radius: 22px;          /* pill shape */
	--wcls-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
	--wcls-font: inherit;
	--wcls-max-width: 320px;
	--wcls-height: 40px;
}

/* ---- Search bar (single pill: input + fused navy button) ---- */
.wcls-wrapper {
	position: relative;
	width: 100%;
	max-width: var(--wcls-max-width);
	font-family: var(--wcls-font);
}

.wcls-form {
	position: relative;
}

.wcls-pill {
	display: flex;
	align-items: stretch;
	height: var(--wcls-height);
	border: 1px solid var(--wcls-border);
	border-radius: var(--wcls-radius);
	background: var(--wcls-bg);
	overflow: hidden; /* clips the button into a fused pill */
	transition: border-color 0.15s ease;
}

.wcls-pill:focus-within {
	border-color: var(--wcls-primary);
}

.wcls-input {
	flex: 1;
	min-width: 0;
	padding: 0 14px;
	font-size: 14px;
	line-height: 1;
	color: var(--wcls-text);
	background: transparent;
	border: none;
	outline: none;
}

.wcls-input::placeholder {
	color: var(--wcls-muted);
}

.wcls-submit {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	padding: 0;
	background: var(--wcls-primary);
	border: none;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.wcls-submit:hover {
	background: var(--wcls-primary-hover);
}

/* ---- Suggestions dropdown ---- */
.wcls-suggestions {
	position: absolute;
	z-index: 9999;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	max-height: 420px;
	overflow-y: auto;
	background: var(--wcls-bg);
	border: 1px solid var(--wcls-border);
	border-radius: var(--wcls-radius);
	box-shadow: var(--wcls-shadow);
}

.wcls-suggestion-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	text-decoration: none;
	color: var(--wcls-text);
	border-bottom: 1px solid var(--wcls-border);
}

.wcls-suggestion-item:last-of-type {
	border-bottom: none;
}

.wcls-suggestion-item:hover,
.wcls-suggestion-item.is-active {
	background: var(--wcls-bg-hover);
}

.wcls-suggestion-img {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	background: var(--wcls-bg-hover);
}

.wcls-suggestion-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wcls-suggestion-name {
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wcls-suggestion-meta {
	display: flex;
	gap: 8px;
	font-size: 12px;
	color: var(--wcls-muted);
}

.wcls-suggestion-price {
	flex-shrink: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--wcls-primary);
	white-space: nowrap;
}

.wcls-no-suggestions {
	padding: 14px;
	text-align: center;
	color: var(--wcls-muted);
	font-size: 14px;
}

.wcls-view-all {
	display: block;
	width: 100%;
	padding: 10px 12px;
	background: var(--wcls-bg-hover);
	border: none;
	border-top: 1px solid var(--wcls-border);
	color: var(--wcls-primary);
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	border-radius: 0 0 var(--wcls-radius) var(--wcls-radius);
}

.wcls-view-all:hover {
	background: var(--wcls-border);
}

/* ---- Modal ---- */
.wcls-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 5vh 16px;
}

body.wcls-modal-open {
	overflow: hidden;
}

.wcls-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.wcls-modal-content {
	position: relative;
	width: 100%;
	max-width: 960px;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	background: var(--wcls-bg);
	border-radius: 12px;
	box-shadow: var(--wcls-shadow);
	overflow: hidden;
}

.wcls-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--wcls-border);
}

.wcls-modal-title {
	margin: 0;
	font-size: 17px;
	font-weight: 600;
	color: var(--wcls-text);
}

.wcls-modal-close {
	background: transparent;
	border: none;
	font-size: 24px;
	line-height: 1;
	color: var(--wcls-muted);
	cursor: pointer;
	padding: 4px 8px;
}

.wcls-modal-close:hover {
	color: var(--wcls-text);
}

.wcls-modal-body {
	padding: 20px;
	overflow-y: auto;
}

.wcls-modal-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 18px;
}

.wcls-modal-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--wcls-border);
	border-radius: var(--wcls-radius);
	overflow: hidden;
	transition: box-shadow 0.15s ease;
}

.wcls-modal-card:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.wcls-modal-card-img-link {
	display: block;
	aspect-ratio: 1 / 1;
	background: var(--wcls-bg-hover);
}

.wcls-modal-card-img-link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wcls-modal-card-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 10px 12px 14px;
}

.wcls-modal-card-title {
	font-size: 14px;
	font-weight: 500;
	color: var(--wcls-text);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wcls-modal-card-price {
	font-size: 14px;
	font-weight: 600;
	color: var(--wcls-primary);
}

.wcls-modal-card-btn {
	margin-top: 4px;
	display: inline-block;
	padding: 8px 12px;
	text-align: center;
	background: var(--wcls-primary);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 6px;
	transition: background 0.15s ease;
}

.wcls-modal-card-btn:hover {
	background: var(--wcls-primary-hover);
	color: #fff;
}

.wcls-loading,
.wcls-no-results {
	text-align: center;
	color: var(--wcls-muted);
	padding: 40px 0;
	grid-column: 1 / -1;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
	.wcls-wrapper {
		max-width: 100%;
	}

	.wcls-modal {
		padding: 0;
	}

	.wcls-modal-content {
		max-height: 100vh;
		height: 100%;
		border-radius: 0;
	}

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