/* ═══════════════════════════════════════════════════════════
   TDN MAGAZINE — Live Search Dropdown
   live-search.css
═══════════════════════════════════════════════════════════ */

/* ── Wrapper must be positioned so dropdown is relative to it ── */
.tdn-live-search-wrap {
    /* Always a positioned block — provides the anchor for the absolute dropdown.
       display:contents was previously used here to "disappear" the wrapper
       inside flex containers, but it makes position:relative ineffective
       (no box = no stacking context). Instead we use display:flex so the
       wrapper itself becomes the flex item and the input fills it. */
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
}

/* Input should fill the wrapper in all contexts */
.tdn-live-search-wrap > input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* When wrapping an input that IS a flex/grid child, the wrapper
   already handles layout via flex above — no extra overrides needed. */
.tdn-hdr-search .tdn-live-search-wrap,
.tdn-hdr-drawer-search .tdn-live-search-wrap,
.tdn-search-form .tdn-live-search-wrap {
    display: flex;
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

/* ── The dropdown panel ────────────────────────────────────── */
.tdn-live-search-dropdown {
    position: absolute;
    top: calc( 100% + 4px );
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border: 1px solid var(--tdn-border, #e0e0e0);
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08);
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
}

/* ── Individual result items ───────────────────────────────── */
.tdn-live-search-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    text-decoration: none;
    color: var(--tdn-text, #1a1a1a);
    border-bottom: 1px solid var(--tdn-border, #ebebeb);
    transition: background .1s;
    cursor: pointer;
    outline: none;
}
.tdn-live-search-item:last-of-type {
    border-bottom: none;
}
.tdn-live-search-item:hover,
.tdn-live-search-item:focus,
.tdn-live-search-item--active {
    background: var(--tdn-bg-soft, #f5f5f5);
}

/* ── Title and highlight ───────────────────────────────────── */
.tdn-live-search-title {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--tdn-text, #1a1a1a);
    flex: 1 1 auto;
    min-width: 0;
}
.tdn-live-search-title mark {
    background: transparent;
    color: var(--tdn-red, #e51a3e);
    font-weight: 700;
}

/* ── Category badge ────────────────────────────────────────── */
.tdn-live-search-cat {
    font-family: var(--font-ui, 'Inter', sans-serif);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--tdn-muted, #777);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Empty state ───────────────────────────────────────────── */
.tdn-live-search-empty {
    padding: 16px;
    font-size: 13px;
    color: var(--tdn-muted, #777);
    text-align: center;
    font-style: italic;
}

/* ── "See all results" footer link ────────────────────────── */
.tdn-live-search-all {
    display: block;
    padding: 10px 16px;
    font-family: var(--font-ui, 'Inter', sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--tdn-red, #e51a3e);
    background: var(--tdn-bg-soft, #f5f5f5);
    border-top: 1px solid var(--tdn-border, #e0e0e0);
    text-align: center;
    transition: background .1s;
}
.tdn-live-search-all:hover,
.tdn-live-search-all--active {
    background: #ececec;
}

/* ── Mobile: extend below header search edge-to-edge ─────────── */
@media ( max-width: 768px ) {
    /* Header search: extend flush to viewport edges */
    .tdn-hdr-search .tdn-live-search-dropdown {
        left: -16px;
        right: -16px;
        border-radius: 0 0 4px 4px;
    }

    /* Drawer & search-page: stay within the form's own bounds */
    .tdn-hdr-drawer-search .tdn-live-search-dropdown,
    .tdn-search-form .tdn-live-search-dropdown {
        left: 0;
        right: 0;
        border-radius: 0 0 4px 4px;
    }
}
