/**
 * Quick search (components/dialogs/quick-search, js/components/quick-search.js) over the shared site-dialog
 * skin: the search field on top, the matches grouped by module and the keyboard hints. Full screen on phones.
 * The header buttons that open it are in layout-site/chrome.css.
 */
.quick-search {
    align-items: flex-start;
    padding-top: min(12vh, 120px);
}

.quick-search .quick-search-panel {
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: calc(100vh - 2 * min(12vh, 120px));
    max-height: calc(100dvh - 2 * min(12vh, 120px));
    padding: 0;
    overflow: hidden;
}

/* The field sits on the top edge, where the other dialogs draw their tone bar */
.quick-search .quick-search-panel::before {
    display: none;
}

.quick-search-field {
    display: flex;
    flex: none;
    align-items: center;
    gap: 12px;
    padding: 0 12px 0 20px;
    border-bottom: 1px solid var(--line);
}

.quick-search-field-icon {
    flex: none;
    width: 16px;
    font-size: 16px;
    color: var(--text-2);
}

.quick-search-spinner {
    display: none;
    flex: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: site-dialog-spin 0.7s linear infinite;
}

.quick-search.is-loading .quick-search-field-icon {
    display: none;
}

.quick-search.is-loading .quick-search-spinner {
    display: block;
}

.quick-search-input {
    flex: 1;
    min-width: 0;
    height: 62px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 17px;
    color: var(--text-1);
    outline: none;
}

.quick-search-input::placeholder {
    color: var(--text-2);
    opacity: 1;
}

/* The focus shows as the accent line under the whole field instead of the theme's ring around the input */
.quick-search .quick-search-input:focus-visible {
    outline: none;
}

.quick-search-field:focus-within {
    box-shadow: inset 0 -2px 0 var(--accent);
}

.quick-search-input::-webkit-search-cancel-button {
    display: none;
}

.quick-search-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    font-size: 17px;
    color: var(--text-2);
    cursor: pointer;
}

.quick-search-close:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.quick-search-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.quick-search-body {
    flex: 1;
    min-height: 0;
    padding: 6px 8px 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.quick-search-intro,
.quick-search-empty {
    padding: 30px 18px 26px;
    text-align: center;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text-2);
}

.quick-search-intro p,
.quick-search-empty p {
    margin: 0;
}

.quick-search-intro .quick-search-tip {
    margin-top: 8px;
    font-size: 13px;
}

.quick-search-empty .kit-button {
    margin-top: 16px;
}

.quick-search-message {
    margin: 14px 12px;
    font-size: 14px;
    color: var(--danger);
}

.quick-search-results {
    transition: opacity 0.15s ease;
}

.quick-search.is-loading .quick-search-results {
    opacity: 0.55;
}

.quick-search-group + .quick-search-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.quick-search-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 12px 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-2);
}

.quick-search-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--module, var(--accent));
}

.quick-search-option {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    padding: 7px 12px;
    border-radius: 10px;
    color: var(--text-1);
    text-decoration: none;
}

.quick-search-option:hover {
    color: var(--text-1);
}

.quick-search-option.is-active {
    background: var(--surface-2);
    box-shadow: inset 3px 0 0 var(--accent);
}

.quick-search-option.is-active .quick-search-name {
    color: var(--text-1);
}

.quick-search-cover {
    flex: none;
    width: 38px;
    border-radius: 4px;
    box-shadow: none;
}

/* Without a cover: the module tint with the title's first letter */
.quick-search-cover .poster-fallback {
    justify-content: center;
    align-items: center;
    padding: 0;
    background-color: color-mix(in srgb, var(--module, var(--text-2)) 30%, var(--surface-2));
}

.quick-search-cover .poster-fallback-bar {
    display: none;
}

.quick-search-initial {
    font-family: var(--font-display);
    font-weight: var(--font-display-weight);
    font-size: 20px;
    line-height: 1;
    text-transform: uppercase;
    color: var(--text-1);
}

.quick-search-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.quick-search-name {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-search-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    font-size: 12.5px;
    color: var(--text-2);
}

.quick-search-meta:empty {
    display: none;
}

.quick-search-owned {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--success);
}

/* The other name the term found the title by (M-027), under the title's own: "also known as" */
.quick-search-aka {
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-2);
}

.quick-search-aka mark {
    padding: 0;
    background: none;
    font-weight: 500;
    color: var(--text-1);
}

.quick-search-option.is-more {
    min-height: 40px;
    color: var(--text-2);
}

.quick-search-option.is-more .quick-search-name {
    font-size: 14px;
    font-weight: 500;
}

.quick-search-more-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    font-size: 13px;
}

.quick-search-foot {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 10px 18px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--text-2);
}

.quick-search-foot span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.quick-search-foot kbd {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    margin-right: 2px;
    padding: 0 6px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface-2);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-1);
}

/* Touch screens have no keys to hint */
@media (hover: none) {
    .quick-search-foot {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .quick-search {
        align-items: stretch;
        padding: 0;
    }

    .quick-search .quick-search-panel {
        width: 100%;
        height: 100%;
        max-height: none;
        padding: 0 0 env(safe-area-inset-bottom);
        border: 0;
        border-radius: 0;
    }

    .quick-search-field {
        padding: 0 8px 0 16px;
    }

    .quick-search-foot {
        display: none;
    }
}

/* Pick mode (quickSearch.pick: the title pickers of the collaborative lists and of the profile showcase): the
   titles already taken */
.quick-search.is-picking .quick-search-option.is-taken {
    cursor: default;
}

.quick-search.is-picking .quick-search-option.is-taken .quick-search-cover {
    opacity: 0.55;
}

.quick-search.is-picking .quick-search-option[aria-busy="true"] {
    opacity: 0.6;
    cursor: progress;
}

.quick-search-taken {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--accent);
}

.quick-search-taken > i {
    font-size: 10px;
}
