/* TiviGlass site search (js/site-search.js). Self-contained so any page can load it
   beside tg.css: /support, /faq and the user guide. Markup contract: see the header of
   js/site-search.js. --tg-* tokens only. */

.tg-search {
    display: flex;
    flex-direction: column;
    gap: var(--tg-space-3);
    width: 100%;
    max-width: 720px;
}

.tg-search-form {
    display: flex;
    flex-direction: column;
    gap: var(--tg-space-2);
    margin: 0;
}

.tg-search-label {
    color: var(--tg-text-soft);
    font-family: var(--tg-font-display);
    font-size: var(--tg-size-small);
    font-weight: 600;
}

.tg-search-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--tg-space-2);
    padding: 6px 6px 6px 48px;
    border: 1px solid var(--tg-line-strong);
    border-radius: var(--tg-radius-pill);
    background: var(--tg-surface-1);
    box-shadow: var(--tg-shadow);
    transition: border-color var(--tg-dur-fast) var(--tg-ease);
}

.tg-search-field:focus-within {
    border-color: var(--tg-focus);
}

.tg-search-field > svg {
    position: absolute;
    top: 50%;
    left: 18px;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    color: var(--tg-text-faint);
    pointer-events: none;
}

.tg-search-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tg-text);
    font-family: var(--tg-font-body);
    /* 16px or more stops iOS zooming the page on focus. */
    font-size: 1.0625rem;
    outline: none;
}

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

/* The field shows focus (focus-within above); the bare input needs no second ring. */
.tg-search-input:focus-visible {
    outline: none;
}

.tg-search-input::-webkit-search-cancel-button {
    filter: invert(1) opacity(0.6);
}

.tg-search-submit {
    flex: none;
}

@media (max-width: 420px) {
    .tg-search-field {
        padding-left: 44px;
    }

    .tg-search-field > svg {
        left: 16px;
    }

    .tg-search-submit {
        padding: 0 16px;
    }
}

.tg-search-status {
    margin: 0;
    color: var(--tg-text-faint);
    font-size: var(--tg-size-small);
}

.tg-search-status:empty {
    display: none;
}

.tg-search-list {
    display: flex;
    flex-direction: column;
    gap: var(--tg-space-4);
    max-height: min(70vh, 640px);
    overflow-y: auto;
    padding: var(--tg-space-4);
    border: 1px solid var(--tg-line-strong);
    border-radius: var(--tg-radius-lg);
    background: var(--tg-ink-2);
    box-shadow: var(--tg-shadow-lift);
    overscroll-behavior: contain;
}

.tg-search-list[hidden] {
    display: none;
}

.tg-search-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tg-search-group-name {
    margin: 0 0 var(--tg-space-1);
    padding-inline: var(--tg-space-3);
    color: var(--tg-text-faint);
    font-family: var(--tg-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tg-search-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 48px;
    justify-content: center;
    padding: 10px var(--tg-space-3);
    border-radius: var(--tg-radius-sm);
    color: var(--tg-text);
    text-decoration: none;
    transition: background-color var(--tg-dur-fast) var(--tg-ease);
}

.tg-search-option:hover {
    background: var(--tg-surface-2);
}

/* The highlighted option (arrow keys): the app's focus colour, as a TV row draws it. */
.tg-search-option.is-active {
    background: var(--tg-surface-2);
    box-shadow: 0 0 0 2px var(--tg-focus) inset;
}

.tg-search-option-title {
    color: #ffffff;
    font-family: var(--tg-font-display);
    font-weight: 600;
    line-height: 1.35;
}

.tg-search-option-summary {
    color: var(--tg-text-soft);
    font-size: var(--tg-size-small);
    line-height: 1.45;
}
