/* WUC Search v1.2 — adds filter chips on results page + recent-searches in overlay.
 * Replaces v1.1 wuc-search.css entirely (file overwrite).
 * All v1.1 styles carry forward; v1.2 additions are clearly marked.
 */

/* ===========================================================================
 * Results page (v1 baseline)
 * ========================================================================*/
.wuc-search-results {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 1.5rem 80px;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: #0a1929;
}
.wuc-search-header {
    padding-bottom: 24px;
    margin-bottom: 32px;
    border-bottom: 1px solid rgba(10,25,41,.08);
}
.wuc-search-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(10,25,41,.55);
    margin: 0 0 8px;
}
.wuc-search-h1 {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0 0 6px;
}
.wuc-search-query { color: #0070e0; }
.wuc-search-meta {
    margin: 0;
    font-size: 14px;
    color: rgba(10,25,41,.6);
}

/* ===========================================================================
 * v1.2 — Filter chip row (above results)
 * ========================================================================*/
.wuc-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(10,25,41,.06);
}
.wuc-search-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 14px;
    background: #fff;
    border: 1.5px solid rgba(10,25,41,.10);
    border-radius: 999px;
    color: rgba(10,25,41,.78);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    transition: border-color .12s ease, background .12s ease, color .12s ease, transform .12s ease;
    cursor: pointer;
}
.wuc-search-filter:hover {
    border-color: rgba(0,112,224,.45);
    color: #0070e0;
    transform: translateY(-1px);
}
.wuc-search-filter:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,112,224,.18);
}
.wuc-search-filter.is-active {
    background: #0070e0;
    color: #fff;
    border-color: #0070e0;
}
.wuc-search-filter.is-active .wuc-search-filter-count {
    background: rgba(255,255,255,.22);
    color: #fff;
}
.wuc-search-filter.is-disabled {
    cursor: default;
    opacity: .42;
    border-color: rgba(10,25,41,.06);
    color: rgba(10,25,41,.45);
    background: rgba(10,25,41,.02);
}
.wuc-search-filter.is-disabled:hover {
    transform: none;
    border-color: rgba(10,25,41,.06);
    color: rgba(10,25,41,.45);
}
.wuc-search-filter-label {
    line-height: 1.3;
}
.wuc-search-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 6px;
    background: rgba(10,25,41,.06);
    color: rgba(10,25,41,.6);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    line-height: 1;
}

/* ===========================================================================
 * Results list (v1 baseline)
 * ========================================================================*/
.wuc-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}
.wuc-search-item { margin: 0; }
.wuc-search-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid rgba(10,25,41,.08);
    border-radius: 8px;
    padding: 20px 22px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.wuc-search-card:hover,
