/* ============================================================
   VOID THEME — A mythic, voidlike search experience
   Appended to SearXNG's compiled CSS at container start.
   ============================================================ */

/* ── Deep space background ── */
html, body {
  background: #05050A !important;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(45, 27, 105, 0.15), transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(15, 23, 42, 0.25), transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(88, 28, 135, 0.08), transparent 70%),
    #05050A;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 30% 65%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 50% 10%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 40%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 90% 15%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 15% 80%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1.5px 1.5px at 45% 45%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 60% 85%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 85% 55%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 5% 45%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 25% 35%, rgba(200, 180, 255, 0.5), transparent),
    radial-gradient(1px 1px at 35% 90%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 55% 25%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 75% 70%, rgba(200, 180, 255, 0.4), transparent),
    radial-gradient(1px 1px at 95% 30%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 8% 72%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 42% 8%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 65% 50%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 88% 88%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 20% 55%, rgba(200, 180, 255, 0.3), transparent);
  background-size: 100% 100%;
  pointer-events: none;
  animation: voidDrift 120s linear infinite;
}

@keyframes voidDrift {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  50% { opacity: 0.8; }
  100% { transform: translate(2%, 1%) rotate(1deg); opacity: 1; }
}

/* Nebula aurora animation */
#main_index::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  z-index: -1;
  background:
    radial-gradient(ellipse 40% 30% at 30% 40%, rgba(108, 63, 201, 0.06), transparent 60%),
    radial-gradient(ellipse 30% 40% at 70% 60%, rgba(59, 130, 246, 0.05), transparent 60%),
    radial-gradient(ellipse 20% 20% at 50% 50%, rgba(168, 85, 247, 0.04), transparent 50%);
  animation: nebulaPulse 15s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes nebulaPulse {
  0% { transform: scale(1) translate(0, 0); opacity: 0.6; }
  50% { transform: scale(1.1) translate(-1%, 1%); opacity: 1; }
  100% { transform: scale(1) translate(1%, -1%); opacity: 0.6; }
}

