/* ==========================================================================
   Leafy Server Theme for SearXNG
   Aesthetic aligned with https://leafyserver.tech (leafy-info Next.js design)
   Fully responsive across mobile, tablet, desktop, and large displays.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Light Mode Color Variables
   -------------------------------------------------------------------------- */
:root {
  --color-base-background: #f8faf7;
  --color-base-background-mobile: #f8faf7;
  --color-base-font: #16231c;
  --color-base-font-rgb: 22, 35, 28;

  --color-url-font: #047857;
  --color-url-visited-font: #065f46;

  --color-header-background: rgba(248, 250, 247, 0.92);
  --color-header-border: #e2e8f0;
  --color-footer-background: transparent;
  --color-footer-border: #e2e8f0;

  --color-sidebar-border: #e2e8f0;
  --color-sidebar-font: #16231c;
  --color-sidebar-background: #ffffff;

  --color-backtotop-font: #059669;
  --color-backtotop-border: #cbd5e1;
  --color-backtotop-background: #ffffff;

  --color-btn-background: #10b981;
  --color-btn-font: #ffffff;
  --color-show-btn-background: #e2e8f0;
  --color-show-btn-font: #16231c;

  --color-search-border: #cbd5e1;
  --color-search-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
  --color-search-background: #ffffff;
  --color-search-font: #16231c;
  --color-search-background-hover: #10b981;

  --color-error: #ef4444;
  --color-error-background: #fef2f2;
  --color-warning: #f59e0b;
  --color-warning-background: #fffbeb;
  --color-success: #10b981;
  --color-success-background: #ecfdf5;

  --color-categories-item-selected-font: #059669;
  --color-categories-item-border-selected: #10b981;
  --color-categories-item-selected: rgba(16, 185, 129, 0.12);

  --color-autocomplete-font: #16231c;
  --color-autocomplete-border: #e2e8f0;
  --color-autocomplete-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --color-autocomplete-background: #ffffff;
  --color-autocomplete-background-hover: #f1f5f9;

  --color-answer-font: #16231c;
  --color-answer-background: #ffffff;

  --color-result-background: #ffffff;
  --color-result-border: #e2e8f0;
  --color-result-url-font: #059669;
  --color-result-vim-selected: #ecfdf5;
  --color-result-vim-arrow: #10b981;
  --color-result-description-highlight-font: #047857;
  --color-result-link-font: #047857;
  --color-result-link-font-highlight: #065f46;
  --color-result-link-visited-font: #047857;
  --color-result-publishdate-font: #64748b;
  --color-result-engines-font: #059669;
  --color-result-search-url-border: #cbd5e1;
  --color-result-search-url-font: #059669;
  --color-result-image-span-font: #16231c;
  --color-result-image-span-font-selected: #ffffff;
  --color-result-image-background: #ffffff;

  --color-settings-tr-hover: #f1f5f9;
  --color-settings-engine-description-font: #64748b;
  --color-toolkit-badge-background: rgba(16, 185, 129, 0.12);
  --color-toolkit-badge-font: #047857;
  --color-toolkit-kbd-background: #f1f5f9;
  --color-toolkit-kbd-font: #16231c;
  --color-toolkit-dialog-background: #ffffff;
  --color-toolkit-dialog-border: #cbd5e1;
  --color-toolkit-select-background: #ffffff;
  --color-toolkit-select-background-hover: #f8fafc;
  --color-toolkit-select-border: #cbd5e1;
}

