/* =============================================================================
   SEARCH.CSS - The search box on every public page (templates/public/_search.html)
   All selectors scoped to #publicSearch.
   Self-contained, like the public page stylesheets: its own tokens, dark by
   default, light via [data-theme="light"] on <html>. Load it AFTER the page's
   own stylesheet. The font is inherited from the page it sits in.

   The box lives inside each page's header, ahead of the nav. This file gives
   it the wide-screen layout: the box on the left of the header, the nav on the
   right. Each page's own stylesheet moves it to a row of its own at that
   page's narrow-screen breakpoint.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Tokens (dark default)
   ----------------------------------------------------------------------------- */
#publicSearch.public-search {
    --s-purple-light: #667eea;
    --s-red: #f87171;
    --s-surface: #1e2332;
    --s-surface-2: #262b3d;
    --s-ink: rgba(255, 255, 255, 0.96);
    --s-soft: rgba(255, 255, 255, 0.68);
    --s-muted: rgba(255, 255, 255, 0.45);
    --s-line: rgba(255, 255, 255, 0.14);
    --s-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] #publicSearch.public-search {
    --s-red: #dc2626;
    --s-surface: #ffffff;
    --s-surface-2: #f4f0fa;
    --s-ink: #221a33;
    --s-soft: #574a6e;
    --s-muted: #8b80a0;
    --s-line: rgba(118, 75, 162, 0.22);
    --s-shadow: 0 18px 40px rgba(60, 40, 90, 0.18);
}

/* -----------------------------------------------------------------------------
   The box
   ----------------------------------------------------------------------------- */
#publicSearch.public-search {
    position: relative;
    /* On the left of the header, up to 420px wide, giving way when the header
       is short of room. The auto margin takes all the spare space, which is
       what pushes the box left and leaves the nav on the right. */
    flex: 0 1 420px;
    min-width: 180px;
    margin: 0 auto 0 0;
    padding: 0;
    z-index: 20;
}

#publicSearch .public-search-form {
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
}

#publicSearch .public-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

#publicSearch .public-search-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 11px 18px 11px 46px;
    border: 1px solid var(--s-line);
    border-radius: 50px;
    background: var(--s-surface);
    color: var(--s-ink);
    font-family: inherit;
    /* 16px or more, so iPhones do not zoom the page when the box is tapped. */
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#publicSearch .public-search-input::placeholder {
    color: var(--s-muted);
}

#publicSearch .public-search-input:focus {
    border-color: var(--s-purple-light);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

#publicSearch .public-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* -----------------------------------------------------------------------------
   Suggestions
   ----------------------------------------------------------------------------- */
#publicSearch .public-search-results {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    /* As wide as the box, but never too narrow to read a venue's name and
       town when the box has been squeezed. Never wider than the screen. */
    width: 100%;
    min-width: min(420px, calc(100vw - 48px));
    box-sizing: border-box;
    margin: 0;
    padding: 8px;
    background: var(--s-surface);
    border: 1px solid var(--s-line);
    border-radius: 16px;
    box-shadow: var(--s-shadow);
    max-height: 70vh;
    overflow-y: auto;
    text-align: left;
}

#publicSearch .public-search-results[hidden] {
    display: none;
}

#publicSearch .public-search-group {
    margin: 0;
    padding: 10px 12px 4px;
    color: var(--s-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#publicSearch .public-search-option {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--s-ink);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
}

#publicSearch .public-search-option:hover,
#publicSearch .public-search-option.is-active {
    background: var(--s-surface-2);
    color: var(--s-purple-light);
}

#publicSearch .public-search-option-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#publicSearch .public-search-option-note {
    flex-shrink: 0;
    color: var(--s-muted);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

#publicSearch .public-search-option-note.is-warning {
    color: var(--s-red);
}

#publicSearch .public-search-empty {
    margin: 0;
    padding: 14px 12px;
    color: var(--s-soft);
    font-size: 0.92rem;
}
