/**
 * TC Discovery command-palette search: the header trigger and the overlay.
 * Palette z-index sits above the mobile nav / filter flyout layers (1000).
 */

/* ---- header trigger ------------------------------------------------------ */

.tc-ds-trigger {
    align-items: center;
    background: #f6f8fc;
    border: 1px solid var(--line, #e0e4ea);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    transition: border-color 0.15s ease;
    width: 100%;
}

.tc-ds-trigger:hover,
.tc-ds-trigger:focus-within {
    border-color: var(--ink-400, #8b95a3);
}

/* The theme's magnifier is stroke-drawn (fill="none", rounded caps) — the
   same glyph as the mobile drawer's search button. Setting fill would
   override the SVG's fill="none" and solid-fill the lens, so these rules
   pin fill:none and color via stroke. Two-class selectors outrank the
   global .icon { fill: currentColor } regardless of stylesheet order. */
.tc-ds-trigger .tc-ds-trigger-icon {
    fill: none;
    flex: 0 0 auto;
    height: 17px;
    stroke: var(--text-muted, #5b6674);
    width: 17px;
}

.tc-ds-trigger input[type="search"] {
    background: transparent;
    border: 0;
    color: var(--text-heading, #252d38);
    cursor: pointer;
    flex: 1 1 auto;
    font-size: 14px;
    min-width: 0;
    outline: none;
    padding: 0;
}

.tc-ds-trigger input[type="search"]::placeholder {
    color: var(--text-muted, #5b6674);
}

.tc-ds-kbd {
    background: #fff;
    border: 1px solid var(--line, #e0e4ea);
    border-radius: 4px;
    color: var(--text-muted, #5b6674);
    flex: 0 0 auto;
    font-family: inherit;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    white-space: nowrap;
}

@media (max-width: 767px), (pointer: coarse) {
    .tc-ds-kbd {
        display: none;
    }
}

/* ---- overlay ------------------------------------------------------------- */

.tc-ds-backdrop {
    background: rgba(41, 48, 66, 0.5);
    inset: 0;
    position: fixed;
    z-index: 1190;
}

.tc-ds-overlay {
    inset: 0;
    overflow-y: auto;
    position: fixed;
    z-index: 1200;
}

.tc-ds-panel {
    background: var(--surface-0, #fff);
    border-radius: 8px;
    box-shadow: 0 5px 30px 5px rgba(66, 71, 76, 0.2);
    display: flex;
    flex-direction: column;
    margin: 8vh auto 0;
    max-height: 72vh;
    overflow: hidden;
    width: min(640px, calc(100vw - 32px));
}

body.tc-ds-locked {
    overflow: hidden;
}

.tc-ds-input-row {
    align-items: center;
    border-bottom: 1px solid var(--line-soft, #e9edf2);
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
    padding: 0 8px 0 16px;
}

.tc-ds-input-row .tc-ds-input-icon {
    fill: none;
    flex: 0 0 auto;
    height: 19px;
    stroke: var(--text-muted, #5b6674);
    width: 19px;
}

.tc-ds-input {
    background: transparent;
    border: 0;
    flex: 1 1 auto;
    /* 16px+ keeps iOS from zooming the dialog on focus. */
    font-size: 16px;
    height: 56px;
    min-width: 0;
    outline: none;
    padding: 0;
}

/* The browser injects its own ✕ into type=search inputs — with a custom
   clear chip AND a close control that native one made three X's. Gone. */
.tc-ds-trigger input[type="search"]::-webkit-search-cancel-button,
.tc-ds-trigger input[type="search"]::-webkit-search-decoration,
.tc-ds-input::-webkit-search-cancel-button,
.tc-ds-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

/* In-field clear: a small circular chip that only exists while there is
   text — visually nothing like the close control. */
.tc-ds-clearq {
    align-items: center;
    background: var(--surface-2, #f7f9fb);
    border: 0;
    border-radius: 999px;
    color: var(--text-muted, #5b6674);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 20px;
    justify-content: center;
    width: 20px;
}

.tc-ds-clearq:hover,
.tc-ds-clearq:focus-visible {
    background: var(--line, #e0e4ea);
    color: var(--text-heading, #252d38);
}

.tc-ds-clearq .icon {
    fill: currentColor;
    height: 10px;
    width: 10px;
}

.tc-ds-close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--text-muted, #5b6674);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.tc-ds-close:hover,
.tc-ds-close:focus-visible {
    background: var(--surface-2, #f7f9fb);
}

.tc-ds-close .icon {
    fill: currentColor;
    height: 18px;
    width: 18px;
}

/* Desktop closes with an Esc chip (same language as ⌘K and the footer
   hints); the X icon only appears on touch, where there is no Escape key. */
.tc-ds-close-esc {
    background: var(--surface-2, #f7f9fb);
    border: 1px solid var(--line, #e0e4ea);
    border-radius: 4px;
    color: var(--text-muted, #5b6674);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 4px 7px;
}

.tc-ds-close:hover .tc-ds-close-esc {
    background: var(--line, #e0e4ea);
    color: var(--text-heading, #252d38);
}

.tc-ds-close .tc-ds-close-x {
    display: none;
}

@media (max-width: 767px), (pointer: coarse) {
    .tc-ds-close-esc {
        display: none;
    }

    .tc-ds-close .tc-ds-close-x {
        display: block;
    }
}

/* ---- results ------------------------------------------------------------- */

.tc-ds-results {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px;
}

.tc-ds-listbox {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tc-ds-heading {
    align-items: center;
    color: var(--text-muted, #5b6674);
    display: flex;
    font-size: 11px;
    font-weight: 700;
    justify-content: space-between;
    letter-spacing: 0.06em;
    padding: 12px 12px 4px;
    text-transform: uppercase;
}

.tc-ds-clear-recents {
    background: none;
    border: 0;
    color: var(--color-link, #0a7497);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: normal;
    padding: 0;
    text-transform: none;
}

.tc-ds-clear-recents:hover {
    text-decoration: underline;
}

.tc-ds-item {
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 8px 12px;
}

.tc-ds-item.is-active {
    background: var(--navy-700, #293042);
}

.tc-ds-item.is-active,
.tc-ds-item.is-active * {
    color: #fff !important;
}

.tc-ds-thumb {
    background: var(--surface-2, #f7f9fb);
    border: 1px solid var(--line-soft, #e9edf2);
    border-radius: 3px;
    display: block;
    flex: 0 0 auto;
    height: 44px;
    object-fit: cover;
    width: 44px;
}

.tc-ds-item-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tc-ds-item-title {
    color: var(--text-heading, #252d38);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.tc-ds-item-meta {
    color: var(--text-muted, #5b6674);
    font-size: 12px;
}

.tc-ds-item-sku {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11px;
}

.tc-ds-item-stock.is-instock {
    color: #1e7b4d;
}

.tc-ds-item-price {
    color: var(--text-heading, #252d38);
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    text-align: right;
}

.tc-ds-item-price del {
    color: var(--text-muted, #5b6674);
    font-size: 12px;
    font-weight: 400;
}

/* Screen-reader price boilerplate from wc_price ranges stays hidden. */
.tc-ds-item-price .screen-reader-text {
    display: none;
}

.tc-ds-item-recent .tc-ds-recent-icon {
    color: var(--text-muted, #5b6674);
    flex: 0 0 auto;
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.tc-ds-item-recent .tc-ds-item-title {
    font-weight: 500;
}

.tc-ds-seeall {
    border-top: 1px solid var(--line-soft, #e9edf2);
    color: var(--color-link, #0a7497);
    font-size: 14px;
    font-weight: 600;
    justify-content: center;
    margin-top: 6px;
}

.tc-ds-empty {
    padding: 32px 16px;
    text-align: center;
}

.tc-ds-empty-title {
    color: var(--text-heading, #252d38);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
}

.tc-ds-empty-hint {
    color: var(--text-muted, #5b6674);
    font-size: 13px;
    margin: 0;
}

/* Brand / category shortcut rows. */
.tc-ds-badge {
    align-items: center;
    background: var(--surface-2, #f7f9fb);
    border: 1px solid var(--line-soft, #e9edf2);
    border-radius: 6px;
    color: var(--navy-700, #293042);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.tc-ds-item-go {
    color: var(--text-muted, #5b6674);
    flex: 0 0 auto;
    font-size: 15px;
}

/* On the navy active row the light badge chip must flip too, or the
   forced-white letter disappears into it. */
.tc-ds-item.is-active .tc-ds-badge {
    background: rgba(255, 255, 255, 0.16);
    border-color: transparent;
}

/* ---- result-type tabs ------------------------------------------------------ */

.tc-ds-tabs {
    border-bottom: 1px solid var(--line-soft, #e9edf2);
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 12px;
}

.tc-ds-tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted, #5b6674);
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.tc-ds-tab:hover {
    background: var(--surface-2, #f7f9fb);
    color: var(--text-heading, #252d38);
}

.tc-ds-tab.is-active {
    background: var(--navy-700, #293042);
    border-color: var(--navy-700, #293042);
    color: #fff;
}

/* Keyboard hints footer — pointless on touch, hidden there. */
.tc-ds-hints {
    border-top: 1px solid var(--line-soft, #e9edf2);
    color: var(--text-muted, #5b6674);
    display: flex;
    flex: 0 0 auto;
    font-size: 12px;
    gap: 16px;
    padding: 8px 16px;
}

.tc-ds-hints kbd {
    background: var(--surface-2, #f7f9fb);
    border: 1px solid var(--line, #e0e4ea);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    margin-right: 4px;
    padding: 1px 5px;
}

@media (max-width: 767px), (pointer: coarse) {
    .tc-ds-hints {
        display: none;
    }
}

/* ---- mobile -------------------------------------------------------------- */

@media (max-width: 767px) {
    .tc-ds-panel {
        border-radius: 0;
        height: 100dvh;
        margin: 0;
        max-height: none;
        width: 100%;
    }
}
