@use 'variables' as *;

.search-wrap {
    max-width: 600px;
    margin: 0 auto 20px;
    position: relative;

    label {
        display: block;
        font-weight: 600;
        font-size: 0.85rem;
        color: $gray-700;
        margin-bottom: 6px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}

#search-input {
    width: 100%;
    padding: 14px 130px 14px 18px;
    font-size: 1rem;
    border: 2px solid $gray-300;
    border-radius: 12px;
    outline: none;
    background: $white;
    transition: border-color 0.2s;

    &:focus {
        border-color: $red-primary;
        box-shadow: 0 0 0 4px rgb(from var(--red-primary) r g b / 0.1);
    }
}

.search-icon {
    position: absolute;
    right: 102px;
    top: calc(50% + 10px);
    transform: translateY(-50%);
    color: $gray-400;
    pointer-events: none;
}

#search-btn {
    position: absolute;
    right: 10px;
    top: calc(50% + 10px);
    transform: translateY(-50%);
    border: none;
    background: $red-primary;
    color: $white;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;

    &:hover { background: $red-dark; }
}

// ─── Autocomplete list ────────────────────────────────────────────────────────
#autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: $white;
    border: 1.5px solid $gray-200;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    display: none;

    &.open { display: block; }
}

.ac-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid $gray-100;
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;

    &:last-child { border-bottom: none; }

    &:hover,
    &.selected { background: $red-ghost; }
}

.ac-left { flex: 1; }

.ac-ein {
    font-family: $font-mono;
    font-size: 0.8rem;
    color: $red-light;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.ac-name {
    font-size: 0.95rem;
    color: $gray-900;
    margin-top: 2px;
}

.ac-meta {
    font-size: 0.75rem;
    color: $gray-400;
    margin-top: 1px;
}

.ac-score {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: $white;
    margin-left: 12px;
}

.no-results {
    padding: 16px;
    text-align: center;
    color: $gray-400;
    font-size: 0.9rem;
}
