/* ============================================================
   XCOM Design System — SearXNG Theme Override
   Colors: #c50f0f (red), #0a0a0a (black), #f5f5f5 (white)
   Font: Space Grotesk
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ── Global font ─────────────────────────────────────────── */
*,
*::before,
*::after {
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif !important;
}

/* ── Override ALL theme CSS variables ───────────────────── */
:root,
:root.theme-auto,
:root.theme-dark,
:root.theme-black,
:root.theme-white,
:root.theme-light {
    /* Backgrounds */
    --color-base-background: #0a0a0a !important;
    --color-base-background-mobile: #0a0a0a !important;
    --color-header-background: #111111 !important;
    --color-footer-background: #111111 !important;
    --color-sidebar-background: #111111 !important;
    --color-backtotop-background: #1a1a1a !important;
    --color-search-background: #1a1a1a !important;
    --color-autocomplete-background: #1a1a1a !important;
    --color-autocomplete-background-hover: #222222 !important;
    --color-answer-background: #141414 !important;
    --color-result-background: #111111 !important;
    --color-result-keyvalue-col-table: #111111 !important;
    --color-result-keyvalue-odd: #111111 !important;
    --color-result-keyvalue-even: #141414 !important;
    --color-result-detail-background: #0d0d0d !important;
    --color-result-image-background: #111111 !important;
    --color-settings-table-group-background: #0d0d0d !important;
    --color-toolkit-dialog-background: #111111 !important;
    --color-toolkit-select-background: #1a1a1a !important;
    --color-toolkit-select-background-hover: #222222 !important;
    --color-toolkit-checkbox-onoff-off-background: #1a1a1a !important;
    --color-toolkit-checkbox-onoff-on-background: #1a1a1a !important;
    --color-toolkit-checkbox-label-background: #1a1a1a !important;
    --color-toolkit-engine-tooltip-background: #111111 !important;

    /* Borders */
    --color-header-border: #1f1f1f !important;
    --color-footer-border: #1f1f1f !important;
    --color-sidebar-border: #1f1f1f !important;
    --color-backtotop-border: #1f1f1f !important;
    --color-search-border: #2a2a2a !important;
    --color-autocomplete-border: #2a2a2a !important;
    --color-result-border: #1f1f1f !important;
    --color-result-search-url-border: #1f1f1f !important;
    --color-result-detail-hr: #2a2a2a !important;
    --color-toolkit-dialog-border: #2a2a2a !important;
    --color-toolkit-select-border: #2a2a2a !important;
    --color-toolkit-checkbox-label-border: #2a2a2a !important;
    --color-toolkit-checkbox-input-border: #c50f0f !important;
    --color-toolkit-engine-tooltip-border: #2a2a2a !important;
    --color-toolkit-tabs-label-border: #0a0a0a !important;
    --color-toolkit-tabs-section-border: #2a2a2a !important;

    /* Text */
    --color-base-font: #f5f5f5 !important;
    --color-base-font-rgb: 245, 245, 245 !important;
    --color-sidebar-font: #f5f5f5 !important;
    --color-backtotop-font: #f5f5f5 !important;
    --color-search-font: #f5f5f5 !important;
    --color-autocomplete-font: #f5f5f5 !important;
    --color-answer-font: #f5f5f5 !important;
    --color-result-url-font: #f5f5f5 !important;
    --color-result-search-url-font: #f5f5f5 !important;
    --color-result-description-highlight-font: #ffffff !important;
    --color-result-detail-font: #f5f5f5 !important;
    --color-result-detail-label-font: #aaaaaa !important;
    --color-result-image-span-font: #f5f5f5 !important;
    --color-result-image-span-font-selected: #ffffff !important;
    --color-result-publishdate-font: #888888 !important;
    --color-result-engines-font: #999999 !important;
    --color-settings-engine-description-font: #999999 !important;
    --color-toolkit-kbd-font: #f5f5f5 !important;
    --color-toolkit-input-text-font: #f5f5f5 !important;

    /* XCOM Red — primary/accent (replaces blue) */
    --color-btn-background: #c50f0f !important;
    --color-btn-font: #f5f5f5 !important;
    --color-search-background-hover: #c50f0f !important;
    --color-categories-item-selected-font: #c50f0f !important;
    --color-categories-item-border-selected: #c50f0f !important;
    --color-url-font: #e06060 !important;
    --color-url-visited-font: #aa4444 !important;
    --color-result-link-font: #e06060 !important;
    --color-result-link-font-highlight: #e06060 !important;
    --color-result-link-visited-font: #aa4444 !important;
    --color-result-vim-arrow: #c50f0f !important;
    --color-result-detail-link: #e06060 !important;
    --color-toolkit-checkbox-onoff-on-mark-background: #c50f0f !important;
    --color-toolkit-checkbox-onoff-on-mark-color: #f5f5f5 !important;
    --color-toolkit-checkbox-onoff-off-mark-background: #444444 !important;
    --color-toolkit-checkbox-onoff-off-mark-color: #f5f5f5 !important;

    /* Misc */
    --color-show-btn-background: #2a2a2a !important;
    --color-show-btn-font: #f5f5f5 !important;
    --color-result-vim-selected: #1a1a1acc !important;
    --color-settings-tr-hover: #1a1a1a !important;
    --color-toolkit-badge-background: #2a2a2a !important;
    --color-toolkit-badge-font: #f5f5f5 !important;
    --color-toolkit-kbd-background: #1a1a1a !important;
    --color-doc-code: #dddddd !important;
    --color-doc-code-background: #1f1f1f !important;
    --color-favicon-background-color: #1a1a1a !important;
    --color-favicon-border-color: #2a2a2a !important;
    --color-search-shadow: 0 2px 12px rgba(197, 15, 15, 0.15) !important;
    --color-autocomplete-shadow: 0 2px 12px rgba(0, 0, 0, 0.6) !important;
    --color-loading-indicator: rgba(197, 15, 15, 0.4) !important;
    --color-loading-indicator-gap: #c50f0f !important;
    --color-line-number: #666666 !important;
}