.wuc-search-card:focus-visible {
    border-color: #0070e0;
    box-shadow: 0 6px 24px -8px rgba(0,112,224,.18);
    outline: none;
    transform: translateY(-1px);
}
.wuc-search-card-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(10,25,41,.55);
}
.wuc-search-badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0,112,224,.08);
    color: #0070e0;
    border: 1px solid rgba(0,112,224,.18);
    line-height: 1.4;
}
.wuc-search-badge--blog        { background: rgba(0,112,224,.08); color: #0070e0; border-color: rgba(0,112,224,.18); }
.wuc-search-badge--case-study  { background: rgba(20,140,60,.08); color: #148c3c; border-color: rgba(20,140,60,.20); }
.wuc-search-badge--field-guide { background: rgba(140,70,160,.08); color: #8c46a0; border-color: rgba(140,70,160,.20); }
.wuc-search-badge--tool        { background: rgba(200,100,30,.08); color: #c8641e; border-color: rgba(200,100,30,.20); }
.wuc-search-badge--page        { background: rgba(10,25,41,.06);  color: rgba(10,25,41,.65); border-color: rgba(10,25,41,.15); }
.wuc-search-date { font-size: 12px; color: rgba(10,25,41,.45); }
.wuc-search-title {
    font-size: 19px;
    line-height: 1.35;
    font-weight: 600;
    letter-spacing: -.005em;
    margin: 0 0 6px;
    color: #0a1929;
}
.wuc-search-excerpt {
    margin: 0 0 10px;
    font-size: 14.5px;
    line-height: 1.55;
    color: rgba(10,25,41,.72);
}
.wuc-search-excerpt mark,
.wuc-search-title mark {
    background: rgba(255,235,90,.55);
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
}
.wuc-search-link {
    display: inline-block;
    font-size: 12.5px;
    color: rgba(10,25,41,.5);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.wuc-search-pagination {
    margin-top: 36px;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.wuc-search-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    font-size: 14px;
    color: #0a1929;
    background: #fff;
    border: 1px solid rgba(10,25,41,.12);
    border-radius: 6px;
    text-decoration: none;
}
.wuc-search-pagination .page-numbers.current {
    background: #0070e0;
    color: #fff;
    border-color: #0070e0;
}
.wuc-search-pagination .page-numbers:hover { border-color: #0070e0; }

.wuc-search-empty {
    padding: 56px 32px;
    text-align: center;
    background: rgba(10,25,41,.02);
    border: 1px solid rgba(10,25,41,.06);
    border-radius: 12px;
}
.wuc-search-empty-h2 { margin: 0 0 12px; font-size: 22px; font-weight: 600; }
.wuc-search-empty-links {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.wuc-search-empty-links a {
    display: inline-block;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid rgba(0,112,224,.3);
    border-radius: 999px;
    color: #0070e0;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.wuc-search-empty-links a:hover { background: #0070e0; color: #fff; }

/* ===========================================================================
 * Body scroll lock (v1.1)
 * ========================================================================*/
body.wuc-search-locked {
    overflow: hidden;
    padding-right: var(--wuc-search-scrollbar-w, 0px);
}

/* ===========================================================================
 * Overlay backdrop blur (v1.1)
 * ========================================================================*/
.wuc-v5-search-overlay.is-open {
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    background: rgba(10, 25, 41, 0.55);
}

/* ===========================================================================
 * Form layout inside overlay (v1.1)
 * ========================================================================*/
.wuc-v5-search-form {
    margin: 0;
    padding: 0;
    display: block;
    position: relative;
    width: 100%;
    max-width: 720px;
}
.wuc-v5-search-form .screen-reader-text {
    clip: rect(1px,1px,1px,1px);
    height: 1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Close button (v1.1) */
.wuc-v5-search-close {
    position: absolute;
    top: -56px;
    right: 0;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    color: rgba(255,255,255,.85);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.wuc-v5-search-close:hover,
.wuc-v5-search-close:focus-visible {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.32);
    outline: none;
    transform: scale(1.04);
}
.wuc-v5-search-close:focus-visible {
    box-shadow: 0 0 0 3px rgba(0,112,224,.45);
}

/* Input polish (v1.1) */
.wuc-v5-search-input {
    width: 100% !important;
    padding: 14px 16px 14px 48px !important;
    font-size: 17px !important;
    line-height: 1.4 !important;
    height: auto !important;
    background-color: #ffffff !important;
    color: #0a1929 !important;
    border: 1.5px solid rgba(10,25,41,.12) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    transition: border-color .15s ease, box-shadow .15s ease;
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-4.35-4.35M10 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 14px center !important;
    background-size: 20px 20px !important;
}
.wuc-v5-search-input::placeholder {
    color: rgba(10,25,41,.45) !important;
    opacity: 1;
}
.wuc-v5-search-input:focus,
.wuc-v5-search-input:focus-visible {
    outline: none !important;
    border-color: #0070e0 !important;
    box-shadow: 0 0 0 4px rgba(0,112,224,.14) !important;
}

/* Visible submit (v1.1) */
.wuc-v5-search-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 22px;
    background: #0070e0;
    color: #fff;
    border: 1.5px solid #0070e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.005em;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, transform .12s ease, box-shadow .12s ease;
    clip: auto;
    height: auto;
    overflow: visible;
    position: relative;
    width: auto;
    word-wrap: normal !important;
}
.wuc-v5-search-submit:hover {
    background: #005bb8;
    border-color: #005bb8;
    transform: translateY(-1px);
}
.wuc-v5-search-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,112,224,.35);
}
.wuc-v5-search-submit:active { transform: translateY(0); }

/* Suggestions header label + chip styling (v1.1) */
.wuc-v5-search-suggestions-label {
    margin: 24px 0 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
}
.wuc-v5-search-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wuc-v5-search-suggestion {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 13px;
    transition: background .12s ease, border-color .12s ease;
}
.wuc-v5-search-suggestion:hover,
.wuc-v5-search-suggestion:focus-visible {
    background: rgba(0,112,224,.22);
    border-color: rgba(0,112,224,.45);
    color: #ffffff;
    outline: none;
}

/* ===========================================================================
 * v1.2 — Recent searches in overlay (rendered by JS when overlay opens with empty input)
 * ========================================================================*/
.wuc-v5-search-recent {
    margin: 0 0 16px;
}
.wuc-v5-search-recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 8px;
}
.wuc-v5-search-recent-label {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
}
.wuc-v5-search-recent-clear-all {
    background: none;
    border: none;
    padding: 4px 8px;
    color: rgba(255,255,255,.45);
    font-size: 11px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 4px;
    transition: color .12s ease, background .12s ease;
}
.wuc-v5-search-recent-clear-all:hover {
    color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.06);
}
.wuc-v5-search-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wuc-v5-search-recent-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    padding: 4px 4px 4px 12px;
    transition: background .12s ease, border-color .12s ease;
}
.wuc-v5-search-recent-item:hover {
    background: rgba(0,112,224,.18);
    border-color: rgba(0,112,224,.35);
}
.wuc-v5-search-recent-query {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}
.wuc-v5-search-recent-query::before {
    content: "↑ ";
    color: rgba(255,255,255,.45);
    margin-right: 2px;
    font-size: 11px;
}
.wuc-v5-search-recent-remove {
    background: none;
    border: none;
    padding: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: background .12s ease, color .12s ease;
}
.wuc-v5-search-recent-remove:hover,
.wuc-v5-search-recent-remove:focus-visible {
    background: rgba(255,255,255,.12);
    color: #ffffff;
    outline: none;
}

/* ===========================================================================
 * Live results dropdown (v1)
 * ========================================================================*/
.wuc-v5-search-live {
    margin-top: 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}
.wuc-v5-search-live[hidden] { display: none !important; }
.wuc-v5-search-live-row {
    display: block;
    padding: 12px 16px;
    color: rgba(255,255,255,.88);
    text-decoration: none;
    border-top: 1px solid rgba(255,255,255,.05);
    transition: background .12s ease;
}
.wuc-v5-search-live-row:first-child { border-top: 0; }
.wuc-v5-search-live-row:hover,
.wuc-v5-search-live-row:focus-visible {
    background: rgba(0,112,224,.18);
    outline: none;
}
.wuc-v5-search-live-row-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(96,165,250,.95);
    margin-right: 8px;
}
.wuc-v5-search-live-row-title {
    font-size: 14.5px;
    font-weight: 500;
    color: rgba(255,255,255,.92);
}
.wuc-v5-search-live-empty,
.wuc-v5-search-live-loading,
.wuc-v5-search-live-error {
    padding: 14px 16px;
    color: rgba(255,255,255,.55);
    font-size: 13.5px;
}
.wuc-v5-search-live-error { color: rgba(255,180,180,.85); }

/* Keyboard hint chip (v1.1) */
.wuc-v5-search-kbd-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(10,25,41,.06);
    border: 1px solid rgba(10,25,41,.10);
    border-radius: 5px;
    font-size: 11px;
    color: rgba(10,25,41,.55);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    opacity: 0;
    transition: opacity .15s ease;
}
.wuc-v5-search-input:focus ~ .wuc-v5-search-kbd-hint,
.wuc-v5-search-input:focus-visible ~ .wuc-v5-search-kbd-hint { opacity: 1; }
.wuc-v5-search-input:not(:placeholder-shown) ~ .wuc-v5-search-kbd-hint { opacity: 0; }
.wuc-v5-search-input-wrap { position: relative; }

/* Mobile (v1.1 + v1.2) */
@media (max-width: 700px) {
    .wuc-search-results { padding: 32px 1rem 60px; }
    .wuc-search-h1     { font-size: 24px; }
    .wuc-search-card   { padding: 16px; }
    .wuc-search-title  { font-size: 17px; }
    .wuc-search-excerpt{ font-size: 14px; }
    .wuc-search-filters { gap: 6px; padding: 12px 0; }
    .wuc-search-filter { padding: 6px 12px; font-size: 12.5px; }

    .wuc-v5-search-close { top: -50px; width: 40px; height: 40px; }
    .wuc-v5-search-input { padding: 12px 14px 12px 42px !important; font-size: 16px !important; }
    .wuc-v5-search-submit { width: 100%; padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .wuc-search-card,
    .wuc-search-filter,
    .wuc-v5-search-close,
    .wuc-v5-search-submit,
    .wuc-v5-search-input,
    .wuc-v5-search-suggestion,
    .wuc-v5-search-kbd-hint,
    .wuc-v5-search-recent-item { transition: none !important; }
    .wuc-search-card:hover,
    .wuc-search-filter:hover,
    .wuc-v5-search-close:hover,
    .wuc-v5-search-submit:hover { transform: none !important; }
}
