.global-search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 620px;
    margin-right: 0;
}

@media (max-width: 576px) {
    .global-search-wrapper {
        max-width: none;
        /* Allow full width on mobile */
    }

    .global-search-kbd {
        display: none;
    }
}

#global-search-input {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    padding-left: 40px;
    padding-right: 40px;
    background-color: #f2f4f7;
    border: 1px solid #e1e6ee;
    transition: all 0.2s ease;
}

#global-search-input:hover {
    border-color: #cfd6e0;
}

#global-search-input:focus {
    background-color: #fff;
    box-shadow: 0 0 0 0.25rem rgba(45, 108, 181, 0.15);
    border-color: #2d6cb5;
}

.global-search-icon {
    position: absolute;
    left: 15px;
    top: 21px;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

.global-search-wrapper.is-loading .global-search-icon {
    animation: gsPulse 0.8s ease-in-out infinite alternate;
}

.global-search-kbd {
    position: absolute;
    right: 10px;
    top: 21px;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid #d5dbe4;
    border-radius: 5px;
    color: #6c757d;
    font-size: 0.75rem;
    padding: 0 7px;
    line-height: 1.5;
    box-shadow: none;
    pointer-events: none;
}

#global-search-input:focus ~ .global-search-kbd {
    display: none;
}

/* Results Dropdown */
#global-search-results,
.gs-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(20, 30, 50, 0.14);
    margin-top: 6px;
    z-index: 1050;
    max-height: min(480px, 70vh);
    overflow-y: auto;
    display: none;
    /* Hidden by default */
}

#global-search-results.show,
.gs-results.show {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

/* Result Items: one per company, the reasons it matched underneath */
.gs-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f6;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.1s ease;
    cursor: pointer;
}

.gs-item:hover,
.gs-item.active {
    background-color: #eef4fb;
    text-decoration: none;
    color: inherit;
}

.gs-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #e8f0fa;
    color: #2d6cb5;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    margin-top: 1px;
}

.gs-body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.gs-line-1 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-line-2 {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 0.82rem;
    color: #6c757d !important;
    /* Force gray for base text */
    min-width: 0;
}

.gs-type {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8794a5;
}

.gs-match {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Highlight of the searched text */
.gs-line-1 b.text-dark,
.gs-line-2 b.text-dark {
    color: #000 !important;
    font-weight: 700;
    background: #fff1c2;
    border-radius: 3px;
    padding: 0 1px;
}

.gs-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: #f7f9fb;
    border-top: 1px solid #e9edf2;
    color: #2d6cb5;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.gs-footer:hover,
.gs-footer.active {
    background: #eef4fb;
    color: #2d6cb5;
}

/* No results */
.gs-no-results {
    padding: 18px 15px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gsPulse {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.35;
    }
}

@media (prefers-reduced-motion: reduce) {
    #global-search-results.show,
    .global-search-wrapper.is-loading .global-search-icon {
        animation: none;
    }
}
