/**
 * Floating AJAX Search - front-end styles.
 * Dynamic colors/sizes are supplied via CSS custom properties
 * (see class-fas-plugin.php) with sensible fallbacks below.
 */

:root {
	--fas-btn-bg: #cc0000;
	--fas-btn-hover-bg: #ffffff;
	--fas-btn-text: #ffffff;
	--fas-popup-width: 700px;
	--fas-radius: 999px;
	--fas-transition: 0.3s ease;
}

/* ----------------------------------------------------------------
 * Floating Button
 * ---------------------------------------------------------------- */
.fas-floating-btn {
	position: fixed;
	top: 180px;
	left: 0;
	z-index: 9998;

	display: flex;
	align-items: center;
	gap: 8px;

	padding: 12px 20px 12px 16px;
	border: 1px solid transparent;
	border-radius: 0 999px 999px 0;

	background-color: var(--fas-btn-bg);
	color: var(--fas-btn-text);

	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;

	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	transition: all 0.3s ease;
}

.fas-floating-btn .fas-btn-icon {
	display: inline-flex;
	color: var(--fas-btn-text);
	transition: color var(--fas-transition);
}

.fas-floating-btn:hover,
.fas-floating-btn:focus-visible {
	background-color: var(--fas-btn-hover-bg);
	border-color: var(--fas-btn-bg);
	color: var(--fas-btn-bg);
	outline: none;
}

.fas-floating-btn:hover .fas-btn-icon,
.fas-floating-btn:focus-visible .fas-btn-icon {
	color: var(--fas-btn-bg);
}

/* Keep clear of the WP admin bar for logged-in users. */
body.admin-bar .fas-floating-btn {
	top: calc(180px + 32px);
}

/* Tablet position (mobile breakpoint below overrides this). */
@media (max-width: 1024px) {
	.fas-floating-btn {
		top: 170px;
	}

	body.admin-bar .fas-floating-btn {
		top: calc(170px + 32px);
	}
}

/* ----------------------------------------------------------------
 * Overlay + Popup
 * ---------------------------------------------------------------- */
.fas-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;

	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	padding: 20px;
}

.fas-search-overlay.is-active {
	opacity: 1;
	visibility: visible;
}

.fas-search-popup {
	position: relative;
	z-index: 100000;
	width: var(--fas-popup-width);
	max-width: 700px;
	background: #ffffff;
	border-radius: 18px;
	padding: 30px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);

	opacity: 0;
	transform: scale(0.96);
	transition: opacity 0.28s ease, transform 0.28s ease;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
}

.fas-search-overlay.is-active .fas-search-popup {
	opacity: 1;
	transform: scale(1);
}

@media (max-width: 1024px) {
	.fas-search-popup {
		width: 90%;
	}
}

@media (max-width: 600px) {
	.fas-search-popup {
		width: 95%;
		padding: 22px;
	}
}

/* ----------------------------------------------------------------
 * Close Button
 * ---------------------------------------------------------------- */
.fas-popup-close {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 9999;

	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;

	background: transparent;
	border: none;
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;

	color: #000000;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: 0.25s ease;
}

.fas-popup-close:hover,
.fas-popup-close:focus,
.fas-popup-close:focus-visible,
.fas-popup-close:active {
	background: transparent;
	border: none;
	box-shadow: none;
	outline: none;
	color: #cc0000;
	transform: rotate(90deg);
}

/* ----------------------------------------------------------------
 * Search Input
 * ---------------------------------------------------------------- */
.fas-search-input-wrap {
	margin-bottom: 18px;
	margin-top: 30px;
}

.fas-search-input {
	width: 100%;
	font-size: 18px;
	padding: 14px 20px;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	outline: none;
	box-sizing: border-box;
	transition: border-color var(--fas-transition);
}

.fas-search-input:focus {
	border-color: var(--fas-btn-bg, #cc0000);
}

/* ----------------------------------------------------------------
 * Loader
 * ---------------------------------------------------------------- */
.fas-search-loader {
	display: flex;
	justify-content: center;
	padding: 14px 0;
}

.fas-loader-spinner {
	width: 22px;
	height: 22px;
	border: 3px solid #eeeeee;
	border-top-color: var(--fas-btn-bg, #cc0000);
	border-radius: 50%;
	animation: fas-spin 0.7s linear infinite;
	display: inline-block;
}

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

/* ----------------------------------------------------------------
 * Results
 * ---------------------------------------------------------------- */
.fas-search-results {
	overflow-y: auto;
	max-height: 400px;
}

.fas-results-heading {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #888888;
	margin: 4px 0 10px;
}

.fas-result-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px;
	border-radius: 10px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.fas-result-item:hover,
.fas-result-item:focus-visible {
	background-color: #f7f7f7;
	outline: none;
}

.fas-result-image {
	width: 70px;
	height: 70px;
	min-width: 70px;
	border-radius: 10px;
	object-fit: cover;
	background: #f2f2f2;
}

.fas-result-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.fas-result-title {
	color: #000000;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	transition: color var(--fas-transition);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.fas-result-item:hover .fas-result-title,
.fas-result-item:focus-visible .fas-result-title {
	color: var(--fas-btn-bg, #cc0000);
}

.fas-result-price {
	color: #000000;
	font-size: 13px;
}

.fas-result-price ins {
	text-decoration: none;
}

.fas-view-all-btn {
	display: block;
	box-sizing: border-box;
	width: calc(100% - 40px);
	margin: 16px auto 4px;
	padding: 14px 28px;
	border: 1px solid transparent;
	border-radius: 999px;

	background-color: #cc0000;
	color: #ffffff;
	font-weight: 600;
	font-size: 15px;
	text-align: center;
	text-decoration: none;
	cursor: pointer;

	transition: 0.3s ease;
}

.fas-view-all-btn:hover,
.fas-view-all-btn:focus-visible {
	background-color: #ffffff;
	border-color: #cc0000;
	color: #cc0000;
	outline: none;
}

.fas-highlight {
	color: var(--fas-btn-bg, #cc0000);
	font-weight: 700;
}

.fas-empty-state {
	text-align: center;
	color: #888888;
	padding: 30px 10px;
	font-size: 15px;
}

/* ----------------------------------------------------------------
 * Mobile positioning for the floating button
 * ---------------------------------------------------------------- */
@media (max-width: 782px) {
	.fas-floating-btn {
		top: auto;
		bottom: 90px;
		left: 15px;
		transform: none;
		padding: 10px 16px 10px 12px;
		font-size: 13px;
	}

	body.admin-bar .fas-floating-btn {
		top: auto;
		bottom: 90px;
	}
}
