/* SPDX-License-Identifier: AGPL-3.0-only */
/* Copyright (C) 2026 Flexion Tech Pty Ltd */
/* A search box's colours and its `@` list (search-matcher.js: renderHighlight, attachColumnSuggest):
   the same in every table's box, Query's and Compare's Results, the Console, Logs and the Hub's
   lists. The box's own shape is its screen's (.search-input-mirror in console.css, the Hub's in hub.css). */

/* Distinct, theme-distinct hex fallbacks so highlighting is visible even when
   the VS Code variable resolves to a colour close to the foreground. Colour only, never
   bold: the coloured copy must be exactly as wide as the text typed over it, or the caret
   drifts away from the letters as the line grows. */

.search-tok-op-and  { color: var(--vscode-charts-blue,   #569cd6); }
.search-tok-op-not  { color: var(--vscode-charts-red,    #f48771); }
.search-tok-quoted  { color: var(--vscode-charts-yellow, #dcdcaa); }
.search-tok-wildcard{ color: var(--vscode-charts-green,  #4ec9b0); }
.search-tok-term-1  { color: var(--vscode-input-foreground); }
.search-tok-term-2  { color: var(--vscode-input-foreground); }

/* A column term: @column in the link colour, its operator orange, its value as quoted text */
.search-tok-col-name  { color: var(--vscode-textLink-foreground, #3794ff); }
/* A column the table does not have (the box is given the table's column names): red, and underlined so it is not told by colour alone */
.search-tok-col-unknown { color: var(--vscode-errorForeground, #f14c4c); text-decoration: underline wavy; text-decoration-skip-ink: none; }
/* A column searched but not shown in the table: its own colour, dotted underline (not told by colour alone) */
.search-tok-col-hidden, .search-tok-deep { color: var(--vscode-charts-purple, #b180d7); text-decoration: underline dotted; text-decoration-skip-ink: none; text-underline-offset: 2px; }
.search-tok-col-op    { color: var(--vscode-charts-orange, #d18616); }
.search-tok-col-value { color: var(--vscode-charts-yellow, #dcdcaa); }

/* `@` in a find box: the columns, then the operators, in a list under it */
.column-suggest {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 220px;
    max-width: 360px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 30;
    padding: 4px 0;
    background: var(--vscode-editorWidget-background, var(--vscode-input-background));
    border: 1px solid var(--vscode-editorWidget-border, var(--vscode-panel-border));
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.column-suggest-option {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}
/* The one the keyboard is on (Enter takes it) is chosen; the one under the pointer only takes the hover
   tint, so two never look picked at once (James, 2026-11-22) */
.column-suggest-option.is-active {
    background: var(--vscode-list-activeSelectionBackground, var(--vscode-list-hoverBackground));
    color: var(--vscode-list-activeSelectionForeground, inherit);
}
.column-suggest-option:hover:not(.is-active) {
    background: var(--vscode-list-hoverBackground);
}
.column-suggest-text {
    font-family: var(--vscode-editor-font-family, monospace);
}
.column-suggest-label {
    color: var(--vscode-descriptionForeground);
}
/* A column searched but not shown: after the shown ones, quieter */
.column-suggest-option.is-hidden .column-suggest-text { color: var(--vscode-charts-purple, #b180d7); opacity: 0.85; }

/* Comma renders as an inverted chip so it punches the OR boundary visually
   without depending on a single hue. */
.search-tok-op-or {
    background: var(--vscode-input-foreground);
    color: var(--vscode-input-background);
    border-radius: 2px;
}

/* Chip backgrounds — each OR group gets a subtle tint so adjacent groups read
   as separate chunks. The comma between groups is tagged orGroup=-1 and keeps
   the default mirror background, acting as the visible separator. */
.search-tok-grp-0   { background: rgba(86, 156, 214, 0.10); }
.search-tok-grp-1   { background: rgba(206, 145, 120, 0.12); }

/* <dbmn-saved-searches> (dbmn-saved-searches.js): a search box's saved searches, a star drop-down inside the box */
/* The room a search box keeps at its right for the star and its caret (38px, 4px clear, 4px from the edge): every box's
   text and its coloured copy use this one value, so none can drift (Query's, the Hub's with its builder beside) */
:root { --search-saved-room: 46px; }
.dbmn-saved-searches { position: relative; display: inline-flex; flex: 0 0 auto; }
.dbmn-saved-searches[hidden] { display: none; }
/* The button: the star (the magnifier's size: 16px against its 14px, Lucide's same stroke) and a caret, no border,
   no name (James, 2026-11-23: "just give me this star with a drop-down… full size… similar size to the search icon") */
.dbmn-saved-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 1px;
    height: 24px; padding: 0 3px 0 4px;
    background: transparent; color: var(--dbmn-foreground);
    border: 1px solid transparent; border-radius: 3px;
    cursor: pointer;
}
.dbmn-saved-btn:hover, .dbmn-saved-btn[aria-expanded="true"] { background: var(--dbmn-toolbar-hoverBackground, var(--dbmn-hover)); }
.dbmn-saved-btn:focus-visible { outline: 1px solid var(--dbmn-focusBorder); outline-offset: 1px; }
.dbmn-saved-caret { display: inline-flex; color: var(--dbmn-descriptionForeground); }
.dbmn-saved-caret svg { width: 12px; height: 12px; }
/* Lucide's star: outlined; filled while the box holds a saved search */
.dbmn-saved-star { display: inline-flex; color: var(--dbmn-descriptionForeground); }
.dbmn-saved-star svg { width: 16px; height: 16px; }
.dbmn-saved-btn.is-saved .dbmn-saved-star { color: var(--dbmn-charts-yellow); }
.dbmn-saved-btn.is-saved .dbmn-saved-star svg { fill: currentColor; }

.dbmn-saved-menu {
    position: absolute; top: calc(100% + 4px); right: 0; z-index: 40;
    width: 320px; max-width: calc(100vw - 32px); max-height: 360px; overflow-y: auto;
    background: var(--dbmn-menu-background, var(--dbmn-editorWidget-background));
    color: var(--dbmn-menu-foreground, var(--dbmn-foreground));
    border: 1px solid var(--dbmn-menu-border, var(--dbmn-widget-border)); border-radius: var(--dbmn-radius, 4px);
    box-shadow: 0 4px 12px var(--dbmn-widget-shadow, rgba(0, 0, 0, 0.25));
    font-size: 12px;
}
.dbmn-saved-menu[hidden] { display: none; }
.dbmn-saved-top { padding: 6px; border-bottom: 1px solid var(--dbmn-panel-border); }
.dbmn-saved-add {
    width: 100%; padding: 5px 8px; text-align: left;
    background: transparent; color: var(--dbmn-textLink-foreground); border: none; border-radius: 3px;
    font: inherit; cursor: pointer;
}
.dbmn-saved-add:hover:not(:disabled) { background: var(--dbmn-list-hoverBackground); }
.dbmn-saved-add:disabled { color: var(--dbmn-descriptionForeground); cursor: default; }
.dbmn-saved-note, .dbmn-saved-empty { padding: 2px 8px 4px; color: var(--dbmn-descriptionForeground); }
.dbmn-saved-empty { padding: 10px 14px; }
.dbmn-saved-list { padding: 4px 0; }
.dbmn-saved-row { display: flex; align-items: center; gap: 2px; padding: 0 6px; }
.dbmn-saved-mark { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: var(--dbmn-charts-yellow); }
.dbmn-saved-mark svg { width: 12px; height: 12px; fill: currentColor; }
.dbmn-saved-row.is-deleting { gap: 6px; padding: 5px 8px; }
.dbmn-saved-pick {
    flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px;
    padding: 5px 8px; text-align: left;
    background: transparent; color: inherit; border: none; border-radius: 3px; font: inherit; cursor: pointer;
}
.dbmn-saved-pick:hover, .dbmn-saved-icon:hover { background: var(--dbmn-list-hoverBackground); }
.dbmn-saved-pick:focus-visible, .dbmn-saved-icon:focus-visible, .dbmn-saved-add:focus-visible, .dbmn-saved-confirm:focus-visible { outline: 1px solid var(--dbmn-focusBorder); outline-offset: -1px; }
.dbmn-saved-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbmn-saved-text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--dbmn-descriptionForeground); font-family: var(--dbmn-editor-font-family, monospace); font-size: 11px;
}
.dbmn-saved-icon {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0;
    background: transparent; color: var(--dbmn-descriptionForeground); border: none; border-radius: 3px; cursor: pointer;
}
.dbmn-saved-icon svg { width: 13px; height: 13px; }
.dbmn-saved-ask { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbmn-saved-form { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 2px; }
.dbmn-saved-name-input {
    flex: 1 1 140px; min-width: 0; height: 24px; padding: 0 6px;
    background: var(--dbmn-input-background); color: var(--dbmn-input-foreground);
    border: 1px solid var(--dbmn-input-border, var(--dbmn-panel-border)); border-radius: 3px; font: inherit;
}
.dbmn-saved-name-input:focus { outline: 1px solid var(--dbmn-focusBorder); outline-offset: -1px; }
.dbmn-saved-confirm {
    flex: 0 0 auto; height: 24px; padding: 0 10px;
    background: transparent; color: var(--dbmn-foreground);
    border: 1px solid var(--dbmn-button-border, var(--dbmn-panel-border)); border-radius: 3px; font: inherit; cursor: pointer;
}
.dbmn-saved-confirm.is-primary { background: var(--dbmn-button-background); color: var(--dbmn-button-foreground); border-color: transparent; }
.dbmn-saved-confirm.is-danger { color: var(--dbmn-errorForeground); border-color: var(--dbmn-errorForeground); }
.dbmn-saved-problem { flex: 1 0 100%; color: var(--dbmn-errorForeground); }
.dbmn-saved-problem:empty { display: none; }

/* The star inside a search box (.search-input-wrapper: the Console's, a table's own box): at the box's right end,
   the text and its coloured copy kept clear of it, 46px (the same padding on both, so the text caret never drifts) */
/* (above the box's text field, and its menu over the table below: Query's 20, the same in every box) */
.search-input-wrapper > .dbmn-saved-searches { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 20; }
.search-input-wrapper:has(> .dbmn-saved-searches:not([hidden])) > .search-input,
.search-input-wrapper:has(> .dbmn-saved-searches:not([hidden])) > .search-input-mirror { padding-right: var(--search-saved-room); }

/*
 * Hidden characters shown (¶, as Word's: a table's `specialCharacters`, a Hub list's toggle; #30): each character stays in the cell
 * in a span of its own, kept as it is (pre), and its mark is drawn over it, faint. A mark never adds to the
 * text, so a copy, a search and the column's fit read the real characters.
 */
.dbmn-sc { position: relative; white-space: pre; }
.dbmn-sc::after {
    position: absolute;
    inset: 0;
    text-align: center;
    color: var(--dbmn-descriptionForeground);
    opacity: 0.75;
    pointer-events: none;
    font-weight: 400;
}
.dbmn-sc.is-space::after { content: '\00b7'; }
.dbmn-sc.is-nbsp::after { content: '\00b0'; }
.dbmn-sc.is-tab::after { content: '\2192'; text-align: left; }
/* A line break: one line in a row (the break is a space under "↵"), a real break where the column wraps */
.dbmn-sc.is-break { white-space: nowrap; }
.dbmn-sc.is-break::after { content: '\21b5'; text-align: left; }
/* (on one line the break is a space, narrower than its ↵: room after it, so a break at the end of a value,
   or of a pill, holds its whole mark and never hangs over the edge; James, 2026-11-23: "bouncy↵") */
.dbmn-sc.is-break:not(.is-breaking) { padding-right: 0.7em; }
.dbmn-sc.is-break.is-breaking { white-space: pre; }
/* A character that draws nothing (zero-width, a control): its code, boxed, beside it */
.dbmn-sc.is-code::after,
.dbmn-sc.is-blank::after { position: static; }
.dbmn-sc.is-code::after {
    content: attr(data-code);
    display: inline-block;
    margin: 0 1px;
    padding: 0 2px;
    border: 1px solid currentColor;
    border-radius: 2px;
    font-size: 0.7em;
    line-height: 1.2;
    vertical-align: 1px;
}
.dbmn-sc.is-blank::after { content: 'blank'; font-style: italic; }