/* --------------------------------------------------------------------------
   Dark Mode Color Variables
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root.theme-auto, html.theme-auto {
    --color-base-background: #0a0f0c;
    --color-base-background-mobile: #0a0f0c;
    --color-base-font: #eef5ef;
    --color-base-font-rgb: 238, 245, 239;

    --color-url-font: #4ade80;
    --color-url-visited-font: #86efac;

    --color-header-background: rgba(10, 15, 12, 0.92);
    --color-header-border: rgba(255, 255, 255, 0.08);
    --color-footer-background: transparent;
    --color-footer-border: rgba(255, 255, 255, 0.08);

    --color-sidebar-border: rgba(255, 255, 255, 0.08);
    --color-sidebar-font: #eef5ef;
    --color-sidebar-background: rgba(255, 255, 255, 0.02);

    --color-backtotop-font: #4ade80;
    --color-backtotop-border: rgba(255, 255, 255, 0.12);
    --color-backtotop-background: #111a14;

    --color-btn-background: #10b981;
    --color-btn-font: #ffffff;
    --color-show-btn-background: rgba(255, 255, 255, 0.08);
    --color-show-btn-font: #eef5ef;

    --color-search-border: rgba(255, 255, 255, 0.12);
    --color-search-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --color-search-background: rgba(255, 255, 255, 0.04);
    --color-search-font: #eef5ef;
    --color-search-background-hover: #10b981;

    --color-error: #f87171;
    --color-error-background: #2b1212;
    --color-warning: #fbbf24;
    --color-warning-background: #2b2310;
    --color-success: #34d399;
    --color-success-background: #0f291e;

    --color-categories-item-selected-font: #4ade80;
    --color-categories-item-border-selected: #10b981;
    --color-categories-item-selected: rgba(16, 185, 129, 0.18);

    --color-autocomplete-font: #eef5ef;
    --color-autocomplete-border: rgba(255, 255, 255, 0.12);
    --color-autocomplete-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
    --color-autocomplete-background: #101913;
    --color-autocomplete-background-hover: rgba(255, 255, 255, 0.08);

    --color-answer-font: #eef5ef;
    --color-answer-background: rgba(255, 255, 255, 0.03);

    --color-result-background: rgba(255, 255, 255, 0.02);
    --color-result-border: rgba(255, 255, 255, 0.06);
    --color-result-url-font: #22c55e;
    --color-result-vim-selected: rgba(16, 185, 129, 0.1);
    --color-result-vim-arrow: #4ade80;
    --color-result-description-highlight-font: #4ade80;
    --color-result-link-font: #4ade80;
    --color-result-link-font-highlight: #86efac;
    --color-result-link-visited-font: #86efac;
    --color-result-publishdate-font: #94a3b8;
    --color-result-engines-font: #34d399;
    --color-result-search-url-border: rgba(255, 255, 255, 0.1);
    --color-result-search-url-font: #22c55e;
    --color-result-image-span-font: #eef5ef;
    --color-result-image-span-font-selected: #ffffff;
    --color-result-image-background: #101913;

    --color-settings-tr-hover: rgba(255, 255, 255, 0.04);
    --color-settings-engine-description-font: #94a3b8;
    --color-toolkit-badge-background: rgba(16, 185, 129, 0.15);
    --color-toolkit-badge-font: #4ade80;
    --color-toolkit-kbd-background: rgba(255, 255, 255, 0.06);
    --color-toolkit-kbd-font: #eef5ef;
    --color-toolkit-dialog-background: #101913;
    --color-toolkit-dialog-border: rgba(255, 255, 255, 0.12);
    --color-toolkit-select-background: #101913;
    --color-toolkit-select-background-hover: #16241c;
    --color-toolkit-select-border: rgba(255, 255, 255, 0.12);
  }
}

:root.theme-dark, html.theme-dark {
  --color-base-background: #0a0f0c;
  --color-base-background-mobile: #0a0f0c;
  --color-base-font: #eef5ef;
  --color-base-font-rgb: 238, 245, 239;

  --color-url-font: #4ade80;
  --color-url-visited-font: #86efac;

  --color-header-background: rgba(10, 15, 12, 0.92);
  --color-header-border: rgba(255, 255, 255, 0.08);
  --color-footer-background: transparent;
  --color-footer-border: rgba(255, 255, 255, 0.08);

  --color-sidebar-border: rgba(255, 255, 255, 0.08);
  --color-sidebar-font: #eef5ef;
  --color-sidebar-background: rgba(255, 255, 255, 0.02);

  --color-backtotop-font: #4ade80;
  --color-backtotop-border: rgba(255, 255, 255, 0.12);
  --color-backtotop-background: #111a14;

  --color-btn-background: #10b981;
  --color-btn-font: #ffffff;
  --color-show-btn-background: rgba(255, 255, 255, 0.08);
  --color-show-btn-font: #eef5ef;

  --color-search-border: rgba(255, 255, 255, 0.12);
  --color-search-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --color-search-background: rgba(255, 255, 255, 0.04);
  --color-search-font: #eef5ef;
  --color-search-background-hover: #10b981;

  --color-error: #f87171;
  --color-error-background: #2b1212;
  --color-warning: #fbbf24;
  --color-warning-background: #2b2310;
  --color-success: #34d399;
  --color-success-background: #0f291e;

  --color-categories-item-selected-font: #4ade80;
  --color-categories-item-border-selected: #10b981;
  --color-categories-item-selected: rgba(16, 185, 129, 0.18);

  --color-autocomplete-font: #eef5ef;
  --color-autocomplete-border: rgba(255, 255, 255, 0.12);
  --color-autocomplete-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
  --color-autocomplete-background: #101913;
  --color-autocomplete-background-hover: rgba(255, 255, 255, 0.08);

  --color-answer-font: #eef5ef;
  --color-answer-background: rgba(255, 255, 255, 0.03);

  --color-result-background: rgba(255, 255, 255, 0.02);
  --color-result-border: rgba(255, 255, 255, 0.06);
  --color-result-url-font: #22c55e;
  --color-result-vim-selected: rgba(16, 185, 129, 0.1);
  --color-result-vim-arrow: #4ade80;
  --color-result-description-highlight-font: #4ade80;
  --color-result-link-font: #4ade80;
  --color-result-link-font-highlight: #86efac;
  --color-result-link-visited-font: #86efac;
  --color-result-publishdate-font: #94a3b8;
  --color-result-engines-font: #34d399;
  --color-result-search-url-border: rgba(255, 255, 255, 0.1);
  --color-result-search-url-font: #22c55e;
  --color-result-image-span-font: #eef5ef;
  --color-result-image-span-font-selected: #ffffff;
  --color-result-image-background: #101913;

  --color-settings-tr-hover: rgba(255, 255, 255, 0.04);
  --color-settings-engine-description-font: #94a3b8;
  --color-toolkit-badge-background: rgba(16, 185, 129, 0.15);
  --color-toolkit-badge-font: #4ade80;
  --color-toolkit-kbd-background: rgba(255, 255, 255, 0.06);
  --color-toolkit-kbd-font: #eef5ef;
  --color-toolkit-dialog-background: #101913;
  --color-toolkit-dialog-border: rgba(255, 255, 255, 0.12);
  --color-toolkit-select-background: #101913;
  --color-toolkit-select-background-hover: #16241c;
  --color-toolkit-select-border: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   Global Layout & Ambient Glow
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  position: relative;
  background-color: var(--color-base-background);
  color: var(--color-base-font);
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

.leafy-ambient-glow {
  position: fixed;
  inset-x: 0;
  top: 0;
  left: 0;
  right: 0;
  height: 520px;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 75% 380px at 50% 0%, rgba(16, 185, 129, 0.22), transparent 70%);
}

@media (prefers-color-scheme: dark) {
  html.theme-auto .leafy-ambient-glow {
    background: radial-gradient(ellipse 75% 380px at 50% 0%, rgba(16, 185, 129, 0.15), transparent 70%);
  }
}

html.theme-dark .leafy-ambient-glow {
  background: radial-gradient(ellipse 75% 380px at 50% 0%, rgba(16, 185, 129, 0.15), transparent 70%);
}

/* --------------------------------------------------------------------------
   Top Navigation Links & Buttons
   -------------------------------------------------------------------------- */
