/* ==========================================================================
   WP Fast Search — styles
   Palette: deep clinical teal + warm amber accent used sparingly.
   Layout uses logical properties (inset-inline-*, margin-inline-*) so the
   whole UI mirrors correctly for RTL (Arabic) and LTR sites automatically.
   ========================================================================== */

:root {
	--wfs-primary: #0b7285;
	--wfs-primary-dark: #075a68;
	--wfs-primary-light: #e6f5f6;
	--wfs-accent: #d4a017;
	--wfs-bg: #ffffff;
	--wfs-surface: #f6fafa;
	--wfs-text: #142a2e;
	--wfs-text-muted: #62797e;
	--wfs-border: #e1edee;
	--wfs-shadow: 0 20px 60px -15px rgba(11, 114, 133, 0.35);
	--wfs-radius: 18px;
	--wfs-font: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
}

#wfs-overlay,
#wfs-overlay * {
	box-sizing: border-box;
	font-family: var(--wfs-font);
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* ---------- Floating action button ---------- */

.wfs-fab {
	position: fixed;
	inset-block-end: 100px;
	inset-inline-end: 32px;
	z-index: 99998;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	background: var(--wfs-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 10px 30px -8px rgba(11, 114, 133, 0.55);
	transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
	font-family: var(--wfs-font);
}

.wfs-fab:hover {
	background: var(--wfs-primary-dark);
	transform: translateY(-3px);
	box-shadow: 0 16px 34px -8px rgba(11, 114, 133, 0.6);
}

.wfs-fab:focus-visible {
	outline: 3px solid var(--wfs-accent);
	outline-offset: 3px;
}

.wfs-fab-icon {
	position: relative;
	z-index: 2;
}

.wfs-fab-ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--wfs-primary);
	opacity: 0;
	animation: wfs-sonar 2.6s ease-out infinite;
}

.wfs-fab-ring-delay {
	animation-delay: 1.3s;
}

@keyframes wfs-sonar {
	0% {
		transform: scale(1);
		opacity: 0.55;
	}
	100% {
		transform: scale(1.9);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wfs-fab-ring {
		animation: none;
		display: none;
	}
}

.wfs-fab.is-open .wfs-fab-icon {
	transform: rotate(90deg);
}

/* ---------- Overlay & modal shell ---------- */

.wfs-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(9, 33, 38, 0.55);
	backdrop-filter: blur(3px);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 8vh 16px 16px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.wfs-overlay[hidden] {
	display: none;
}

.wfs-overlay.is-visible {
	opacity: 1;
}

.wfs-modal {
	width: 100%;
	max-width: 620px;
	max-height: 78vh;
	background: var(--wfs-bg);
	border-radius: var(--wfs-radius);
	box-shadow: var(--wfs-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform: translateY(-14px) scale(0.97);
	opacity: 0;
	transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.22s ease;
}

.wfs-overlay.is-visible .wfs-modal {
	transform: translateY(0) scale(1);
	opacity: 1;
}

/* ---------- Search input row ---------- */

.wfs-modal-top {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 20px 12px;
	flex-shrink: 0;
}

.wfs-search-box {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--wfs-surface);
	border: 1px solid var(--wfs-border);
	border-radius: 12px;
	padding: 12px 14px;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.wfs-search-box:focus-within {
	border-color: var(--wfs-primary);
	box-shadow: 0 0 0 3px var(--wfs-primary-light);
}

.wfs-search-box-icon {
	color: var(--wfs-text-muted);
	flex-shrink: 0;
}

#wfs-input {
	flex: 1;
	border: none;
	background: transparent;
	outline: none;
	font-size: 16px;
	font-weight: 500;
	color: var(--wfs-text);
}

#wfs-input::placeholder {
	color: var(--wfs-text-muted);
	font-weight: 400;
}

.wfs-clear {
	border: none;
	background: none;
	color: var(--wfs-text-muted);
	cursor: pointer;
	padding: 2px;
	display: flex;
	border-radius: 50%;
}

.wfs-clear:hover {
	color: var(--wfs-text);
}

