/* Global item search widget (mounted by search.js on all pages).
   Must live in an external stylesheet: the site CSP uses a style-src nonce,
   which makes browsers ignore 'unsafe-inline' — JS-injected <style> tags and
   style="" attributes are silently refused (this broke the widget layout). */
.global-search {
    position: relative;
    width: 260px;
}
.global-search-input {
    padding-left: 2rem !important;
    padding-right: 2.2rem !important;
    font-size: 0.8rem !important;
}
.global-search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 4;
}
.global-search-kbd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    padding: 1px 5px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 3px;
    color: var(--bs-tertiary-color, #adb5bd);
    background: transparent;
    pointer-events: none;
    line-height: 1.3;
    font-family: inherit;
    z-index: 4;
}
/* Dropdown is self-sufficient here (not all pages load main.css).
   Theme colors (bg/border/shadow) come from Bootstrap's .dropdown-menu. */
.global-search .autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    border-radius: 6px;
    min-width: 300px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1050;
}
.global-search .autocomplete-dropdown.show {
    display: block;
}
.global-search .autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.08));
    text-decoration: none;
    color: inherit;
    font-size: 0.8rem;
}
.global-search .autocomplete-item:last-child {
    border-bottom: none;
}
.global-search .autocomplete-item:hover,
.global-search .autocomplete-item:focus,
.global-search .autocomplete-item.active {
    background: var(--bs-primary-bg-subtle, #cfe2ff);
    color: inherit;
    text-decoration: none;
}
.global-search .autocomplete-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}
.global-search .autocomplete-item img.icon-failed {
    visibility: hidden;
}
.global-search .autocomplete-item-info {
    flex: 1;
    min-width: 0;
}
.global-search .item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.global-search .item-price {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
}
.global-search .item-id {
    font-size: 0.7rem;
    color: var(--bs-tertiary-color, #adb5bd);
}
@media (max-width: 767.98px) {
    .global-search {
        width: 100%;
    }
    .global-search-kbd {
        display: none !important;
    }
    .global-search .autocomplete-dropdown {
        min-width: 0;
    }
}