#links_on_top {
  position: absolute !important;
  top: 1.25rem !important;
  right: 1.5rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  z-index: 1000 !important;
}

#links_on_top a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.45rem !important;
  height: 2.25rem !important;
  padding: 0 0.9rem !important;
  border-radius: 9999px !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  color: var(--color-base-font) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--color-search-border) !important;
  backdrop-filter: blur(8px) !important;
  transition: all 0.15s ease !important;
}

#links_on_top a svg {
  width: 1.1rem !important;
  height: 1.1rem !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

#links_on_top a:hover {
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  background: rgba(16, 185, 129, 0.1) !important;
  transform: translateY(-1px) !important;
}

.leafy-nav-logo-svg {
  width: 1.15rem !important;
  height: 1.15rem !important;
}

/* Responsive Top Navigation */
@media screen and (max-width: 50em) {
  #main_index #links_on_top {
    top: 0.85rem !important;
    right: 0.85rem !important;
    gap: 0.4rem !important;
  }
  #main_index #links_on_top a {
    height: 2.1rem !important;
    padding: 0 0.75rem !important;
  }
  #main_index #links_on_top a span {
    display: none !important;
  }

  body.results_endpoint #links_on_top {
    display: none !important; /* Neutralize overlap on results page on mobile */
  }
}