.wfs-close {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: 10px;
	border: 1px solid var(--wfs-border);
	background: var(--wfs-bg);
	color: var(--wfs-text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.18s ease, color 0.18s ease;
}

.wfs-close:hover {
	background: var(--wfs-surface);
	color: var(--wfs-text);
}

/* ---------- Signature ECG / pulse divider ---------- */

.wfs-pulse-divider {
	height: 20px;
	padding: 0 20px;
	flex-shrink: 0;
	opacity: 0.9;
}

.wfs-pulse-divider svg {
	width: 100%;
	height: 100%;
	overflow: visible;
}

.wfs-pulse-path {
	stroke: var(--wfs-primary);
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 420;
	stroke-dashoffset: 420;
}

.wfs-overlay.is-visible .wfs-pulse-path {
	animation: wfs-draw 0.9s ease-out 0.15s forwards;
}

@keyframes wfs-draw {
	to {
		stroke-dashoffset: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wfs-pulse-path {
		stroke-dashoffset: 0;
		animation: none;
	}
}

/* ---------- Tabs ---------- */

.wfs-tabs {
	display: flex;
	gap: 6px;
	padding: 4px 20px 14px;
	flex-shrink: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.wfs-tabs::-webkit-scrollbar {
	display: none;
}

.wfs-tab {
	flex-shrink: 0;
	border: 1px solid var(--wfs-border);
	background: var(--wfs-bg);
	color: var(--wfs-text-muted);
	font-size: 13.5px;
	font-weight: 500;
	padding: 7px 16px;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.16s ease;
}

.wfs-tab:hover {
	border-color: var(--wfs-primary);
	color: var(--wfs-primary);
}

.wfs-tab.is-active {
	background: var(--wfs-primary);
	border-color: var(--wfs-primary);
	color: #fff;
}

/* ---------- Results ---------- */

.wfs-results {
	flex: 1;
	overflow-y: auto;
	padding: 0 12px 12px;
}

.wfs-hint {
	padding: 40px 20px;
	text-align: center;
	color: var(--wfs-text-muted);
	font-size: 14.5px;
}

.wfs-section {
	margin-bottom: 6px;
}

.wfs-section-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 8px 4px;
}

.wfs-section-label {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--wfs-primary);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.wfs-section-count {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--wfs-primary);
	background: var(--wfs-primary-light);
	border-radius: 999px;
	min-width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 6px;
}

.wfs-result-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wfs-result-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 8px;
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
	transition: background 0.14s ease;
}

.wfs-result-item.is-active .wfs-result-link,
.wfs-result-link:hover {
	background: var(--wfs-surface);
}

.wfs-result-media {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--wfs-primary-light);
	color: var(--wfs-primary);
	display: flex;
	align-items: center;
	justify-content: center;
}

.wfs-result-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wfs-result-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wfs-result-title {
	font-size: 14.5px;
	font-weight: 600;
	color: var(--wfs-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wfs-result-title mark {
	background: transparent;
	color: var(--wfs-primary);
	font-weight: 800;
}

.wfs-result-subtitle {
	font-size: 12.5px;
	color: var(--wfs-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wfs-result-arrow {
	flex-shrink: 0;
	color: var(--wfs-text-muted);
	transform: scaleX(var(--wfs-flip, 1));
}
[dir="rtl"] .wfs-result-arrow svg {
	transform: rotate(180deg);
}

/* ---------- Empty state ---------- */

.wfs-empty {
	padding: 36px 20px;
	text-align: center;
	color: var(--wfs-text-muted);
}

.wfs-empty-icon {
	display: inline-flex;
	color: var(--wfs-primary);
	opacity: 0.55;
	margin-bottom: 10px;
}

.wfs-empty-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--wfs-text);
	margin: 0 0 4px;
}

.wfs-empty-hint {
	font-size: 13px;
	margin: 0;
}

/* ---------- Footer hint bar ---------- */

.wfs-footer {
	flex-shrink: 0;
	display: flex;
	gap: 16px;
	padding: 10px 20px;
	border-top: 1px solid var(--wfs-border);
	background: var(--wfs-surface);
}

.wfs-kbd-hint {
	display: none;
	align-items: center;
	gap: 4px;
	font-size: 11.5px;
	color: var(--wfs-text-muted);
}

.wfs-kbd-hint kbd {
	font-family: inherit;
	background: var(--wfs-bg);
	border: 1px solid var(--wfs-border);
	border-radius: 5px;
	padding: 1px 6px;
	font-size: 11px;
}

/* Loading state: subtle pulse on the results area */
.wfs-results.is-loading {
	opacity: 0.55;
	pointer-events: none;
}

/* ---------- Responsive ---------- */

@media (min-width: 640px) {
	.wfs-kbd-hint {
		display: inline-flex;
	}
}

@media (max-width: 639px) {
	.wfs-fab {
		width: 52px;
		height: 52px;
		inset-block-end: 103px;
		inset-inline-end: 20px;
	}

	.wfs-overlay {
		padding: 0;
		align-items: stretch;
	}

	.wfs-modal {
		max-width: none;
		max-height: none;
		height: 100dvh;
		border-radius: 0;
	}

	.wfs-modal-top {
		padding-top: max(14px, env(safe-area-inset-top));
	}

	.wfs-footer {
		padding-bottom: max(10px, env(safe-area-inset-bottom));
	}
}

/* Lock body scroll while modal is open (class toggled via JS) */
body.wfs-no-scroll {
	overflow: hidden;
}
