/* ===========================================================
   Smart Search Popup – styles
   Mimics Doofinder popup layout (popular searches + product carousel)
   =========================================================== */

:root {
	--ssp-brand: #39D03A;
	--ssp-brand-hover: #2CB52D;
	--ssp-brand-dark: #0F1A3D;
	--ssp-text: #0F1A3D;
	--ssp-muted: #555;
	--ssp-border: #e6e6e6;
	--ssp-bg: #ffffff;
	--ssp-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Overlay */
.ssp-overlay {
	position: fixed;
	top: var(--ssp-header-offset, 0);
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.35);
	z-index: 99998;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 8px 16px 16px;
	overflow-y: auto;
}
.ssp-overlay.is-open {
	display: flex;
}

/* Modal box */
.ssp-modal {
	position: relative;
	width: 100%;
	max-width: 1300px;
	background: var(--ssp-bg);
	border-radius: 4px;
	box-shadow: var(--ssp-shadow);
	border-top: 4px solid var(--ssp-brand);
	animation: ssp-fade 0.18s ease-out;
}
@keyframes ssp-fade {
	from { opacity: 0; transform: translateY(-8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Close button — clear hit area, always above content */
.ssp-close {
	position: absolute;
	top: 14px;
	right: 18px;
	width: 36px;
	height: 36px;
	background: transparent;
	border: 0;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	color: #6b7280;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	z-index: 10;
	transition: background 0.15s, color 0.15s;
}
.ssp-close:hover {
	background: #f3f4f6;
	color: #111;
}

/* Body grid: popular left, products right */
.ssp-body {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 32px;
	padding: 40px 32px 24px;
}

.ssp-heading {
	font-size: 17px;
	font-weight: 700;
	color: var(--ssp-text);
	margin: 0 0 18px;
	font-family: inherit;
}

/* Popular searches list */
.ssp-popular-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.ssp-popular-list li {
	padding: 6px 0;
	cursor: pointer;
	color: var(--ssp-muted);
	font-size: 15px;
	transition: color 0.15s;
}
.ssp-popular-list li:hover {
	color: var(--ssp-brand);
}

/* Products section */
.ssp-products {
	position: relative;
	min-width: 0; /* allow grid item to shrink */
}

/* Carousel */
.ssp-carousel-wrap {
	position: relative;
	display: flex;
	align-items: center;
}
.ssp-carousel {
	flex: 1;
	overflow: hidden;
}
.ssp-track {
	display: flex;
	gap: 16px;
	transition: transform 0.35s ease;
}

/* Arrows */
.ssp-arrow {
	flex: 0 0 auto;
	background: none;
	border: 0;
	font-size: 24px;
	color: var(--ssp-brand);
	cursor: pointer;
	padding: 8px 12px;
	user-select: none;
}
.ssp-arrow:disabled {
	color: #ccc;
	cursor: default;
}

/* Product card */
.ssp-card {
	flex: 0 0 calc(25% - 12px);
	min-width: 0;
	border: 1px solid var(--ssp-border);
	border-radius: 4px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	background: #fff;
	transition: box-shadow 0.18s;
}
.ssp-card:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.ssp-card-image {
	display: block;
	aspect-ratio: 1 / 1;
	width: 100%;
	margin-bottom: 14px;
	overflow: hidden;
}
.ssp-card-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.ssp-card-title {
	font-size: 14px;
	line-height: 1.4;
	color: var(--ssp-text);
	margin: 0 0 14px;
	text-decoration: none;
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ssp-card-title:hover {
	color: var(--ssp-brand);
}
.ssp-card-price {
	font-size: 16px;
	font-weight: 700;
	color: var(--ssp-text);
	margin: 0 0 14px;
}
.ssp-card-price .ssp-vat {
	font-size: 11px;
	font-weight: 500;
	color: var(--ssp-muted);
	margin-left: 4px;
	text-transform: uppercase;
}
.ssp-card-price del {
	color: var(--ssp-muted);
	font-weight: 400;
	margin-right: 6px;
}
.ssp-add-btn {
	background: var(--ssp-brand);
	color: var(--ssp-brand-dark);
	border: 0;
	padding: 12px;
	font-size: 14px;
	font-weight: 700;
	border-radius: 3px;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	display: block;
	transition: background 0.15s;
	font-family: inherit;
}
.ssp-add-btn:hover {
	background: var(--ssp-brand-hover);
	color: var(--ssp-brand-dark);
}
.ssp-add-btn.is-loading {
	opacity: 0.6;
	cursor: wait;
}
.ssp-add-btn.is-added {
	background: #2e7d32;
}

/* States */
.ssp-loading, .ssp-empty {
	padding: 40px;
	text-align: center;
	color: var(--ssp-muted);
}

/* Footer brand */
.ssp-footer-brand {
	text-align: right;
	padding: 8px 24px 16px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	color: #999;
}

/* Body scroll lock */
body.ssp-locked {
	overflow: hidden;
}

/* [smart_search] shortcode form (Builders Megastore header style) */
.ssp-search-form {
	display: flex;
	align-items: center;
	background: rgba(255, 255, 255, 0.12);
	border-radius: 999px;
	padding: 4px 8px 4px 20px;
	width: 100%;
	max-width: 720px;
	margin: 0 auto;
}
.ssp-search-form input[type="search"] {
	flex: 1;
	background: transparent;
	border: 0;
	outline: 0;
	color: #fff;
	font-size: 16px;
	padding: 12px 8px;
	min-width: 0;
	box-shadow: none;
}
.ssp-search-form input[type="search"]::placeholder {
	color: rgba(255, 255, 255, 0.7);
}
.ssp-search-form button {
	background: transparent;
	border: 0;
	color: var(--ssp-brand);
	cursor: pointer;
	padding: 8px 12px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ssp-search-form button:hover {
	color: #fff;
}

/* Mobile */
@media (max-width: 768px) {
	.ssp-overlay {
		padding: 16px;
	}
	.ssp-body {
		grid-template-columns: 1fr;
		gap: 24px;
		padding: 32px 16px 16px;
	}
	.ssp-popular {
		order: 2;
	}
	.ssp-products {
		order: 1;
	}
	.ssp-card {
		flex: 0 0 calc(50% - 8px);
	}
	.ssp-card-title { font-size: 13px; }
}

@media (max-width: 480px) {
	.ssp-card {
		flex: 0 0 calc(80% - 8px);
	}
}