/* --------------------------------------------------------------------------
   Front Page Hero (index.html)
   -------------------------------------------------------------------------- */
#main_index {
  margin-top: 12vh !important;
  position: relative !important;
  z-index: 1 !important;
}

.index.leafy-index {
  max-width: 44rem !important;
  margin: 0 auto !important;
  padding: 0 1.25rem !important;
  text-align: center !important;
}

.leafy-hero {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  margin-bottom: 2rem !important;
}

.leafy-logo-link {
  display: inline-block !important;
  cursor: pointer !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.leafy-logo-link:hover {
  transform: scale(1.08) translateY(-2px) !important;
}

.leafy-logo-hero {
  width: 70px !important;
  height: 70px !important;
  filter: drop-shadow(0 6px 16px rgba(16, 185, 129, 0.22)) !important;
}

.leafy-tagline {
  margin: 1.25rem 0 0.35rem 0 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.03em !important;
  color: #10b981 !important;
}

.leafy-title {
  margin: 0.1rem 0 0.6rem 0 !important;
  font-size: 2.85rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em !important;
  color: var(--color-base-font) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.65rem !important;
}

.leafy-badge {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  letter-spacing: normal !important;
  padding: 0.2rem 0.65rem !important;
  border-radius: 9999px !important;
  background: rgba(16, 185, 129, 0.14) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.32) !important;
}

.leafy-subtitle {
  margin: 0 auto 0.5rem auto !important;
  font-size: 0.95rem !important;
  line-height: 1.55 !important;
  color: #64748b !important;
  max-width: 32rem !important;
}

@media (prefers-color-scheme: dark) {
  html.theme-auto .leafy-subtitle {
    color: #94a3b8 !important;
  }
}
html.theme-dark .leafy-subtitle {
  color: #94a3b8 !important;
}

@media screen and (max-width: 50em) {
  #main_index {
    margin-top: 8vh !important;
  }
  .leafy-title {
    font-size: 2.25rem !important;
  }
  .leafy-logo-hero {
    width: 58px !important;
    height: 58px !important;
  }
}

/* --------------------------------------------------------------------------
   Search Box & Internal Buttons (All Screens)
   -------------------------------------------------------------------------- */
#search_view {
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}

body.results_endpoint #search_view {
  padding: 0 !important;
}

body.index_endpoint #search_header {
  display: block !important;
  background: transparent !important;
  border-bottom: none !important;
  padding: 0 !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

body.index_endpoint #search_view {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  padding: 0 !important;
}

body.index_endpoint .search_box {
  margin: 0 auto !important;
}

.search_box {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 44rem !important;
  height: 3.15rem !important;
  min-height: 3.15rem !important;
  border-radius: 9999px !important;
  border: 1px solid var(--color-search-border) !important;
  background: var(--color-search-background) !important;
  box-shadow: var(--color-search-shadow) !important;
  backdrop-filter: blur(14px) !important;
  position: relative !important;
  box-sizing: border-box !important;
  padding: 0 !important;
  overflow: hidden !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.search_box:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22), 0 8px 30px rgba(0, 0, 0, 0.2) !important;
}

#q {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  height: 100% !important;
  padding: 0 1.25rem !important;
  font-size: 1rem !important; /* 16px to prevent iOS Safari auto-zoom */
  line-height: normal !important;
  color: var(--color-search-font) !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-sizing: border-box !important;
  border-radius: 0 !important;
}

#q::placeholder {
  color: #94a3b8 !important;
  opacity: 0.8 !important;
}

/* Clear Button */
#clear_search {
  flex: 0 0 2.5rem !important;
  width: 2.5rem !important;
  height: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  transition: color 0.15s ease !important;
}