/* ── Override base theme colors ── */
:root {
  --color-base-font: #e2dff0 !important;
  --color-base-background: transparent !important;
  --color-base-background-mobile: transparent !important;
  --color-url-font: #8bb4ff !important;
  --color-url-visited-font: #c084fc !important;
  --color-header-background: transparent !important;
  --color-header-border: transparent !important;
  --color-footer-background: transparent !important;
  --color-footer-border: transparent !important;
  --color-search-border: rgba(108, 63, 201, 0.25) !important;
  --color-search-shadow: 0 4px 30px rgba(108, 63, 201, 0.15) !important;
  --color-search-background: rgba(255, 255, 255, 0.04) !important;
  --color-search-font: #e2dff0 !important;
  --color-search-background-hover: rgba(108, 63, 201, 0.15) !important;
  --color-btn-background: rgba(108, 63, 201, 0.3) !important;
  --color-btn-font: #e2dff0 !important;
  --color-result-background: rgba(255, 255, 255, 0.03) !important;
  --color-result-border: rgba(108, 63, 201, 0.1) !important;
  --color-result-vim-selected: rgba(108, 63, 201, 0.08) !important;
  --color-result-vim-arrow: #7c4dff !important;
  --color-result-link-font: #8bb4ff !important;
  --color-result-link-font-highlight: #a5c8ff !important;
  --color-result-link-visited-font: #c084fc !important;
  --color-result-url-font: rgba(200, 180, 255, 0.6) !important;
  --color-result-description-highlight-font: #c084fc !important;
  --color-result-engines-font: rgba(200, 180, 255, 0.5) !important;
  --color-result-publishdate-font: rgba(200, 180, 255, 0.4) !important;
  --color-result-search-url-border: rgba(108, 63, 201, 0.15) !important;
  --color-result-search-url-font: rgba(200, 180, 255, 0.6) !important;
  --color-result-image-background: rgba(255, 255, 255, 0.02) !important;
  --color-sidebar-background: rgba(255, 255, 255, 0.02) !important;
  --color-sidebar-border: rgba(108, 63, 201, 0.1) !important;
  --color-sidebar-font: #e2dff0 !important;
  --color-settings-tr-hover: rgba(108, 63, 201, 0.08) !important;
  --color-settings-engine-description-font: rgba(200, 180, 255, 0.5) !important;
  --color-settings-table-group-background: rgba(255, 255, 255, 0.02) !important;
  --color-autocomplete-background: rgba(10, 10, 22, 0.95) !important;
  --color-autocomplete-font: #e2dff0 !important;
  --color-autocomplete-border: rgba(108, 63, 201, 0.2) !important;
  --color-autocomplete-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  --color-autocomplete-background-hover: rgba(108, 63, 201, 0.15) !important;
  --color-result-detail-background: rgba(10, 10, 22, 0.98) !important;
  --color-result-detail-font: #e2dff0 !important;
  --color-result-detail-label-font: rgba(200, 180, 255, 0.5) !important;
  --color-result-detail-hr: rgba(108, 63, 201, 0.15) !important;
  --color-result-detail-link: #8bb4ff !important;
  --color-categories-item-selected-font: #7c4dff !important;
  --color-categories-item-border-selected: rgba(108, 63, 201, 0.3) !important;
  --color-toolkit-dialog-background: rgba(10, 10, 22, 0.98) !important;
  --color-toolkit-dialog-border: rgba(108, 63, 201, 0.15) !important;
  --color-answer-background: rgba(255, 255, 255, 0.03) !important;
  --color-answer-font: #e2dff0 !important;
  --color-backtotop-background: rgba(108, 63, 201, 0.15) !important;
  --color-backtotop-font: #e2dff0 !important;
  --color-backtotop-border: rgba(108, 63, 201, 0.2) !important;
  --color-favicon-background-color: rgba(255, 255, 255, 0.05) !important;
  --color-favicon-border-color: rgba(108, 63, 201, 0.1) !important;
  --color-header-border: transparent !important;
}

/* ── Index page: center the search bar ── */
#main_index {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0 1rem;
  margin-top: 0 !important;
}

#main_index .index {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Search form styling ── */
#search {
  margin: 0;
}

.index #search,
.index #search_header,
.index #search_view {
  background: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0;
}

.index #search::before,
.index #search::after,
.index #search_header::before,
.index #search_header::after,
.index #search_view::before,
.index #search_view::after {
  display: none !important;
  content: none !important;
}

main,
main::before,
main::after {
  border: none !important;
  outline: none !important;
}

.autocomplete:not(.open) {
  display: none !important;
}

.search_box {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: none !important;
  outline: none !important;
  border-radius: 16px;
  padding: 4px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search_box:focus-within {
  box-shadow:
    0 0 40px rgba(108, 63, 201, 0.12),
    0 0 80px rgba(59, 130, 246, 0.06);
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.01);
}

#q {
  background: transparent !important;
  border: none !important;
  color: #e2dff0 !important;
  font-size: 1.1rem !important;
  padding: 14px 50px 14px 20px !important;
  height: auto !important;
  box-shadow: none !important;
  letter-spacing: 0.01em;
}

#q::placeholder {
  color: rgba(200, 180, 255, 0.35) !important;
  font-weight: 300;
  letter-spacing: 0.02em;
}

#q:focus {
  outline: none !important;
}

#send_search {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(108, 63, 201, 0.4), rgba(59, 130, 246, 0.3)) !important;
  border: 1px solid rgba(108, 63, 201, 0.2) !important;
  border-radius: 10px !important;
  color: #e2dff0 !important;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0 !important;
  margin: 0 !important;
}

