/*
 * Primare Support Search — structural styles
 *
 * These styles handle layout and behaviour only.
 * Typography, colours, border-radius, and padding are intentionally
 * left to the theme so the block inherits Primare's visual language.
 *
 * Theme hooks (add rules in the theme stylesheet):
 *   .pss-search-input        — text input
 *   .pss-search-submit       — submit/search button
 *   .pss-search-dropdown     — dropdown panel
 *   .pss-result-item         — individual result row
 *   .pss-result-item.is-active — keyboard/hover highlighted row
 *   .pss-badge--article      — "Article" type badge
 *   .pss-badge--guide        — "User Guide" type badge
 *   .pss-badge--download     — "Download" type badge
 */


/* -------------------------------------------------------------------------
   Wrapper
   ------------------------------------------------------------------------- */

.pss-search-wrapper {
    position: relative;
    width: 100%;
}


/* -------------------------------------------------------------------------
   Search field row (input + submit button)
   ------------------------------------------------------------------------- */

.pss-search-field {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.pss-search-input {
    flex: 1 1 auto;
    min-width: 0; /* prevents flex overflow */
}

.pss-search-submit {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pss-search-submit svg {
    display: block;
}


/* -------------------------------------------------------------------------
   Loading state — subtle opacity shift on the input
   ------------------------------------------------------------------------- */

.pss-search-wrapper.is-loading .pss-search-input {
    opacity: 0.6;
}


/* -------------------------------------------------------------------------
   Dropdown panel
   ------------------------------------------------------------------------- */

.pss-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    color: #1a1a1a; /* reset — dropdown may sit inside a section with white text */
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    max-height: 480px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* [hidden] attribute hides the dropdown */
.pss-search-dropdown[hidden] {
    display: none;
}


/* -------------------------------------------------------------------------
   Results list
   ------------------------------------------------------------------------- */

.pss-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}


/* -------------------------------------------------------------------------
   Result item
   ------------------------------------------------------------------------- */

.pss-result-item a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 0.1s ease;
}

.pss-result-item:last-child a {
    border-bottom: none;
}

.pss-result-item.is-active > a {
    background: rgba(0, 0, 0, 0.04);
}


/* -------------------------------------------------------------------------
   Result title and meta
   Scoped under .pss-search-wrapper to win specificity over theme rules.
   ------------------------------------------------------------------------- */

.pss-search-wrapper .pss-result-title {
    display: block;
    font-weight: 500;
    line-height: 1.3;
    color: inherit;
    visibility: visible;
    opacity: 1;
}

.pss-search-wrapper .pss-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.78em;
    opacity: 0.7;
    line-height: 1;
}

.pss-search-wrapper .pss-result-category::before {
    content: '·';
    margin-right: 6px;
    opacity: 0.5;
}


/* -------------------------------------------------------------------------
   Content type badge
   ------------------------------------------------------------------------- */

.pss-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.pss-badge--article {
    background: rgba(0, 70, 180, 0.08);
    color: #0046b4;
}

.pss-badge--download {
    background: rgba(0, 130, 70, 0.1);
    color: #008246;
}

.pss-badge--guide {
    background: rgba(140, 80, 0, 0.08);
    color: #8c5000;
}


/* -------------------------------------------------------------------------
   "See all results" footer item
   ------------------------------------------------------------------------- */

.pss-result-see-all a {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: none;
    padding-top: 14px;
    padding-bottom: 14px;
}

.pss-result-see-all a::after {
    content: ' →';
    margin-left: 4px;
    opacity: 0.6;
}


/* -------------------------------------------------------------------------
   No-results message
   ------------------------------------------------------------------------- */

.pss-no-results {
    padding: 14px 16px;
    opacity: 0.55;
    font-style: italic;
}