#clear_search:hover {
  color: #ef4444 !important;
}

#clear_search svg {
  width: 1.15rem !important;
  height: 1.15rem !important;
  display: block !important;
}

#q:placeholder-shown ~ #clear_search {
  display: none !important;
}

/* Search Submit Button */
#send_search {
  flex: 0 0 3.25rem !important;
  width: 3.25rem !important;
  height: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  margin-right: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #10b981 !important;
  cursor: pointer !important;
  border-radius: 0 !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}

/* Neutralize SearXNG margin-right jump */
#main_results #q:placeholder-shown ~ #send_search,
#search_view:focus-within .search_box #send_search {
  margin-right: 0 !important;
  transition: none !important;
}

#send_search:hover {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #059669 !important;
}

@media (prefers-color-scheme: dark) {
  html.theme-auto #send_search:hover {
    color: #34d399 !important;
  }
}
html.theme-dark #send_search:hover {
  color: #34d399 !important;
}

#send_search svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  display: block !important;
}

/* --------------------------------------------------------------------------
   Header Grid on Results Page (Desktop vs Mobile)
   -------------------------------------------------------------------------- */
body.results_endpoint #search_header {
  position: relative !important;
  z-index: 10 !important;
  background: var(--color-header-background) !important;
  border-bottom: 1px solid var(--color-header-border) !important;
  backdrop-filter: blur(14px) !important;
  display: grid !important;
  grid-template-columns: max-content 1fr !important;
  grid-template-areas:
    "logo search"
    "spacer categories" !important;
  column-gap: 1.25rem !important;
  row-gap: 0.6rem !important;
  padding: 1.25rem 2rem 0.6rem 4rem !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

#search_logo {
  grid-area: logo !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  text-decoration: none !important;
  height: 3.15rem !important;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform 0.2s ease !important;
}

#search_logo:hover {
  transform: scale(1.03) !important;
}

#search_logo svg,
.leafy-brand-logo-svg {
  width: 32px !important;
  height: 32px !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.leafy-nav-brand {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em !important;
  color: #10b981 !important;
  white-space: nowrap !important;
}

/* Mobile & Tablet Header (< 800px) */
@media screen and (max-width: 50em) {
  body.results_endpoint #search_header {
    grid-template-columns: 2.75rem 1fr !important;
    grid-template-areas:
      "logo search"
      "categories categories" !important;
    column-gap: 0.5rem !important;
    row-gap: 0.45rem !important;
    padding: 0.65rem 0.85rem 0.45rem 0.85rem !important;
    width: 100% !important;
  }

  #search_logo {
    height: 2.75rem !important;
    width: 2.75rem !important;
    justify-content: center !important;
  }

  #search_logo .leafy-nav-brand {
    display: none !important; /* Hide brand text on mobile so search input gets maximum width */
  }

  #search_logo svg,
  .leafy-brand-logo-svg {
    width: 28px !important;
    height: 28px !important;
  }

  .search_box {
    height: 2.75rem !important;
    min-height: 2.75rem !important;
    max-width: 100% !important;
  }

  #q {
    padding: 0 0.85rem !important;
    font-size: 1rem !important;
  }

  #clear_search {
    flex: 0 0 2.25rem !important;
    width: 2.25rem !important;
  }

  #send_search {
    flex: 0 0 2.6rem !important;
    width: 2.6rem !important;
  }

  /* Neutralize mobile full-screen jump */
  #search_view:focus-within {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
  }

  #search_view:focus-within .search_box {
    border-radius: 9999px !important;
    border: 1px solid #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22) !important;
  }
}

/* Ultra-compact screens (< 380px) */
@media screen and (max-width: 24rem) {
  body.results_endpoint #search_header {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "search"
      "categories" !important;
    padding: 0.5rem 0.5rem 0.35rem 0.5rem !important;
  }
  #search_logo {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Category Buttons & Horizontal Scroll (Any Screen)
   -------------------------------------------------------------------------- */
#categories {
  grid-area: categories !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  margin: 0.35rem 0 0.2rem 0 !important;
  padding: 0 !important;
}

