@@ -1143,10 +1143,10 @@ const categoryColors: Record<string, string> = {
11431143 </section >
11441144
11451145 <!-- Calculators Section with Category Filter -->
1146- <section class =" relative px-6 py-6" id =" calculators" >
1146+ <section class =" relative px-6 py-3 md:py- 6" id =" calculators" >
11471147 <div class =" max-w-7xl mx-auto" >
1148- <!-- Search Bar and Currency Selector -->
1149- <div class =" max-w-2xl mx-auto mb-5" >
1148+ <!-- Search Bar and Currency Selector - Hidden on mobile (search is in header) - ->
1149+ <div class =" max-w-2xl mx-auto mb-5 hidden md:block " >
11501150 <div class =" flex items-center gap-3" >
11511151 <div class =" relative flex-1" >
11521152 <svg class =" absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--color-muted)]" fill =" none" stroke =" currentColor" viewBox =" 0 0 24 24" >
@@ -1174,6 +1174,10 @@ const categoryColors: Record<string, string> = {
11741174 <HomepageCurrencySelector client:idle />
11751175 </div >
11761176 </div >
1177+ <!-- Mobile Currency Selector (search is in header) -->
1178+ <div class =" flex justify-end mb-3 md:hidden" >
1179+ <HomepageCurrencySelector client:idle />
1180+ </div >
11771181
11781182 <!-- Recent Section (hidden by default, shown via JS) -->
11791183 <div id =" recently-used-section" class =" hidden mb-5" >
@@ -1462,6 +1466,7 @@ const categoryColors: Record<string, string> = {
14621466 const calculatorCards = document.querySelectorAll('.calculator-card');
14631467 const emptyState = document.getElementById('empty-state');
14641468 const searchInput = document.getElementById('search-input') as HTMLInputElement;
1469+ const headerSearchInput = document.getElementById('header-search-input') as HTMLInputElement;
14651470 const clearSearch = document.getElementById('clear-search');
14661471 const favoritesFilter = document.getElementById('favorites-filter');
14671472 const recentlyUsedSection = document.getElementById('recently-used-section');
@@ -1506,10 +1511,13 @@ const categoryColors: Record<string, string> = {
15061511 // Reset active filter badge
15071512 activeFilterBadge?.classList.add('hidden');
15081513
1509- // Clear search input
1514+ // Clear search inputs (desktop and header)
15101515 if (searchInput) {
15111516 searchInput.value = '';
15121517 }
1518+ if (headerSearchInput) {
1519+ headerSearchInput.value = '';
1520+ }
15131521 clearSearch?.classList.add('hidden');
15141522
15151523 // Show all calculator cards
@@ -1893,23 +1901,28 @@ const categoryColors: Record<string, string> = {
18931901 });
18941902 } );
18951903
1896- // Search functionality
1897- searchInput?.addEventListener('input', () => {
1898- currentSearch = searchInput . value ;
1904+ // Search functionality - sync both desktop and header (mobile) search inputs
1905+ function handleSearch(value: string) {
1906+ currentSearch = value ;
18991907 filterCards ();
19001908
1909+ // Sync both inputs
1910+ if (searchInput && searchInput .value !== value ) searchInput .value = value ;
1911+ if (headerSearchInput && headerSearchInput .value !== value ) headerSearchInput .value = value ;
1912+
19011913 // Show/hide clear button
19021914 if (clearSearch ) {
19031915 clearSearch .classList .toggle (' hidden' , ! currentSearch );
19041916 }
1905- } );
1917+ }
1918+
1919+ searchInput?.addEventListener('input', () => handleSearch(searchInput.value));
1920+ headerSearchInput?.addEventListener('input', () => handleSearch(headerSearchInput.value));
19061921
19071922 clearSearch?.addEventListener('click', () => {
1923+ handleSearch (' ' );
19081924 if (searchInput ) {
1909- searchInput .value = ' ' ;
1910- currentSearch = ' ' ;
1911- filterCards ();
1912- clearSearch .classList .add (' hidden' );
1925+ clearSearch ?.classList .add (' hidden' );
19131926 searchInput .focus ();
19141927 }
19151928 } );
0 commit comments