/* ── Body & base ─────────────────────────────────────────── */
body {
    background-color: #0a0a0a !important;
    color: #f5f5f5 !important;
}

/* ── Header ──────────────────────────────────────────────── */
header#searxng_start,
#main_search header,
#main_index header {
    background: #111111 !important;
    border-bottom: 1px solid #1f1f1f !important;
    padding: 0.75rem 1.5rem !important;
}

/* Search bar container */
.search_box,
#search_header .search_box,
form[action="/search"] .search_box {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 12px rgba(197, 15, 15, 0.12) !important;
    overflow: hidden !important;
}

.search_box:focus-within {
    border-color: #c50f0f !important;
    box-shadow: 0 0 0 2px rgba(197, 15, 15, 0.25) !important;
}

/* Search input */
#q,
input[name="q"],
.search_box input[type="search"],
.search_box input[type="text"] {
    background: transparent !important;
    color: #f5f5f5 !important;
    border: none !important;
    caret-color: #c50f0f !important;
}

#q::placeholder,
input[name="q"]::placeholder {
    color: #555555 !important;
}

/* Search button */
.search_box button[type="submit"],
button.search_submit {
    background: #c50f0f !important;
    color: #f5f5f5 !important;
    border: none !important;
    border-radius: 0 6px 6px 0 !important;
    transition: background 0.2s ease !important;
}

.search_box button[type="submit"]:hover,
button.search_submit:hover {
    background: #a00d0d !important;
}

/* ── XCOM Wordmark / Logo ────────────────────────────────── */
#main_index .title,
.title a,
#main_search .title,
h1.title {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 700 !important;
    font-size: 2rem !important;
    color: #f5f5f5 !important;
    letter-spacing: -0.5px !important;
}

/* Red dot / accent on logo */
#main_index .title span,
.title a span {
    color: #c50f0f !important;
}

/* Hide default SearXNG wordmark SVG, replace with text */
.searxng-wordmark svg,
img.searxng-logo {
    display: none !important;
}

/* ── Navigation top links ────────────────────────────────── */
#links_on_top a {
    color: #888888 !important;
    transition: color 0.2s !important;
}

#links_on_top a:hover {
    color: #c50f0f !important;
}

#links_on_top a svg {
    fill: currentColor !important;
}

/* ── Category tabs ───────────────────────────────────────── */
#categories button,
.category_button,
button[value] {
    background: transparent !important;
    color: #888888 !important;
    border-bottom: 2px solid transparent !important;
    transition: color 0.2s, border-color 0.2s !important;
}

#categories button:hover,
.category_button:hover {
    color: #f5f5f5 !important;
}

#categories button.active,
.category_button.active,
#categories button[aria-selected="true"] {
    color: #c50f0f !important;
    border-bottom-color: #c50f0f !important;
}