#categories::-webkit-scrollbar {
  display: none !important;
}

#categories_container {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.45rem !important;
  width: max-content !important;
  min-width: 100% !important;
  padding: 0.15rem 0.25rem !important;
  box-sizing: border-box !important;
}

.category {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

.category_button,
.category_checkbox label {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
  height: 2.2rem !important;
  min-height: 2.2rem !important;
  padding: 0 0.95rem !important;
  border-radius: 9999px !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  border: 1px solid transparent !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--color-base-font) !important;
  opacity: 0.8 !important;
  cursor: pointer !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  transition: all 0.15s ease !important;
}

.category_button svg,
.category_checkbox label svg {
  display: inline-block !important;
  width: 1rem !important;
  height: 1rem !important;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
}

.category_button .category_name,
.category_checkbox label .category_name {
  display: inline-block !important;
  line-height: 1 !important;
  font-size: 0.85rem !important;
}

.category_button:hover,
.category_checkbox label:hover {
  opacity: 1 !important;
  background: rgba(16, 185, 129, 0.1) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.category_button.selected,
.category_checkbox input:checked + label {
  opacity: 1 !important;
  background: rgba(16, 185, 129, 0.18) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  font-weight: 600 !important;
}

@media (prefers-color-scheme: dark) {
  html.theme-auto .category_button.selected,
  html.theme-auto .category_checkbox input:checked + label {
    color: #4ade80 !important;
  }
}
html.theme-dark .category_button.selected,
html.theme-dark .category_checkbox input:checked + label {
  color: #4ade80 !important;
}

/* --------------------------------------------------------------------------
   Search Result Cards & Responsive Layout
   -------------------------------------------------------------------------- */
#main_results div#results {
  max-width: 48rem !important;
  margin: 1.25rem auto !important;
  padding: 0 1rem !important;
  box-sizing: border-box !important;
}

@media screen and (max-width: 50em) {
  #main_results div#results {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0.5rem auto !important;
    padding: 0 0.75rem !important;
  }
}

.result {
  border-radius: 1rem !important;
  margin: 0.85rem 0 !important;
  padding: 1.15rem 1.35rem !important;
  background: var(--color-result-background) !important;
  border: 1px solid var(--color-result-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-sizing: border-box !important;
}

.result:hover {
  border-color: rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.08) !important;
  transform: translateY(-1px) !important;
}

@media (prefers-color-scheme: dark) {
  html.theme-auto .result {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
  }
  html.theme-auto .result:hover {
    border-color: rgba(16, 185, 129, 0.35) !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4) !important;
  }
}
html.theme-dark .result {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
}
html.theme-dark .result:hover {
  border-color: rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4) !important;
}

@media screen and (max-width: 50em) {
  .result {
    width: 100% !important;
    margin: 0.65rem 0 !important;
    padding: 1rem 1.1rem !important;
  }
}

.result .url_header {
  text-decoration: none !important;
}

.result .url_wrapper {
  color: var(--color-result-url-font) !important;
  font-size: 0.825rem !important;
  font-weight: 500 !important;
  margin-bottom: 0.35rem !important;
  display: block !important;
  word-break: break-all !important;
}

