/* ═══════════════════════════════════════════════════════════
   Search Bar Widget – Portal2026
   ═══════════════════════════════════════════════════════════ */

/* ── Container ────────────────────────────────────────── */
.widget-search-bar {
    position: relative;
    width: 100%;
}

.search-bar-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* ── Input ────────────────────────────────────────────── */
.search-bar-input {
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    z-index: 2;
    position: relative;
    background: transparent;   /* let ghost text show through */
}

.search-bar-input:focus {
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.25);
}

/* ── Ghost text (autocomplete preview) ───────────────── */
.search-bar-ghost {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    z-index: 1;
    opacity: 0.5;
    display: flex;
    align-items: center;
    /* Mirror the input's padding, font, and border so characters align */
    padding: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    border: 1px solid transparent;   /* match input border space */
    box-sizing: border-box;
}

/* ── Dropdown ────────────────────────────────────────── */
.search-bar-dropdown {
    display: none;
    position: fixed;            /* fixed so it escapes overflow:hidden parents */
    z-index: 2147483647;        /* max z-index – always on top */
    max-height: 300px;
    overflow-y: auto;
    background: var(--ac-bg, #ffffff);
    border: 1px solid var(--ac-border, #e0e0e0);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    scrollbar-width: thin;
    /* width and top/left set by JS _positionDropdown */
}

/* ── Dropdown Items ──────────────────────────────────── */
.search-bar-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.12s;
    border-bottom: 1px solid var(--ac-border, #e0e0e0);
}

.search-bar-item:last-child {
    border-bottom: none;
}

.search-bar-item:hover,
.search-bar-item.selected {
    background: var(--ac-hover-bg, #f5f5f5);
}

.search-bar-item-main {
    font-size: 0.95em;
    line-height: 1.4;
    white-space: nowrap;
}

.search-bar-item-sub {
    font-size: 0.78em;
    color: #888;
    line-height: 1.3;
    margin-top: 2px;
    white-space: nowrap;
}

/* ── Tags (small pill badges below URL) ──────────────── */
.search-bar-item-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 3px;
}

.search-bar-tag {
    display: inline-block;
    font-size: 0.68em;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
    background: #e8eaf6;
    color: #3949ab;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-bar-tag-more {
    background: #f5f5f5;
    color: #999;
    font-style: italic;
}

/* ── Description snippet ─────────────────────────────── */
.search-bar-item-desc {
    font-size: 0.72em;
    color: #666;
    line-height: 1.3;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

/* ── Scrollbar styling ───────────────────────────────── */
.search-bar-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-bar-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.search-bar-dropdown::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