/* ── Result cards ────────────────────────────────────────── */
article.result {
    background: #111111 !important;
    border: 1px solid #1f1f1f !important;
    border-radius: 8px !important;
    padding: 1rem 1.25rem !important;
    margin-bottom: 0.75rem !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

article.result:hover {
    border-color: #c50f0f !important;
    box-shadow: 0 0 0 1px rgba(197, 15, 15, 0.2) !important;
}

/* Result title links */
article.result h3 a,
.result_title a,
a.result_title {
    color: #e06060 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

article.result h3 a:hover,
.result_title a:hover {
    color: #c50f0f !important;
    text-decoration: underline !important;
}

article.result h3 a:visited,
.result_title a:visited {
    color: #aa4444 !important;
}

/* Result URL */
.result_url,
.url_o span,
article.result .url_wrapper {
    color: #777777 !important;
    font-size: 0.8rem !important;
}

/* Result description */
article.result p.content {
    color: #cccccc !important;
    line-height: 1.55 !important;
}

/* ── Autocomplete dropdown ───────────────────────────────── */
#autocomplete,
.autocomplete {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
}

.autocomplete li,
#autocomplete li {
    color: #f5f5f5 !important;
    padding: 0.5rem 1rem !important;
}

.autocomplete li:hover,
.autocomplete li.selected,
#autocomplete li:hover,
#autocomplete li.selected {
    background: #222222 !important;
    color: #c50f0f !important;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
    background: #111111 !important;
    border-top: 1px solid #1f1f1f !important;
    color: #555555 !important;
    font-size: 0.8rem !important;
}

footer a {
    color: #666666 !important;
    transition: color 0.2s !important;
}

footer a:hover {
    color: #c50f0f !important;
}

/* ── Preferences page ────────────────────────────────────── */
.preferences_back,
.preferences_back a {
    color: #c50f0f !important;
}

table.striped tr:hover {
    background: #1a1a1a !important;
}

table.striped td,
table.striped th {
    border-bottom-color: #1f1f1f !important;
}

.engine_checkbox label,
.checkbox_container label {
    color: #f5f5f5 !important;
}

select,
input[type="text"],
input[type="number"],
textarea {
    background: #1a1a1a !important;
    color: #f5f5f5 !important;
    border: 1px solid #2a2a2a !important;
    border-radius: 6px !important;
}

select:focus,
input:focus,
textarea:focus {
    border-color: #c50f0f !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(197, 15, 15, 0.2) !important;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}

::-webkit-scrollbar-track {
    background: #0a0a0a !important;
}

::-webkit-scrollbar-thumb {
    background: #2a2a2a !important;
    border-radius: 3px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: #c50f0f !important;
}

/* ── Loading indicator ───────────────────────────────────── */
#progress-indicator,
.loader {
    border-color: rgba(197, 15, 15, 0.3) !important;
    border-left-color: #c50f0f !important;
}

/* ── Dialogs / modals ────────────────────────────────────── */
dialog,
.dialog {
    background: #111111 !important;
    border: 1px solid #2a2a2a !important;
    border-radius: 10px !important;
    color: #f5f5f5 !important;
}

/* ── Badges ──────────────────────────────────────────────── */
span.badge,
.toolkit_badge {
    background: #1f1f1f !important;
    color: #999999 !important;
    border-radius: 4px !important;
    font-size: 0.7rem !important;
}

/* ── Info / answer boxes ─────────────────────────────────── */
.result-answer {
    background: #141414 !important;
    border-left: 3px solid #c50f0f !important;
    border-radius: 0 8px 8px 0 !important;
    padding: 1rem 1.25rem !important;
}

/* ── Back to top button ──────────────────────────────────── */
#backToTop {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
    color: #f5f5f5 !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

#backToTop:hover {
    border-color: #c50f0f !important;
    color: #c50f0f !important;
}

/* ── Image results ───────────────────────────────────────── */
.image_result {
    border-radius: 6px !important;
    overflow: hidden !important;
}

.image_result .image_resolution {
    background: rgba(197, 15, 15, 0.7) !important;
    color: #f5f5f5 !important;
}

/* ── Error / warning boxes ───────────────────────────────── */
.dialog-error {
    background: #1a0a0a !important;
    border: 1px solid #c50f0f !important;
    border-radius: 8px !important;
    color: #f5f5f5 !important;
}