.result h3 {
  margin: 0.25rem 0 0.45rem 0 !important;
  font-size: 1.18rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

.result h3 a {
  color: var(--color-result-link-font) !important;
  text-decoration: none !important;
  transition: color 0.15s ease !important;
}

.result h3 a:hover {
  color: var(--color-result-link-font-highlight) !important;
  text-decoration: underline !important;
}

.result .content {
  color: var(--color-base-font) !important;
  opacity: 0.85 !important;
  font-size: 0.93rem !important;
  line-height: 1.62 !important;
  margin: 0.4rem 0 !important;
}

.result .highlight {
  background: rgba(16, 185, 129, 0.18) !important;
  color: inherit !important;
  font-weight: 600 !important;
  border-radius: 3px !important;
  padding: 0 3px !important;
}

.result .engines {
  margin-top: 0.65rem !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.35rem !important;
}

.result .engines span {
  border-radius: 9999px !important;
  padding: 0.18rem 0.6rem !important;
  font-size: 0.725rem !important;
  font-weight: 600 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
  flex-shrink: 0 !important;
}

@media (prefers-color-scheme: dark) {
  html.theme-auto .result .engines span {
    color: #4ade80 !important;
  }
}
html.theme-dark .result .engines span {
  color: #4ade80 !important;
}

.result .cache_link {
  font-size: 0.725rem !important;
  color: #94a3b8 !important;
  text-decoration: none !important;
  margin-left: 0.35rem !important;
}

.result .cache_link:hover {
  color: #10b981 !important;
}

/* --------------------------------------------------------------------------
   Autocomplete Dropdown
   -------------------------------------------------------------------------- */
.autocomplete {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 2000 !important;
  margin-top: 0.4rem !important;
}

.autocomplete ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0.4rem 0 !important;
  border-radius: 1.15rem !important;
  background: var(--color-autocomplete-background) !important;
  border: 1px solid var(--color-autocomplete-border) !important;
  box-shadow: var(--color-autocomplete-shadow) !important;
  backdrop-filter: blur(14px) !important;
  overflow: hidden !important;
}

.autocomplete li {
  padding: 0.65rem 1.25rem !important;
  cursor: pointer !important;
  font-size: 0.95rem !important;
  color: var(--color-autocomplete-font) !important;
  transition: background 0.12s ease !important;
}

.autocomplete li:hover, .autocomplete li.autocomplete_selected {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
}

/* --------------------------------------------------------------------------
   Pagination Buttons
   -------------------------------------------------------------------------- */
#pagination {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1rem !important;
  margin: 2.5rem 0 !important;
  width: 100% !important;
}

#pagination form.next_page {
  display: flex !important;
  justify-content: center !important;
}

#pagination form.next_page button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  height: 2.5rem !important;
  padding: 0 1.5rem !important;
  border-radius: 9999px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  background: #10b981 !important;
  border: 1px solid #059669 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25) !important;
  transition: all 0.15s ease !important;
}

#pagination form.next_page button:hover {
  background: #059669 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

#pagination form.next_page button svg {
  width: 1rem !important;
  height: 1rem !important;
}

.numbered_pagination {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
}

.numbered_pagination form.page_number input {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.2rem !important;
  height: 2.2rem !important;
  border-radius: 9999px !important;
  border: 1px solid var(--color-search-border) !important;
  background: var(--color-search-background) !important;
  color: var(--color-base-font) !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
}

.numbered_pagination form.page_number input:hover {
  border-color: #10b981 !important;
  color: #10b981 !important;
}

.numbered_pagination form.page_number input.page_number_current {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  font-weight: 700 !important;
}

/* --------------------------------------------------------------------------
   Preferences Page Buttons & Controls
   -------------------------------------------------------------------------- */
#main_preferences input[type="submit"],
#main_preferences .button,
#main_preferences .preferences_back a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 2.35rem !important;
  padding: 0 1.25rem !important;
  border-radius: 9999px !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
}

#main_preferences input[type="submit"] {
  background: #10b981 !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25) !important;
}

#main_preferences input[type="submit"]:hover {
  background: #059669 !important;
  transform: translateY(-1px) !important;
}

#main_preferences .preferences_back {
  display: inline-flex !important;
  margin: 0.25rem 0.5rem !important;
}

#main_preferences .preferences_back a {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--color-search-border) !important;
  color: var(--color-base-font) !important;
}

#main_preferences .preferences_back a:hover {
  border-color: #10b981 !important;
  color: #10b981 !important;
}

#main_preferences .enable-all-engines,
#main_preferences .disable-all-engines {
  height: 1.85rem !important;
  padding: 0 0.75rem !important;
  font-size: 0.78rem !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--color-search-border) !important;
  color: var(--color-base-font) !important;
  margin: 0.2rem !important;
}

#main_preferences .enable-all-engines:hover {
  border-color: #10b981 !important;
  color: #10b981 !important;
}

#main_preferences .disable-all-engines:hover {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

#copy-hash {
  height: 2.2rem !important;
  padding: 0 1rem !important;
  border-radius: 9999px !important;
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  font-weight: 600 !important;
}

/* --------------------------------------------------------------------------
   Filter Selects & Dropdowns
   -------------------------------------------------------------------------- */