#send_search:hover {
  background: linear-gradient(135deg, rgba(108, 63, 201, 0.6), rgba(59, 130, 246, 0.4)) !important;
  box-shadow: 0 0 20px rgba(108, 63, 201, 0.3);
  transform: translateY(-50%) scale(1.05);
}

#send_search svg,
#send_search .icon {
  fill: #e2dff0;
  width: 18px;
  height: 18px;
}

#clear_search {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  background: none !important;
  border: none !important;
  color: rgba(200, 180, 255, 0.4) !important;
  padding: 6px !important;
  cursor: pointer;
  transition: all 0.3s ease;
}

#clear_search:hover {
  color: rgba(200, 180, 255, 0.8) !important;
}

/* ── Autocomplete ── */
.autocomplete {
  border: 1px solid rgba(108, 63, 201, 0.2) !important;
  border-radius: 12px !important;
  margin-top: 8px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
  overflow: hidden;
}

.autocomplete li {
  padding: 10px 16px !important;
  transition: background 0.2s ease;
}

/* ── Results page ── */
#main_results {
  padding-top: 0;
}

/* ── Result cards ── */
article.result {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(108, 63, 201, 0.08) !important;
  border-radius: 12px !important;
  margin: 0.5rem 0 !important;
  padding: 1rem 1.25rem !important;
  transition: all 0.3s ease !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

article.result:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(108, 63, 201, 0.2) !important;
  box-shadow: 0 4px 20px rgba(108, 63, 201, 0.08);
  transform: translateY(-1px);
}

article.result[data-vim-selected] {
  background: rgba(108, 63, 201, 0.08) !important;
  border-color: rgba(108, 63, 201, 0.3) !important;
}

.result .url {
  color: rgba(200, 180, 255, 0.5) !important;
  font-size: 0.8rem !important;
}

.result h3 a {
  color: #8bb4ff !important;
  transition: color 0.2s ease;
}

.result h3 a:visited {
  color: #c084fc !important;
}

.result h3 a:hover {
  color: #a5c8ff !important;
  text-decoration: none !important;
}

.result .content {
  color: rgba(226, 223, 240, 0.75) !important;
}

.result .engine {
  color: rgba(200, 180, 255, 0.4) !important;
  font-size: 0.75rem !important;
}

.result .published_date {
  color: rgba(200, 180, 255, 0.35) !important;
  font-size: 0.75rem !important;
}

.result .engines {
  color: rgba(200, 180, 255, 0.4) !important;
}

.result .highlight {
  color: #c084fc !important;
}

/* ── Sidebar on results ── */
#sidebar {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(108, 63, 201, 0.08) !important;
  border-radius: 12px !important;
  padding: 1rem !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#sidebar section {
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  padding: 0.5rem 0 !important;
}

#sidebar h1,
#sidebar h2,
#sidebar h3,
#sidebar h4 {
  color: #e2dff0 !important;
}

#sidebar .infobox dl {
  color: rgba(226, 223, 240, 0.7) !important;
}

/* ── Image results ── */
article.result-images {
  border: 1px solid rgba(108, 63, 201, 0.08) !important;
  border-radius: 8px !important;
  overflow: hidden;
  transition: all 0.3s ease !important;
}

article.result-images:hover {
  border-color: rgba(108, 63, 201, 0.3) !important;
  box-shadow: 0 4px 20px rgba(108, 63, 201, 0.1);
}

article.result-images img {
  transition: transform 0.4s ease;
}

article.result-images:hover img {
  transform: scale(1.03);
}

/* ── Pagination ── */
#pagination {
  margin: 2rem 0 !important;
}

#pagination a {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(108, 63, 201, 0.15) !important;
  border-radius: 8px !important;
  color: #8bb4ff !important;
  padding: 0.5rem 1rem !important;
  transition: all 0.3s ease !important;
}

#pagination a:hover {
  background: rgba(108, 63, 201, 0.15) !important;
  border-color: rgba(108, 63, 201, 0.3) !important;
  box-shadow: 0 0 15px rgba(108, 63, 201, 0.1);
}

