search.less 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. /*
  2. * SearXNG, A privacy-respecting, hackable metasearch engine
  3. */
  4. #search {
  5. padding: 0;
  6. margin: 0;
  7. }
  8. #search_header {
  9. padding-top: 1.5em;
  10. .ltr-padding-right(2em);
  11. .ltr-padding-left(@results-offset - 3rem);
  12. margin: 0;
  13. background: var(--color-header-background);
  14. border-bottom: 1px solid var(--color-header-border);
  15. display: grid;
  16. column-gap: 1.2rem;
  17. row-gap: 1rem;
  18. grid-template-columns: 3rem 1fr;
  19. grid-template-areas:
  20. "logo search"
  21. "spacer categories";
  22. }
  23. .category_checkbox,
  24. .category_button {
  25. display: inline-block;
  26. position: relative;
  27. .ltr-margin-right(1rem);
  28. padding: 0;
  29. }
  30. .category_checkbox {
  31. input {
  32. display: none;
  33. }
  34. label {
  35. svg {
  36. padding-right: 0.2rem;
  37. }
  38. cursor: pointer;
  39. padding: 0.2rem 0;
  40. display: inline-flex;
  41. text-transform: capitalize;
  42. font-size: 0.9em;
  43. border-bottom: 2px solid transparent;
  44. .disable-user-select;
  45. div.category_name {
  46. margin: auto 0;
  47. }
  48. }
  49. input[type="checkbox"]:checked + label {
  50. color: var(--color-categories-item-selected-font);
  51. border-bottom: 2px solid var(--color-categories-item-border-selected);
  52. }
  53. }
  54. button.category_button {
  55. background-color: inherit;
  56. color: var(--color-base-font);
  57. cursor: pointer;
  58. padding: 0.2rem 0;
  59. display: inline-flex;
  60. align-items: center;
  61. text-transform: capitalize;
  62. font-size: 0.9em;
  63. border: none;
  64. border-bottom: 2px solid transparent;
  65. svg {
  66. padding-right: 0.2rem;
  67. }
  68. &.selected,
  69. &:active,
  70. &:focus-within {
  71. color: var(--color-categories-item-selected-font);
  72. border-bottom: 2px solid var(--color-categories-item-border-selected);
  73. }
  74. }
  75. #categories_container:has(button.category_button:focus-within) button.category_button.selected {
  76. color: var(--color-base-font);
  77. border-bottom: none;
  78. }
  79. #search_logo {
  80. padding: 0.5rem 10px 0 10px;
  81. grid-area: logo;
  82. display: flex;
  83. align-items: center;
  84. justify-content: center;
  85. svg {
  86. flex: 1;
  87. width: 30px;
  88. height: 30px;
  89. margin: 0.5rem 0 auto 0;
  90. }
  91. }
  92. .search_categories {
  93. grid-area: categories;
  94. .help {
  95. display: none;
  96. }
  97. &:hover .help {
  98. display: block;
  99. position: absolute;
  100. background: var(--color-base-background);
  101. padding: 1rem 0.6rem 0.6rem 0;
  102. z-index: 1000;
  103. width: 100%;
  104. left: -0.1rem;
  105. }
  106. }
  107. #search_view {
  108. padding: 0.5rem 0.3rem 0 0.5rem;
  109. grid-area: search;
  110. body.results_endpoint & {
  111. padding: 0.5rem 2.8rem 0 0;
  112. }
  113. }
  114. .search_box {
  115. border-radius: 0.8rem;
  116. width: @search-width;
  117. display: inline-flex;
  118. flex-direction: row;
  119. white-space: nowrap;
  120. box-shadow: var(--color-search-shadow);
  121. }
  122. #clear_search {
  123. display: block;
  124. border-collapse: separate;
  125. box-sizing: border-box;
  126. width: 1.8rem;
  127. margin: 0;
  128. padding: 0.8rem 0.2rem;
  129. background: none repeat scroll 0 0 var(--color-search-background);
  130. border: none;
  131. outline: none;
  132. color: var(--color-search-font);
  133. font-size: 1.1rem;
  134. z-index: 10000;
  135. &:hover {
  136. color: var(--color-search-background-hover);
  137. }
  138. &.empty * {
  139. display: none;
  140. }
  141. }
  142. html.no-js #clear_search.hide_if_nojs {
  143. display: none;
  144. }
  145. #q,
  146. #send_search {
  147. display: block;
  148. margin: 0;
  149. padding: 0.8rem;
  150. background: none repeat scroll 0 0 var(--color-search-background);
  151. border: none;
  152. outline: none;
  153. color: var(--color-search-font);
  154. font-size: 1.1rem;
  155. z-index: 2;
  156. }
  157. #q {
  158. width: 100%;
  159. .ltr-padding-left(1rem);
  160. .ltr-padding-right(0) !important;
  161. .ltr-rounded-left-corners(0.8rem);
  162. }
  163. #q::-ms-clear,
  164. #q::-webkit-search-cancel-button {
  165. display: none;
  166. }
  167. #send_search {
  168. .ltr-rounded-right-corners(0.8rem);
  169. &:hover {
  170. cursor: pointer;
  171. background-color: var(--color-search-background-hover);
  172. color: var(--color-search-background);
  173. }
  174. }
  175. .no-js #clear_search,
  176. .no-js #send_search {
  177. width: auto !important;
  178. .ltr-border-left(1px solid var(--color-search-border));
  179. }
  180. .search_filters {
  181. margin-top: 0.6rem;
  182. .ltr-margin-right(0);
  183. margin-bottom: 0;
  184. .ltr-margin-left(@results-offset + 0.6rem);
  185. display: flex;
  186. overflow-x: auto;
  187. overscroll-behavior-inline: contain;
  188. select {
  189. background-color: inherit;
  190. &:hover,
  191. &:focus {
  192. color: var(--color-base-font);
  193. }
  194. }
  195. }
  196. @media screen and (max-width: @tablet) {
  197. #search_header {
  198. padding: 1.5em @results-tablet-offset 0 @results-tablet-offset;
  199. column-gap: @results-tablet-offset;
  200. }
  201. .search_filters {
  202. margin-top: 0.6rem;
  203. .ltr-margin-right(0);
  204. margin-bottom: 0;
  205. .ltr-margin-left(@results-tablet-offset + 3rem);
  206. }
  207. #categories {
  208. font-size: 90%;
  209. clear: both;
  210. }
  211. }
  212. @media screen and (max-width: @tablet) and (hover: none) {
  213. #main_index,
  214. #main_results {
  215. #categories_container {
  216. width: max-content;
  217. .category_checkbox {
  218. display: inline-block;
  219. width: auto;
  220. }
  221. }
  222. #categories {
  223. width: 100%;
  224. .ltr-text-align-left();
  225. overflow-x: scroll;
  226. overflow-y: hidden;
  227. -webkit-overflow-scrolling: touch;
  228. }
  229. }
  230. }
  231. @media screen and (max-width: @phone) {
  232. #search_header {
  233. width: 100%;
  234. margin: 0;
  235. padding: 0.1rem 0 0 0;
  236. column-gap: 0;
  237. row-gap: 0;
  238. grid-template-areas:
  239. "logo search"
  240. "categories categories";
  241. }
  242. .search_logo {
  243. padding: 0;
  244. }
  245. .search_box {
  246. width: 98%;
  247. display: flex;
  248. }
  249. #q {
  250. width: 100%;
  251. flex: 1;
  252. }
  253. .search_filters {
  254. margin: 0 10px;
  255. padding: 0.5rem 0;
  256. }
  257. .category {
  258. display: inline-block;
  259. width: auto;
  260. margin: 0;
  261. svg {
  262. display: none;
  263. }
  264. }
  265. .category_checkbox {
  266. label {
  267. padding: 1rem !important;
  268. margin: 0 !important;
  269. }
  270. }
  271. .category_button {
  272. padding: 1rem !important;
  273. margin: 0 !important;
  274. }
  275. #search_view:focus-within {
  276. display: block;
  277. background-color: var(--color-search-background);
  278. position: absolute;
  279. top: 0;
  280. height: 100%;
  281. width: 100%;
  282. z-index: 10000;
  283. .search_box {
  284. border-bottom: 1px solid var(--color-search-border);
  285. width: 100%;
  286. border-radius: 0;
  287. box-shadow: none;
  288. #send_search {
  289. .ltr-margin-right(0) !important; // Delete when send_search button is disabled on mobile.
  290. }
  291. * {
  292. border: none;
  293. border-radius: 0;
  294. box-shadow: none;
  295. }
  296. }
  297. }
  298. #main_results #q:placeholder-shown ~ #send_search {
  299. .ltr-margin-right(2.6rem);
  300. transition: margin 0.1s;
  301. }
  302. }
  303. @media screen and (max-width: @ultra-small-phone) {
  304. #search_header {
  305. grid-template-areas:
  306. "search search"
  307. "categories categories";
  308. }
  309. #search_logo {
  310. display: none;
  311. }
  312. }
  313. #categories {
  314. .disable-user-select;
  315. &::-webkit-scrollbar {
  316. width: 0;
  317. height: 0;
  318. }
  319. }
  320. #categories_container {
  321. position: relative;
  322. }