/* PSB Product Search widget + modal */

/* ── Search container ───────────────────────────────────────────────────── */

.psb-search {
	position: relative;
	width: 100%;
	margin-top: 30px;
}

.psb-search__bar {
	display: flex;
	align-items: center;
	position: relative;
}

.psb-search__input {
	width: 100%;
	height: 50px;
	padding: 0 2.5rem 0 1rem;
	font-size: 1rem;
	line-height: 1.5;
	color: inherit;
	background: #fff;
	border: none;
	border-radius: 8px !important;
	outline: none;
	box-shadow: 0px 0px 0px 1px #CBD5E0;
	transition: box-shadow 0.15s;
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
}

.psb-search__input:focus {
	box-shadow: 0px 0px 0px 2px var(--e-global-color-primary, #1a56db);
}

/* hide native × in WebKit */
.psb-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.psb-search__clear {
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem !important;
    height: 1.5rem !important;
    padding: 0 !important;
    font-size: 1.125rem !important;
    line-height: 1px;
    color: #e74c3c !important;
    background: transparent;
    border: 1px solid #e74c3c !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: background-color 0.15s !important;
}

.psb-search__clear:hover,
.psb-search-modal__close:hover {
	background: #e74c3c !important;
	color: #fff !important;
}

.psb-search__clear[hidden] {
	display: none;
}

.psb-search__spinner {
	position: absolute;
	right: 0.625rem;
	top: 50%;
	width: 1.125rem;
	height: 1.125rem;
	border: 2px solid #CBD5E0;
	border-top-color: var(--e-global-color-primary, #1a56db);
	border-radius: 50%;
	animation: psb-spin 0.7s linear infinite;
	pointer-events: none;
}

.psb-search__spinner[hidden] {
	display: none;
}

@keyframes psb-spin {
	from { transform: translateY(-50%) rotate(0deg); }
	to   { transform: translateY(-50%) rotate(360deg); }
}

/* ── Dropdown ───────────────────────────────────────────────────────────── */

.psb-search__dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 9999;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	max-height: 420px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.psb-search__section-label {
	padding: 0.5rem 1rem 0.25rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #9ca3af;
	border-top: 1px solid #f3f4f6;
}

.psb-search__section-label:first-child {
	border-top: none;
}

.psb-search__result {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.625rem 1rem;
	font-size: 0.9375rem;
	color: #111827;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.1s;
}

.psb-search__result:hover,
.psb-search__result--focused {
	background: #f9fafb;
	color: var(--e-global-color-primary, #1a56db);
}

.psb-search__result--product::before {
	content: '';
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M20 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2Z'/%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M16 7V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
}

.psb-search__result--category::before {
	content: '';
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M3 9h18M3 15h18M12 3v18'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: contain;
}

.psb-search__result-name {
	flex: 1;
}

.psb-search__result-count {
	flex-shrink: 0;
	font-size: 0.8125rem;
	color: #9ca3af;
}

.psb-search__view-all {
	display: block;
	padding: 0.75rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--e-global-color-primary, #1a56db);
	text-decoration: none;
	text-align: center;
	border-top: 1px solid #f3f4f6;
	background: #f9fafb;
	border-radius: 0 0 8px 8px;
	transition: background-color 0.1s;
}

.psb-search__view-all:hover {
	background: #f3f4f6;
}

.psb-search__no-results {
	padding: 1rem;
	font-size: 0.9375rem;
	color: #6b7280;
	text-align: center;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.psb-search-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
}

.psb-search-modal--open {
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.psb-search-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.psb-search-modal__panel {
	position: relative;
	z-index: 1;
	width: min(640px, calc(100vw - 2rem));
	margin-top: 55px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	padding: 1.25rem;
}

.psb-search-modal__panel .psb-search__dropdown {
	position: static;
	border-radius: 8px;
	margin-top: 0.5rem;
	box-shadow: unset;
}

.psb-search-modal__close {
	position: absolute;
    top: 0.75rem;
    right: 1.25rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 2rem  !important;
    height: 2rem;
    padding: 0 !important;
    font-size: 1.25rem !important;
    line-height: 1;
    color: var(--e-global-color-secondary, #6b7280) !important;
    background: transparent;
    border: none !important;
    cursor: pointer !important;
}

body.psb-search-modal-open {
	overflow: hidden;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
	.psb-search {
		margin-top: 0;
	}

	.psb-search-modal__panel {
		width: calc(100vw - 1rem);
		margin-top: 2rem;
		padding: 1rem;
	}
}