/* ── Categories / Search filters ── */
#categories {
  margin: 0.5rem 0 !important;
}

#categories .category {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(108, 63, 201, 0.1) !important;
  border-radius: 8px !important;
  padding: 0.3rem 0.8rem !important;
  color: rgba(200, 180, 255, 0.6) !important;
  transition: all 0.3s ease !important;
  font-size: 0.8rem !important;
}

#categories .category.selected {
  background: rgba(108, 63, 201, 0.15) !important;
  border-color: rgba(108, 63, 201, 0.3) !important;
  color: #7c4dff !important;
}

#categories .category:hover {
  background: rgba(108, 63, 201, 0.1) !important;
  border-color: rgba(108, 63, 201, 0.2) !important;
}

/* Search filters row */
.search_filters select,
.search_filters .filter_select {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(108, 63, 201, 0.15) !important;
  border-radius: 8px !important;
  color: rgba(200, 180, 255, 0.7) !important;
  padding: 0.35rem 0.8rem !important;
  font-size: 0.8rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  max-width: 12rem !important;
}

.search_filters select:hover,
.search_filters .filter_select:hover {
  background: rgba(108, 63, 201, 0.1) !important;
  border-color: rgba(108, 63, 201, 0.25) !important;
}

/* ── Preferences page ── */
#main_preferences {
  padding: 2rem 1rem;
}

#main_preferences .preferences_title {
  color: #e2dff0 !important;
}

#main_preferences fieldset {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(108, 63, 201, 0.1) !important;
  border-radius: 12px !important;
}

#main_preferences legend {
  color: #c084fc !important;
}

#main_preferences table tr:hover {
  background: rgba(108, 63, 201, 0.05) !important;
}

#main_preferences input[type="text"],
#main_preferences input[type="url"],
#main_preferences input[type="search"],
#main_preferences select,
#main_preferences textarea {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(108, 63, 201, 0.15) !important;
  border-radius: 8px !important;
  color: #e2dff0 !important;
}

#main_preferences input[type="submit"],
#main_preferences button {
  background: linear-gradient(135deg, rgba(108, 63, 201, 0.4), rgba(59, 130, 246, 0.3)) !important;
  border: 1px solid rgba(108, 63, 201, 0.2) !important;
  border-radius: 8px !important;
  color: #e2dff0 !important;
  padding: 0.5rem 1.5rem !important;
  cursor: pointer;
  transition: all 0.3s ease;
}

#main_preferences input[type="submit"]:hover,
#main_preferences button:hover {
  background: linear-gradient(135deg, rgba(108, 63, 201, 0.6), rgba(59, 130, 246, 0.4)) !important;
  box-shadow: 0 0 15px rgba(108, 63, 201, 0.2);
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #05050A;
}

::-webkit-scrollbar-thumb {
  background: rgba(108, 63, 201, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 63, 201, 0.5);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 63, 201, 0.3) #05050A;
}

/* ── Selection color ── */
::selection {
  background: rgba(108, 63, 201, 0.3);
  color: #e2dff0;
}

/* ── Loading indicator ── */
.loading {
  background: linear-gradient(90deg, transparent, rgba(108, 63, 201, 0.1), transparent) !important;
}

/* ── Responsive adjustments ── */
@media (max-width: 50em) {
  #main_index {
    padding: 0 0.75rem;
  }

  .search_box {
    border-radius: 12px;
  }

  #q {
    font-size: 1rem !important;
    padding: 12px 44px 12px 16px !important;
  }

  #send_search {
    width: 34px;
    height: 34px;
  }

  #send_search svg {
    width: 16px;
    height: 16px;
  }
}

/* ── Fade-in page load ── */
main {
  animation: voidFadeIn 0.6s ease-out;
}

@keyframes voidFadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
