/* ==========================================================================
   Quick search ( Ctrl+K ): a Spotlight-style palette.
   Loaded after refresh.css, and uses its tokens.
   ========================================================================== */

html.palette-open { overflow: hidden; }

/* The shortcut hint inside the top bar button */

.topbar-kbd {
    margin-left: 8px;
    padding: 1px 6px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    color: var(--muted);
    font-family: var(--font-mono, ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace);
    font-size: 11px;
    line-height: 1.5;
}

@media (hover: none), (max-width: 900px) {
    .topbar-kbd { display: none; }
}

/* Overlay */

#palette {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 13vh 16px 16px;
}

#palette[hidden] { display: none; }

.pl-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 9, 11, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* Panel */

.pl-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(660px, 100%);
    max-height: min(70vh, 560px);
    overflow: hidden;
    background: rgba(31, 34, 39, 0.9);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(237, 234, 227, 0.1);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(0, 0, 0, 0.6);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .pl-panel { background: #1F2227; }
}

/* Search field: big and quiet, like the one on macOS */

.pl-field {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.pl-glass {
    flex: none;
    color: var(--muted);
    font-size: 18px;
}

#palette input.pl-input {
    flex: 1;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    outline: none;
    color: var(--color-font1);
    font-family: inherit;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
}

#palette input.pl-input::placeholder { color: var(--muted); opacity: 1; }

/* Results */

.pl-list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 6px 8px 8px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid var(--line);
}

.pl-group {
    padding: 10px 12px 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.pl-group:first-child { padding-top: 6px; }

.pl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border-radius: 9px;
    color: var(--color-font1);
    cursor: pointer;
}

.pl-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-size: 14px;
}

.pl-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pl-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 15px;
    line-height: 1.3;
}

.pl-title b { font-weight: 700; }

.pl-sub {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.3;
}

.pl-ext {
    flex: none;
    color: var(--muted);
    font-size: 11px;
}

/* A test's verdict */

.pl-chip {
    flex: none;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(237, 234, 227, 0.08);
    color: var(--color-font2);
    font-size: 11.5px;
    font-weight: 600;
}

.pl-chip[data-state="passed"]   { background: rgba(110, 219, 154, 0.14); color: var(--ok); }
.pl-chip[data-state="failed"]   { background: rgba(239, 123, 114, 0.14); color: var(--bad); }
.pl-chip[data-state="running"]  { background: var(--accent-soft); color: var(--accent-hover); }
.pl-chip[data-state="pending"],
.pl-chip[data-state="awaiting"] { background: rgba(233, 178, 76, 0.14); color: var(--warn); }
.pl-chip[data-state="stopped"]  {
    background-image: repeating-linear-gradient(135deg, transparent 0, transparent 4px, rgba(237, 234, 227, 0.14) 4px, rgba(237, 234, 227, 0.14) 5.5px);
}

.pl-enter {
    display: none;
    flex: none;
    margin-left: 2px;
    font-family: inherit;
    font-size: 14px;
    opacity: 0.9;
}

/* The row Enter would open: filled like a selection on macOS */

.pl-item[aria-selected="true"] {
    background: var(--accent);
    color: #fff;
}

.pl-item[aria-selected="true"] .pl-icon  { background: rgba(255, 255, 255, 0.18); color: #fff; }
.pl-item[aria-selected="true"] .pl-sub,
.pl-item[aria-selected="true"] .pl-ext   { color: rgba(255, 255, 255, 0.95); }
.pl-item[aria-selected="true"] .pl-chip  { background: rgba(255, 255, 255, 0.2); background-image: none; color: #fff; }
.pl-item[aria-selected="true"] .pl-enter { display: block; }

/* Footer with the keys */

.pl-foot {
    display: flex;
    gap: 18px;
    padding: 9px 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.pl-foot kbd {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    margin-right: 6px;
    padding: 0 5px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(237, 234, 227, 0.08);
    color: var(--color-font2);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
}

.pl-foot kbd + kbd { margin-left: -2px; }

.pl-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Motion: only when the palette is opened, and never for people who ask for less */

@keyframes pl-panel-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

@keyframes pl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#palette.is-open .pl-panel    { animation: pl-panel-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1); }
#palette.is-open .pl-backdrop { animation: pl-fade-in 0.16s ease-out; }

@media (prefers-reduced-motion: reduce) {
    #palette.is-open .pl-panel,
    #palette.is-open .pl-backdrop { animation: none; }
}

@media (max-width: 640px) {
    #palette { padding-top: 8vh; }
    #palette input.pl-input { font-size: 17px; }
    .pl-foot { display: none; }
}
