/**
 * EventHub Live-Suche Styles
 *
 * Auto-Suggest Dropdown für Event-Suche.
 *
 * @package EventHub
 * @since 1.0.0
 */

/* === Screen Reader Only === */
.eventhub-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === Suchfeld Container === */
.eventhub-search {
    position: relative;
    z-index: 100; /* Über anderen Filter-Elementen. */
}

/* Suchfeld exakt wie .eventhub-filter__select. */
.eventhub-search__input {
    width: 100%;
    height: var(--eventhub-input-height); /* Explizite Höhe für Konsistenz. */
    padding: 0 2.5rem 0 var(--eventhub-spacing-md, 1rem); /* Rechts Platz für Clear-Button. */
    border: 1px solid var(--eventhub-color-border-input) !important; /* WordPress-Admin-Grau für Konsistenz. */
    border-radius: var(--eventhub-border-radius) !important;
    background-color: var(--eventhub-color-bg-input) !important;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    box-sizing: border-box;
}

.eventhub-search__input:hover {
    border-color: var(--eventhub-color-primary, #0073aa);
}

.eventhub-search__input:focus {
    outline: 2px solid var(--eventhub-color-primary, #0073aa);
    outline-offset: 2px;
    border-color: var(--eventhub-color-primary, #0073aa);
}

/* === Clear-Button === */
.eventhub-search__clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    color: var(--eventhub-color-text-muted, #666);
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.eventhub-search__clear:hover {
    opacity: 1;
}

.eventhub-search__clear[hidden] {
    display: none;
}

/* === Dropdown === */
.eventhub-search__results {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: var(--eventhub-spacing-xs);
    min-width: 100%;
    width: max-content;
    max-width: 400px;
    background-color: var(
        --eventhub-color-bg-input
    ) !important; /* Explizit weiß, keine Variable. */
    border: 1px solid var(--eventhub-color-border);
    border-radius: var(--eventhub-border-radius, 4px);
    box-shadow: var(--eventhub-dropdown-shadow);
    max-height: 350px;
    overflow-y: auto;
    z-index: 9999;
}

.eventhub-search__results[hidden] {
    display: none;
}

/* === Einzelnes Ergebnis === */
.eventhub-search__item {
    display: block;
    padding: var(--eventhub-spacing-sm, 0.5rem) var(--eventhub-spacing-md, 1rem);
    text-decoration: none;
    color: var(--eventhub-color-text);
    background-color: var(--eventhub-color-bg-input);
    border-bottom: 1px solid var(--eventhub-color-border, #ddd);
}

.eventhub-search__item:last-of-type {
    border-bottom: none;
}

.eventhub-search__item:hover,
.eventhub-search__item--selected {
    background-color: var(--eventhub-color-surface-hover);
}

.eventhub-search__item:focus {
    outline: none;
    background: var(--eventhub-color-bg-alt, #f5f5f5);
}

.eventhub-search__item-title {
    display: block;
    font-weight: 500;
    color: var(--eventhub-color-text, #333);
}

.eventhub-search__item-meta {
    display: block;
    font-size: var(--eventhub-font-size-sm, 0.875rem);
    color: var(--eventhub-color-text-muted, #666);
    margin-top: 2px;
}

/* === Keine Ergebnisse === */
.eventhub-search__no-results {
    padding: var(--eventhub-spacing-md, 1rem);
    text-align: center;
    color: var(--eventhub-color-text-muted, #666);
    font-style: italic;
}

/* === Alle anzeigen Button === */
.eventhub-search__show-all {
    display: block;
    width: 100%;
    padding: var(--eventhub-spacing-sm, 0.5rem) var(--eventhub-spacing-md, 1rem);
    background: var(--eventhub-color-bg-alt, #f5f5f5);
    border: none;
    border-top: 1px solid var(--eventhub-color-border, #ddd);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: var(--eventhub-color-primary, #0073aa);
    text-align: center;
    transition: background-color 0.15s ease;
}

.eventhub-search__show-all:hover {
    background: var(--eventhub-color-bg-hover, #eee);
}

.eventhub-search__show-all:focus {
    outline: 2px solid var(--eventhub-color-primary, #0073aa);
    outline-offset: -2px;
}

/* === Filter-Group Integration === */
/* Die Suche nutzt die Grid-Area "search" aus eventhub-filter.css */
.eventhub-filter__group--search {
    /* Keine festen Größen mehr nötig - Grid regelt das. */
}

/* === Responsive === */
@media (max-width: 600px) {
    .eventhub-search__results {
        max-width: 100%;
        width: 100%;
    }
}