.search_filters {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 0.45rem !important;
  margin: 0.4rem 0 !important;
  padding: 0 !important;
}

.search_filters select {
  height: 2.1rem !important;
  padding: 0 0.85rem !important;
  border-radius: 9999px !important;
  font-size: 0.825rem !important;
  border: 1px solid var(--color-search-border) !important;
  background-color: var(--color-search-background) !important;
  color: var(--color-base-font) !important;
  cursor: pointer !important;
  outline: none !important;
}

.search_filters select:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

/* --------------------------------------------------------------------------
   Interactive Elements, Toggles & Forms
   -------------------------------------------------------------------------- */
input[type="checkbox"]:checked,
input.checkbox-onoff[type="checkbox"]:checked {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
}

button.btn, input[type="submit"], input[type="button"] {
  border-radius: 9999px !important;
  transition: all 0.15s ease !important;
}

button.btn-primary, input[type="submit"].btn-primary, .btn_action {
  background: #10b981 !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
}

button.btn-primary:hover, input[type="submit"].btn-primary:hover, .btn_action:hover {
  background: #059669 !important;
}

/* --------------------------------------------------------------------------
   Sidebar & Infoboxes
   -------------------------------------------------------------------------- */
#sidebar {
  background: var(--color-sidebar-background) !important;
  border: 1px solid var(--color-sidebar-border) !important;
  border-radius: 1.25rem !important;
  padding: 1.25rem !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

#infoboxes .infobox {
  border-radius: 1rem !important;
  border: 1px solid var(--color-sidebar-border) !important;
}

/* --------------------------------------------------------------------------
   Image & Media Results
   -------------------------------------------------------------------------- */
.result-images {
  border-radius: 0.85rem !important;
  overflow: hidden !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
  border: 1px solid var(--color-result-border) !important;
}

.result-images:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12) !important;
}

.result-images .image_resolution {
  background: rgba(10, 15, 12, 0.75) !important;
  backdrop-filter: blur(4px) !important;
  color: #34d399 !important;
  border-top-left-radius: 0.5rem !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
}

.result-videos {
  border-radius: 1rem !important;
  border: 1px solid var(--color-result-border) !important;
}

.result-videos:hover {
  border-color: rgba(16, 185, 129, 0.35) !important;
}

/* --------------------------------------------------------------------------
   Answers & Dialogs
   -------------------------------------------------------------------------- */
#answers section, .dialog-error {
  border-radius: 1rem !important;
  border: 1px solid var(--color-result-border) !important;
  background: var(--color-result-background) !important;
  padding: 1rem 1.25rem !important;
  margin: 0.75rem 0 !important;
}

/* --------------------------------------------------------------------------
   Infinite Scroll Divider & Loader
   -------------------------------------------------------------------------- */
#urls hr {
  border: none !important;
  border-top: 1px dashed rgba(16, 185, 129, 0.25) !important;
  margin: 2rem 0 !important;
}

#pagination .loader {
  border: 3px solid rgba(16, 185, 129, 0.15) !important;
  border-top: 3px solid #10b981 !important;
  border-radius: 50% !important;
  width: 2.2rem !important;
  height: 2.2rem !important;
  animation: leafy-spin 0.75s linear infinite !important;
  margin: 2rem auto !important;
}

@keyframes leafy-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Back to Top
   -------------------------------------------------------------------------- */
#backToTop {
  border-radius: 9999px !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  color: #10b981 !important;
  background: var(--color-base-background) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.15s ease !important;
}

#backToTop:hover {
  background: #10b981 !important;
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--color-footer-border) !important;
  padding: 2.5rem 1rem !important;
  text-align: center !important;
  font-size: 0.85rem !important;
  color: #64748b !important;
  background: transparent !important;
  position: relative !important;
  z-index: 1 !important;
}

@media (prefers-color-scheme: dark) {
  html.theme-auto footer {
    color: #94a3b8 !important;
  }
}
html.theme-dark footer {
  color: #94a3b8 !important;
}

footer a {
  color: #10b981 !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  transition: color 0.15s ease !important;
}

footer a:hover {
  color: #34d399 !important;
  text-decoration: underline !important;
}
