/* -- DocSearch styles ------------------------------------------------------- */
/* Variables which can be modified: https://github.com/algolia/docsearch/blob/main/packages/docsearch-css/src/_variables.css */

/* Base Variables */
:root {
    /* General */
    --docsearch-hit-height: auto;
    --docsearch-highlight-color: #343b4394;
    --docsearch-hit-shadow: none;
    --docsearch-container-background: rgb(22 22 22 / 80%);

    /* Modal */
    --docsearch-modal-width: 870px;
    --docsearch-modal-height: 800px;
    --docsearch-modal-background: #ffffff;

    /* Searchbox */
    --docsearch-searchbox-shadow: inset 0 0 0 0px var(--docsearch-primary-color);

    /* Footer */
    --docsearch-key-shadow: none;
    --docsearch-footer-shadow: none;

    /* Dark mode presets */
    --docsearch-custom-dark-text-color: rgb(245, 246, 247);
    --docsearch-custom-dark-container-background: rgba(0, 0, 0, 0.8);
    --docsearch-custom-dark-modal-background: rgb(18, 21, 22);
    --docsearch-custom-dark-modal-shadow: inset 1px 1px 0 0 rgb(44, 46, 64), 0 3px 8px 0 rgb(0, 3, 9);
    --docsearch-custom-dark-searchbox-background: rgb(26 28 30);
    --docsearch-custom-dark-searchbox-focus-background: #121516;
    --docsearch-custom-dark-hit-color: rgb(229, 230, 230);
    --docsearch-custom-dark-hit-shadow: none;
    --docsearch-custom-dark-hit-background: rgb(18, 21, 22);
    --docsearch-custom-dark-key-gradient: none;
    --docsearch-custom-dark-key-shadow: none;
    --docsearch-custom-dark-footer-background: rgb(18, 21, 22);
    --docsearch-custom-dark-footer-shadow: none;
    --docsearch-custom-dark-logo-color: rgb(255, 255, 255);
    --docsearch-custom-dark-muted-color: rgb(127, 132, 151);
}

/* Apply dark mode variables - consolidated for all themes */
/* For prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) {
        --docsearch-text-color: var(--docsearch-custom-dark-text-color);
        --docsearch-container-background: var(--docsearch-custom-dark-container-background);
        --docsearch-modal-background: var(--docsearch-custom-dark-modal-background);
        --docsearch-modal-shadow: var(--docsearch-custom-dark-modal-shadow);
        --docsearch-searchbox-background: var(--docsearch-custom-dark-searchbox-background);
        --docsearch-searchbox-focus-background: var(--docsearch-custom-dark-searchbox-focus-background);
        --docsearch-hit-color: var(--docsearch-custom-dark-hit-color);
        --docsearch-hit-shadow: var(--docsearch-custom-dark-hit-shadow);
        --docsearch-hit-background: var(--docsearch-custom-dark-hit-background);
        --docsearch-key-gradient: var(--docsearch-custom-dark-key-gradient);
        --docsearch-key-shadow: var(--docsearch-custom-dark-key-shadow);
        --docsearch-footer-background: var(--docsearch-custom-dark-footer-background);
        --docsearch-footer-shadow: var(--docsearch-custom-dark-footer-shadow);
        --docsearch-logo-color: var(--docsearch-custom-dark-logo-color);
        --docsearch-muted-color: var(--docsearch-custom-dark-muted-color);
    }
}

/* For explicit dark theme setting */
body[data-theme="dark"],
html.dark-mode {
    color-scheme: dark;
    --docsearch-text-color: var(--docsearch-custom-dark-text-color);
    --docsearch-container-background: var(--docsearch-custom-dark-container-background);
    --docsearch-modal-background: var(--docsearch-custom-dark-modal-background);
    --docsearch-modal-shadow: var(--docsearch-custom-dark-modal-shadow);
    --docsearch-searchbox-background: var(--docsearch-custom-dark-searchbox-background);
    --docsearch-searchbox-focus-background: var(--docsearch-custom-dark-searchbox-focus-background);
    --docsearch-hit-color: var(--docsearch-custom-dark-hit-color);
    --docsearch-hit-shadow: var(--docsearch-custom-dark-hit-shadow);
    --docsearch-hit-background: var(--docsearch-custom-dark-hit-background);
    --docsearch-key-gradient: var(--docsearch-custom-dark-key-gradient);
    --docsearch-key-shadow: var(--docsearch-custom-dark-key-shadow);
    --docsearch-footer-background: var(--docsearch-custom-dark-footer-background);
    --docsearch-footer-shadow: var(--docsearch-custom-dark-footer-shadow);
    --docsearch-logo-color: var(--docsearch-custom-dark-logo-color);
    --docsearch-muted-color: var(--docsearch-custom-dark-muted-color);
}

/* DocSearch Button */
.DocSearch-Button {
    height: 32px !important;
    width: 32px !important;
    padding: 0 !important;
    margin: 0;
    margin-top: 7px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

.DocSearch-Button-Container {
    margin: 0 !important;
    padding: 0 !important;
}

.DocSearch-Button-Placeholder,
.DocSearch-Button-Keys {
    display: none !important;
}

.DocSearch-Search-Icon {
    stroke: var(--docsearch-text-color);
    width: 20px !important;
    height: 20px !important;
    stroke-width: 2px;
}

.DocSearch-Button:hover .DocSearch-Search-Icon {
    color: var(--color-sidebar-link-text--hover, #1a73e8) !important;
}

.DocSearch-Button:hover {
    background: transparent !important;
    box-shadow: none !important;
}

/* Tooltip */
.DocSearch-Button::after {
    content: "Search documentation (Ctrl+K)";
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
}

.DocSearch-Button:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Icons & Highlighting */
.DocSearch-MagnifierLabel,
.DocSearch-Reset {
    color: #3B8FF5;
}

.DocSearch-Hits mark {
    color: #3B8FF5;
}

.DocSearch-Hit-Tree {
    width: 16px;
}

.DocSearch-Hit-action,
.DocSearch-Hit-icon {
    color: rgb(112 160 232);
    padding-right: 10px;
}

/* Search Modal */
.DocSearch-Modal {
    border-radius: 24px;
    border-style: solid;
    border-width: thin;
    border-color: #394145;
}

/* Search Results */
.DocSearch-Hit {
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 8px;
}

.DocSearch-Hit-title {
    font-size: 1em;
}

.DocSearch-Hit-path {
    margin-top: 2px;
    font-size: .7em;
}

.DocSearch-Hit-source {
    color: rgb(246 252 255 / 90%);
    background: rgb(71 82 93);
    font-size: .85em;
    font-weight: 400;
    padding: 0px 12px;
    border-radius: 8px;
    margin: 4px 0;
}

.DocSearch-Hit-Container {
    margin: 4px 0;
    padding: 8px 12px 8px 0;
}

.DocSearch-Hit-content-wrapper {
    white-space: normal;
    margin: 0 12px;
}

/* Footer & Keyboard Controls */
.DocSearch-Footer {
    border-radius: 0 0 24px 24px;
    margin-top: 4px;
    padding: 12px 24px;
}

kbd.DocSearch-Commands-Key,
kbd.DocSearch-Button-Key {
    border-style: solid;
    border-width: thin;
    border-radius: 4px;
    background: none;
    box-shadow: none;
}

kbd.DocSearch-Button-Key {
    padding: 1px 0 1px;
}

/* No Results */
.DocSearch-Prefill {
    color: #b4b4b4;
}

.DocSearch-Cancel {
    color: #797c7e78;
}

.kbd:not(.compound) {
    background-color: transparent;
}